This is a template control package for sas_robot_driver_ur.
- ROS 2 Jazzy
- DQ Robotics CPP (Development branch)
sudo add-apt-repository ppa:dqrobotics-dev/development
sudo apt-get update
sudo apt-get install libdqrobotics libdqrobotics-interface-json11 libdqrobotics-interface-coppeliasim libdqrobotics-interface-coppeliasim-zmq
- DQ Robotics Python (pre-release)
python3 -m pip install dqrobotics --pre
None
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone --recurse-submodules -b jazzy https://github.com/SmartArmStack/smart_arm_stack_ROS2.git sas
cd ~/ros2_ws
colcon build
source install/setup.bash
Supposing that you created a repository called https://github.com/YOUR_USER/sas_ur_control_template.git based on this template, do
mkdir -p ~/ros2_ws/src
cd ~/ros2_ws/src
git clone git@github.com:YOUR_USER/sas_ur_control_template.git
❗ This repository is a ROS2 package. If you change the name of the folder, you must remember to change the name on the package.xml and CMakeLists.txt otherwise colcon might misbehave.
This package is intended to expose joint positions of the robot to ROS2. It is based on the sas_robot_driver server--client topology.
Each robot node will create a server with ROS2 topics. That is completely managed by sas_robot_driver.
You must use a launch file to create your own servers, if needed. For guidance, use launch/real_robot_launch.py and modify as needed.
For most users, you will only need to modify the ip address to match the ip address of your robot.
If you have multiple robots, remember to change each one to have a unique name.
After your server is running, you can obtain current joint positions and send joint position commands. All those are managed through ROS2 topics.
❗ sas_robot_driver handles all ROS2 publishers and subscribers for you. DO NOT CREATE THEM MANUALLY. In, C++ and Python with the RobotDriverClient class.
An example on how to do that using rclpy is available at
scripts/joint_interface_example.py
When using CoppeliaSim, you will notice that we're not interfacing directly with the robot node. You can see that from the name
and the launch file that runs a sas_robot_driver_ros_composer_node
The composer node has two main roles. First, it allows us to abstract many different devices into a single serial robot. This is important for complex systems. It also allows us to reflect robot state in CoppeliaSim, as a virtual twin.
These are specified in the following parameters in the launch file and most parameters are probably self-evident.
Please note that this means that CoppeliaSim can be executed in any computer accessible with the ip address and port specified. It can be a completely separate computer, for instance, running Windows or macOS.
ur3e_jointspace_sim.mp4
For using the real robot, you must have the risk assessments in place. This guide is meant to be helpful but holds absolutely no liability whatsoever. More details are available in the software license.
This code will move the robot. Be sure that the workspace is free and safe for operation.
- Be sure that the teaching pendant is in
Remove Controlmode. - Split the terminator into four screens. Now, the order matters.
a |
b |
|---|---|
c |
d |
- In
a, run the CoppeliaSim scenescenes/UR3_470rev4.tttand start the simulation. - In
b, runros2 launch sas_robot_driver_ur real_robot_launch.py- The emergency button must be held at all times.
- After some seconds of initialization, the robot will be active.
- In
c, runros2 launch sas_robot_driver_ur composed_with_coppeliasim_launch.py. This will connect the CoppeliaSim scene with the ros2 code. - In
d, runros2 run sas_robot_driver_ur joint_interface_example.py. The robot will move in a sine wave in joint space, with respect to its initial joint values.