MavLink Message From Cockpit

Hello Blue Robotics, I am Having troubles picking out MAV commands from the MAV2REST endpoint sent from cockpit from a connected joystick. I connected a joystick and mapped some buttons to send Mav Commands using one of the mapping template format. My goal is when I trigger this functions I should recieve them or be able to read them from/through a local running app/script(python script running on the RPI). I have tried using the MAV2REST but after connecting I get a bunch of data and I am not sure which one to look out for that is related to mav commands sent from cockpit or is there a totally different or better way of recieving/interpreting mav commands from cockpit asides the mav2rest?.

for Context here’s what the data i get after connecting to the mav2rest response looks like:
{‘param_count’: 914, ‘param_id’: [‘B’, ‘T’, ‘N’, ‘5’, ‘_’, ‘S’, ‘F’, ‘U’, ‘N’, ‘C’, ‘T’, ‘I’, ‘O’, ‘N’, ‘\x00’, ‘\x00’], ‘param_index’: 65535, ‘param_type’: {‘type’: ‘MAV_PARAM_TYPE_INT8’}, ‘param_value’: 1.0, ‘type’: ‘PARAM_VALUE’}
{‘header’: {‘component_id’: 1, ‘sequence’: 48, ‘system_id’: 1}, ‘message’: {‘autopilot’: {‘type’: ‘MAV_AUTOPILOT_ARDUPILOTMEGA’}, ‘base_mode’: {‘bits’: 1}, ‘custom_mode’: 4, ‘mavlink_version’: 3, ‘mavtype’: {‘type’: ‘MAV_TYPE_GROUND_ROVER’}, ‘system_status’: {‘type’: ‘MAV_STATE_STANDBY’}, ‘type’: ‘HEARTBEAT’}}
{‘header’: {‘component_id’: 101, ‘sequence’: 251, ‘system_id’: 1}, ‘message’: {‘autopilot’: {‘type’: ‘MAV_AUTOPILOT_INVALID’}, ‘base_mode’: {‘bits’: 0}, ‘custom_mode’: 0, ‘mavlink_version’: 3, ‘mavtype’: {‘type’: ‘MAV_TYPE_CAMERA’}, ‘system_status’: {‘type’: ‘MAV_STATE_STANDBY’}, ‘type’: ‘HEARTBEAT’}}

At the moment mavlink2rest has the following issue that does not allow cross communication between websockets: Send messages received from rest api and websocket to others websocket clients · Issue #93 · mavlink/mavlink2rest · GitHub

Thanks @abuislam and @patrickelectric for the Reply, But my main goal is to get joystick data from cockpit I am not interested in sending or injecting data back to cockpit, I understand that Cockpit send a MANUAL_CONTROL mav message to the vechile and this conatins joystick data however when I look and check for this MANUAL_CONTROL I don’t see it.

From the Mav2Rest webscoket I dont get MANUAL_CONTROL and then on
http://blueos.local/mavlink2rest/


I don’t see an endpoint as well.

my question is how exactly can I get the joystick data?
@rafael.lehmkuhl @williangalvani please take a look.
Thank you.

The MANUAL_CONTROL messages should start appearing under vehicle ID 255 once you activate it on Cockpit. To activate it you need to use the controller (move a joystick or click a button when on Cockpit’s tab).

1 Like

Hey @rafael.lehmkuhl

Some feedback for the above.

BlueOS v1.3.0-beta.10
ArduPilot v4.1.2 - Type: Submarine - Board: Pixhawk1
Cockpit v1.0.2

Joystick is connected and detected by Cockpit. When in the joystick config and buttons are pressed, they reflect accordingly.
image

Opening the below shows Vehicle ID: 255 with the MANUAL_CONTROL under Component ID: 240
image

When “watcher” is selected the below shows.

When the joystick is functioned, nothing shows in MAVLINK however actions take place in Cockpit

Hey grant.

As @patrickelectric mentioned above, the “watcher” function on mavlink2Rest (this service page) is not working for things other than vehicles (in this case Cockpit, which is a gcs), but that should be no problem for you guys.

The MANUAL_CONTROL messages are working perfectly in this case and you guys can consume from it normally. It’s just the “watcher” functionality (that is only used on this frontend) that is not working. If you poll the MANUAL_CONTROL endpoint, it will show you the changes in the joystick.

Thanks @rafael.lehmkuhl

Forgive the next potentially daft question, what would the MANUAL_CONTROL end point config look like? I’m for details that I would use to populate the image below.

image

By endpoint there I mean the HTTP endpoint, not a MAVLink endpoint.

You don’t need a new MAVLink endpoint. Just click the MANUAL_CONTROL link, and use this URL to poll for new joystick data.

1 Like