# MavLink Message From Cockpit

**URL:** <https://discuss.bluerobotics.com/t/mavlink-message-from-cockpit/17826>\
**Category:** Cockpit\
**Created:** [August 28, 2024, 12:12am UTC](https://discuss.bluerobotics.com/t/mavlink-message-from-cockpit/17826 "2024-08-28T00:12:52Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jurassic5](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@Jurassic5](https://discuss.bluerobotics.com/u/Jurassic5)\
**Post date:** [August 28, 2024, 12:12am UTC](https://discuss.bluerobotics.com/t/mavlink-message-from-cockpit/17826/1 "2024-08-28T00:12:52Z")

</div>

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’}}

---

<div class="post-metadata">

**Author:** ![patrickelectric](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/patrickelectric/32/2162_2.png) [@patrickelectric](https://discuss.bluerobotics.com/u/patrickelectric)\
**Post date:** [August 28, 2024, 4:30pm UTC](https://discuss.bluerobotics.com/t/mavlink-message-from-cockpit/17826/3 "2024-08-28T16:30:42Z")

</div>

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](https://github.com/mavlink/mavlink2rest/issues/93)

---

<div class="post-metadata">

**Author:** ![Jurassic5](https://avatars.discourse-cdn.com/v4/letter/j/e0b2c6/32.png) [@Jurassic5](https://discuss.bluerobotics.com/u/Jurassic5)\
**Post date:** [August 31, 2024, 4:11pm UTC](https://discuss.bluerobotics.com/t/mavlink-message-from-cockpit/17826/4 "2024-08-31T16:11:27Z")

</div>

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/](http://blueos.local/mavlink2rest/)

 ![Screenshot 2024-08-31 at 17.08.36](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/a/ab5148d0446cc2db74e3b24d451858af21791e31.jpeg)  
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.

---

<div class="post-metadata">

**Author:** ![rafael.lehmkuhl](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/rafael.lehmkuhl/32/6630_2.png) [@rafael.lehmkuhl](https://discuss.bluerobotics.com/u/rafael.lehmkuhl)\
**Post date:** [September 2, 2024, 11:51am UTC](https://discuss.bluerobotics.com/t/mavlink-message-from-cockpit/17826/5 "2024-09-02T11:51:34Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![grantdutoit](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/grantdutoit/32/14898_2.png) [@grantdutoit](https://discuss.bluerobotics.com/u/grantdutoit)\
**Post date:** [September 3, 2024, 7:12am UTC](https://discuss.bluerobotics.com/t/mavlink-message-from-cockpit/17826/6 "2024-09-03T07:12:48Z")

</div>

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](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/a/a17de14034db323e95fb8a2abadf04964a074c5b.png)

 ![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/9/9c1ce4d02769bf05caaf43de9950b9557ebb40aa.jpeg)

Opening the below shows Vehicle ID: 255 with the MANUAL\_CONTROL under Component ID: 240  
 ![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/9/97011e703ac81c622c19eb0482164d5bd3208923.jpeg)

When “watcher” is selected the below shows.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/9/9464b41e98002a724a805a46edaf21a8abd59464.png)

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

---

<div class="post-metadata">

**Author:** ![rafael.lehmkuhl](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/rafael.lehmkuhl/32/6630_2.png) [@rafael.lehmkuhl](https://discuss.bluerobotics.com/u/rafael.lehmkuhl)\
**Post date:** [September 3, 2024, 12:22pm UTC](https://discuss.bluerobotics.com/t/mavlink-message-from-cockpit/17826/7 "2024-09-03T12:22:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![grantdutoit](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/grantdutoit/32/14898_2.png) [@grantdutoit](https://discuss.bluerobotics.com/u/grantdutoit)\
**Post date:** [September 3, 2024, 12:48pm UTC](https://discuss.bluerobotics.com/t/mavlink-message-from-cockpit/17826/8 "2024-09-03T12:48:07Z")

</div>

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](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/9/9f7ec18317ff069bc1597d61556e1f035c5ce796.png)

---

<div class="post-metadata">

**Author:** ![rafael.lehmkuhl](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/rafael.lehmkuhl/32/6630_2.png) [@rafael.lehmkuhl](https://discuss.bluerobotics.com/u/rafael.lehmkuhl)\
**Post date:** [September 3, 2024, 1:55pm UTC](https://discuss.bluerobotics.com/t/mavlink-message-from-cockpit/17826/9 "2024-09-03T13:55:41Z")

</div>

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.

 ![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/c/c4fdca34019b3bc4e1d0976a29b7b89fac64c91a.jpeg)
