Hi I’m working on trying to send MAVLink commands to ArduCopter requesting it to send GPS data.
From what I understand, the newer MESSAGE_INTERVAL MAVLink command is not supported but REQUEST_DATA_STREAM is. However I am unsure about some of the parameters for the MAVLink packing function.
^ This is the documentation that my MAVLink library gives for the REQUEST_DATA_STREAM packing function. I said system_id to 32 (from what I understand this is an arbitrary number between 1 and 255, though I’ve also tried using 1 and 255 and nothing improved), for component_id I used 1, for target_system I used 1, for target_component I used 220 aka MAV_COMP_ID_GPS (GPS’s component ID), start_stop is set to 1.
I’m assuming that the req_stream_id is supposed to be the id # of the MAVLink message that I want ArduCopter to send. I’ve tried 24, 25, 63, etc.
req_message_rate is something that I am wary of. I’ve set it to 100, 1000, 100000, and 38400 (baud rate of GPS component) but nothing has improved.
No matter what I do, the only thing ArduCopter sends back is the same constant heartbeat messages as always. I’ve tried using PARAM_REQUEST and that actually worked so I don’t know what’s up with REQUEST_DATA_STREAM.
Any help would be greatly appreciated, this is driving me crazy.
This might be working, but there is no reason why you are sending the message with that ID. You want to target the autopilot, not a GPS (and there’s no GPS that talks MAVLink that I’m aware). The system is the vehicle, the autopilot is one of the components, a MAVLink gimbal is another component, a companion computer another, etc.
No, you can’t select individual messages with REQUEST_DATA_STREAM, you can only select streams. The available streams are defined in the MAV_DATA_STREAM (http://mavlink.org/messages/common).
Thanks yeah I ended up figuring it out a bit after stumbling across the MAV_DATA_STREAM enum. For some reason I can only get it to send all of the statuses (stream id 0) and not just position (stream id 6).
More is better than nothing though so I’ve been able to get on with my work regardless, thank you all for the help!
Did you success with enable some types of data streaming and disable some types? I am getting too many packets and want just to get specific packets like MAV_DATA_STREAM_POSITION but I still get other types.
Do you keep sending heartbeats or not?
Can you help me with a complete example ?
Thanks @Matt_Kun
My sequense of request to start:
0xFE 0x06 0x01 0x01 0x01 0x42 0x01 0x00 0x01 0x00 0x02 0x01 0x65 0x28
where
0xFE
0x06 0x01 0x01 0x01 0x42 - heading
0x01 0x00 0x01 0x00 0x02 0x01 -
0x01 0x00 - rate in Hz (lsb ) = 1Hz
01 - system id
00 - component id (don’t know why 0)
02 - number of stream in MAV_DATA_STREAM = MAV_DATA_STREAM_EXTENDED_STATUS
01 - start
0x65 0x28 - crc (lsb)
About numder of stream: I need [GPS_RAW_INT], in SRx params - stream is SRx_EXT_STAT, than look at the MAV_DATA_STREAM - value 2 fits (at first I tried value 1 - no data needed).