ROS2 Humble + Gazebo + MoveIt2 based UR3e & Robotiq Pick-and-Place simulation project.
This project uses a RealSense D435 depth camera and YOLO segmentation to dynamically adjust robot speed based on the distance between a human and the robot.
- Ubuntu 22.04
- ROS2 Humble
- Gazebo Classic
- MoveIt2
- Python 3
sudo apt install -y \
python3-colcon-common-extensions \
python3-rosdep \
python3-vcstool \
python3-argcomplete \
python3-pipsudo rosdep init
rosdep updatemkdir -p ~/colcon_ws/src
cd ~/colcon_wssudo apt install -y \
ros-humble-gazebo-ros-pkgs \
ros-humble-gazebo-ros2-control \
ros-humble-moveit \
ros-humble-ros2-control \
ros-humble-ros2-controllers \
ros-humble-joint-state-publisher-gui \
ros-humble-xacro \
ros-humble-rviz2 \
ros-humble-tf-transformationscd ~/colcon_ws/src
git clone https://github.com/IRaC-Lab/Robot-Speed-Control-ros2.gitcd ~/colcon_ws/src
git clone -b ros2 https://github.com/tylerjw/serial.git serialcd ~/colcon_ws/src
git clone https://github.com/AndrejOrsula/pymoveit2.gitcd ~/colcon_ws
rosdep install --from-paths src --ignore-src -r -yexport GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/colcon_ws/src/Robot-Speed-Control-ros2/ur_gripper_gazebo/modelsDisable Gazebo online model database:
echo 'export GAZEBO_MODEL_DATABASE_URI=""' >> ~/.bashrc
source ~/.bashrcpip3 install torch==1.13.1 torchvision==0.14.1 ultralytics==8.4.50 numpy==1.26.4pip3 install pandascd ~/colcon_ws
source /opt/ros/humble/setup.bash
colcon build --symlink-installAdd workspace setup to bashrc:
echo "source ~/colcon_ws/install/setup.bash" >> ~/.bashrc
source ~/.bashrcros2 launch ur_gripper_gazebo sim.launch.pyOpen a new terminal:
source ~/colcon_ws/install/setup.bash
ros2 launch ur_robotiq_moveit_config move_group.launch.py use_sim_time:=truepython3 ~/colcon_ws/src/Robot-Speed-Control-ros2/ur_robotiq_moveit_config/scripts/pick_place.pycd ~/colcon_ws/src/Robot-Speed-Control-ros2/yolov5/segment
python3 predict.py --conf 0.7 --imgsz 256conf: detection confidence thresholdimgsz: inference image size
Both values can be adjusted.
cd ~/colcon_ws/src/Robot-Speed-Control-ros2/realsense-ros/realsense2_camera/scriptspython3 align_depth_to_color_ros2.pypython3 depth_distance_seg_ros2.py- UR3e + Robotiq Gripper Pick-and-Place
- Gazebo Simulation
- RealSense D435 Depth Camera
- YOLO Segmentation
- Human-Robot Distance Monitoring