Hi,

I just bought the APM 2.5 together with the Remzibi OSD (not the minimOSD).

Now I try to get the connection from the APM to the OSD with the adapter calbe for telemetry

http://store.diydrones.com/Adapter_cable_for_APM_2_5_p/kt-apm25-cab...

EDIT:  I want to send a big thank you to Heino R. Pull who send me a lot of informations and the very good working code for the ardurino mini to start the telemetry link and bring the APM 2.5 to send data to the remzibi OSD 3DR.

The original code can be downloaded here: http://www.heino.com/

Use this original Code to use the ardurino pro mini with an XBee.

If you don`t want to use the XBee, you need to do the wiring and code below.

(Tested with APM 2.5,  Arduplane 2.6 and Remzibi OSD 3DR)

Here is the modification from the osdmavlink.pde (I assume he will update it on his page soon, but maybe someone is interested)

<code>

// Mavlink to Remzibi OSD converter
// Using Ardustation code written by psmitty
// Heino Pull (heyno@heino.com) httpwww.heino.com
// Mavlink to Remzibi OSD compatible with ACM 2.7.3/2.8
#define MAVLINK10

#include <FastSerial.h>
#include <GCS_MAVLink.h>
#include <avr/pgmspace.h>
#include <LiquidCrystal.h>
#include <EEPROM.h>
#include <AP_EEPROMB.h>         // ArduPilot Mega RC Library
//#include <Time.h>


#include <Servo.h>
//AP_EEPROMB ee;
#undef PROGMEM
#define PROGMEM __attribute__(( section(".progmem.data") ))

#undef PSTR
#define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];}))

#define SERIAL_BAUD 57600
//#define BUZZERON // is the buzzer on?
FastSerialPort0(Serial);

// data streams active and rates
#define MAV_DATA_STREAM_POSITION_ACTIVE 1
#define MAV_DATA_STREAM_RAW_SENSORS_ACTIVE 1
#define MAV_DATA_STREAM_EXTENDED_STATUS_ACTIVE 1
#define MAV_DATA_STREAM_RAW_CONTROLLER_ACTIVE 1
#define MAV_DATA_STREAM_EXTRA1_ACTIVE 1

// update rate is times per second (hz)
#define MAV_DATA_STREAM_POSITION_RATE 1
#define MAV_DATA_STREAM_RAW_SENSORS_RATE 1
#define MAV_DATA_STREAM_EXTENDED_STATUS_RATE 1
#define MAV_DATA_STREAM_RAW_CONTROLLER_RATE 1
#define MAV_DATA_STREAM_EXTRA1_RATE 1
#define GET_PARAMS_TIMEOUT 200 //(20 seconds)
#define TOTAL_PARAMS 37
#define toRad(x) (x*PI)/180.0
#define toDeg(x) (x*180.0)/PI

float altitude=0;
float pitch=0;
float roll=0;
float yaw=0;
float longitude=0;
float latitude=0;
float velocity = 0;
unsigned long gpstime = 0;
int numSats=0;
int battery=0;
int currentSMode=0;
int currentNMode=0;
int droneType;
int autoPilot;
uint32_t custom_mode;
 int tdfix = 0;
int callsignprint = 0;
int waitingAck=0;
int paramsRecv=0;
int beat=0;

int find_param(const char* key)
{
  char buffer[15];
  for (int i=0; i<TOTAL_PARAMS; i++)
  {
//    get_Param_Key(buffer, i);
    if (strcmp(buffer,(const char*)key) == 0)
      return i;    
  }
  return -1;  
}

void gcs_update()
{
    // receive new packets
    mavlink_message_t msg;
    mavlink_status_t status;

    // process received bytes
    while(Serial.available())
    {
        uint8_t c = Serial.read();
        // Try to get a new message
        if(mavlink_parse_char(0, c, &msg, &status)) gcs_handleMessage(&msg);
    }
}

uint8_t received_sysid=0; ///< ID of heartbeat sender
uint8_t received_compid=0; // component id of heartbeat sender

void gcs_handleMessage(mavlink_message_t* msg)
{
  switch (msg->msgid) {
    case MAVLINK_MSG_ID_HEARTBEAT:
    {
      mavlink_heartbeat_t packet;
      mavlink_msg_heartbeat_decode(msg, &packet);
      custom_mode = packet.custom_mode;
      droneType = packet.type; // Don't pick up from the heartbeat now since there is some weirdness when the Planner is running
                               // and ArduPlane is running (get packet with type = 1 and type =0 also - confused this logic)
                                  
      autoPilot = packet.autopilot;

      beat = 1;
      break;
    }

    case MAVLINK_MSG_ID_ATTITUDE:
    {
      // decode
      mavlink_attitude_t packet;
      mavlink_msg_attitude_decode(msg, &packet);
      pitch = toDeg(packet.pitch);
      yaw = toDeg(packet.yaw);
      roll = toDeg(packet.roll);
      break;
    }

  #ifdef MAVLINK10
      case MAVLINK_MSG_ID_GPS_RAW_INT:
          #else // MAVLINK10
 
      case MAVLINK_MSG_ID_GPS_RAW:
          #endif // MAVLINK10
          
              {
                // decode
          
          #ifdef MAVLINK10
                mavlink_gps_raw_int_t packet;
                mavlink_msg_gps_raw_int_decode(msg, &packet);
                velocity = packet.vel/100.0;
                latitude = packet.lat/1e7;
                longitude = packet.lon/1e7;
                altitude = packet.alt/1000.0;
                gpstime = packet.time_usec>>16;
          #else // MAVLINK10
                mavlink_gps_raw_t packet;
                mavlink_msg_gps_raw_decode(msg, &packet);
                velocity = packet.v;
                latitude = packet.lat;
                longitude = packet.lon;
                altitude = packet.alt;  
                gpstime = packet.usec >> 16;
          
          #endif // MAVLINK10
                tdfix = packet.fix_type;
                      numSats = packet.satellites_visible;
                create_Remzibi_output();
    
      break;
    }

    case MAVLINK_MSG_ID_GPS_STATUS:
    {
      mavlink_gps_status_t packet;
      mavlink_msg_gps_status_decode(msg, &packet);        
//      numSats = packet.satellites_visible;
//      Serial.print(numSats);
      break;
    }
    case MAVLINK_MSG_ID_RAW_PRESSURE:
    {
      // decode
      mavlink_raw_pressure_t packet;
      mavlink_msg_raw_pressure_decode(msg, &packet);
      break;
    }
     case MAVLINK_MSG_ID_SYS_STATUS:
    {

        mavlink_sys_status_t packet;
        mavlink_msg_sys_status_decode(msg, &packet);
    #ifdef MAVLINK10
        battery=packet.voltage_battery;  
    #else // MAVLINK10
      currentSMode = packet.mode;
      currentNMode = packet.nav_mode;
      battery = packet.vbat;
    #endif // MAVLINK10
      break;
    }
    case MAVLINK_MSG_ID_PARAM_VALUE:
    {
      // decode
      mavlink_param_value_t packet;
      mavlink_msg_param_value_decode(msg, &packet);
      const char * key = (const char*) packet.param_id;
      break;
    }
  }
}

void send_message(mavlink_message_t* msg)
{
  uint8_t buf[MAVLINK_MAX_PACKET_LEN];
  uint16_t len = mavlink_msg_to_send_buffer(buf, msg);

  for(uint16_t i = 0; i < len; i++)
  {
    Serial.write(buf[i]);
  }
}

void start_feeds()
{
  mavlink_message_t msg;
  mavlink_msg_request_data_stream_pack(127, 0, &msg, received_sysid, received_compid, MAV_DATA_STREAM_RAW_SENSORS, MAV_DATA_STREAM_RAW_SENSORS_RATE, MAV_DATA_STREAM_RAW_SENSORS_ACTIVE);
  send_message(&msg);
  delay(10);
  // mavlink_message_t msg3;
  mavlink_msg_request_data_stream_pack(127, 0, &msg, received_sysid, received_compid, MAV_DATA_STREAM_EXTENDED_STATUS, MAV_DATA_STREAM_EXTENDED_STATUS_RATE, MAV_DATA_STREAM_EXTENDED_STATUS_ACTIVE);
  send_message(&msg);
  delay(10);
  // mavlink_message_t msg4;
  mavlink_msg_request_data_stream_pack(127, 0, &msg, received_sysid, received_compid, MAV_DATA_STREAM_RAW_CONTROLLER, MAV_DATA_STREAM_RAW_CONTROLLER_RATE, MAV_DATA_STREAM_RAW_CONTROLLER_ACTIVE);
  send_message(&msg);
  delay(10);
  // mavlink_message_t msg1;
  mavlink_msg_request_data_stream_pack(127, 0, &msg, received_sysid, received_compid, MAV_DATA_STREAM_POSITION, MAV_DATA_STREAM_POSITION_RATE, MAV_DATA_STREAM_POSITION_ACTIVE);
  send_message(&msg);
  delay(10);
  // mavlink_message_t msg5;
  mavlink_msg_request_data_stream_pack(127, 0, &msg, received_sysid, received_compid, MAV_DATA_STREAM_EXTRA1, MAV_DATA_STREAM_EXTRA1_RATE, MAV_DATA_STREAM_EXTRA1_ACTIVE);
  send_message(&msg);
  delay(460);
}

void setup()
{
  Serial.begin(SERIAL_BAUD);
  delay(300);
}

int start_count = 0;

void loop()
{

  gcs_update();
 
  if ((start_count< 3) && (millis() >(3000+(start_count * 2000)))) //send start feed after 3 seconds of powerup - need time for heartbeat to be received - try 3 times with 2 seconds between each try
  {
    start_feeds();
    start_count++;
  }
}

void pids() // menu 2
{
}

void create_Remzibi_output()
{
//      Distance_Home=calc_dist(Latitude_Home, Longitud_Home, latitude, longitude);
//    Bearing_Home=calc_bearing(Latitude_Home, Longitud_Home, latitude, longitude);
//    SvBearingHome=Bearing_Home;
//    Angle_Home=ToDeg(atan((float)(altitude-Altitude_Home)/(float)Distance_Home));
//    Bearing_Home = 180-(Bearing_Home/2.0);
//    
//    // Offset for servo limit
//    Bearing_Home = Bearing_Home + offset;
//    if (Bearing_Home > 180.0)
//       Bearing_Home = Bearing_Home - 180.0;
//    else
//    {
//        if (Bearing_Home <0.0)
//           Bearing_Home = Bearing_Home + 180.0;
//    }

    print_GPGGA();
     delay(30);
    print_GPRMC();
     delay(30);
    print_sonar();
     delay(20);
     callsignprint++;
     if (callsignprint>100) {
      
       print_remzibi_mode();
       delay(20);
       callsignprint=0;
     }
}


int availableMemory() {
  int size = 2048;
  byte *buf;

  while ((buf = (byte *) malloc(--size)) == NULL)
    ;

  free(buf);
  return size;
}

</code>

Views: 8834

Attachments:

Reply to This

Replies to This Discussion

As I know Remzibi OSD 3DR is not compatible with APM, see notice from website "NOTE: This product is not compatible with the APM 2.0."

You are using APM2.5, but I understood the mavlink protocol is the same as APM2.0.

There is someone who makes Remzibi OSD 3DR working with APM2.0, but he use an intermediate board for protocol adapting, I dont have the link, but is on DIYDrones.

I am curios if you can user your Remzibi with APM2.5 with one GPS , I have same setup but using 2 GPS...

Thanks for the answer. I found this link you are talking about.

I thought that it`s not possible to connect to APM 2.0 because there is no Telemetry link.

