APM 2.012 + REMZIBI OSD

 

 

 

With the APM together, it can display much information on the screen, e.g. the attitude of the plane, GPS data, NAV data, etc. The details of displayed information can be found in the web site of Remzibi OSD and the ARDUmV1_71.txt. Blake Krone has done great works to integrate the OSD and the APM. However, due to the fast development of the APM, some source codes are out of date, and thus a few modifications are needed to make them work properly. In this article, we give a detailed instruction of those modifications.

 

Our work is based on

1. APM 2.12 source code. Arduino-0022 IDE.

2. The firmware of OSD is ARDUmV1_71.hex

3. The serial port of the OSD is connected to serial port 3 of the APM (i.e. Telemetry port). Because the OSD does not send data to APM, the TX pin of the OSD is not required to be connected. You can also connect the Xbee to the serial port 3 of the APM in the meantime. In such case, the RX pins of the Xbee and the OSD are connected in parallel, and You MUST NOT connect the TX pin of the OSD. The Baud rate of the OSD is self-adaptive, and it is usually below 115200.

 

Here are the modifications:

First, download OSD_Remzibi.pde, and then modify some parameters according to the definitions in the code of APM:

1. In function print_osd_data(void)

Original:                    SendSer(GPS.date,DEC); //Date

Modified:       SendSer(g_gps->date,DEC); //Date

Comment:     This parameter is the GPS UTC date

 

Orignal:             SendSer(GPS.time,DEC); //Time

Modified:       SendSer(g_gps->time,DEC); //Time

Comment:     This parameter is the GPS UTC time

 

2. In function void print_osd_ahrs(void):

Original:         SendSer((pitch_sensor/100) * -1,DEC); //Pitch

Modified:       SendSer(dcm.pitch_sensor/100,DEC); //Pitch

Comment:   This parameter is the pitch of the plane.

 

Original:         SendSer(roll_sensor/100,DEC); //Roll

Modified:       SendSer(dcm.roll_sensor/100,DEC); //Roll

Comment:     This parameter is the roll of the plane.

 

Second, modify the source of APM (ver 2.12):

① In APM_Config.h :

Add following codes:

#define OSD_PROTOCOL OSD_PROTOCOL_REMZIBI

#define OSD_PORT 3

#define OSD_MODE_CHANNEL 7

 

These macros tell the APM to use the serial port 3 to connect to the OSD under the REMZIBI protocol. The channel 7 is used to control whether the OSD displays. You can change the serial port or control channel if it is needed.

 

② ArduPilotMega.pde :

In function medium_loop(), add following codes before the break statement in case 3:

#if OSD_PROTOCOL != OSD_PROTOCOL_NONE

print_osd_ahrs();

#endif

 

In function slow_loop (), add following code before the break statement in case 1:

#if OSD_PROTOCOL != OSD_PROTOCOL_NONE

print_osd_data();

#endif

// Read OSD Mode Switch

#if OSD_PROTOCOL == OSD_PROTOCOL_REMZIBI

read_osd_switch();

#endif

 

③ defines.h :

Add following codes after “//GPS type codes”:

// OSD type codes

#define OSD_PROTOCOL_NONE -1

#define OSD_PROTOCOL_REMZIBI 0

 

④ commands.pde :

In line 251, add following code at the end of function init_home():

// Save Home to OSD

// ----------------

#if OSD_PROTOCOL == OSD_PROTOCOL_REMZIBI

osd_init_home();

#endif

 

Now, all the modifications have been done. Copy the OSD_Remzibi.pde to the folder of the source code of the APM 2.12(APM Trunk\ArduPilotMega), start Arduino, build the sketch and upload to the APM.

 

3689404993?profile=original

 

 3689404945?profile=original

 

Uploads are not downloaded,Why?ArduPilotMega2.12+remzibi_osd.rar

 

 

OSD_RemzibiV2.pde

 

chineseV.pdf

 

