ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

CANopen test based on the canopen_test_utils package

asked 2018-06-19 13:51:14 -0600

akosodry gravatar image

updated 2018-06-21 09:23:56 -0600


i am trying to communicate with a single motor through CANopen. I had posted earlier about it in this question: #q294210

EDIT (21/06): This question was answered by Mathias Lüdtke. The error was in the EDS file, Mathias noticed that the [6502] object had a wrong DataType value, the right DataType value is 0x0007. After i changed the value the controller was spawned correctly.

*However a new ERROR occurred after the spawning. * This problem is discussed in #q294869

ORIGINAL question starts here: Since no answer was arrived, i was trying to find reference CANopen based projects. Two popular projects/packages were recommended by Mathias Lüdtke: 1) canopen_test_utils and 2) schunk_robots.

The canopen_test_utils seemed perfect to me, since it provides a CANopen based control solution for only 1 joint, e.g. one motor. Therefore i only needed to replace the Elmo.dcf file to my EDS file in canopen_rig1.yaml file. I changed nothing else in the package.

So i did the following:

  1. sudo ip link set can0 up type can bitrate 500000
  2. roslaunch canopen_test_utils hw_rig1.launch
  3. rosservice call /rig1/driver/init

And of course the call crashed with the following message:

success: False
message: "Throw location unknown (consider using BOOST_THROW_EXCEPTION)\nDynamic exception\
\ type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error>\
\ >\nstd::exception::what: boost: mutex lock failed in pthread_mutex_lock: Invalid\
\ argument\n; Could not set transition"

OK.. (so i thought...) Since only the DCF/EDS file differs, and this project has been tested, therefore i checked and compared the Elmo.dcf and my EDS file line by line in a bruteforce way. I modified my original EDS file based on this Elmo.dcf, so it has the same T/R PDO mappings, transmission types, etc, more or less everything.

I repeated the aforementioned 3 steps using the new updated EDS file to test the package.

And of course it crashes again. I try to give here every information that i got in the terminals:

After step 2, i have the following output in the terminal (2 suspicious warnings: Controller Spawner couldn't find the expected controller_manager ROS interface.):

xacro: Traditional processing is deprecated. Switch to --inorder processing!
To check for compatibility of your document, use option --check-order.
For more infos, see
deprecated: xacro tags should be prepended with 'xacro' xml namespace.
Use the following script to fix incorrect usage:
    find . -iname "*.xacro" | xargs sed -i 's#<\([/]\?\)\(if\|unless\|include\|arg\|property\|macro\|insert_block\)#<\1xacro:\2#g'
when processing file: /home/akosodry/catkin_ws/src/canopen_test_utils/urdf/rig1.urdf.xacro is deprecated; please use xacro instead
started roslaunch server http://akosodry-8700K-linux:33007/


* /rig1/driver/

* /rig1/driver/bus/device: can0
* /rig1/driver/bus/master_allocator: canopen::SimpleMa...
* /rig1/driver/defaults/dcf_overlay/1016sub1: 0x7F0064
* /rig1/driver/defaults/dcf_overlay/1017: 100
* /rig1/driver/defaults/dcf_overlay/6098: 35
* /rig1/driver/defaults/eds_file: config/ASDA_A2_10...
* /rig1/driver/defaults/eds_pkg: canopen_test_utils
* /rig1/driver/heartbeat/msg: 77f#05
* /rig1/driver/heartbeat/rate: 20
* /rig1/driver ...
edit retag flag offensive close merge delete



Also after the rosservice call i get the following:

Which service call? The errors do not look good. The error register (1001) cannot be read/reset and your drive has a heartbeat failure. In addition "RPDO timeout" might occur once in a while (given heavy CPU or bus load), but not always.

Mathias Lüdtke gravatar image Mathias Lüdtke  ( 2018-06-20 12:21:59 -0600 )edit

After i call:

rosservice call /rig1/controller_manager/load_controller "name: 'rig1_plate_joint_position_controller'"
akosodry gravatar image akosodry  ( 2018-06-20 12:24:26 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2018-06-20 12:00:19 -0600

Mathias Lüdtke gravatar image

updated 2018-06-21 08:29:06 -0600

The config and launch files in canopen_test_utils describe a rather specific set-up. They might be good to copy out some snippets, but not the full files.

If you start with a slow sync rate (~10Hz), you could try it without any specific PDO mapping. Everthing should work with SDOs as well, but most-likely not at a high rate. PDO mapping could be added afterwards.

First you should identify the drive mode you want to use (not all devices support all modes). Afterwards you can create the controller config for it and setup the units in the driver config.

If i do rosservice list there is no controller_manager:

The controller_manager services will get started during driver/init.

I assume that these messages are OK. But the problem is that i have no topics related to the controllers:

These will get availables after the controller was spawned successfully.

Could not find resource 'rig1_plate_joint' in 'hardware_interface::PositionJointInterface'

Does your drive support mode 1 and reports it in 0x6502?

Update: I have checked ASDA_A2_1042sub980_C_ORIG_mod_bonSchunkv1.eds with CANeds. Looks like 0x6502 has the wrong type (Integer32 instead of Unsigned32). Please try to change DataType to 0x0007.

edit flag offensive delete link more


Hello Mathias! Thank you for the reply.

ParameterName=Supported drive modes

This is how my 6502 object looks. SHould i add ParamVal=1?

akosodry gravatar image akosodry  ( 2018-06-20 12:11:39 -0600 )edit

0D is fine, it is a bit field. And it includes bit 1 for mode 1.

Mathias Lüdtke gravatar image Mathias Lüdtke  ( 2018-06-20 12:14:14 -0600 )edit

Ok, its 6D. Then the 6502 object is correct (i assume). What can be then wrong with the 'hardware_interface::PositionJointInterface' ?

Additionally, i also created a new package, based on the schunk package. Where the same error occurs..

akosodry gravatar image akosodry  ( 2018-06-20 12:18:35 -0600 )edit

I also checked that ros-control is installed, ros-controllers as well.. i have no idea what could be the problem....

akosodry gravatar image akosodry  ( 2018-06-20 12:21:19 -0600 )edit

In the rig1_controller.yaml i have only the rig1_plate_joint_position_controller and joint_state_controller, the rest is commented out. I also changed in the test_setup_controller.xml to spawn the rig1_plate_joint_position_controller.

akosodry gravatar image akosodry  ( 2018-06-20 13:28:31 -0600 )edit

If you have 3 minutes, HERE is the test video (first 3 minutes). Thank you in advance for your help.

akosodry gravatar image akosodry  ( 2018-06-20 13:29:38 -0600 )edit

Have you changed any joint/node name? It might be helpful if you update the files somewhere (e.g. github)..

Mathias Lüdtke gravatar image Mathias Lüdtke  ( 2018-06-20 13:51:51 -0600 )edit

No i did not! I just commented out the controllers that (i thought) are not needed for me. I will upload the package in a minute. And again, thanks for the help!

akosodry gravatar image akosodry  ( 2018-06-20 13:54:02 -0600 )edit

Question Tools



Asked: 2018-06-19 13:51:14 -0600

Seen: 761 times

Last updated: Jun 21 '18