ros-industrial / ur_modern_driver

(deprecated) ROS 1 driver for CB1 and CB2 controllers with UR5 or UR10 robots from Universal Robots
Apache License 2.0
302 stars 340 forks source link

Updated for SW>=3.5 and E-series #310

Closed akihikoy closed 4 years ago

akihikoy commented 5 years ago

I have updated the codes for SW>=3.5 and E-series. I verified my updates on UR3 and UR3e.

Actually my updates was manually merging the updates from dniewinski: https://github.com/dniewinski/ur_modern_driver Since many other codes were modified in dniewinski version (such as removing the copyright sections of the files), I did this manually, rather than using git merge. My updates are minimum to merge into ros-industrial version, which would be useful to other users.

I also copied config and launch files from the dniewinski's updates. For example, we can run: $ roslaunch ur_modern_driver ur3e_bringup.launch robot_ip:=xxx.xxx.xxx.xxx

I referred to: https://github.com/ros-industrial/ur_modern_driver/issues/184 Especially this is important to work with E-series: https://github.com/ros-industrial/ur_modern_driver/issues/184#issuecomment-435325436

cambel commented 5 years ago

Hi,

I am trying to work with a UR3e (SW5.4). I tested your commit and also I tried directly using the latest code in dniewinski repo but I got the same error:

