Hello!
I am working with a BlueROV2, and I am running python programs on the Raspberry Pi on the BlueROV2 to make the robot move.
I have recently upgraded to BlueOS and I am struggling to get the passing of Mavlink Messages to work. The old system used under the old OS involved creating a master in the python programs, and then calling that master to send the appropriate Mavlink messages. This methodology is not working under BlueOS, as the master fails to send any Mavlink messages - the program gets stuck when no heartbeat is detected, and if the check for heartbeat is removed, the code runs, but does not do what it needs to do since Mavlink messages are not being sent.
I have turned to using REST to send Mavlink messages to the Pixhawk in order to send data to and receive data from the Pixhawk. I have followed the format detailed at the following GitHub repository written by patrickelectric: GitHub - patrickelectric/mavlink2rest: mavlink2rest creates a REST server that provides mavlink information from a mavlink source . This format is working well for Mavlink messages which involve requesting that the Pixhawk send data to the Pi, such as SCALED_IMU, as using GET in my python programs returns the desired data consistently. However, for Mavlink messages which involve sending data from the Pi to the Pixhawk, such as RC_CHANNELS_OVERRIDE and MANUAL_CONTROL, it is not working. I have used POST in the way that the GitHub repository does in order to send these Mavlink messages, but as seen in the picture below, all that happens when I make a POST request in the BlueOS terminal is that the terminal prints “Ok”. Nothing happens on the BlueROV, even though the Mavlink message was supposed to turn the motors on.
The following is a description of how I tried to use POST to send data from the Pi to the Pixhawk via Mavlink messages:
Following the format in patrickelectric’s GitHub repository, I used GET to request a template for the appropriate format for sending the Mavlink message MANUAL_CONTROL over REST.
I then made a POST request using this format, but the terminal just printed “Ok” and the robot did nothing:
I made another POST request following this format, but changed the system_id and component_id to 1, since these were the values that I used when successfully using GET to send Mavlink messages such as SCALED_IMU in my python programs, but once again the terminal just printed “Ok” and the robot did nothing.
I followed this same pattern again, but for the Mavlink message RC_CHANNELS_OVERRIDE, and the results were identical.
My question is (1) What am I doing wrong to cause the POST requests not to work, and (2) Is there an easier way of sending Mavlink messages to the Pixhawk under BlueOS which would avoid this issue entirely? Any help would be greatly appreciated. If there is some key information missing from what I have provided here, let me know and I can share it.