The goals for this section:
Task 1.1 — Cleanup. Remove directory ~/autonomy_ws
if it exists. This may be leftover from a previous section.
Task 1.2 — Directories. Create the base directory structure for your group’s ROS workspace, ~/autonomy_ws/src
.
Task 1.3 — Clone and Branch. Clone your group’s GitHub repo to the src/
directory, and create a new branch called section6
.
Task 1.4 — Build. Navigate back to the root of your workspace, ~/autonomy_ws/
, and build it using colcon build --symlink-install
.
For this section, we want to implement a controller named PerceptionController
. This makes the robot move in a circular motion continuously, stopping for 5 seconds when a stop command is sent, and then resuming movement.
Task 2.1 - Create a file named perception_controller.py
in autonomy_repo/scripts
. Set the shebang at the top of the file, and import:
rclpy
library.BaseController
class from asl_tb3_lib.control
.TurtleBotControl
message from asl_tb3_msgs.msg
.Task 2.2 - Create a class named PerceptionController
that inherits from BaseController
. In the __init__
method of the class:
__init__
method of the parent class (BaseController
) and set the node name to perception_controller
.active
with a default value of True
.Task 2.3 - Using the @property
decorator, define the active
property of type bool
. This property should retrieve the current value of the active
parameter in real-time.