0
$\begingroup$

Rosanswers logo

Hello,

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 http://wiki.ros.org/xacro#Processing_Order
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

xacro.py is deprecated; please use xacro instead
started roslaunch server http://akosodry-8700K-linux:33007/

SUMMARY
========

CLEAR PARAMETERS
* /rig1/driver/

PARAMETERS
* /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/nodes/rig1_plate_joint/id: 1
* /rig1/driver/sync/interval_ms: 10
* /rig1/driver/sync/overflow: 0
* /rig1/joint_state_controller/joints: ['rig1_plate_joint']
* /rig1/joint_state_controller/publish_rate: 50
* /rig1/joint_state_controller/type: joint_state_contr...
* /rig1/joint_trajectory_controller/action_monitor_rate: 10
* /rig1/joint_trajectory_controller/constraints/goal_time: 0.6
* /rig1/joint_trajectory_controller/constraints/rig1_plate_joint/goal: 0.1
* /rig1/joint_trajectory_controller/constraints/rig1_plate_joint/trajectory: 0.1
* /rig1/joint_trajectory_controller/constraints/stopped_velocity_tolerance: 0.5
* /rig1/joint_trajectory_controller/joints: ['rig1_plate_joint']
* /rig1/joint_trajectory_controller/required_drive_mode: 7
* /rig1/joint_trajectory_controller/state_publish_rate: 25
* /rig1/joint_trajectory_controller/stop_trajectory_duration: 0.5
* /rig1/joint_trajectory_controller/topic: test
* /rig1/joint_trajectory_controller/type: position_controll...
* /rig1/joint_trajectory_pid_controller/action_monitor_rate: 10
* /rig1/joint_trajectory_pid_controller/constraints/goal_time: 0.6
* /rig1/joint_trajectory_pid_controller/constraints/rig1_plate_joint/goal: 0.1
* /rig1/joint_trajectory_pid_controller/constraints/rig1_plate_joint/trajectory: 0.1
* /rig1/joint_trajectory_pid_controller/constraints/stopped_velocity_tolerance: 0.5
* /rig1/joint_trajectory_pid_controller/gains/rig1_plate_joint/d: 0.0
* /rig1/joint_trajectory_pid_controller/gains/rig1_plate_joint/i: 0.0
* /rig1/joint_trajectory_pid_controller/gains/rig1_plate_joint/i_clamp: 0.0
* /rig1/joint_trajectory_pid_controller/gains/rig1_plate_joint/p: 0.5
* /rig1/joint_trajectory_pid_controller/joints: ['rig1_plate_joint']
* /rig1/joint_trajectory_pid_controller/required_drive_mode: 3
* /rig1/joint_trajectory_pid_controller/state_publish_rate: 25
* /rig1/joint_trajectory_pid_controller/stop_trajectory_duration: 0.5
* /rig1/joint_trajectory_pid_controller/topic: test
* /rig1/joint_trajectory_pid_controller/type: position_controll...
* /rig1/rig1_plate_joint_position_controller/joint: rig1_plate_joint
* /rig1/rig1_plate_joint_position_controller/required_drive_mode: 1
* /rig1/rig1_plate_joint_position_controller/type: position_controll...
* /rig1/rig1_plate_joint_velocity_controller/joint: rig1_plate_joint
* /rig1/rig1_plate_joint_velocity_controller/required_drive_mode: 3
* /rig1/rig1_plate_joint_velocity_controller/type: velocity_controll...
* /robot_description: <?xml version="1....
* /robot_state_publisher/publish_frequency: 50.0
* /robot_state_publisher/tf_prefix: 
* /rosdistro: kinetic
* /rosversion: 1.12.13
* /script_server/rig1/action_name: /rig1/joint_traje...
* /script_server/rig1/default_vel: 0.3
* /script_server/rig1/down: [[3.14]]
* /script_server/rig1/home: [[0.0]]
* /script_server/rig1/joint_names: ['rig1_plate_joint']
* /script_server/rig1/left: [[1.5708]]
* /script_server/rig1/right: [[-1.5708]]
* /script_server/rig1/roundtrip: ['down', 'left', ...
* /script_server/rig1/service_ns: /rig1/driver
* /script_server/rig1/ticktack: ['left', 'right',...
* /script_server/rig1/up: [[0.0]]

NODES
/rig1/
driver (canopen_motor_node/canopen_motor_node)
rig1_controller_spawner (controller_manager/spawner)
rig1_joint_state_controller_spawner (controller_manager/spawner)
/
robot_state_publisher (robot_state_publisher/robot_state_publisher)

auto-starting new master
process[master]: started with pid [9070]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 157337bc-73ee-11e8-931c-78321b043645
process[rosout-1]: started with pid [9083]
started core service [/rosout]
process[robot_state_publisher-2]: started with pid [9101]
process[rig1/driver-3]: started with pid [9102]
process[rig1/rig1_joint_state_controller_spawner-4]: started with pid [9103]
process[rig1/rig1_controller_spawner-5]: started with pid [9115]
[ INFO] [1529432704.218127226]: Using fixed control period: 0.010000000
[WARN] [1529432734.635528]: Controller Spawner couldn't find the expected controller_manager ROS interface.
[WARN] [1529432734.636938]: Controller Spawner couldn't find the expected controller_manager ROS interface.
[rig1/rig1_joint_state_controller_spawner-4] process has finished cleanly
log file: /home/akosodry/.ros/log/157337bc-73ee-11e8-931c-78321b043645/rig1-rig1_joint_state_controller_spawner- 4*.log
[rig1/rig1_controller_spawner-5] process has finished cleanly
log file: /home/akosodry/.ros/log/157337bc-73ee-11e8-931c-78321b043645/rig1-rig1_controller_spawner-5*.log

If i do rosservice list there is no controller_manager:

/rig1/driver/get_loggers
/rig1/driver/get_object
/rig1/driver/halt
/rig1/driver/init
/rig1/driver/recover
/rig1/driver/set_logger_level
/rig1/driver/set_object
/rig1/driver/shutdown
/robot_state_publisher/get_loggers
/robot_state_publisher/set_logger_level
/rosout/get_loggers
/rosout/set_logger_level

And also, if i call the /rig1/driver/init, it returns with success: True, i can hear that my servo is turned on. I got the following message in the other terminal:

[ INFO] [1529433440.546777357]: Initializing XXX
[ INFO] [1529433440.547440823]: Current state: 1 device error: system:0 internal_error: 0 (OK)
[ INFO] [1529433440.547911808]: Current state: 2 device error: system:0 internal_error: 0 (OK)
EMCY: 81#0000000000000000

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

/diagnostics
/joint_states
/rosout
/rosout_agg
/tf
/tf_static

If i do rosservice list i have now the controller manager:

/rig1/controller_manager/list_controller_types
/rig1/controller_manager/list_controllers
/rig1/controller_manager/load_controller
/rig1/controller_manager/reload_controller_libraries
/rig1/controller_manager/switch_controller
/rig1/controller_manager/unload_controller
/rig1/driver/get_loggers
/rig1/driver/get_object
/rig1/driver/halt
/rig1/driver/init
/rig1/driver/recover
/rig1/driver/set_logger_level
/rig1/driver/set_object
/rig1/driver/shutdown
/robot_state_publisher/get_loggers
/robot_state_publisher/set_logger_level
/rosout/get_loggers
/rosout/set_logger_level

However, if i call for example:

rosservice call /rig1/controller_manager/load_controller "name: 'rig1_plate_joint_position_controller'"

It returns with false and message:

[ERROR] [1529433712.087792833]: Exception thrown while initializing controller rig1_plate_joint_position_controller.
Could not find resource 'rig1_plate_joint' in 'hardware_interface::PositionJointInterface'.
[ERROR] [1529433712.087895663]: Initializing controller 'rig1_plate_joint_position_controller' failed

Also after the rosservice call i get the following:

[ WARN] [1529433780.238559532]: RPDO timeout
Did not receive a response message
abort1001#0, reason: Client/server command specifier not valid or unknown.
Could not process message
discarded message 
[ WARN] [1529433790.288558376]: RPDO timeout
[ WARN] [1529433800.298543451]: RPDO timeout
[ WARN] [1529433810.298551968]: RPDO timeout
EMCY: 81#3081108001000000
EMCY: 81#3081108001000000
[ERROR] [1529433816.158555573]: RPDO timeout; Node has emergency error
[ERROR] [1529433826.168516048]: not operational; not operational
[ERROR] [1529433836.178398516]: not operational; not operational
[ERROR] [1529433846.178455135]: not operational; not operational
[ERROR] [1529433856.188484882]: not operational; not operational

At this point i am stuck. I really tried to give all the information i have regarding the testing of this package.

I would like to ask some help from the forum members. Especially, the help of @Mathias Lüdtke would be appreciated, (if im not mistaken) the owner/author of the canopen_test_utils package.

Thank you in advance. Best regards, Akos


Originally posted by akosodry on ROS Answers with karma: 121 on 2018-06-19

Post score: 0


Original comments

Comment by Mathias Lüdtke on 2018-06-20:\

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.

Comment by akosodry on 2018-06-20:
After i call:

rosservice call /rig1/controller_manager/load_controller "name: 'rig1_plate_joint_position_controller'"
$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Mathias Lüdtke with karma: 1596 on 2018-06-20

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by akosodry on 2018-06-20:
Hello Mathias! Thank you for the reply.

[6502]
ParameterName=Supported drive modes
ObjectType=0x7
DataType=0x0004
LowLimit=
HighLimit=
AccessType=ro
DefaultValue=0x0000006D
PDOMapping=1
ObjFlags=0x0

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

Comment by Mathias Lüdtke on 2018-06-20:
0D is fine, it is a bit field. And it includes bit 1 for mode 1.

Comment by akosodry on 2018-06-20:
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..

Comment by akosodry on 2018-06-20:
I also checked that ros-control is installed, ros-controllers as well.. i have no idea what could be the problem....

Comment by akosodry on 2018-06-20:
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.

Comment by akosodry on 2018-06-20:
If you have 3 minutes, HERE is the test video (first 3 minutes). Thank you in advance for your help.

Comment by Mathias Lüdtke on 2018-06-20:
Have you changed any joint/node name? It might be helpful if you update the files somewhere (e.g. github)..

Comment by akosodry on 2018-06-20:
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!

Comment by akosodry on 2018-06-20:
This is the link for the package: github link

So this is basically YOUR package, i only changed the EDS file: ASDA_A2_1042sub980_C_ORIG_mod_bonELMO.eds

and i commented out some controllers.

Comment by akosodry on 2018-06-21:
Hello @Mathias Lüdtke I also uploaded my own package (LINK) which crashes also with:

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

I have no idea what could be wrong, or what is missing?!

Comment by akosodry on 2018-06-21:
Dear Mathias! Thank you for the help, i updated the DataType and it seems that it could spawn the controller :) I can't believe that this was the problem. I also checked with Vector CANeds, but it did not give me any error.

However there is new error, i am now editing,/updating the originalquestion

Comment by akosodry on 2018-06-21:
@Mathias Lüdtke : I've just updated the original question.

Comment by Mathias Lüdtke on 2018-06-21:
I would prefer to discuss the new error in another question. Otherwise, it is really hard to follow.

Comment by akosodry on 2018-06-21:
Ive just posted a new question: link

Iam now updating this question, and mark your answer correct.

Thanks again for the help.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.