Simulating Manual Control using Mavros

Hi @MavNav,

I’ll itemize each step to make sure that everything is correct :slight_smile:
Probably will work with the real ROV, but I’ll write a simple guide to you to test with SITL.

  • Start SITL
    • cd ardupilot/ArduSub
    • sim_vehicle.py -j4
  • Connect mavros with SITL
    • roslaunch mavros apm.launch fcu_url:=udp://0.0.0.0:14550@
  • Arm the ROV and put it on guided mode.
    • rosrun mavros mavsafety arm
    • rosrun mavros mavsys mode -c GUIDED
      • It’ll appear Mode changed.

Now, we should have everything prepared to send linear and angular messages.
To make sure that everything is correct, we can subscribe in odom to see the drone position.

  • rostopic echo /mavros/local_position/odom/pose
pose: 
  position: 
    x: -15.353191375732417
    y: -2.969302654266354
    z: -39.34264373779297
  orientation: 
    x: 0.0005757744895501046
    y: 0.0023029090765363785
    z: -0.4099183091346866
    w: -0.9121191506210589

Now, we can send a linear and angular reference with rospub.

  • rostopic pub -r 10 /mavros/setpoint_velocity/cmd_vel geometry_msgs/TwistStamped "{header: auto, twist: {linear: {x: 10.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 0.0}}}"

And with this, you’ll see the x go up.

1 Like