Skip to content

vrx_classic_driving_programmatic_tutorial

M1chaelM edited this page May 5, 2023 · 2 revisions

Programmatic Operation of WAM-V Thrusters

How to control the WAM-V thrusters by publishing messages to the appropriate ROS topics.

Set up environment

For this tutorial, we'll using the VRX example launch file:

roslaunch vrx_gazebo vrx.launch

This should launch Gazebo and spawn a WAM-V using the "T" propulsion configuration.

Once the simulation launches, open a new terminal and source the appropriate setup.bash file.

List thruster topics

Each thruster has two associated topics: one for speed and one for thruster angle. For example, the right aft thruster is controlled by

/wamv/thrusters/right_thrust_cmd
/wamv/thrusters/right_thrust_angle

To see all relevant topics for the current configuration, run:

rostopic list | grep thrust

Assuming your WAM-V is using the default settings for vrx.launch, you should see:

/wamv/thrusters/lateral_thrust_angle
/wamv/thrusters/lateral_thrust_cmd
/wamv/thrusters/left_thrust_angle
/wamv/thrusters/left_thrust_cmd
/wamv/thrusters/right_thrust_angle
/wamv/thrusters/right_thrust_cmd

rostopic pub

We can use the rostopic pub utility to publish individual messages to the topics above to control thruster behavior. For example, run:

rostopic pub --once /wamv/thrusters/right_thrust_cmd std_msgs/Float32 "data: 1.0"
  • This will publish one message and cause the WAM-V to rotate about the z-axis.
  • The command will timeout after a pre-determined amount of time (the default is 1.0 s, but can be changed in the wamv_gazebo_thruster_config.xacro SDF file).

Likewise, to control the thruster angle, you can run:

rostopic pub --once /wamv/thrusters/right_thrust_angle std_msgs/Float32 "data: 1.57"
  • This will cause the right aft thruster to rotate 90 degrees in a counter-clockwise direction.
  • See the thruster articulation tutorial for more details about configuring and controlling thruster angles.

rqt_publisher

  • As described in the thruster articulation tutorial it is possible to the rqt_publisher utility to publish thrust and articulation commands to the WAM-V propulsion system.
  • This provides a convenient, very flexible graphical tool for testing commands.

Generalizing programmatic control

The above examples show basic interaction with the propulsion system by publishing messages to topics. This approach is very versatile and can be extended to create complex behavior.

  • Note that there are many ways to publish to the ROS API.
  • Note that the propulsion system is reconfigurable, so the interface may change (topic names, etc.) with different configurations.
Clone this wiki locally