The goal of this lab is to use numpy
to improve our Turtlebot’s
ability to wander without hitting obstacles.
Bringup the Turtlebot and rviz according to the instructions from this previous lab.
Then download and execute smart_wander.py
. For
now, just run this as a Python script:
python smart_wander.py
Click the “Add” button in the lower-left corner of the Rviz window to add a visualization for detected obstacles. If you select the “by topic” tab you should see an option for “obstacles -> MarkerArray”. Once you select that option, you should see a line of green spheres.
You may also want to run the following node, which will stop the Turtlebot whenever no other node is publishing movement commands: safe_cmd_vel.py.
Open smart_wander.py
and make sure you understand the provided code.
Your goal is to update the timer_callback
method so that it
satisfies the following requirements:
numpy
operations and
there must be no loops in your code.Hints and Suggestions:
self.scan.ranges
to a numpy array.arange
function will be useful for creating
this.Once you are happy with the behavior of your node, turn it into a ROS
2 package named smart_wander
and submit through GitHub classroom.