Thank LEE,hazy,Blake Krone's

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Ok, I got this to work.

    But my numbers and symbols on the screen are flickering wild and disappearing. I see this a little on the video's above, but here it's really extreme.

    Could it have to do that I used the 2.1 firmware in stead of the 2.012 ? Or had it something to do with de remzibi's firmware/layout.

  • Hi Matthias.

     

    I had to change the code to get it to work switching off then on again. Switching off was always possible.

     

    I changed the code to this;

     

    byte oldOSDSwitchPosition = 1;

    void read_osd_switch()
    {
        byte osdSwitchPosition = readOSDSwitch();
        if (oldOSDSwitchPosition != osdSwitchPosition){
           
            switch(osdSwitchPosition)
            {
                case 1: // First position
                set_osd_mode(1);
                break;

                case 0:
                set_osd_mode(0);
                break;
            }

            oldOSDSwitchPosition = osdSwitchPosition;
        }
    }

    byte readOSDSwitch(void){
          int osdPulseWidth = APM_RC.InputCh(OSD_MODE_CHANNEL - 1);
        if (osdPulseWidth < 1000)  return 0;    // Off
        return 1;
    }

    void set_osd_mode(byte mode){
            switch(mode)
            {
                case 1: // On
                            SendSerln("$CLS");
                            SendSerln("$L1");
                break;

                case 0: // Off
                SendSerln("$L0");
                            SendSerln("$CLS");
                break;
            }
    }

     

    Of course the set_osd_mode(xx) value must match the values possible in the switch() case inside it. Same goes for read_osd_switch() must return a code that matches the switch() case in read_osd_switch(). The code above works for me now. I might have changed it, and then changed it again to make it work, but i think there was an issue there. Compare it to the real code then you will see... I think... :)

  • I flew with this , during the week-end .The experience was very solid.

    I have just a few things for the wish list that I may implement myself:

    - I connect the OSD after the APM and the APM has already "set home" when I connect the OSD. It would be nice to activate "set home" with a switch or in some automatic way.

    - Maybe changing the ground speed osd with the airspeed when available.

    @thomas :check the function read_osd_switch. The code seems ok to me.

    Thanks to all the people who made this integration.

  • Found a bug in your code handling the on/off switch.

     

    byte readOSDSwitch(void){
          int osdPulseWidth = APM_RC.InputCh(OSD_MODE_CHANNEL - 1);
        if (osdPulseWidth >= 1450)  return 2;    // Off
        return 1;
    }

    void set_osd_mode(int mode){
            switch(mode)
            {
                case 1: // On
                            SendSerln("$CLS");
                            SendSerln("$L1");
                break;

                case 0: // Off
                SendSerln("$L0");
                            SendSerln("$CLS");
                break;
            }
    }

     

    the readOSDSwitch() function needs to return either 0 or 1, or the case statement bellow needs a change..

    They way it wokrs now is, on, off, and never on again...

     

    Nice work by the way..!!

     

    :)

  • Many thanks Matthias, i should remove all those and honestly i did not pay attention regarding the /* */
  • me being stupid .. : Did you keep the /* */ that comments and therefore removes all those lines at compilation ?
  • Yes , i did and find hereafter the complete data :

    /*
    #define OSD_PROTOCOL OSD_PROTOCOL_REMZIBI
    #define OSD_PORT 3
    #define OSD_MODE_CHANNEL 7
    #define HIL_PROTOCOL HIL_PROTOCOL_MAVLINK
    #define HIL_MODE HIL_MODE_ATTITUDE
    #define HIL_PORT 0
    #define GCS_PROTOCOL GCS_PROTOCOL_MAVLINK
    #define GCS_PORT 3
    */
  • Dider, did you declare as per the original post:

     

    Second, modify the source of APM (ver 2.12):

    ① In APM_Config.h :

    Add following codes:

    #define OSD_PROTOCOL OSD_PROTOCOL_REMZIBI

    #define OSD_PORT 3

    #define OSD_MODE_CHANNEL 7

     

    These macros tell the APM to use the serial port 3 to connect to the OSD under the REMZIBI protocol. The channel 7 is used to control whether the OSD displays. You can change the serial port or control channel if it is needed.

     

  • It is getting better butr unfortunately i still have the following error:

    ArduPilotMega.cpp: In function 'byte readOSDSwitch()':
    OSD_Remzibi:57: error: 'OSD_MODE_CHANNEL' was not declared in this scope
  • Hey that's the point : APM send GPS and attitude information to the OSD via the GPS port.

    You would need a special version of Remzibi firmware as explained by Blake's original post :

    http://diydrones.com/profiles/blog/show?id=705844%3ABlogPost%3A252631

     

This reply was deleted.