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.
- 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.
-
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
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_base_node: filter to estimate the odometry
Unfortunately no tutorial from WaveShare.
-
ugv_bringup: drive, control with two-wheel differential kinematics
A tutorial is available from Waveshare: Tutorial 3: Use Joystick or Keyboard Control
-
ugv_chat_ai: web ai interaction
A tutorial is available from Waveshare: Tutorial 8: Web Natural Language Interaction
-
ugv_description: Kinematic Model
A tutorial is available from Waveshare: Tutorial 2: RViz View Product Model
-
ugv_gazebo: simulation
A tutorial is available from Waveshare: Tutorial 11: Gazebo Simulation Debugging
-
ugv_interface: Information interface
A tutorial is available from Waveshare: Tutorial 10: Command Interaction
-
ugv_nav navigation: Nav2 toolbox
A tutorial is available from Waveshare: Tutorial 6: Auto Navigation
-
ugv_slam: Simultaneous Localization and Mapping
This module is described in three tutorials from Waveshare:
-
ugv_tools: Joystick tool
This module is used in Waveshare's Tutorial 3: Use Joystick or Keyboard Control
-
ugv_vision: visual interaction
Actually, this module is already used in Tutorial 4: 2D Mapping based on LiDAR
-
ugv_web_app: web-based control tool
A tutorial is available from Waveshare: Tutorial 9: Web-based control tool
-
apriltag_ros: ROS2 wrapper for apriltag detection
dependence from ugv_vision
-
[cartographer][https://github.com/IntelligentRoboticsLab/ugv_ws/tree/ros2-humble-develop/src/ugv_else/cartographer]: real-time simultaneous localization, see [ROS Humble documentation][https://docs.ros.org/en/humble/p/cartographer/]
dependence from ugv_slam
-
costmap_converter: converts occupied costmap2d cells to primitive types.
dependence from ugv_nav navigation
-
emcl_ros2: Monte Carlo localization
dependence from ugv_slam
-
dependence from ugv_nav navigation
-
gmapping: ROS2 wrapper for OpenSlam's Gmapping.
dependence from ugv_slam
-
ldlidar: drivers for LiDAR products sold by Shenzhen LDROBOT Co.
dependence from ugv_bringup
-
rf2o_laser_odometry: estimate the planar motion from lidar measurements
dependence from ugv_bringup
-
robot_pose_publisher: ROS2 wrapper which publishes the transform between the /base_link frame and the /map frame as a pose message
dependence from ugv_nav navigation
-
teb_local_planner: optimizes the robot's trajectory after planning
dependence from ugv_nav navigation
-
vizanti: web-based visualization and control tool for outdoor robots
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
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
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.
