-
Notifications
You must be signed in to change notification settings - Fork 186
vrx_classic_driving_programmatic_tutorial
How to control the WAM-V thrusters by publishing messages to the appropriate ROS topics.
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.
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
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.
- 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.
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.
- The ROS tutorials provide examples for writing publishers in C++ and Python.
- Mathworks provides examples of publishing from MATLAB or Simulink.
- Tufts University developed a LabView ROS interface that can publish these messages.
- Note that the propulsion system is reconfigurable, so the interface may change (topic names, etc.) with different configurations.