Usage - Bigfire3/waymo GitHub Wiki

Prerequisites / Installation

  1. ROS2 Humble: Ensure ROS2 Humble is installed.

  2. Colcon: Install the build tool Colcon.

    sudo apt update
    sudo apt install python3-colcon-common-extensions
    
  3. Python Dependencies: OpenCV, cv_bridge, NumPy, SciPy.

    • Install via ROS packages if possible:

      sudo apt update
      sudo apt install ros-humble-cv-bridge python3-opencv python3-scipy python3-numpy
      
    • Alternatively, use conda within your environment (e.g. on macOS): `

      conda install numpy scipy opencv-python
      

Workspace Setup

  1. Create a ROS2 workspace (if not already done):

    mkdir -p ~/ros2_ws/src
    cd ~/ros2_ws/src
    
  2. Clone the waymo package from GitHub into your src folder:

    • with ssh:

      git clone [email protected]:Bigfire3/waymo.git
      
    • with https:

      git clone https://github.com/Bigfire3/waymo.git
      
  3. Build the package:

    cd ~/ros2_ws
    colcon build --packages-select waymo
    
  4. Source the workspace:

    source ~/ros2_ws/install/setup.bash
    

    Add this command to your .bashrc (or .zshrc) to avoid running it manually every time.


Running the Package

The package includes several scripts that automate the build process and launch of waymo. There is a script for bash, zsh and conda environment.

Here are the commands for bash:

```bash
cd ~/ros2_ws/src/waymo
chmod +x run_waymo.bash
./run_waymo.bash
```

(Paths in the script might need adjustment, e.g., the path to the workspace cd ~/ros2_ws and the source commands)

The nodes also can be easily started together using the provided launch file:

  1. Source the workspace (if not already done):

    source ~/ros2_ws/install/setup.bash
    
  2. Start the launch file:

    ros2 launch waymo waymo_launch.py
    

    This will start lane_detection_node, obstacle_detection_node, passing_obstacle_node, traffic_light_detection_node, sign_detection_node, parking_node, state_manager_node, and gui_debug_node.

Running the Keyboard Handler Node (Manual Pause & Debug Toggle)

The keyboard_handler_node allows you to manually pause/resume the robot's operation and toggle the debug image canvas.

  • Important: This node must be run in a separate, interactive terminal.

  • In the new terminal, run the following commands:

    cd ~/ros2_ws/src/waymo
    source ~/ros2_ws/install/serup.bash
    chmod +x run_keyboard_handler_node.bash
    ./run_keyboard_handler_node.bash
    

    Alternatively, run it directly (ensure your Conda environment, if used, is active):

    ros2 run waymo keyboard_handler_node
    
  • Ensure the terminal running the node has keyboard focus.

  • Press s to toggle the pause state (MANUAL_PAUSE in state_manager_node).

  • Press d to toggle the debug image canvas visibility in gui_debug_node.

  • Press Ctrl+C in the handler's terminal to stop it cleanly.


Modifying Parameters

Parameters can primarily changed at runtime via the ROS2 rqt_reconfigure tool. Open a new terminal window and source the workspace again:

source ~/ros2_ws/install/setup.bash

Parameters can also be changed at runtime via the ROS2 CLI. Open a new terminal window and source the workspace again:

source ~/ros2_ws/install/setup.bash

Examples:

  • Change the stopping distance for obstacles:

    ros2 param set /obstacle_detection_node distance_to_stop 0.3
    
  • Adjust the thresholding parameter for lane detection:

    ros2 param set /lane_detection_node c_value 25
    
  • Change the base driving speed:

    ros2 param set /state_manager_node drivingspeed 0.1
    
  • Adjust the ROI for lane detection:

    ros2 param set /lane_detection_node roi_top_left_h 0.6
    

Testing Functionality / Monitoring Topics

Open new terminals (and source the workspace) to check the functionality:

  1. Display motion commands (/cmd_vel):

    ros2 topic echo /cmd_vel
    

    Shows the velocity commands sent by state_manager_node.

  2. Display robot state (/robot/state):

    ros2 topic echo /robot/state
    

    Shows the current state (WAYMO_STARTED, STOPPED, FOLLOW_LANE).

  3. Display obstacle status (/obstacle/blocked):

    ros2 topic echo /obstacle/blocked
    

    Shows true or false, depending on whether an obstacle was detected.

  4. Display traffic light status (/traffic_light):

    ros2 topic echo /traffic_light
    

    Shows the boolean status from the color detector (false if specific color detected, true otherwise).

  5. Display lane offset (/lane/center_offset):

    ros2 topic echo /lane/center_offset
    

    Shows the calculated lateral offset from the lane center.

  6. Visualize Node Graph:

    rqt_graph
    

    Shows how the nodes are connected and which topics they use (requires rqt).

  7. Display detected sign messages (/sign):

    ros2 topic echo /sign
    

    Shows string messages when signs (e.g., "parking_sign_detected") are detected by sign_detection_node.

  8. Display parking maneuver status (/parking/finished):

    ros2 topic echo /parking/finished
    

    Shows true when the parking_node has completed (or aborted) the parking maneuver.

  9. Debug Images from sign_detection_node (GUI or rqt_image_view):

    • /debug/cam/template_matching (CompressedImage): Visual output of the template matching process.
    • /debug/cam/binary_sign (CompressedImage): Shows the binarized image used for sign detection.
  10. Debug Images from gui_debug_node (Canvas):

    • The gui_debug_node (toggled via 'd' with keyboard_handler_node) can display various debug image topics, including those from sign detection if configured. Check gui_debug_node.py for the list of subscribed topics.