MAVLINK DATA REQUEST

124 views
Skip to first unread message

Aleksejs Sencenko

unread,
Feb 5, 2021, 8:41:57 AM2/5/21
to MAVLink
I'm trying to request mavlink joystick data, but couldn't get it to work, my message request looks like this, i can see the heartbeat but no mnual control data on the bus:

        mavlink_message_t data_request_message;

        uint8_t system_id  =        1;
        uint8_t component_id =   1;
        uint8_t stream_id =          MAVLINK_MSG_ID_MANUAL_CONTROL;
        uint16_t message_rate = 10;
        uint8_t on_off =                1;


        mavlink_msg_data_stream_pack( system_id,
                                                                       component_id,
                                                                       &data_request_message,
                                                                       stream_id,
                                                                       message_rate,
                                                                       on_off );


        port->write_message(data_request_message);

j.ta...@gmail.com

unread,
Feb 5, 2021, 8:55:29 AM2/5/21
to MAVLink
Ardupilot doesn't support this message (yet). I use this to get the MAVLINK_MSG_ID_RC_CHANNELS (and more) messages in 10 Hz rate:

Every time I get MAVLINK_MSG_ID_HEARTBEAT in msg_rx from the flightcomputer, I am sending this back:

mavlink_msg_request_data_stream_send(MAVLINK_UART, msg_rx->sysid, msg_rx->compid, MAV_DATA_STREAM_ALL, 10, 1);


Op vrijdag 5 februari 2021 om 14:41:57 UTC+1 schreef Sinb...@icloud.com:

Aleksejs Sencenko

unread,
Feb 5, 2021, 9:08:25 AM2/5/21
to MAVLink
Will try that. I'm using px4, does it have any meaning?

j.ta...@gmail.com

unread,
Feb 5, 2021, 9:20:43 AM2/5/21
to MAVLink
PX4 can run Ardupilot and PX autopilot software. Most people use Ardupilot (I guess). I don't know if PX autopilot supports stream requests. I found a couple of Mavlink messages which are invented, but never used. :-)

Op vrijdag 5 februari 2021 om 15:08:25 UTC+1 schreef Sinb...@icloud.com:

Aleksejs Sencenko

unread,
Feb 5, 2021, 9:41:17 AM2/5/21
to MAVLink
Couldn't find that function in the mavlin2 library:
mavlink_msg_request_data_stream_send(....)

j.ta...@gmail.com

unread,
Feb 5, 2021, 9:51:24 AM2/5/21
to MAVLink
What about this?

mavlink_msg_request_data_stream_pack(msg_rx->sysid, THIS_COMPONENT_ID, &msg_send, msg_rx->sysid, msg_rx->compid, MAV_DATA_STREAM_ALL, 10, 1);

Op vrijdag 5 februari 2021 om 15:41:17 UTC+1 schreef Sinb...@icloud.com:

Aleksejs Sencenko

unread,
Feb 5, 2021, 10:26:03 AM2/5/21
to MAVLink
Have a problem creating that message (with the *uri argument, there you have MAV_DATA_STREAM_ALL ) :

    mavlink_message_t  data_request_message;

    uint8_t system_id = 1;
    uint8_t component_id =1;
    uint8_t request_id = 1;
    uint8_t uri_type;
    const uint8_t *uri = MAVLINK_MSG_ID_MANUAL_CONTROL;        <<<< What should i put here ???
    uint8_t transfer_type;
    const uint8_t *storage;

    mavlink_msg_resource_request_pack(system_id,
                                                                    component_id,
                                                                    &data_request_message,
                                                                    request_id,
                                                                    uri_type,
                                                                    &uri,
                                                                    transfer_type,
                                                                    storage);
Reply all
Reply to author
Forward
0 new messages