robotic-vision-lab / UR-Robotiq-Integrated-Driver

Python wrapper for the Universal Robots ROS driver with Robotiq gripper support.
Apache License 2.0
10 stars 1 forks source link

basic example required #2

Closed ProfJust closed 1 year ago

ProfJust commented 2 years ago

We use an UR5e with a 2F-Robotiq-Gripper directly connected to the M8-UR-Tool-Connector. After days of work we still cannot open or close the gripper from ROS-Noetic / MoveIt! or a python-script running on the remote-PC.

We started $ roslaunch rvl_ur_remote_dashboard rvl_ur5e_bringup.launch and $roslaunch rvl_ur5e_moveit_config demo.launch

Many Thanks in advance from the Westphalian University of Applied Sciences in Bocholt / Germany.

mqt0029 commented 2 years ago

I really should update the instruction on how to get started, it is a bit convoluted and it definitely can be a lot clearer. But, here is a short, simple step-by-step instruction on how to recreate our setup.

There is also an import error that I somehow missed, which is now patched, so make sure you pull the recent changes.

Step 1: Make sure you have installed socat and running

⚠️ This is for the UR control box itself, not the host computer.

You can build socat from source, and to make it autostart on control box booting, use the included .service file to register it to service system.

Step 2: Setup Docker

Setup the Docker image as specified in the included instruction manual.

If you are using Linux, make sure you follow Docker Post-Installation Steps

If you are using Windows, I suggest you use Docker Desktop with a WSL2 distribution. The setup step is much more involved here, so if you are using it on Windows, do let me know.

What I did for this step (assuming Docker is properly installed and configured) was

⚠️ If you are on Windows, last command use windows_launch_docker_container.sh instead of launch_docker_container.sh

# pull image from Docker Hub
$ docker pull mqt0029/rvl-ur-robotiq-driver:latest

# rename image so it matches script hard-coded name
$ docker tag mqt0029/rvl-ur-robotiq-driver:latest rvl-ur-robotiq-driver:latest

# create container if not exist, else attach to it
$ sh [path_to_repository]/docker/launch_docker_container.sh

Step 3: Setup ROS Workspace inside Docker container

Update and install ROS dependencies using run_rosdep and rebuild catkin workspace using rebuild_catkin. These are all custom aliases and ready to use.

$ run_rosdep
[...]

$ rebuild_catkin
[...]

$ src_ros

You can now modify the launch file IP address and calibration files to match your UR5e.

<arg name="robot_ip" default="192.168.1.147" doc="IP address by which the robot can be reached."/>
<arg name="robot_description_file" default="$(find rvl_ur_remote_dashboard)/launch/load_rvl_ur5e.launch" doc="Robot description launch file."/>
<arg name="kinematics_config" default="$(find rvl_ur_remote_dashboard)/configs/ur5e_calibration.yaml" doc="Kinematics config file used for calibration correction. This will be used to verify the robot's calibration is matching the robot_description."/>

Finally, launch ROS. You should see something along the line of robot status and 2F85 node.

$ roslaunch rvl_ur_remote_dashboard rvl_ur5e_bringup.launch
[...]
[ INFO] [1660598179.677917200]: Robot mode is now RUNNING
[ INFO] [1660598179.678877500]: Robot's safety mode is now NORMAL
[INFO] [1660598179.710610]: Controller Spawner: Waiting for service controller_manager/switch_controller
[INFO] [1660598179.713022]: Controller Spawner: Waiting for service controller_manager/unload_controller
[INFO] [1660598179.713531]: Controller Spawner: Waiting for service controller_manager/switch_controller
[INFO] [1660598179.715505]: Loading controller: joint_state_controller
[INFO] [1660598179.716167]: Controller Spawner: Waiting for service controller_manager/unload_controller
[INFO] [1660598179.718290]: Loading controller: pos_joint_traj_controller
[INFO] [1660598179.723563]: Loading controller: scaled_pos_joint_traj_controller
[INFO] [1660598179.747691]: Loading controller: joint_group_vel_controller
[INFO] [1660598179.769891]: Loading controller: speed_scaling_state_controller
[INFO] [1660598179.775900]: Controller Spawner: Loaded controllers: pos_joint_traj_controller, joint_group_vel_controller
[INFO] [1660598179.778143]: Loading controller: force_torque_sensor_controller
[INFO] [1660598179.786267]: Controller Spawner: Loaded controllers: joint_state_controller, scaled_pos_joint_traj_controller, speed_scaling_state_controller, force_torque_sensor_controller
[INFO] [1660598179.789837]: Started controllers: joint_state_controller, scaled_pos_joint_traj_controller, speed_scaling_state_controller, force_torque_sensor_controller
[R2F85 Node] UR Arm already powered, updating and accepting command
[R2F85 Node] Gripper interface node is now running

Step 4: Run sample script

I have modified a script that demonstrate the control of UR5e and Robotiq, see URDashboardTest.py.

$ rosrun rvl_ur_remote_dashboard URDashboardTest.py

This will power on the arm if it's not already powered, with brakes engaged. After you hit enter the first time, the gripper will reset (fully close then fully open). When you hit enter the second time, it will close the gripper with a default force specified in the driver until it fully closes or it is obstructed by an object.

mqt0029 commented 1 year ago

Moved to ROS 2 Humble. See new instructions.