Home        Store        Learn        Blog

Ros + Gazebo SITL : rc/override vs cmd_vel?

Hi all,

I want to develop a controller in ROS for the Bluerov2, and I decided to first start developing the code using SITL.

I did the following procedure to start controlling the ROV:

  1. Run sim_vehicle.py from ~/…/ardupilot/ArduSub
  2. Launched gazebo with roslaunch bluerov_ros_playground gazebo_sitl.launch
  3. Launched QGroundControl (because I found it more convenient to toggle between navigation modes)

After that, the next step is to send the ROV the control commands. AFAIK, mavros/rc/override and /mavros/setpoint (I specifically want to use cmd_vel) can be used to do that.

According to ROS wiki:

Send RC override […] Not recommended to use in automatic control because lack of safety mechanisms. Use one of setpoint plugins and OFFBOARD mode.

However, there was a little discussion about this question in this topic , where you stated that:

rc/override -> (STABILIZE/MANUAL) MODE
cmd_vel -> GUIDED MODE

However, GUIDED MODE requires to have a GPS, because as Patrick said:

You are not able to set speed reference without a position system, the software derivative the position to use it as a velocity reference for the control loop.

I guess that cmd_vel works in the SITL but will not work in the real ROV since I don’t have GPS, but, since cmd_vel is more recommended for automated systems, is there any workaround I can do to be able to use GUIDED MODE and thus this topic? Maybe publishing the Bluerov2 Pose in some topic?

Thank you!!

Edit: cmd_vel was not working at first because I had the joystick connected and I guess there were conflict in the commands. However, the same question for the real ROV remains!!

Hi Olaya,

You should be able to control the ROV in guided mode with SITL, the model does have a “GPS” integrated, you can check the position information in /mavros/global_position/ and /mavros/local_position/, can you share your code or tell how are you publishing to the cmd_vel topic ?

Just to make it clear, do you want to use guided mode with the real vehicle to control attitude or position/velocity ? Because it’s not possible to control velocity/position without a GPS or a velocity sensor with accuracy. However, it’s possible to control the attitude without a GPS in althode mode.

Hi Patrick,
That was a real quick answer! I edited the post because cmd_vel finally worked, but the question about controlling the real rov still remains!

I want to do an autonomous controller from the computer (without using the joystick), in all the coordinates, not only the attitude.
I know it will not be accurate with the onboard sensors, but first I want to do a naive controller with all the elements I have, and then incorporate extra measurements (i.e. a fixed camera) to improve the accuracy.
Is it possible to use setpoint without the GPS, or do I have to use rc/override by force?

Thank you,

Hi Olaya,

Sorry for answering to quickly, hehe.

If you have a camera or any sensor that can provide a position information for the ROV, you can create your own position system for the guided mode, check GPS_INPUT message.
Note: cmd_vel will only work with GPS modes (like GUIDED).

Nothing to be sorry about :wink:

So, to be clear, if I want to use GPS modes without GPS, I can/have send a fake GPS message according to that documentation.
Otherwise, I have to use rc/override.

Where can I see in my ROV the code with the mapping of the rc message to the rov commands? (not sure if this deserves a new topic!)

Hi Olaya,

Exactly.

Everything is done in ArduSub/joystick.cpp.

I have no interest in sending velocity commands, I want to actually override my rc in SITL but the vehicle is not responding to any input, what can I do?

Answered in Gazebo ARDUSUB SITL+MAVROS RC OVERRIDE ISSUE.
Please avoid multiple posts with the same question.