Introduction

In the previous activity you modified an existing Python node in order improve its functionality. Today's goal is to practice working with publishers and subscribers by developing a new Python node from scratch.

Your wander.py node does a beautiful job of wandering aimlessly while avoiding obstacles. Unfortunately, OSHA regulations require that any robot that backs-up "blindly", without the benefit of bumpers or proximity sensors, must emit an appropriate auditory warning.

We could add this functionality by modifying the original wander.py node, but that approach isn't very modular. As much as possible, each ROS node should handle a single well-defined task. As an alternative, we will develop a new announce node that handles the problem of providing back-up warnings. This new node could potentially be re-used for any application that requires this functionality.

Node Specifications

Your new node will monitor the Twist messages that are controlling the motion of the robot. Whenever the robot moves backwards, your node will use the text-to-speech functionality of the ROS sound_play package to generate the verbal warning: "BACKING UP!".

Section 6 of the sound_play documentation describes the sound_play node. You will need to start this node using rosrun. That page also contains detailed specifications for the sound_play/SoundRequest message type. Your code should instantiate and configure an appropriate SoundRequest message without using the provided Python bindings. (In other words, ignore the sentence in the documentation that says "Programmers should use the C++/Python bindings to send messages to robotsound, rather than creating messages themselves.")

Detailed requirements:

Once you have completed your node, test it in Gazebo to confirm that it works as expected. Make sure that you have started the sound_play node, and that the volume on your computer is turned up.

If you have extra time

If you have extra time, make some improvements to the existing wander functionality.

Possibilities include:

Submitting

Submit your completed announce.py file through Canvas.