-
Notifications
You must be signed in to change notification settings - Fork 196
vrx_classic_acoustic_pinger_tutorial
Some of the RobotX Challenge tasks make use of an underwater acoustic beacon. As an example, the RobotX "Entrance and Exit Gates" task, requires teams to detect an active beacon and transit through the gate in which the beacon is located.
The VRX WAM-V is equipped with a sensor that detects the underwater acoustic beacon. The sensor periodically publishes data to the ROS topic /wamv/sensors/pingers/pinger/range_bearing
using the RangeBearing message definition.
You can use rostopic echo
command to read the output of this sensor as follows:
- Launch the VRX 2019 simulation environment:
roslaunch vrx_2019 vrx.launch
- Show the data published by the acoustic sensor:
rostopic echo /wamv/sensors/pingers/pinger/range_bearing
You should see a stream of messages similar to this one:
header:
seq: 30
stamp:
secs: 31
nsecs: 56000000
frame_id: "wamv/pinger"
range: 189.372650146
bearing: 0.219589501619
elevation: -0.0155547577888
---
Notes:
- The sensor gives you a value in spherical coordinates: a distance (range) and two angles (bearing and elevation).
- The value that you'll get from the sensor includes some noise.
For convenience, we have included a pinger.launch
file that places the acoustic beacon under one of the entrance gates. This launch file also publishes RViz markers in the location where the beacon is detected. To use this file, open a new terminal and run:
roslaunch vrx_2019 pinger.launch
Now, let's start RViz. Open a new terminal and run:
roslaunch wamv_gazebo rviz_vrx.launch
to start RViz. In Rviz window, click the Add
button, select the By topic
tab, and select /wamv/sensors/pingers/pinger/marker/signal/Marker
, and then, hit OK.
Now, select the WAM-V, hit t
(translate), and drag and drop the WAM-V next to the entrance gate.
You should see a blue arrow in your Rviz display showing the location of the beacon according to your acoustic sensor.
The topic /wamv/sensors/pingers/pinger/set_pinger_position
allows you to change the beacon location. You need to publish a Vector3 message. Here's the message definition.
For example, to change the pinger location to the origin, you would run:
rostopic pub -r 10 /wamv/sensors/pingers/pinger/set_pinger_position geometry_msgs/Vector3 -- 0 0 0
Try this command while watching your Rviz window to see the blue arrow redirect toward the new location. Killing the command will cause the sensor location to revert to the position published by the set_pinger_position.py
node (launched by pinger.launch
).