[ INFO] [1560233989.811899775]: Setting up connection: 10.0.1.26:30003 [ INFO] [1560233989.812273811]: Connection established for 10.0.1.26:30003 [ INFO] [1560233989.812323309]: Setting up connection: 10.0.1.26:30001 [ INFO] [1560233989.812577689]: Connection established for 10.0.1.26:30001 [ INFO] [1560233990.182753076]: Got VersionMessage: [ INFO] [1560233990.182851978]: project name: URControl [ INFO] [1560233990.182907262]: version: 5.4.0 [ INFO] [1560233990.182968718]: build date: 03-05-2019, 06:40:37 [ INFO] [1560233990.183105964]: Disconnecting from 10.0.1.26:30001 [ INFO] [1560233990.225228646]: ActionServer enabled [ INFO] [1560233990.225369262]: Use standard trajectory follower [ INFO] [1560233990.233021414]: Setting up connection: :50001 [ INFO] [1560233990.233439264]: Connection established for :50001 [ INFO] [1560233990.233942562]: Initializing ur_driver/URScript subscriber [ INFO] [1560233990.251729318]: The ur_driver/URScript initialized [ INFO] [1560233990.251801482]: Notifier: Pipeline disconnect will shutdown the node [ INFO] [1560233990.261377984]: Service 'ur_driver/robot_enable' activation mode: Never [ INFO] [1560233990.261431896]: Starting main loop [ INFO] [1560233990.261583147]: Starting pipeline RTPacket [ INFO] [1560233990.261692670]: Starting pipeline StatePacket [ INFO] [1560233990.261775757]: Setting up connection: 10.0.1.26:30003 [ INFO] [1560233990.262052097]: Setting up connection: 10.0.1.26:30002 [ INFO] [1560233990.262152688]: Connection established for 10.0.1.26:30003 [ INFO] [1560233990.262376065]: Connection established for 10.0.1.26:30002 [ INFO] [1560233990.263999128]: Starting ActionServer [ INFO] [1560233990.264147438]: Trajectory thread started [ERROR] [1560233990.341568984]: Sub-package of type 3 was not parsed completely! [ INFO] [1560233990.341725109]: Disconnecting from 10.0.1.26:30002 [ INFO] [1560233990.342062962]: Shutting down on stopped pipeline StatePacket Error in `/root/ros_ws/devel/lib/ur_modern_driver/ur_driver': corrupted size vs. prev_size: 0x0000000000d9a3c0 ======= Backtrace: ========= /lib/x86_64-linux-gnu/libc.so.6(+0x777e5)[0x7fde720f97e5] /lib/x86_64-linux-gnu/libc.so.6(+0x80dfb)[0x7fde72102dfb] /lib/x86_64-linux-gnu/libc.so.6(cfree+0x4c)[0x7fde7210653c] /lib/x86_64-linux-gnu/libc.so.6(+0x3a025)[0x7fde720bc025] /lib/x86_64-linux-gnu/libc.so.6(+0x3a045)[0x7fde720bc045] /root/ros_ws/devel/lib/ur_modern_driver/ur_driver(_ZN33ShutdownOnPipelineStoppedNotifier7stoppedENSt7cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x4b)[0x46ebeb] /root/ros_ws/devel/lib/ur_modern_driver/ur_driver(_ZN8PipelineI11StatePacketE12run_consumerEv+0x22d)[0x47318d] /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xb8c80)[0x7fde72a23c80] /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7fde72cf46ba] /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7fde7218941d] [ur_driver-3] process has died [pid 11120, exit code -6, cmd /root/ros_ws/devel/lib/ur_modern_driver/ur_driver name:=ur_driver __log:=/root/.ros/log/e8b64566-8c10-11e9-bb66-0242ac110002/ur_driver-3.log]. log file: /root/.ros/log/e8b64566-8c10-11e9-bb66-0242ac110002/ur_driver-3*.log

Do you know what the problem may be? I guess is a problem is related to the parsing of the data but I don't know what new fields may have been added to the SW5.4 version. The documentation goes only up to 5.2 in the official website https://www.universal-robots.com/how-tos-and-faqs/how-to/ur-how-tos/remote-control-via-tcpip-16496/

akihikoy commented 5 years ago

@cambel Did you checkout the branch kinetic-devel?

By the way, my SW version is 5.2 (UR3e).

cambel commented 5 years ago

@akihikoy Thanks for the quick reply.

Yeah I did check the kinetic-devel and also I try directly the commit 78d17c8aec19aa5be76786f2e4cb94ff9c54ff1d. In both cases, I got the exact same error.

I don't know if it would be better (and safe?) to downgrade to SW5.2...

akihikoy commented 5 years ago

@cambel

  1. Did you do this? https://github.com/ros-industrial/ur_modern_driver/issues/184#issuecomment-435325436
  2. In order to make sure that the other versions are not used, remove build and devel directories in catkin_ws, and then run catkin_make.

If you already did them and they do not work, the only thing I can guess is the SW version. I do not know if it is safe to downgrade. Note: my UR3e is: version: 5.2.0, build date: 21-11-2018, 14:35:16. --Akihiko

cambel commented 5 years ago

@akihikoy

Yes, I had followed the instructions from #182 (comment). So the remote control was active but still, the error persisted.

Now, I actually downgraded the robot software to SW 5.3.0 and now I get a different behavior from the driver. I am able to connect using ur3e_bringup_joint_limited.launch, but when I try to move the robot, it does not move at all.

I try executing the test_move.py, I got the following output but no motion in the robot.

rosrun ur_modern_driver test_move.py Waiting for server... Connected to server This program makes the robot move between the following three poses: [126.05071492878113, 0.0, -89.95437383553926, 0.0, 0.0, 0.0] [85.94366926962348, 0.0, -89.95437383553926, 0.0, 0.0, 0.0] [85.94366926962348, -11.459155902616464, -89.95437383553926, 0.0, 0.0, 0.0] Please make sure that your robot can move freely between these poses before proceeding! Continue? y/n: y

Output from the ur3e_bringup_joint_limited.launch terminal

roslaunch -v ur_modern_driver ur3e_bringup_joint_limited.launch robot_ip:=10.0.1.26 SUMMARY

PARAMETERS /robot_description: <?xml version="1.... /rosdistro: kinetic /rosversion: 1.12.14 /ur_driver/base_frame: base /ur_driver/max_joint_difference: 0.01 /ur_driver/max_payload: 3.0 /ur_driver/max_velocity: 10.0 /ur_driver/max_waiting_time: 2.0 /ur_driver/min_payload: 0.0 /ur_driver/prefix: /ur_driver/require_activation: Never /ur_driver/reverse_ip_address: /ur_driver/reverse_port: 50001 /ur_driver/robot_ip_address: 10.0.1.26 /ur_driver/servoj_gain: 100.0 /ur_driver/servoj_lookahead_time: 1.0 /ur_driver/servoj_time: 0.008 /ur_driver/servoj_time_waiting: 0.001 /ur_driver/shutdown_on_disconnect: True /ur_driver/time_interval: 0.008 /ur_driver/tool_frame: tool0_controller /ur_driver/use_lowbandwidth_trajectory_follower: False /ur_driver/use_ros_control: False NODES / robot_state_publisher (robot_state_publisher/robot_state_publisher) ur_driver (ur_modern_driver/ur_driver) auto-starting new master process[master]: started with pid [19131] ROS_MASTER_URI=http://localhost:11311 setting /run_id to 1944998c-8cb4-11e9-8306-0242ac110002 process[rosout-1]: started with pid [19144] started core service [/rosout] process[robot_state_publisher-2]: started with pid [19147] process[ur_driver-3]: started with pid [19162] [ INFO] [1560304079.219414004]: Setting up connection: 10.0.1.26:30003 [ INFO] [1560304079.219985067]: Connection established for 10.0.1.26:30003 [ INFO] [1560304079.220035116]: Setting up connection: 10.0.1.26:30001 [ INFO] [1560304079.220263279]: Connection established for 10.0.1.26:30001 [ INFO] [1560304079.367628286]: Got VersionMessage: [ INFO] [1560304079.367719170]: project name: URControl [ INFO] [1560304079.367766605]: version: 5.3.0 [ INFO] [1560304079.367827193]: build date: 21-02-2019, 15:09:25 [ INFO] [1560304079.367914410]: Disconnecting from 10.0.1.26:30001 [ INFO] [1560304079.399452732]: ActionServer enabled [ INFO] [1560304079.399607853]: Use standard trajectory follower [ INFO] [1560304079.408792133]: Setting up connection: :50001 [ INFO] [1560304079.409151990]: Connection established for :50001 [ INFO] [1560304079.409445826]: Initializing ur_driver/URScript subscriber [ INFO] [1560304079.425850724]: The ur_driver/URScript initialized [ INFO] [1560304079.425972890]: Notifier: Pipeline disconnect will shutdown the node [ INFO] [1560304079.440371327]: Service 'ur_driver/robot_enable' activation mode: Never [ INFO] [1560304079.440427691]: Starting main loop [ INFO] [1560304079.440625748]: Setting up connection: 10.0.1.26:30003 [ INFO] [1560304079.440720535]: Starting pipeline RTPacket [ INFO] [1560304079.440860197]: Starting pipeline StatePacket [ INFO] [1560304079.440938269]: Setting up connection: 10.0.1.26:30002 [ INFO] [1560304079.441149257]: Connection established for 10.0.1.26:30003 [ INFO] [1560304079.441469963]: Connection established for 10.0.1.26:30002 [ INFO] [1560304079.443650505]: Starting ActionServer [ INFO] [1560304079.443803616]: Trajectory thread started [ INFO] [1560304093.940431914]: Received new goal [ INFO] [1560304093.943878922]: Trajectory received and accepted [ INFO] [1560304093.944044483]: Translating trajectory [ INFO] [1560304093.944132265]: Executing trajectory with 31 points and duration of 40.000s [ INFO] [1560304093.944181238]: Attempting to start follower 0x26035b0 [ INFO] [1560304093.944219585]: Uploading trajectory program to robot

It just stays there doing nothing, no error or any significant message. I try using moveit, but I got the same message uploading trajectory program to robot but no motion from the robot.

Have you had a similar problem with your UR3e?

akihikoy commented 5 years ago

@cambel Thanks for your note. I think the reason of the error (Sub-package of type 3 was not parsed completely!) was due to the deserialisation of the state packet. SW 5.2 is okay but there seems to be a modification on SW 5.4.

If you completed https://github.com/ros-industrial/ur_modern_driver/issues/184#issuecomment-435325436 , I think the robot should move.

Here's my test code:

$ roslaunch ur_modern_driver ur3e_bringup.launch robot_ip:=xxx.xxx.xxx.xxx
$ rosrun rviz rviz
$ ./follow_q_traj2.py

where the last script is available from here. (I do not like test_move.py as the movement is large; ./follow_q_traj2.py moves all joints in +/- 0.02 rad from the current joint angles, which is a small movement.)

You can also run ./get_q2.py to see if the joint state topics are available, or simply use rostopic echo.

cambel commented 5 years ago

@akihikoy

Thank you very much for your reply and for sharing your test codes.

Here is what I did. First I downgraded the system again to SW5.2.1. I try the same commands as my previous reply and I got the same behavior: successful connection but no motion in the robot.

Then I installed the simulators UR-SIM for the versions 5.2, 5.3 and 5.4, I tested the ur_modern_driver in each version. What I learned from that is that the serialization problem is indeed introduced in version 5.4, the 5.2 and 5.3 works fine, both connect and move (in simulation).

I omit to mention that I was trying to connect and move the robot within a Docker container, so I tried to move the robot from a PC that has ROS installed locally (no docker) and it worked! :smile: The problem then with my docker container is probably related to the network and ports setting, I still couldn't move the robot from the docker container, but it is not a priority for now. Still, it is strange because the connection seems to be successful and I can even get the robot state from rostopic echo -n1 /joint_states :man_shrugging:

gavanderhoorn commented 5 years ago

I omit to mention that I was trying to connect and move the robot within a Docker container, so I tried to move the robot from a PC that has ROS installed locally (no docker) and it worked! smile The problem then with my docker container is probably related to the network and ports setting, I still couldn't move the robot from the docker container, but it is not a priority for now. Still, it is strange because the connection seems to be successful and I can even get the robot state from rostopic echo -n1 /joint_states man_shrugging

The problem is the reverse connection (from the controller to the PC).

If you check the log on your teach pendant there is a good chance you'll find an error saying something like:

Error - Not able to open socket socket_0 to host: [ROS PC IP] at port: 50001 Connection Timed out

See #311 for a post by another user that ran into this.

cambel commented 5 years ago

@gavanderhoorn

Thanks for your reply.

I think you are right, I tried explicitly exposing the port 50001 of the docker container but it didn't work. I will check the configuration of the docker and let you know if it works. But the problem is most likely not related to this repository.

As an additional note, I just upgrade again my UR3e to version SW5.3.1 (Mar 2019) and check that it works fine (in a non-docker environment) for a simple test, using the code from this pull request.

gavanderhoorn commented 5 years ago

I think you are right, I tried explicitly exposing the port 50001 of the docker container but it didn't work. I will check the configuration of the docker and let you know if it works.

another problem with Docker configurations is that the node will embed the IP address of the container instead of the host in the program sent to the controller. That will also lead to a failure trying to setup the reverse connection.

If you haven't setup routing for your Docker containers, you'll want to use the reverse_ip argument to the launch file to the IP of your ROS PC. This argument:

https://github.com/ros-industrial/ur_modern_driver/blob/6b818fa149bcd070131d6b04e5d97e2f67d28684/launch/ur10_bringup_joint_limited.launch#L13

That argument was added in #301, especially to support NAT setups (which a standard Docker network essentially is).

But the problem is most likely not related to this repository.

It is indeed not a problem with the driver, but with the configuration of your setup.

gavanderhoorn commented 5 years ago

This could be reviewed in isolation, but could also be used as a starting point to address issues with the deserialisers reported in #147 and #316 fi.

AdmiralWall commented 5 years ago

@akihikoy which universal_robot repo/branch are you using for this?

I am also getting the Sub-package of type 3 was not parsed completely! error with a UR10e and 5.4 software version. I am using a ROS-installed machine without a docker container.

akihikoy commented 5 years ago

@AdmiralWall kinetic-devel. As we discussed above, the SW version 5.4 cannot be serialized with the current implementation (5.2 is okay).

Csp0920 commented 4 years ago

@akihikoy

Yes, I had followed the instructions from #182 (comment). So the remote control was active but still, the error persisted.

Now, I actually downgraded the robot software to SW 5.3.0 and now I get a different behavior from the driver. I am able to connect using ur3e_bringup_joint_limited.launch, but when I try to move the robot, it does not move at all.

I try executing the test_move.py, I got the following output but no motion in the robot.

rosrun ur_modern_driver test_move.py Waiting for server... Connected to server This program makes the robot move between the following three poses: [126.05071492878113, 0.0, -89.95437383553926, 0.0, 0.0, 0.0] [85.94366926962348, 0.0, -89.95437383553926, 0.0, 0.0, 0.0] [85.94366926962348, -11.459155902616464, -89.95437383553926, 0.0, 0.0, 0.0] Please make sure that your robot can move freely between these poses before proceeding! Continue? y/n: y

Output from the ur3e_bringup_joint_limited.launch terminal

roslaunch -v ur_modern_driver ur3e_bringup_joint_limited.launch robot_ip:=10.0.1.26 SUMMARY

PARAMETERS /robot_description: <?xml version="1.... /rosdistro: kinetic /rosversion: 1.12.14 /ur_driver/base_frame: base /ur_driver/max_joint_difference: 0.01 /ur_driver/max_payload: 3.0 /ur_driver/max_velocity: 10.0 /ur_driver/max_waiting_time: 2.0 /ur_driver/min_payload: 0.0 /ur_driver/prefix: /ur_driver/require_activation: Never /ur_driver/reverse_ip_address: /ur_driver/reverse_port: 50001 /ur_driver/robot_ip_address: 10.0.1.26 /ur_driver/servoj_gain: 100.0 /ur_driver/servoj_lookahead_time: 1.0 /ur_driver/servoj_time: 0.008 /ur_driver/servoj_time_waiting: 0.001 /ur_driver/shutdown_on_disconnect: True /ur_driver/time_interval: 0.008 /ur_driver/tool_frame: tool0_controller /ur_driver/use_lowbandwidth_trajectory_follower: False /ur_driver/use_ros_control: False NODES / robot_state_publisher (robot_state_publisher/robot_state_publisher) ur_driver (ur_modern_driver/ur_driver) auto-starting new master process[master]: started with pid [19131] ROS_MASTER_URI=http://localhost:11311 setting /run_id to 1944998c-8cb4-11e9-8306-0242ac110002 process[rosout-1]: started with pid [19144] started core service [/rosout] process[robot_state_publisher-2]: started with pid [19147] process[ur_driver-3]: started with pid [19162] [ INFO] [1560304079.219414004]: Setting up connection: 10.0.1.26:30003 [ INFO] [1560304079.219985067]: Connection established for 10.0.1.26:30003 [ INFO] [1560304079.220035116]: Setting up connection: 10.0.1.26:30001 [ INFO] [1560304079.220263279]: Connection established for 10.0.1.26:30001 [ INFO] [1560304079.367628286]: Got VersionMessage: [ INFO] [1560304079.367719170]: project name: URControl [ INFO] [1560304079.367766605]: version: 5.3.0 [ INFO] [1560304079.367827193]: build date: 21-02-2019, 15:09:25 [ INFO] [1560304079.367914410]: Disconnecting from 10.0.1.26:30001 [ INFO] [1560304079.399452732]: ActionServer enabled [ INFO] [1560304079.399607853]: Use standard trajectory follower [ INFO] [1560304079.408792133]: Setting up connection: :50001 [ INFO] [1560304079.409151990]: Connection established for :50001 [ INFO] [1560304079.409445826]: Initializing ur_driver/URScript subscriber [ INFO] [1560304079.425850724]: The ur_driver/URScript initialized [ INFO] [1560304079.425972890]: Notifier: Pipeline disconnect will shutdown the node [ INFO] [1560304079.440371327]: Service 'ur_driver/robot_enable' activation mode: Never [ INFO] [1560304079.440427691]: Starting main loop [ INFO] [1560304079.440625748]: Setting up connection: 10.0.1.26:30003 [ INFO] [1560304079.440720535]: Starting pipeline RTPacket [ INFO] [1560304079.440860197]: Starting pipeline StatePacket [ INFO] [1560304079.440938269]: Setting up connection: 10.0.1.26:30002 [ INFO] [1560304079.441149257]: Connection established for 10.0.1.26:30003 [ INFO] [1560304079.441469963]: Connection established for 10.0.1.26:30002 [ INFO] [1560304079.443650505]: Starting ActionServer [ INFO] [1560304079.443803616]: Trajectory thread started [ INFO] [1560304093.940431914]: Received new goal [ INFO] [1560304093.943878922]: Trajectory received and accepted [ INFO] [1560304093.944044483]: Translating trajectory [ INFO] [1560304093.944132265]: Executing trajectory with 31 points and duration of 40.000s [ INFO] [1560304093.944181238]: Attempting to start follower 0x26035b0 [ INFO] [1560304093.944219585]: Uploading trajectory program to robot

It just stays there doing nothing, no error or any significant message. I try using moveit, but I got the same message uploading trajectory program to robot but no motion from the robot.

Have you had a similar problem with your UR3e?

I also use UR3e and have exactly same problem as you. I‘d like to ask you how to solve this problem. Hoping to get your reply. Thank you very much.

gavanderhoorn commented 4 years ago

We're going to announce this later this week, but please use UniversalRobots/Universal_Robots_ROS_Driver for CB3 and e-series controllers with recent Polyscope versions.

This PR will not be merged, or at least not in this form.

Csp0920 commented 4 years ago

Firstly, thank you very much for your reply. I used to use the packages from dniewinski, including universal_robot and ur_modern_driver. So i need to use UniversalRobots/Universal_Robots_ROS_Driver? Now, it is too late to try your method, and im going to try your method tomorrow. Once again, thank you for your help.

gavanderhoorn commented 4 years ago

I used to use the packages from dniewinski, including universal_robot and ur_modern_driver. So i need to use UniversalRobots/Universal_Robots_ROS_Driver?

Please read the readme in UniversalRobots/Universal_Robots_ROS_Driver. It should all be clarified.

gavanderhoorn commented 4 years ago

I'm closing this as we've officially deprecated this package.

Please use ur_robot_driver for all CB3 and e-series controllers.

Refer to the announcement on ROS Discourse.

gavanderhoorn commented 4 years ago

@akihikoy: thanks for submitting the PR. Taking the time to update the code and submit it as a PR is very much appreciated.

The new ur_robot_driver specifically tries to avoid using the primary, secondary or matlab/real-time interfaces for receiving robot state, as it's almost undoable to keep up-to-date with the changes to the binary protocol.

RTDE provides a more controllable interface, and as such ur_robot_driver has standardised on that as much as possible.