Not able to initialize driver with canopen_motor_node

asked 2019-06-13 03:34:12 -0500

mjt_28 gravatar image

Hi.

I am trying to control a maxon epos2 using ros_canopen - canopen_motor_node. I followed steps given in this answer

When I give the command:

rosservice call /test_motor/driver/init

I get the following error:

success: False
message: "/home/manuj/catkin_ws/src/ros_canopen/canopen_master/include/canopen_master/objdict.h(224):\
  \ Throw in function const EntryConstSharedPtr& canopen::ObjectDict::at(const canopen::ObjectDict::Key&)\
  \ const\nDynamic exception type: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<std::out_of_range>\
  \ >\nstd::exception::what: Unable to find key in unordered_map.\n[canopen::tag_objectdict_key*]\
  \ = 60c1sub1\n; Could not set transition"

I found this answer stating that Maxon uses 0x20C1 instead of 0x60C1, however, I can't understand how to proceed from here.

This is my config launch file:

<launch>

  <!-- Load the URDF into ROS parameter server -->
  <arg
    name="model" />
  <arg
    name="gui"
    default="False" />

  <param
    name="use_gui"
    value="$(arg gui)" />
  <node
    name="joint_state_publisher"
    pkg="joint_state_publisher"
    type="joint_state_publisher" />

  <node name="canopen_motor"
     pkg="canopen_motor_node"
     type="canopen_motor_node"
     ns="/test_motor"
     output="screen" clear_params="true">
     <rosparam command="load" file="$(find test_motor_config)/config/driver_config2.yaml" />
  </node>

  <!-- Load joint controller configurations from YAML file to parameter server -->
  <rosparam file="$(find test_motor_control)/config/test_motor_control.yaml" command="load"/>
  <param name="robot_description" textfile="$(find test_motor)/urdf/test_motor.urdf"/>

  <!-- load the controllers -->
  <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false"
    output="screen" ns="/test_motor" args="joint_state_controller
                      joint1_position_controller"/>

  <!-- convert joint states to TF transforms for rviz, etc -->
  <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher"
    respawn="false" output="screen">
    <remap from="/joint_states" to="/test_motor/joint_states" />
  </node>

    <!-- Show in Rviz   -->
    <node name="rviz" pkg="rviz" type="rviz"/>

</launch>

And this is my driver_config2.yaml:

bus:
  device: can0
sync:
  interval_ms: 10
  overflow: 0

#name: arm

defaults:
  eds_pkg: test_motor_config
  eds_file: "config/maxon2.dcf"
  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
#  dcf_overlay: # "ObjectID": "ParameterValue" (both as strings)
#    "60C1sub1": "1" # vl dimension factor numerator
#    "604Csub2": "24000" # vl dimension factor denominator

nodes:
  Joint_1:
    id: 8

Can someone please help me figure this out?

edit retag flag offensive close merge delete

Comments

Hi, I'm not sure how to solve your issue, but the first thing I can say is that the Maxon EPOS2 is not CiA 402 compatible. So you either need to make sure that you match the right addresses from your DCF file and what ros_canopen is expecting, or you need to use a compatible board like the EPOS4.

Cyril Jourdan gravatar image Cyril Jourdan  ( 2020-10-01 10:37:09 -0500 )edit