# Roomba Robot **Repository Path**: liucl14/roomba-robot ## Basic Information - **Project Name**: Roomba Robot - **Description**: 基于ROS2的扫地机器人代码 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2025-03-22 - **Last Updated**: 2025-03-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Roomba Robot Control with ROS2 and AprilTag Detection This repository contains code for controlling a Roomba robot using ROS2, with AprilTag-based pose detection. ## Prerequisites - ROS2 installed - ADB tools installed - USB cable for initial robot connection - Python3 - OpenCV ## Initial Setup ### 1. Robot Connection 1. Connect the robot to your computer using a USB cable 2. Set up ADB connection: ```bash adb devices # Verify robot is detected ``` ### 2. WiFi Configuration 1. Use ADB to configure wireless network: ```bash adb shell # Inside robot shell vim /data/misc/wifi/wpa_supplicant.conf # Modify ssid and psk adb reboot ``` Get robot IP: ```bash adb shell ifconfig # get robot ip ``` 2. After WiFi setup, you can disconnect USB and use wireless connection: ```bash ssh root@ROBOT_IP ``` ## Repository Setup 1. Clone the repository: ```bash git clone [repository-url] cd roomba-robot ``` 2. Source ROS2 environment: ```bash source /opt/ros/foxy/setup.bash ``` 3. Build the packages: ```bash colcon build ``` 4. Source the built packages: ```bash source install/setup.bash ``` ## Running the System You'll need to open multiple terminals for different components. Make sure to source the ROS2 environment and built packages in each terminal. ### 1. Camera Node ```bash ros2 launch rb5_ros2_vision rb_camera_main_ocv_launch.py ``` ### 1.1. Camera Calibration (Depending on your robot) You need a 6*8 chessboard pattern for calibration. Use commands below to take photos from the camera: ```bash ros2 run image_view image_view --ros-args -r image:=/camera_0 ``` Then run the calibration script: ```bash python3 camera_calibration.py ``` ### 2. AprilTag Detection In a new terminal: ```bash ros2 run ros2_april_detection april_detection_node ``` ### 3. Pose Listener In a new terminal: ```bash python3 hw2_apriltag_listener.py ``` ### 4. Robot Controller In a new terminal, run one of the available controllers depending on your task: ```bash python3 my_controller.py # OR python3 hw2_controller.py # OR python3 hw3_controller.py # OR python3 hw4_controller.py # OR python3 hw5_controller.py ``` ## Available Controllers - `my_controller.py`: Basic control without AprilTag detection - `hw2_controller.py`: Basic waypoint navigation using AprilTag detection for pose estimation - `hw3_controller.py`: SLAM (Simultaneous Localization and Mapping) with square and octagon trajectory following - `hw4_controller.py`: Path planning with obstacle avoidance using A* algorithm - `hw5_controller.py`: Roomba-style coverage path planning for systematic area coverage ## File Structure - `rb5_ros2_vision/`: Camera and vision-related ROS2 package - `ros2_april_detection/`: AprilTag detection implementation - `key_joy/`: Keyboard control implementation - Various controller implementations and utility scripts ## Notes - Ensure all ROS2 dependencies are properly installed - Check camera calibration if pose detection seems inaccurate - Make sure the robot has sufficient battery charge before running experiments - Check reports for more details on each controller's behavior ## Demo Video - 路点导航:https://www.youtube.com/watch?v=k59tYfPH4DA - AprilTag视觉定位:https://www.youtube.com/watch?v=D_ynTF-hmls - SLAM:https://youtu.be/bPvDySvIiso?si=s3HNhfpOFbcvSt01 - A*最短路径规划:https://www.youtube.com/watch?v=WAUbtLeenn4 - Voronoi最安全路径规划:https://www.youtube.com/watch?v=1h9yBezolrM - 覆盖路径规划:https://www.youtube.com/watch?v=D1YIhZf8ZzU