Control BlueRov2 from MavRos

Hi everyone,

I’m trying to pilot my BlueROV2 (heavy) directly from the terminal using ROS2 and MAVROS, without a physical RC transmitter.
My procedure is:

  1. Arm the vehicle
ros2 service call /mavros/cmd/arming mavros_msgs/srv/CommandBool "{value: true}"

  1. Attempt to override motor via override
ros2 topic pub /mavros/rc/override mavros_msgs/msg/OverrideRCIn "{channels: [1505,1500,1500,1500,1500,1500,1500,1500]}"

But the motors do not move, /mavros/rc/out still shows neutral output (1500 for all motors) and /mavros/state shows:

header:
  stamp:
    sec: 1770819919
    nanosec: 840314323
  frame_id: ''
connected: true
armed: true
guided: false
manual_input: true
mode: MANUAL
system_status: 5

Am I missing something? I’m doing something wrong?

Thanks a lot for any advice!

The issue is probably your mavros system_id. ArduSub/ArduRover only accept mavlink messages with system_id: 255, but mavros defaults to 1.

Check mavros_control its my ros2 package with boilerplate code for mavros

It shows how to set the system_id to 255: mavros_control/launch/apm_pluginlist.yaml at edc6e0dc0810b87e4a88dae953afda9808289cea · itskalvik/mavros_control · GitHub

This setup allows you to control the robot with any standard GCS and mavros at the same time, which will cause issues if both are running at the same time.

Alternatively you can changes the robot’s default accepted system_id in BlueOS/QGC firmware parameters

3 Likes

Hi, thanks for your help, it’s partially fixed.
When I run:

ros2 topic pub mavros/rc/override mavros_msgs/msg/OverrideRCIn "{channels: [10,1500,1500,1500,1500,1500,1500,1500,0,0,0,1633,1100,0,0,0]}"

now I get:

ros2 topic echo /mavros/rc/override
---
channels:
- 1510
- 1500
- 1500
- 1500
- 1500
- 1500
- 1500
- 1500
- 0
- 0
- 0
- 1633
- 1100
- 0
- 0
- 0
- 48
- 0
---

And:

ros2 topic echo /mavros/rc/out
---
header:
  stamp:
    sec: 1770890750
    nanosec: 521302007
  frame_id: ''
channels:
- 1500
- 1500
- 1500
- 1500
- 1510
- 1490
- 1510
- 1490
- 0
- 0
- 0
- 1633
- 1100
- 0
- 0
- 0
---

I’ve understood that it map the value to the direction (e.g., channel 1 = forward → changes 4 motors) but I still don’t see the motors moving, why could that be? Are there other issues I should check?
Is there any official documentation about this?

Hi @Magform,

I’m not well-versed in the ROS side of things, but MAVLink’s RC_CHANNELS_OVERRIDE messages (which OverrideRCIn uses) are overriding the RC inputs - i.e. pretending to be a radio controller communicating with the vehicle.

The SERVO_OUTPUT_RAW messages (which as I understand it are provided as ROS’s rc/out) are reflecting the autopilot’s raw servo channel outputs, which are determined by the autopilot from the combination of its various inputs, including the RC input channel mapping, to achieve the configured output functions.

It is possible to set each output to RCPassThru if you want, but that then doesn’t make any use of the autopilot’s functionalities (including arming and failsafes and the like).

Assuming you’re only using the values you’ve shown, 10µs of pulse-duration away from the neutral PWM value is still within the ESC’s dead-zone, so isn’t expected to have any effect.

If you’re using larger values and still not getting any movement then perhaps you haven’t armed your vehicle, or have triggered a disarming failsafe (e.g. by not sending heartbeats, or sending control inputs too infrequently)?

2 Likes

Thanks! It was just too short a pulse duration, that’s why nothing was moving. I increased the values and now it works. I’ll keep using OverrideRCIn as before.

Really appreciate you taking the time to explain how OverrideRCIn works that clarified things a lot.

Thanks again!

2 Likes