Skip to content

IntelligentRoboticsLab/ugv_ws

 
 

Repository files navigation

ugv_ws

Workspace to use ROS2 Humble with Waveshare's UGV Rover

This is a fork from https://github.com/waveshareteam/ugv_ws.git, created for the course 'Vision for Autonomous Robots' at the University of Amsterdam.

In the original code of Waveshare, there is explicit reference to the home-directory '/home/ws', while on the UGV itself the home-directory can be found at '/home/jetson'. At your own machine, you will have own configuration.

Note that the situation is different once you have started the docker image (at the UGV or at your laptop). Note that most of the Waveshare documentation assumes that you are inside the docker image. The Intelligent Robotics Lab also reversed engineered a version of the docker image, also available on github.

1. Environment

  • pc software:Ubuntu 22.04, ROS2 Humble
  • ugv Version:UGV Rover

The workspace should also work for the UGV Beast, although this is not tested.

2. Installation

  • The history of the this workspace can be summarized:https://github.com/DUDULRX/ugv_ws/tree/ros2-humble -> https://github.com/waveshareteam/ugv_ws.git -> https://github.com/IntelligentRoboticsLab/ugv_ws.git

  • Start with creating a clone of this repository:

    cd 
    git clone -b ros2-humble-develop https://github.com/IntelligentRoboticsLab/ugv_ws.git
  • Before your first compilation, you should first install a number of dependencies

    cd ~/ugv_ws
    source install_additional_ros_humble_packages.sh
  • install_additional_ros_humble_packages.sh content:

    sudo apt-get install ros-humble-nav2-msgs ros-humble-map-msgs
    sudo apt-get install ros-humble-nav2-costmap-2d
    sudo apt-get install ros-humble-rosbridge-suite
    sudo apt-get install ros-humble-nav2-bringup
    sudo apt-get install ros-humble-usb-cam ros-humble-depthai-*
    sudo apt-get install ros-humble-joint-state-publisher-*
    sudo apt-get install ros-humble-robot-localization
    sudo apt-get install ros-humble-imu-tools
    sudo apt-get install ros-humble-cartographer-ros
    sudo apt-get install ros-humble-apriltag ros-humble-apriltag-msgs ros-humble-apriltag-ros
    sudo apt-get install ros-humble-ros-gz
       ```
  • First compilation (it starts cleans the workspace, so you start from scratch. It also defines a number of environment variables, which is needed only once):

    cd ~/ugv_ws
    . build_first.sh
  • build_first.sh content:

    cd ~/ugv_ws/
    colcon clean workspace
    colcon build --cmake-args -Wno-dev --packages-select cartographer costmap_converter_msgs explore_lite --executor sequential 
    colcon build --cmake-args -Wno-dev --packages-select openslam_gmapping slam_gmapping --executor sequential
    colcon build --cmake-args -Wno-dev --packages-select ldlidar rf2o_laser_odometry robot_pose_publisher teb_msgs --executor sequential  
    colcon build --cmake-args -Wno-dev --packages-select ugv_base_node ugv_interface ugv_bringup ugv_chat_ai ugv_description ugv_gazebo ugv_nav ugv_slam ugv_tools ugv_vision ugv_web_app --executor sequential
    chmod +x ~/ugv_ws/src/ugv_else/vizanti/vizanti_server/scripts/*.py
    colcon build --cmake-args -Wno-dev --packages-select vizanti vizanti_cpp vizanti_demos vizanti_msgs vizanti_server --executor sequential
          
    # echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc ## already done in install_additional_ros_humble_packages.sh
    # echo ""export ROS_DOMAIN_ID=42" >> ~/.bashrc # change ROS_DOMAIN_ID to your group-number
    echo "source ~/ugv_ws/install/setup.bash" >> ~/.bashrc
    echo "export UGV_MODEL=ugv_rover" >> ~/.bashrc
    echo "export LDLIDAR_MODEL=ld19" >> ~/.bashrc
    source ~/.bashrc 
  • Daily compilation after first build:

    cd ~/ugv_ws
    . build_common.sh
  • build_common.sh content

    cd ~/ugv_ws
    colcon build --cmake-args -Wno-dev --packages-select cartographer costmap_converter_msgs explore_lite --executor sequential
    colcon build --cmake-args -Wno-dev --packages-select openslam_gmapping slam_gmapping --executor sequential
    colcon build --cmake-args -Wno-dev --packages-select ldlidar rf2o_laser_odometry robot_pose_publisher teb_msgs  --executor sequential  
    colcon build --cmake-args -Wno-dev --packages-select ugv_base_node ugv_interface ugv_bringup ugv_chat_ai ugv_description ugv_gazebo ugv_nav ugv_slam ugv_tools ugv_vision ugv_web_app --executor sequential 
    colcon build --cmake-args -Wno-dev --packages-select vizanti vizanti_cpp vizanti_demos vizanti_msgs vizanti_server --executor sequential  
    source install/setup.bash 
          ```
  • Compile apriltag

    cd ~/ugv_ws
    . build_apriltag.sh
  • build_apriltag.sh content

    sudo apt install libopencv-dev=4.5.4+dfsg-9ubuntu4 -y
    cd ~/ugv_ws
    colcon build --cmake-args -Wno-dev --packages-select apriltag apriltag_msgs apriltag_ros --executor sequential
  • Python3 Library:

    cd ~/ugv_ws/
    python3 -m pip install -r requirements.txt
    echo "export PATH=$PATH:$HOME/.local/bin" >> ~/.bashrc
  • requirements.txt content

    pyserial
    flask
    mediapipe
    requests
    pygame