Here is the post, where I found one solution. I tried this by connecting the telemetry adapter cable to the second GPS port of the APM but without success yet.

http://www.rcgroups.com/forums/showthread.php?t=1102975

I even  tried to send a mail to the support - without success :)

Maybe I should try to use the second GPS from another OSD. It`s much easier.

No, it not that the link, because this link is refering to Remzibi OSD (previous model), not Remzibi OSD 3DR. I did try that myself and was not working.

The link I was refering was using the Remzibi OSD 3DR and make it running with APM2.0, but as I said, that person did use another hardware board, I dont remember which one.

If I find the link I will let you know.

Using 2 GPS is not the best solution, you can have on RemzibyOSD 3DR data from Lat/Lon, Speed, Altitude, etc, but data from APM2.5 like Barometric altitude, APM battery, etc will not be visible on your OSD.

I know that this was not the link you where talking about. He was using the ardurino Pro Mini board and changed a lot, even in the FW. I just want to have an easy solution :)

I thougt it`s possible to just grab the rx of the gps for the osd.

The Power of the APM is not the problem, because the OSD has a port to monitor the flying battery.

Sender, OSD and CAM are using the same 3S Battery.

The barometric ALT could be interesting, But I can fly without it as long as the cam is on. If its off, the APM takes control anyway with the correct ALT.

