Hi Folks -
I’m using Copter 3.4.2 on a PixHawk clone and communicating with an embedded platform via MavLink. I’m presently utilizing the binary C MavLink release from GitHub. (BTW oddly MP reports both v3.4.2 and 3.4.1. If I connect briefly to QGC, however it reports 3.4.1…)
Anyway connection to the pixhawk is on Serial4 at 38400 and have verified proper bitrate (within 1%).
I am able to turn on and off the “legacy” datastreams OK (MAVLINK_MSG_ID_REQUEST_DATA_STREAM). However I am unable to set individual stream ID rates: the pixhawk is responding with a MAV_ACK result of 0x3, which from my interpretation of the headers, is a MAV_CMD_ACK_ERR_ACCESS_DENIED, assuming the results are indexed started at 1 (and not zero).
This is the command I am using (PIX_ both set to 1):
mavlink_msg_command_long_send(MAVLINK_COMM_0, PIX_SYSID, PIX_CMPID, MAV_CMD_SET_MESSAGE_INTERVAL, 1, MAVLINK_MSG_ID_GPS_RAW_INT, 500000, 0,0,0,0,0); // 500000uS interval
In my mavlink_bridge_header.h file I have defined:
mavlink_system_t mavlink_system;
And in the main program (where I’m sending the command):
mavlink_system.sysid = 255; mavlink_system.compid = 1;
On the bus I see (outgoing):
#FE#21#05#FF#01#4C#00#00#C0#41#00#24#F4#48#00#00#00#00#00#00#00#00#00#00#00#00#00#00#00#00#00#00#00#00#FF#01#01#01#01#A8#A1
And response from Pixhawk:
#FE#03#B0#01#01#4D#FF#01#03#44#51
Both of which, if you break down the packets, seem to be in accordance with the header packet structure.
Here is a Pixhawk heartbeat if that offers any clues (sys status etc). I’m bench testing with only pixhawk powered from USB, all sensors/etc connected. However, no RC receiver, GPS only has 5 sats, and prearm error of GPS speed (1.5ish).
#09#3E#01#01#00#11#00#00#00#02#03#59#03#03#B3#D8#FE
A few general questions that I haven’t been able to determine by the MavLink code alone:
- When is a heartbeat from the GCS absolutely required (the microcontroller in my case)? My intention is only to monitor streams and initiate a RTL. I have tried the above SET_MESSAGE_INTERVAL with a heartbeat sent from the micro at the same rate of heartbeat receipt (from pixhawk), format below. No change.
- What are the recommended MAV_TYPE, MAV_AUTOPILOT, MAV_MODE_FLAG, and MAV_STATE fields in my case? My best guess is (and was):
mavlink_msg_heartbeat_send(MAVLINK_COMM_0, MAV_TYPE_ONBOARD_CONTROLLER, MAV_AUTOPILOT_GENERIC, MAV_MODE_FLAG_STABILIZE_ENABLED, 0, MAV_STATE_ACTIVE);
3… I know there were more but I’m drawing a blank the moment so I’ll post back!
Thanks for taking the time to read and any insight you may be able to offer. I’ve been at this for longer than I want to admit.