# Inability to change mode when controlling autonomous underwater vehicle with Mavros

**URL:** <https://discuss.bluerobotics.com/t/inability-to-change-mode-when-controlling-autonomous-underwater-vehicle-with-mavros/19511>\
**Category:** ArduSub\
**Created:** [February 24, 2025, 2:42pm UTC](https://discuss.bluerobotics.com/t/inability-to-change-mode-when-controlling-autonomous-underwater-vehicle-with-mavros/19511 "2025-02-24T14:42:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Abdurrahman](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Abdurrahman](https://discuss.bluerobotics.com/u/Abdurrahman)\
**Post date:** [February 24, 2025, 2:42pm UTC](https://discuss.bluerobotics.com/t/inability-to-change-mode-when-controlling-autonomous-underwater-vehicle-with-mavros/19511/1 "2025-02-24T14:42:19Z")

</div>

Hii;  
I want to control and change the modes of my Ardusub-based unmanned underwater vehicle with Mavros. However, I can only use certain modes of Ardusub. These are; Stabilize, Manual and Acro. I can switch to other modes by typing which modes in the terminal in Ubuntu. I also want my vehicle to do the tasks and commands I want, how can I do this?

---

<div class="post-metadata">

**Author:** ![tony-white](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/tony-white/32/18385_2.png) [@tony-white](https://discuss.bluerobotics.com/u/tony-white)\
**Post date:** [February 24, 2025, 2:45pm UTC](https://discuss.bluerobotics.com/t/inability-to-change-mode-when-controlling-autonomous-underwater-vehicle-with-mavros/19511/2 "2025-02-24T14:45:39Z")

</div>

Hi @Abdurrahman -  
Depth hold and guided/auto mode require additional sensors - a pressure sensor and location sensors, respectively. Can you share more about the hardware you’re using? What autopilot, version of BlueOS, etc.? What are your overall goals for the vehicle?

---

<div class="post-metadata">

**Author:** ![Abdurrahman](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Abdurrahman](https://discuss.bluerobotics.com/u/Abdurrahman)\
**Post date:** [February 24, 2025, 5:44pm UTC](https://discuss.bluerobotics.com/t/inability-to-change-mode-when-controlling-autonomous-underwater-vehicle-with-mavros/19511/3 "2025-02-24T17:44:33Z")

</div>

First off all.Thank you.We are using jetson and pixhawk. ArduSub software is installed on Pixhawk. We have pressure sensors but when we try to change the mode, we do not attach the sensors to our vehicle. As I mentioned above, we use ArduSub software and Mavros communication. Our vehicle will work completely autonomously. We will make the vehicle perform tasks with the Ros commands we will send. We also tried the px4 software, it can still run certain head modes and the vehicle does not arm when we change the mode.

---

<div class="post-metadata">

**Author:** ![tony-white](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.bluerobotics.com/tony-white/32/18385_2.png) [@tony-white](https://discuss.bluerobotics.com/u/tony-white)\
**Post date:** [February 24, 2025, 6:53pm UTC](https://discuss.bluerobotics.com/t/inability-to-change-mode-when-controlling-autonomous-underwater-vehicle-with-mavros/19511/4 "2025-02-24T18:53:19Z")

</div>

Hi @Abdurrahman -  
Auto flight mode requires the vehicle to know its position. For surface vehicles, this can come from a GPS, once underwater a USBL or DVL is required…

A supported pressure sensor needs to be connected and feeding measurements to the autopilot via I2C in order for depth hold to work…

---

<div class="post-metadata">

**Author:** ![Abdurrahman](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Abdurrahman](https://discuss.bluerobotics.com/u/Abdurrahman)\
**Post date:** [February 24, 2025, 10:51pm UTC](https://discuss.bluerobotics.com/t/inability-to-change-mode-when-controlling-autonomous-underwater-vehicle-with-mavros/19511/5 "2025-02-24T22:51:00Z")

</div>

![image](https://us1.discourse-cdn.com/flex019/uploads/bluerobotics/original/2X/2/222d5434ef0c1713f318c3e7fa151366f0ced63e.jpeg)  
First I attached my depth sensor to the vehicle. Then in the terminal in Ubuntu, there are modes for the px4 software, but my vehicle does not arm in any of them, and there is also no depth-related mode in px4. What should I do in this case? I have a problem like this: if I change the mode in px4, the vehicle does not arm, if I arm the vehicle, this time the mode does not change, so if I do one, the other does not work, there is such a problem.

---

<div class="post-metadata">

**Author:** ![Abdurrahman](https://avatars.discourse-cdn.com/v4/letter/a/dec6dc/32.png) [@Abdurrahman](https://discuss.bluerobotics.com/u/Abdurrahman)\
**Post date:** [February 25, 2025, 6:37am UTC](https://discuss.bluerobotics.com/t/inability-to-change-mode-when-controlling-autonomous-underwater-vehicle-with-mavros/19511/6 "2025-02-25T06:37:06Z")

</div>

Hii Tony White,  
sim\_vehicle.py -L RATBeach

- -out=udp:127.0.0.1:14550
- console -map

roslaunch mavros

apm.launch fcu\_url:="udp://:

14550@127.0.0.1:14550"

roslaunch bluerov\_ros\_playground gazebo.launch

rosservice call /mavros/ set\_mode “(base\_mode: 0, custom\_mode: ‘GUIDED’}” rosservice call /mavros/ cmd/arming “{value: true)” rostopic echo /mavros/state rostopic pub /mavros/ setpoint\_velocity/ cmd\_vel\_unstamped geometry\_msgs/Twist ‘[1.0, 0.0, 0.0}’[0.0, 0.0, 0.0]’

these commands When I run it, I can see the movement of the vehicle on the map, but I can’t make the vehicle in Gazebo move. There is no problem in changing modes and arming, but when I write the movement code, only the vehicle on the map moves, the vehicle in Gazebo does not move at all. I have a similar problem, can you look into it too?Thank you so much.
