-
Notifications
You must be signed in to change notification settings - Fork 11
Marina Basic
This tutorial assumes you have followed the Installation tutorial to set up your environment.
Source ROS and your workspace built from source:
source /opt/ros/melodic/setup.bash
cd ~/vorc_ws
source install/setup.bash
Remember to source these in every new terminal.
Run the example:
roslaunch vorc_gazebo marina.launch
This will launch a Gazebo GUI window similar to this:
You can zoom in and out with respect to the vehicle by hovering the cursor on the vehicle and scrolling. To rotate the view with respect to the vehicle, press down Shift on the keyboard, hold the cursor down on the vehicle and drag. The object the cursor hovers on is the object with respect to which the viewpoint will move.
The shoreline is a coarse approximation of La Spezia, Italy.
For an introduction to the Gazebo Graphical User Interface follow this tutorial.
We can use the rostopic pub
utility to publish individual messages:
rostopic pub --once /cora/thrusters/right_thrust_cmd std_msgs/Float32 "data: 1.0"
This will publish one message and cause the robot to rotate about the z-axis. The command will time out after a predetermined amount of time (the default is 1.0 s, but can be changed in the cora_thruster_config.xacro SDF file).
We use the teleop_twist_keyboard package, along with a custom twist2thrust.py node to convert the Twist messages to two Float32 messages for the left and right thrusters. Forward velocity (twist.linear.x) is mapped to axial thrust (right+left) and rotational velocity (twist.linear.z) is mapped to differential thrust (usvdrive.right-usvdrive.left).
Be sure to specify the namespace to cora
when you launch the keyboard control:
roslaunch vorc_gazebo usv_keydrive.launch
The control is identical to VRX. See the VRX Keydrive Details page for the details of how keyboard teleop is set up.
We use the joy and joy_teleop packages, along with a custom twist2thrust.py node to convert Twist messages from the standard teleop to two Float32 messages for the thruster plugin.
You can launch usv_joydrive.launch in another terminal for joystick control:
roslaunch vorc_gazebo usv_joydrive.launch
Equivalently, you can launch the Marina environment with joystick enabled:
roslaunch vorc_gazebo marina.launch joy:=true
For the default configuration, the left stick up/down axis (axis 1) is mapped to the left thruster and the right stick up/down axis (axis 3) is mapped to the right thruster. Therefore, pushing both sticks forward should drive the robot forward.
If you are using the Logitech F310 with the default configuration, make sure the Mode light is unlit.
If you are using a different input device compatible with the joy package, you can edit the diffdrive.yaml configuration file so that the pertinent axis of your device are used.