Linebot Bringup
The linebot package is the main entry point for the robot's operation. It manages the launch of hardware interfaces, controllers, sensor drivers, and high-level logic nodes.
Launch Files
robot.launch.py
This is the primary launch file for the physical robot. It orchestrates the entire system startup.
Command:
ros2 launch linebot robot.launch.py [arguments]
Arguments:
mode(string, default:camera): Determines which sensors and logic nodes to launch.camera: Launches the camera driver and thelinefollower_cvnode.ir: Launches thelinefollower_irnode.hybrid: Launches both.
use_ros2_control(bool, default:true): Enables theros2_controlframework for hardware abstraction.rviz(bool, default:false): Iftrue, launches RViz2 with a pre-configured view for hardware debugging.use_sim_time(bool, default:false): Should befalsefor physical hardware.
Nodes Launched:
robot_state_publisher: Publishes the URDF model and TF transforms.ros2_control_node: Manages the hardware interface (diffdrive_arduino) and controllers.- Controllers:
diff_drive_controller: Handles differential drive kinematics.joint_state_broadcaster: Publishes joint states.
twist_mux: Multiplexes velocity commands from different sources (e.g., navigation, teleop, joyful).twist_stamper: ConvertsTwistmessages toTwistStampedfor compatibility.- Sensor Nodes:
- Camera: Launches
camera.launch.py(if mode iscameraorhybrid). - Logic: Launches
linefollower_cvorlinefollower_irbased on the mode.
- Camera: Launches
sim.launch.py
Launches the robot in the Gazebo Sim environment.
Command:
ros2 launch linebot sim.launch.py [arguments]
Arguments:
world(string): Path to the SDF world file. Default:linefollow.sdf.use_sim_time(bool): Default:true.
Hardware Interface
The system uses ros2_control with a custom hardware interface provided by the diffdrive_arduino package. This interface communicates with the microcontroller (ESP32/Arduino) to read encoders/sensors and write motor commands.
- Config:
src/linebot/config/controller.yaml - URDF:
src/linebot/description/robot.urdf.xacro