Do you know if the engine battery power can be displayed on the minim OSD? This is the only reason why I bought the OSD 3DR.

I do not have minimOSD. But I know Remzibi can display 2 different voltages (main motor battery and FPV battery) and the current from main battery. There are others information you want to see on OSD like artificial horizon, usually for night flight. Myself I am flying with 2 GPS, one from Remzibi, one from APM. I know is not the best things, but it works. If you use 2 GPS, you need to keep a distance between them and if you are using 900MHz for Video link (like me), your need to keep GPS at some 10-12 inch from Video TX.

Indeed, this is the link, thanks. Keep me in touch if works for you, I did not have time to test it.

I decided to use a second GPS and ordered a 3DR GPS uBlox LEA-6 to use it with my APM and plug in the other gps to the OSD.

The Problem with the ardurino Pro Mini solution is the patched firmware. I cannot use the original firmware from diydrones and I`m not sure if this is a very good idea.

I also like to see the main battery voltage and stay with the remzibi OSD.

I`m using 5.8 GHz for Video becaues 900 MHz is not allowed in Switzerland.

I hope DIYdrones can provide a new Firmware later to use the remzibi OSD with mavlink. I don`t understand the mavlink at the moment and hope that it`s not a physical barrier.

I even don`t understand why the minimOSD does not have a second Battery monitor link. This is the most important information for the pilot because the engine needs much more power and is more important than the video link. If we loose video link, we can still Return to Launch with APM. But without main battery  power, we can just see how the plane is crashing :(

OK, the second GPS is not connected and the OSD is able to find it BUT:

I don`t get the GPS data on the OSD. altitude, speed, satellites, latitude and longitute are not displayed.

