# ROS2 on blueOS software

**URL:** <https://discuss.bluerobotics.com/t/ros2-on-blueos-software/14266>\
**Category:** BlueROV2\
**Created:** [May 5, 2023, 2:06pm UTC](https://discuss.bluerobotics.com/t/ros2-on-blueos-software/14266 "2023-05-05T14:06:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MorgannLBT](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@MorgannLBT](https://discuss.bluerobotics.com/u/MorgannLBT)\
**Post date:** [May 5, 2023, 2:06pm UTC](https://discuss.bluerobotics.com/t/ros2-on-blueos-software/14266/1 "2023-05-05T14:06:36Z")

</div>

Hello,  
I am working on an AUV project programmed with ROS2 and for the first tests we bought a BLUEROV2 v4.  
On the PC I installed ROS2 (humble) and mavros (to convert mavlink messages to ROS2).  
I receive all the data from the BlueRov but when I post on topics like “/mavros/rc/overideRCin” or “/mavros/setpoint\_attitude/cmd\_vel” to turn on the lights or thrusters nothing happens on the BlueROV.  
On the other hand I managed to arm the vehicle with mavros with the “mavros/cmd/arming” service.  
Can someone help me to control my BlueROV by posting on a mavros2 topic or by using a mavros2 service?  
Thanks a lot.  
Goodbye.  
Morgann Le Bot

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [May 13, 2023, 12:39pm UTC](https://discuss.bluerobotics.com/t/ros2-on-blueos-software/14266/2 "2023-05-13T12:39:06Z")

</div>

Hi @MorgannLBT,

Apologies for the delay on getting to this.

I don’t have experience with ROS, but assuming mavros is just acting as a wrapper around MAVLink messages then I would expect RC overrides to work, assuming the relevant peripherals are configured correctly in the vehicle parameters.

Commanding a velocity could also work, but I suspect it requires some form of positioning or velocity sensor to be connected (like a USBL and/or DVL). Motion commands generally require that the vehicle is armed and receiving a regular (≳1Hz) heartbeat. If that’s not sufficient it may help to send the motion commands regularly as well, since that’s at least required for manual control.

---

<div class="post-metadata">

**Author:** ![clyde](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/clyde/32/8563_2.png) [@clyde](https://discuss.bluerobotics.com/u/clyde)\
**Post date:** [May 14, 2023, 3:38pm UTC](https://discuss.bluerobotics.com/t/ros2-on-blueos-software/14266/3 "2023-05-14T15:38:49Z")

</div>

Hi @MorgannLBT –

For ArduSub to accept RC overrides you will need to make sure that mavros is the GCS. The typical way to do this is to set the system\_id to 255.

Here’s a long-ish thread discussing this: [RC override not working with SITL ArduSub + Mavros - #8 by patrickelectric](https://discuss.bluerobotics.com/t/rc-override-not-working-with-sitl-ardusub-mavros/12046/8)

/Clyde

---

<div class="post-metadata">

**Author:** ![MorgannLBT](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@MorgannLBT](https://discuss.bluerobotics.com/u/MorgannLBT)\
**Post date:** [May 15, 2023, 8:40am UTC](https://discuss.bluerobotics.com/t/ros2-on-blueos-software/14266/4 "2023-05-15T08:40:01Z")

</div>

Hello,

Thanks to both of you for your answers!

@EliotBR: for the velocity command (cmd\_vel) do you know if I can simulate a GPS input? What is the name of the GPS input used (setpostion.local or setposition.global)?

@clyde:  
In my ROS2 terminal I launch mavros like this:  
“ros2 launch mavros apm.launch gcs\_url:=udp://:14570@localhost:12000”  
I created an Endpoint on the BlueROV at port 14560.  
And since I’m using a linux VM, I created a redirect port from port 14560 on my PC to port 14570 on my VM. That’s why I use port 14570.

Does this seem correct?

In my terminal where i launch mavros I have this error :  
“[ERROR] [1684139311.296292915] [mavros.mavros\_router]: link[1000] reconnect failed: DeviceError:serial:open: No such file or directory”

And I get the same error when I run the command with fcu\_url:=tcp://localhost as you said in the thread you mentioned in your post.

I receive the output data well and I can arm and change the mode of the vehicle with the “arming” and “SetMode” services but I cannot control the thrusters or the lights of the ROV.

How can I set the system\_id to 255?

Thank’s a lot.

Good Bye

Morgann Le Bot

---

<div class="post-metadata">

**Author:** ![EliotBR](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/eliotbr/32/6937_2.png) [@EliotBR](https://discuss.bluerobotics.com/u/EliotBR)\
**Post date:** [June 2, 2023, 6:44am UTC](https://discuss.bluerobotics.com/t/ros2-on-blueos-software/14266/5 "2023-06-02T06:44:54Z")

</div>

Apologies for the delay on responding to this

> [@MorgannLBT](#):
>
> for the velocity command (cmd\_vel) do you know if I can simulate a GPS input? What is the name of the GPS input used (setpostion.local or setposition.global)?

GPS input can be simulated by sending regular [`GPS_INPUT`](http://mavlink.io/en/messages/common.html#GPS_INPUT) MAVLink messages to the autopilot.

> [@MorgannLBT](#):
>
> How can I set the system\_id to 255?

[It seems](http://wiki.ros.org/mavros#Connection_URL) it can be added as a query string to the connection URL.

---

<div class="post-metadata">

**Author:** ![MorgannLBT](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@MorgannLBT](https://discuss.bluerobotics.com/u/MorgannLBT)\
**Post date:** [June 15, 2023, 9:55am UTC](https://discuss.bluerobotics.com/t/ros2-on-blueos-software/14266/6 "2023-06-15T09:55:10Z")

</div>

Hello !  
I finally solved my problem.  
It seems that the mavros rc\_override topic is well subscribed as well as other topics but we can’t drive the BlueROV by publishing on the topic.  
To solve my problem, I added a new Endpoint to the BlueOS site. Then I used the python library Pymavlink to send a mavlink message to control the rc\_override.  
So, I made a ROS2 subscriber node that reads the rc\_override topic (where I can publish messages) and sends mavlink messages (with the data contained in the rc\_override) using Pymavlink.  
Thanks for your answers.  
NB: I’m using a new Endpoint because we can’t use mavros and pymavlink on the same one.
