-
Notifications
You must be signed in to change notification settings - Fork 1
Using the UR5(e)
- Stay out of the safety circle when the robot is powered on and deeeefinitely keep the touchscreen out of the safety circle. The robot is powerful enough to punch you in the face and break some bones.
- Whatever you do, if you control the robot via the touchscreen or you control it via some remote software, the red emergency button always works. Just smack it, and the robot will instantly shut down and stop moving. This does not harm the robot in any way, so feel free to use it whenever. Test the button before starting to program the robot.
- The arm has built-in safety features that halt the arm if it’s going too fast or if it’s pushing against something that has too much resistance (like when you set a goal point below the table, it will hit the table but then stop). However, it can still accelerate quickly and it can quickly smash into something before the safety mechanism comes on. So be sure to use it with low max velocity/low acceleration unless you know exactly what you’re doing.
- The arm is always “stiff”, meaning the breaks in each joint are active by default. Don’t try to move the arm unless you are HOLDING the “freedrive” touchscreen button or the black little nubbin at the back of the touchpad panel (see below). Only then can you move the arm around; otherwise, you damage the brakes.
- The max payload of the robot is 5kg, which is on top of its own mass. Meaning you can pick up and effortlessly move around objects of up to (5kg - weight_of_the_gripper).
For safety and the best use of the hardware, you need to get approved to try your code on the UR5 arm.
- You must show that your policy behaves well in the simulation. This includes sending a video to Glen or Kirsty so we can judge if the policy is acting reasonably enough to try on the hardware.
- You need to show that you understand how to use the safety features on the hardware. How to use the E-Stop, how to set the invisible safety boundaries for the robot, and describe what you have done in your code to avoid breaking the robot.
- You will need to run the policy on the Robo-server simulator that models the real robot the best and uses an interface very similar to the real robot.
- You need to schedule time on the hardware. It is a limited resource; we must share the hardware and not interfere with other people's experiments.
-
Grab the touchscreen, push the on/off button
-
Wait for the boot to finish (can take 1-2 min).
-
After boot, it will tell you the arm needs to be started, click on “Go to initialization screen”
-
The arm overall has 3 states: [Power off/Error/Fault] -> Idle -> Normal. When it’s in the first state, click on “[ON/RESET]” (the name on the button changes depending if it’s a normal shutdown or an error)
-
That’ll take 2-3 seconds and make noises. When it’s “idle”, click on “start”
-
When the arm is fully operational and happy, it should look like this. When done, press “ok” (c ). That will bring you back to the main menu:
(a - status normal, b - payload is anything that’s not the base arm, like an end effector or an object that is gripped by the arm. When we later get the end effector, we have to set this to that weight. And once we pick up an object, we have to change the payload in software to the weight of the object for smooth motion.) 7. In the main menu, click on “run program”.
-
If you want, you can manually move the arm, by clicking on the “move” tab (a) or you can go to the log terminal that is great for remote control (b). If you do the latter, continue with step 10.
-
In this screen, you can control the robot manually in joint/tool space and you can read the positions of all joints.
a. Move the end effector (“tool space”). The top changes the position of the end effector, and the bottom changes the orientation. Press and hold the arrows. b. Visualization of the current state of the robot. This is interactive and with click-drag you can rotate the preview. c. FREEDRIVE button. While you’re holding this button, you can freely move the robot to a desired position. While doing this, you can still observe the position readings. d. Position of each joint. Press & hold an arrow to move an individual joint. Each joint can theoretically rotate 360 deg in each direction for a total range of 720 deg. e. You can directly input a target joint position if you click on those values. You’ll see a preview of the resulting motion and it will give you a choice to go there automatically or manually. Press and hold “automatic”. f. This button makes the robot stand up straight. This is not a great position because the inverse kinematics freak out in this position. IDK why it’s there, I would recommend not to use it unless your arm is stuck in some weird pose. g. When you’re done here, click on the “log” tab. 10. This log view is great for when you’re getting started programming the robot remotely (e.g. via Python). It gives you an overview of the health and state of all joints as well as incoming commands. While programming the robot, just keep this screen open.
a. General health of the whole system. Make sure this doesn’t run too hot. b. Individual joint status. It can happen that the failsafe of an individual joint comes on if you move it too quickly and then the state will change here from “OK” to “ERROR” on that joint or all joints. c. When you’re lifing something or poking something, make sure that the teperature/power draw in individual joints doesn’t go too high. That’s an indication that you’re lifintg too heavy. d. If you’re sending commands remotely via Python/Matlab/Socket, they will show up here. If there is an error, you will also find warnings and advice here. e. If you havent tried it yet, please press the emergency stop button. 11. Emergency Stop. Once you’ve hit the emergency stop, the robot will freeze and you’ll see this screen. To get back to normal operation, first twist the stop button clockwise to make it pop back out (a). Then click on “go to initialization screen” and continue with step 4 of this guide.
You can either control the robot with either ROS or use the sockets of the robot directly.
You will need to have ROS installed, at the REAL lab the current supported version is Noetic, install following the results here:
http://wiki.ros.org/noetic/Installation/Ubuntu
Please note, ROS Noetic targets Python 3 exclusively, so you will need to work with python 3. Historically there have been problems running ROS with Conda, if you want to use a conda environment, I would suggest looking here:
https://github.com/RoboStack/ros-noetic
Follow install instructions https://github.com/montrealrobotics/universal_robot, we are working with ROS Noetic so please use the branch ‘noetic’ and clone with the following command:
git clone -b noetic https://github.com/montrealrobotics/universal_robot
For working with the real robot, we also need to install the new ROS UR driver. Please follow the install instructions here:
https://github.com/UniversalRobots/Universal_Robots_ROS_Driver
To use the UR5 with the robotiq gripper you should also clone the robotiq repo into your workspace:
git clone https://github.com/cambel/robotiq.git
You will need to copy the URcap to the robot’s polyscope and create a robot program by following the instructions given in the link.
To connect to the real robot, you need to configure the networking. Connect to the robot with an ethernet cable, you will have to configure the ethernet connection on the PC to be a static IP on the same subnet as the robot.
Set/check the robot IP address by following these instructions:
On the PC side, the IP could be set to something like 192.168.1.101, subnet 255.255.255.0 and default gateway 192.168.1.1
To launch just the UR5(e) arm, where robot type is either ur5 or ur5e:
roslaunch ur_gazebo <robot_type>_bringup.launch
To launch the UR5(e) arm with a gripper, the robotiq gripper 85 is launched by default:
roslaunch ur_gazebo <robot_type>_bringup.launch gripper:=true
To launch the UR5(e) with the robotiq hand-e gripper:
roslaunch ur_gazebo <robot_type>_bringup.launch gripper:=true gripper_type:=robotiq_hande_gripper
Then to launch moveit, robot_type can be either:
- ur5
- ur5e
- ur5_robotiq_85_gripper
- ur5e_robotiq_85_gripper
- ur5_robotiq_hande_gripper
- ur5_robotiq_hande_gripper
roslaunch <robot_type>_moveit_config moveit_planning_execution.launch sim:=true
Then to launch rviz:
roslaunch <robot_type>_moveit_config moveit_rviz.launch
Check out this video to see a demo of the robot being controlled by moveit in simulation:
Screencast.2022-09-29.11.08.59.mp4
To launch just the UR5(e) arm:
roslaunch ur_robot_driver <robot_type>_bringup.launch robot_ip:=<your_robot’s_IP>
You can then launch moveit and rviz as before.
The robot can be moved by using the motion planning integrated into Rviz. You should see an interactive marker on the robot’s end effector, in the form of a blue sphere with arrows, if it is not there, make sure that your fixed frame is set to base link
If there is no motion planning tree in the display section, it can be added by selecting ‘Add’.
Then select MotionPlanning.
The interactive marker on the robot can be used to move the robot, click ‘Plan’ to see the trajectory that the robot will complete to move to the new pose, always check that this trajectory looks safe before clicking ‘Execute’, and always have one hand on the E-stop!!
Plans can also be created by moving the joint sliders in tab ‘Joints’. The joints listed will depend on the planning group that is selected, to plan for the UR, select planning group ‘arm’, for the gripper, select ‘manipulator’. Joints for the UR:
Joints for the Robotiq 85 gripper:
Joints for the Robotiq hand-e gripper:
I have a friend from MSR send me his custom Python code for using the sockets (that’s gonna take a week or so to polish; I’ll update this section when I get it). In the meantime, we can use the public code from here:
https://github.com/fgolemo/python-urx.git
Install this package via:
git clone https://github.com/fgolemo/python-urx.git
cd python-urx
pip install -e .
Then try out the example script to see how it works, like:
https://github.com/fgolemo/python-urx/blob/master/examples/simple.py
!!! Note how almost all motor commands are in tool space (i.e. cartesian control of the end effector). !!!
It’s sensitive to the starting position of the robot. Sometimes you’ll get a warning about “joint limits” or similar which is not true but only refers to the fact that the motion planner encountered a singularity. If you run the same script twice in rapid succession, only one of the two times will work. This is kinda expected behavior because the socket needs to reset between operations, which takes a second. An easy fix for this would be to add a while-try/catch block around the intialization and give it a few attempts with a second in between. Also there is currently a bug in the acceleration code in that the robot will sometimes accelerate too quickly and not respect the max velocity. Haven’t had a chance to look into this. Temporay solution: very low acceleration value. In this library, currently only the tool space commands (i.e. cartesian control) are implemented. Joint control/PID (the servoj() function) is missing. When I get back to UdeM, that’ll be the first thing to do for me but if someone wants to beat me to it, feel free. If you don’t wanna use a library or write your own socket connection, here’s a more low-level tutorial: https://www.zacobria.com/universal-robots-zacobria-forum-hints-tips-how-to/script-via-socket-connection/
The robot has its own programming language called “URScript” that has variables, loops, conditions, and …move functions. These can be sent in text to one of several sockets that’s open when the robot is started and not currently being moved by the touchscreen interface.
URScript documentation: https://s3-eu-west-1.amazonaws.com/ur-support-site/62056/scriptManual.pdf (The interesting commands here are movec p.23, movej p.24, movel p.25, servoc p.28, servoj p.29, the last one being my favorite.)
TBD: more explanation here, actually set this up with example code
URDF for use in Gazebo, Pybullet, and Mujoco (also with gripper, see their readme): https://github.com/utecrobotics/ur5/tree/master/ur5_description/urdf Mujoco simulator: https://github.com/cxy1997/Robotiq-UR5