Does anyone have an idea why? I`ve updated the GPS Firmware with the original one to work with the OSD. Do I need to change settings on the OSD?

Thanks in advance

Did you be able to ever see the Lat/Lon on your Remzibi OSD with its GPS (without any firmware update)? Without any connection to APM2.

Is your GPS conencted to RemzibiOSD as fixed? - blue led

When your Remzibi OSD reboot, you should see on the screen the detection of the GPS. Is that happening?

I have the Pro Mini solution working right now on ACM 2.8.  I just haven't announced a new version.  If you want the source for Mavlink 1.0/ACM 2.,7.3/2.8  I can send it to you.  

Heino

Hi,

Yes, the blue LED is solid (on OSD and GPS) without APM connected.

No, I never tried to connect the GPS with the DIYdrones Firmware :(

I can see the Lat/Lon if I connect the OSD via USB to the PC with GPS Emulator. Thats Why I assume that the problem is on the GPS itself. The connection is correct (RX/TX). I doublechecked and switched RX and TX.

After OSD Reboot I can see the GPS detected message.

Did you ever try to upload the Hazy`s Firmware to the Remzibi OSD 3DR?

http://code.google.com/p/hazys-osd/

It supports the MAVLINK 1.0 and you can connect the APM to the (original) Remzibi OSD.

Maybe I should give it a try. What do you think?

Reply to Discussion

RSS

© 2016   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service