Rosanswers logo


I'm trying to use the motion controller FAULHABER MCBL 3006 S AES with ros_canopen. It seems there is no tutorial on how to use ros_canopen, the closest i've found is : https://answers.ros.org/question/250174/how-to-control-maxon-motor-by-using-ros_canopen/

I use a raspberry pi 3 with a PICAN hat. The hat works fine : with candump and cansend I can communicate, send PDO request or commands.

I've followed the instructions of the answer above, so here are my configuration files :


<robot name="test_robot">
  <link name="link1" />
  <link name="link2" />

  <joint name="node1" type="continuous">
    <parent link="link1"/>
    <child link="link2"/>
    <origin xyz="1 0 0" rpy="0 0 0" />
    <axis xyz="1 0 0" />
    <limit effort="30" velocity="1.0" lower="-2.2" upper="2.7" />

The urdf file is fine when checked with check_urdf.

yaml config

  device: can0 # socketcan network
  # loopback: false # socket should loop back messages
  # driver_plugin: can::SocketCANInterface
  # master_allocator: canopen::SimpleMaster::Allocator
  interval_ms: 10 # set to 0 to disable sync
  # update_ms: <interval_ms> #update interval of control loop, must be set explecitly if sync is disabled
  overflow: 0 # overflow sync counter at value or do not set it (0, default)
heartbeat: # simple heartbeat producer, optional!
  rate: 20 # heartbeat rate
  msg: "77f#05" # message to send, cansend format: heartbeat of node 127 with status 5=Started

# struct syntax
    id: 1
    eds_pkg: can_test # optionals package name for relative path
    eds_file: "config/605.3150.70-A-EK-2-60.eds" # path to EDS/DCF file

defaults: # optional, all defaults can be overwritten per node
  # canopen_chain_node settings ..
  motor_allocator: canopen::Motor402::Allocator # select allocator for motor layer
  motor_layer: # settings passed to motor layer (plugin-specific)
    switching_state: 5 # (Operation_Enable), state for mode switching
  pos_to_device: "rint(rad2deg(pos)*1000)" # rad -> mdeg
  pos_from_device: "deg2rad(obj6064)/1000" # actual position [mdeg] -> rad
  vel_to_device: "rint(rad2deg(vel)*1000)" # rad/s -> mdeg/s
  vel_from_device: "deg2rad(obj606C)/1000" # actual velocity [mdeg/s] -> rad/s
  eff_to_device: "rint(eff)" # just round to integer
  eff_from_device: "0" # unset


<?xml version="1.0" encoding="UTF-8"?>

  <param name="robot_description" value="$(find can_test)/config/robot_description.urdf"/>

  <node name="motor" pkg="canopen_motor_node" type="canopen_motor_node">
    <rosparam command="load" file="$(find can_test)/config/can_config.yaml" />

There is no controller for now. I'm not sure this isn't required to use canopen_motor_node, I would appreciate if someone could clarify that.