Modules inside the workspace

This are the alphabetic-list of the modules in the ugv_ws, which is not the logical build-up as given in Waveshare documentation.

ugv_main: Main functions

ugv_else ( ugv_main dependencies)

3. Usage

The ugv-packages have several parameters, including the hardware configuration, specified as environment variable:

  • car model optional rasp_rover, ugv_rover, ugv_beast

  • lidar model optional ld06, ld19 (default), stl27l

You have also parameters given as ros-argument, such as:

  • use_rviz optional true, false (default)

Graphical tools like rviz only work when you have a display. So, run those tools on your laptop, and the drivers on the UGV Rover

View model joints

See also Tutorial 2: RViz View Product Model

  • Specify your UGV-model

       export UGV_MODEL=ugv_rover
  • start up on (executed on your laptop)

    ros2 launch ugv_description display.launch.py use_rviz:=true

    image.png

Drive the car

See also Tutorial 3: Use Joystick or Keyboard Control

  • Start the car (executed at the UGV Rover)

    ros2 run ugv_bringup ugv_driver
  • Make sure that your UGV Rover is on the ground. Alternatively lift the wheels from the table by placing the base on a small box.

    ros2 topic pub --once /cmd_vel geometry_msgs/msg/Twist "{linear : {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}"  

    Control the light data 0-255 data[0] control the light IO4 near the oak camera data[1] control the light IO5 near the usb camera

      ```jsx
      ros2 topic pub /ugv/led_ctrl std_msgs/msg/Float32MultiArray "{data: [0, 0]}" -1
      ```
    
  • Start LiDAR (executed at the UGV Rover)

    export LDLIDAR_MODEL=LD19
    ros2 launch ugv_bringup bringup_lidar.launch.py use_rviz:=false
  • Joystick, keyboard control

    • Joystick control (can be executed at the UGV Rover or your own laptop, as long as you are in the same ROS_DOMAIN_ID)

      ros2 launch ugv_tools teleop_twist_joy.launch.py
    • keyboard control

      ros2 run ugv_tools keyboard_ctrl

The other functionalities are explained in the documention of the each of the ugv packages and the Waveshare documentation.

About

ROS workspace for Waveshare's UGV Rover

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 66.1%
  • C++ 22.8%
  • Python 5.6%
  • JavaScript 3.4%
  • CMake 0.9%
  • HTML 0.8%
  • Other 0.4%