Search
Your task is to create a simple reactive behavior for the Turtlebot robot in a simulator. The robot should move in the environment without colliding with obstacles. The onboard laser scanner should be used to detect obstacles in the surroundings of the robot and based on the obstacle proximity one of the following actions should be performed:
The motion of the robot has to be started after an activation service is called. Then, the robot has only 50 s for a movement (including requested stop for 10 s). Within the specified time limit the robot should visit a location at least 1.5 m away from the start, travel at least 8 meters in total, stop its motion and call a service requesting evaluation of the mission. During the mission, the robot also has to respond to the call of deactivation service by stopping its motion. More detailed instructions are provided in task description below. An example of the expected behavior can be seen here:
Responsible lecturer: Vít Krátký (kratkvit@fel.cvut.cz)
reactive_controller.py
aro_reactive_control
/reactive_control/activate
data == True
data == False
/cmd_vel
/reactive_control/evaluate_mission
The Turtlebot robot is a robot of type differential drive, which has two control inputs forward velocity and angular velocity. In the ROS implementation, these control inputs are set by publishing message of type geometry_msgs/msg/TwistStamped on topic /cmd_vel where the control inputs are represented by field linear.x for forward velocity (m/s, negative for reverse) and angular.z for angular velocity (rad/s, positive/negative to rotate in counter clockwise (CCW)/clockwise (CW) direction).
linear.x
angular.z
Desired reactive behavior can be achieved by constantly checking the robot's laser scanner output to see if there are obstacles in front of the robot and adapt the control inputs (velocities) so that the robot is moving through the environment while avoiding collisions. For example, you can check the minimum distance in the measurements taken at an angle between -30° and 30° (similarly to the first homework) to determine whether there is a potential collision in direction of robot movement. If not, the robot can move ahead at full speed safely. If the robot is getting closer to an obstacle (first distance limit), it should decrease its forward velocity and start turning away from the obstacle. The direction of the rotation can be determined, e.g., by comparing the minimum distance from the left half of the scan (between -30° and 0°) and the right half of the scan (between 0° and 30°). If the robot comes even closer (second distance limit), it should stop the forward movement completely and only turn. Once there are no obstacles in front of it, it should start moving forward again.
You can run your solution including RViz visualization by running
ros2 launch aro_reactive_control hw02_sim.launch.xml
ros2 launch aro_reactive_control hw02_sim.launch.xml run_controller:=false
ros2 run aro_reactive_control reactive_controller
Local evaluation of your solution can be run using
ros2 launch aro_reactive_control hw02_eval.launch.xml
Run script aro_exploration/homeworks/create_hw02_package.sh to create an archive containing your implementation (reactive_controller.py) and upload it to upload system. The script reactive_controller.py must be “runnable” from the provided launch file hw02_eval.launch.xml. 5 points will be awarded for a valid submission fulfilling all requirements described in Assignment section.
aro_exploration/homeworks/create_hw02_package.sh
hw02_eval.launch.xml