But when I run roslaunch can_test test.launch I get :


 * /motor/bus/device: can0
 * /motor/defaults/eff_from_device: 0
 * /motor/defaults/eff_to_device: rint(eff)
 * /motor/defaults/motor_allocator: canopen::Motor402...
 * /motor/defaults/motor_layer/switching_state: 5
 * /motor/defaults/pos_from_device: deg2rad(obj6064)/...
 * /motor/defaults/pos_to_device: rint(rad2deg(pos)...
 * /motor/defaults/vel_from_device: deg2rad(obj606C)/...
 * /motor/defaults/vel_to_device: rint(rad2deg(vel)...
 * /motor/heartbeat/msg: 77f#05
 * /motor/heartbeat/rate: 20
 * /motor/nodes/node1/eds_file: config/605.3150.7...
 * /motor/nodes/node1/eds_pkg: can_test
 * /motor/nodes/node1/id: 1
 * /motor/sync/interval_ms: 10
 * /motor/sync/overflow: 0
 * /robot_description: /home/body/Worksp...
 * /rosdistro: kinetic
 * /rosversion: 1.12.12

    motor (canopen_motor_node/canopen_motor_node)

auto-starting new master
process[master]: started with pid [2259]

setting /run_id to 9b20be06-1e4f-11e8-9f91-b827eb24e870
process[rosout-1]: started with pid [2272]
started core service [/rosout]
process[motor-2]: started with pid [2286]
[ERROR] [1520018791.076780633]: Error document empty.
[ERROR] [1520018791.258530945]: joint node1 was not found in URDF
[motor-2] process has died [pid 2286, exit code 1, cmd /opt/ros/kinetic/lib/canopen_motor_node/canopen_motor_node __name:=motor __log:=/home/body/.ros/log/9b20be06-1e4f-11e8-9f91-b827eb24e870/motor-2.log].
log file: /home/body/.ros/log/9b20be06-1e4f-11e8-9f91-b827eb24e870/motor-2*.log

Does anyone knows why I get the error Error document empty ? I replaced in the yaml configuration file the path to the .eds file to an absolute path and removed eds_pkg but nothing changed. I searched for document empty in the source code of ros_canopen but it's not there, so this error is related to something else.

Does anyone knows why node1 is not found ? The system finds the urdf file but seems to be unable to use it properly.

Thank you

More generally, does anyone knows where I could find instructions or documentation to get started with ros_canopen ?


I haven't yet reached the a fully working canopen_motor_node. Thanks to the first answer of Mathias Lüdtke, I have been able to launch the canopen_motor_node without errors. However, when I call the service /driver/init I get the answer : could not prepare homing; Homing failed. I checked with candump, there is some CAN communication going on.

Below is the screen output of the canopen_motor_node.

process[motor-1]: started with pid [16247]
[ INFO] [1520034957.545512695]: Using fixed control period: 0.010000000
[ INFO] [1520035019.445144442]: Initializing XXX
[ INFO] [1520035019.445839182]: Current state: 1 device error: system:0 internal_error: 0 (OK)
[ INFO] [1520035019.452644703]: Current state: 2 device error: system:0 internal_error: 0 (OK)
abort6060#0, reason: Invalid value for parameter (download only).
Could not process message
[ INFO] [1520035022.549487462]: Current state: 0 device error: system:0 internal_error: 0 (OK)
[ INFO] [1520035022.549780691]: Current state: 0 device error: system:0 internal_error: 0 (OK)
Did not receive a response message
[ERROR] [1520035023.549111107]: /tmp/binarydeb/ros-kinetic-canopen-master-0.7.6/src/sdo.cpp(429): Throw in function void canopen::SDOClient::transmitAndWait(const canopen::ObjectDict::Entry&, const canopen::String&, canopen::String*)
Dynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<canopen::TimeoutException> >
std::exception::what: SDO
[canopen::tag_objectdict_key*] = 6061sub0

However the question is closed since the first question has been answered.

Originally posted by simchanu on ROS Answers with karma: 20 on 2018-03-07

Post score: 0


1 Answer 1


Rosanswers logo

[ERROR] [1520018791.076780633]: Error document empty.

The line is not related to ros_canopen, but issued by the URDF parser..

<param name="robot_description" value="$(find can_test)/config/robot_description.urdf"/>

sets robot_description to the path of the URDF file.

However, you have to set it to the content of the URDF file (see roslaunch wiki):

<param name="robot_description" textfile="$(find can_test)/config/robot_description.urdf"/>

Originally posted by Mathias Lüdtke with karma: 1596 on 2018-03-07

This answer was ACCEPTED on the original site

Post score: 1

Original comments

Comment by simchanu on 2018-03-07:
Thank you for your help,

I managed to get to the service call /driver/init. However, the call fails with the message : could not prepare homing; Homing failed. I updated the question with theses informations and new tests.

Should I open a new question or we can continue on this one ?

Comment by Mathias Lüdtke on 2018-03-07:
I would say this qualifies for a new question. canopen_motor_mode will try to home the drive if the homing method (object 0x6098) is not zero (= no homing).

Comment by simchanu on 2018-03-09:
Ok, I close the question. I will open another if necessary.

Comment by simchanu on 2018-03-19:
A new question has been opened that follows this one : https://answers.ros.org/question/284933/falhaber-mcbl-3006-with-canopen_motor_node-homing-failed/


Your Answer

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