This workspace contains the source code of a ROS 2 workspace that allows the Syncro 5 Cobot developed by Addverb to be controlled by an LLM to perform basic tasks in a Gazebo simulation environment. Several modifications were made to Addverb's existing configuration files, and several new ones were created, to allow the cobot to be successfully simulated. This included, amongst other changes:
- Changes to the joint limit convention used in the URDF
- Adding Gazebo camera plugins
- Replacing Addverb's hardware interfaces with Gazebo-ROS2 standards
- Modifying the state and command interfaces
- MoveIt Servo setup and configuration
The full documentation of additions can be viewed at the bottom of this readme.
The python scripts for pick-and-place logic are located in the moveit_pytest package.
The prompt used below was "pick up the red cube to your right".
cobot_demo.2.mp4
The cobot can currently interact with four objects in the scene:
- blue cube
- red cube
- green cube
- yellow cube
As the cobot operates solely based on a camera attached to the end-effector, the target may not be immediately visible in all cases. Hence, the LLM prompt must also include the approximate direction in which the object is to be searched for. The cobot can be prompted to search forward, backward, left or right.
Clone this repository into a brand new workspace folder.
git clone https://github.com/keshavln/CobotLLMControl.git .
Install the requirements.
pip install -r src/cobot_ros2/cobot_ros2/requirements.txt
Build the ROS 2 workspace.
colcon build --executor sequential
Source the workspace.
source install/setup.bash
Execute the launch file.
ros2 launch addverb_cobot_description gazebo.launch.py
addverb_cobot_control/config/payload_config.yaml- Change:
gripper_typeupdated from1.0to5.0.
- Change:
addverb_cobot_control/launch/cobot_control.launch.py- Change: Added timeout parameters to
joint_state_broadcasterspawner to prevent timeouts during simulation startup. - Change: Commented out the original
gripper_controller_spawner.
- Change: Added timeout parameters to
addverb_cobot_description/ros2_control/heal.ros2_control.xacro- Change: Replaced
addverb_cobot/CobotHWInterfacewithgz_ros2_control/GazeboSimSystemto connectros2_controlto Gazebo instead of real hardware.
- Change: Replaced
addverb_cobot_description/urdf/heal.urdf.xacro- Gazebo Integration: Included
cobot_gazebo.xacroandnewcontrol.xacro. - Physics Properties: Added
inertialproperties tobase_link(required for simulation). Added Friction (mu1,mu2) and contact coefficients (kp,kd) for gripper fingers. - Joint Limits: Increased
joint2upper limit from0.725to0.8757. - Gripper Mimicry: Added "dummy" links and fixed joints (
mimic_dummy_link_*) to handle Gazebo's behavior with mimic joints, ensuring the gripper moves correctly in simulation. - Camera Integration: Added
camera_link,camera_opticallink, and a Gazebo camera sensor plugin publishing to/image_raw. - Detachable Joints: Added
ignition-gazebo-detachable-joint-systemplugins to allow the gripper to grasp objects.
- Gazebo Integration: Included
addverb_moveit_configs/syncro_5_moveit_config/config/joint_limits.yaml- Change: Reset velocity and acceleration scaling factors from
0.1(safety mode) to1.0(full speed) for simulation.
- Change: Reset velocity and acceleration scaling factors from
addverb_moveit_configs/syncro_5_moveit_config/config/moveit_controllers.yaml- Change: Switched controller from
ptp_joint_controllertoarm_controller. Added trajectory execution parameters (tolerances, scaling).
- Change: Switched controller from
addverb_moveit_configs/syncro_5_moveit_config/config/robot.ros2_control.xacro- Change: Switched hardware plugin to
gz_ros2_control/GazeboSimSystem.
- Change: Switched hardware plugin to
addverb_moveit_configs/syncro_5_moveit_config/config/robot.srdf- Change: Disabled collisions between various gripper parts and the arm (e.g.,
robotiq_85_base_linkvs knuckles) to prevent self-collision errors in simulation. - Change: Updated
end_effectorparent link.
- Change: Disabled collisions between various gripper parts and the arm (e.g.,
addverb_moveit_configs/syncro_5_moveit_config/config/robot.urdf.xacro- Change: Commented out the inclusion of
robot.ros2_control.xacroto avoid conflicts with the main description's control file.
- Change: Commented out the inclusion of
addverb_moveit_configs/syncro_5_moveit_config/config/ros2_controllers.yaml- Change: Redefined controllers.
arm_controller:JointTrajectoryControllerfor the arm (joints 1-6).gripper_controller:GripperActionControllerfor thefinger_joint.- Added parameters for open-loop control and trajectory integration.
- Change: Redefined controllers.
moveit_pytest/package.xml- Change: Added dependencies for computer vision and AI:
pynput,cv2,torch,groq,ultralytics,cv_bridge.
- Change: Added dependencies for computer vision and AI:
moveit_pytest/setup.py- Change: Registered new console scripts (entry points) for nodes like
cobotdetection,grippercontrol,cobotkeyboard, etc.
- Change: Registered new console scripts (entry points) for nodes like
addverb_cobot_description/launch/gazebo.launch.py:- Function: Main launch file for the simulation.
- Details: Launches Gazebo (
ros_gz_sim), spawns the robot, startsros_gz_bridge(for connecting Gazebo topics to ROS 2), launches MoveIt servo, and starts custom nodes (cobotkeyboard,detection).
addverb_cobot_description/launch/blueworld*.sdf&multiple.sdf:- Function: Gazebo world files (SDF format) containing the environment setup, likely testing different scenarios with cubes/tables.
addverb_cobot_control/config/sim_config.yaml:- Function: Configuration for the
ros2_controlcontroller manager in simulation.
- Function: Configuration for the
addverb_cobot_description/ros2_control/newcontrol.xacro:- Function: Defines the
ros2_controlhardware interface specifically for Gazebo, setting up position command/state interfaces for all arm and gripper joints.
- Function: Defines the
addverb_cobot_description/urdf/cobot_gazebo.xacro:- Function: Adds necessary Gazebo plugins (
gz_ros2_control-system,ignition-gazebo-sensors-system) to the robot description.
- Function: Adds necessary Gazebo plugins (
moveit_pytest/moveit_pytest/cobotdetection*.py(Original, 2, 3):- Function: Python nodes for object detection.
- Details: Uses YOLO (via
ultralytics) to detect objects in the camera feed (/image_raw). Integrates with Groq API for interpreting user intent (e.g., "detect a blue cube").
moveit_pytest/moveit_pytest/cobotkeyboard.py:- Function: Node for teleoperating the robot or triggering actions using keyboard input.
moveit_pytest/moveit_pytest/grippercontrol.py:- Function: Node to control the gripper.
This project may be extended in the future to allow the cobot to generalize to more tasks using MCP tools.