ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

ROS_canopen correct PDO mapping + EDS modifications?

asked 2018-06-15 07:20:59 -0500

akosodry gravatar image


I have the following setup: Microchip CAN BUS Analyzer + Delta ASDA A2 motor driver + ECMA AC servo motor Later there will be more motors and drivers, but now the goal is to control a single motor in ROS. Of course, i both read all the information in wiki.ros and followed all the relevant questions here in the forum, but still my setup is not working, so here i am and would like to ask the parts that are fuzzy.

Quickly i summarize what i've done: (, even though these steps are listed in most of the forum questions and answers, see jdeleon's question or Mathias Lüdtke's answer)

  1. I set up the ASDA motor driver to CANopen mode, + Node id to 1, + Baudrate to 500 kBps + Sync (see the link: CANopen manual on page 7)
  2. SocketCAN is set up, running
  3. URDF is written containing 2 links (base_link, link_1 with visual geometry, collision and inertial tags) + a revolute joint (name:joint_1 with limits, and parent child links) + a transmission(tran1: SimpleTransmission, PositionJointInterface). The URDF was tested in rviz with the joint_state_publisher slider it worked as expected.
  4. EDS file: This file was given by the manufacturer (EDS file)
  5. I configured the CANopen bus layer, however i don't know if the heartbeat part is necessary or not (in some forum answers i saw that it was commented out)? (can.yaml)
  6. i configured the Motor settings and the Node layer with name:joint_1, id:1 (manipulator1d_motors.yaml) however i dont't know what should be the default switching state? (is the default 5, i.e., quick stop ok?)
  7. Controller config file containing the joint_state_controller and a joint_1_position_controller (type: position_controllers/JointPositionController, joint: joint_1, required_drive_mode: 1) (manipulator1d_controller.yaml)
  8. Launch file containing robot_description urdf, robot_state_publisher node, joint_state_publisher node, rviz node, + canopen_motor_node with loading the aforementioned can.yaml and manipulator1d_motors.yaml files + load of the controller yaml file, + controller_spawner node with the spawning of the aforementioned controllers
  9. rosservice call /driver/init

Of course, in the 9th step the service call crashed, with the messages:

first terminal:

[ INFO] [1529055659.976854113]: Using fixed control period: 0.010000000
[ INFO] [1529055664.213323688]: Initializing XXX
[ INFO] [1529055664.213611131]: Current state: 1 device error: system:0 internal_error: 0 (OK)
[ INFO] [1529055664.213834181]: Current state: 2 device error: system:0 internal_error: 0 (OK)
EMCY: 81#4154201300000000
[ERROR] [1529055667.444154070]: Throw location unknown (consider using BOOST_THROW_EXCEPTION)
Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >
std::exception::what: boost: mutex lock failed in pthread_mutex_lock: Invalid argument
illegal tranistion 0 -> 2
[ INFO] [1529055667.496812113]: Current state: 0 device error: system:0 internal_error: 0 (OK)
[ INFO] [1529055667.496986914]: Current state: 0 device error: system:0 internal_error: 0 (OK)

second terminal:

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"

So at this point i started to read everything and dig into the details. More or ... (more)

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-06-20 11:36:34 -0500

Mathias Lüdtke gravatar image

updated 2018-06-20 11:37:19 -0500

Did i do it correctly? Also it is not written anywhere what should be done with the TPDO mapping?

No. The PDO settings should go into the ParameterValue entries. DefaulValue should contain the values after boot-up of the devices. Statuses are TPDOs (sent by the device), commands are RPDOs (received by the device).

Can someone recommend a working TPDO mapping?

The Care-O-bot mapping can be found in canopen_test_utils. These scripts can even be called to patch an EDS to form a DCF. As an alternative, you can use CANeds to set-up the PDO mapping.

As a result of consecutive fails, i also tried to change the DefaultValue

Don't change DefaultValue. ros_canopen compares DefaultValue and ParameterValue and will only send out the SDO if somethings needs to be changed.

edit flag offensive delete link more


Hello Mathias! Thank you for the help. I also posted a new question related to the canopen_test_utils package: #q294570 Can you give a hint what causes the 'hardware_interface:' ERROR? Thanks in advance

akosodry gravatar image akosodry  ( 2018-06-20 11:59:33 -0500 )edit

I am going to redo the modification of the original EDS file where i will add the ParameterValue as it is given in the Care-O-bot dfc, and i wil not change the DefaultValue. Thanks again!

akosodry gravatar image akosodry  ( 2018-06-20 12:02:51 -0500 )edit

Hi @akosodry, did you find out what is the correct switching_state value? I could not find any documentation regarding this parameter.

martinlucan gravatar image martinlucan  ( 2021-12-06 09:09:25 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2018-06-15 07:20:59 -0500

Seen: 981 times

Last updated: Jun 20 '18