Tutorials/drcsim/2.2/VRC Plugin Golf Cart


 * 1) DRC Tutorial: Using the VRC plugin to tele-operate the Golf Cart

This tutorial will demonstrate how to control the a Golf Cart using ROS topics provided by the VRC Plugin. The Golf Cart is a placeholder vehicle to use for testing, while the DRC Vehicle model is being finished. Note that this is a development aid provided for testing and will not be available during the competition. In the course of this tutorial, we're going to drive the Golf Cart using direct commands to the steering wheel, hand brake, gas pedal, and brake pedal, which can be used to test vehicle navigation without using Atlas.


 * 1) Install DRC Simulator ##

Click to see the instructions for installing the DRC simulator and associated utilities. This tutorial requires drcsim-1.3 or later.


 * 1) Launch the DRC Simulator ##

Launch the simulator using the `atlas_golf_cart_fire_hose.launch`

roslaunch atlas_utils atlas_golf_cart_fire_hose.launch


 * 1) Read the Golf Cart interface states ##

The VRC plugin exposes ROS topics for the Golf Cart interface elements. In addition to the steering wheel, hand brake, and pedals, the Golf Cart also has a key switch and a 3-way direction switch (Forward / Neutral / Reverse). The current state of each interface element can be read on the following ROS topics, which broadcast at 1 Hz:

 /golf_cart/brake_pedal/state /golf_cart/direction/state /golf_cart/gas_pedal/state /golf_cart/hand_brake/state /golf_cart/hand_wheel/state /golf_cart/key/state

These topics can be viewed from the command line using, for example:

rostopic echo /golf_cart/brake_pedal/state

The brake_pedal, gas_pedal, and hand_brake topics send a Float64 value scaled from 0 (disengaged) to 1 (fully engaged). The Golf Cart defaults to the pedals disengaged and the hand brake engaged. The hand_wheel topic reports the steering wheel angle in radians. Note that the steering wheel has a range of more than [-7 rad, 7 rad].

The direction state and key state topics send an Int8 value. The direction state reports "1" for Forward, "0" for Neutral, and "-1" for Reverse. The key state reports "1" for On, "0" for Off, and "-1" for an error caused by turning the key to On when the direction switch is not in Neutral. Putting the direction switch back to neutral will restore the key state to "1". The key switch defaults to "On" and the direction to "Forward", but this may not be the case in future versions of the software or in the competition.


 * 1) Control the Golf Cart with open-loop commands ##

Start by sending a command to turn the steering wheel to the left:

rostopic pub --once /golf_cart/hand_wheel/cmd std_msgs/Float64 '{ data : 3.14 }'

Look at the front wheels to see a change.

Turn back to the right:

rostopic pub --once /golf_cart/hand_wheel/cmd std_msgs/Float64 '{ data : -3.14 }'

Press the gas pedal:

rostopic pub --once /golf_cart/gas_pedal/cmd std_msgs/Float64 '{ data : 1 }'

but the vehicle's not moving! The hand brake is engaged by default. Let's disengage it:

rostopic pub --once /golf_cart/hand_brake/cmd std_msgs/Float64 '{ data : 0 }'

The vehicle will start driving in circles. Send the following command to turn the engine off:

rostopic pub --once /golf_cart/key/cmd std_msgs/Int8 '{ data : 0 }'


 * 1) Next ##

Next: Using the VRC plugin with the Golf Cart and Atlas