# Ros + Gazebo SITL : rc/override vs cmd\_vel?

**URL:** <https://discuss.bluerobotics.com/t/ros-gazebo-sitl-rc-override-vs-cmd-vel/3706>\
**Category:** Blue Robotics Software\
**Tags:** sitl, simulate\
**Created:** [November 6, 2018, 11:44am UTC](https://discuss.bluerobotics.com/t/ros-gazebo-sitl-rc-override-vs-cmd-vel/3706 "2018-11-06T11:44:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![olaya](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/olaya/32/1671_2.png) [@olaya](https://discuss.bluerobotics.com/u/olaya)\
**Post date:** [November 6, 2018, 11:44am UTC](https://discuss.bluerobotics.com/t/ros-gazebo-sitl-rc-override-vs-cmd-vel/3706/1 "2018-11-06T11:44:08Z")

</div>

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](http://wiki.ros.org/mavros#mavros.2BAC8-Plugins.rc_io):

> 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](https://discuss.bluerobotics.com/t/simulating-manual-control-using-mavros/1745/25) , 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!!

---

<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:** [November 6, 2018, 11:56am UTC](https://discuss.bluerobotics.com/t/ros-gazebo-sitl-rc-override-vs-cmd-vel/3706/2 "2018-11-06T11:56:20Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![olaya](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/olaya/32/1671_2.png) [@olaya](https://discuss.bluerobotics.com/u/olaya)\
**Post date:** [November 6, 2018, 12:05pm UTC](https://discuss.bluerobotics.com/t/ros-gazebo-sitl-rc-override-vs-cmd-vel/3706/3 "2018-11-06T12:05:01Z")

</div>

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,

---

<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:** [November 6, 2018, 12:15pm UTC](https://discuss.bluerobotics.com/t/ros-gazebo-sitl-rc-override-vs-cmd-vel/3706/4 "2018-11-06T12:15:53Z")

</div>

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](https://mavlink.io/en/messages/common.html#GPS_INPUT).  
Note: cmd\_vel will **only** work with GPS modes (like GUIDED).

---

<div class="post-metadata">

**Author:** ![olaya](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/olaya/32/1671_2.png) [@olaya](https://discuss.bluerobotics.com/u/olaya)\
**Post date:** [November 6, 2018, 2:44pm UTC](https://discuss.bluerobotics.com/t/ros-gazebo-sitl-rc-override-vs-cmd-vel/3706/5 "2018-11-06T14:44:13Z")

</div>

Nothing to be sorry about 😉

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

---

<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:** [November 13, 2018, 11:12am UTC](https://discuss.bluerobotics.com/t/ros-gazebo-sitl-rc-override-vs-cmd-vel/3706/6 "2018-11-13T11:12:05Z")

</div>

Hi Olaya,

> [@olaya](#):
>
> 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.

Exactly.

> [@olaya](#):
>
> 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!)

Everything is done in [ArduSub/joystick.cpp](https://github.com/ArduPilot/ardupilot/blob/master/ArduSub/joystick.cpp).

---

<div class="post-metadata">

**Author:** ![qwertyuiop](https://avatars.discourse-cdn.com/v4/letter/q/db5fbb/32.png) [@qwertyuiop](https://discuss.bluerobotics.com/u/qwertyuiop)\
**Post date:** [May 26, 2019, 4:20pm UTC](https://discuss.bluerobotics.com/t/ros-gazebo-sitl-rc-override-vs-cmd-vel/3706/7 "2019-05-26T16:20:02Z")

</div>

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?

---

<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:** [May 28, 2019, 11:13am UTC](https://discuss.bluerobotics.com/t/ros-gazebo-sitl-rc-override-vs-cmd-vel/3706/8 "2019-05-28T11:13:25Z")

</div>

Answered in [Gazebo ARDUSUB SITL+MAVROS RC OVERRIDE ISSUE](https://discuss.bluerobotics.com/t/gazebo-ardusub-sitl-mavros-rc-override-issue/5157).  
Please avoid multiple posts with the same question.
