Ask Your Question
0

ros_canopen with joint_position_controller does not work

asked 2021-08-19 12:27:39 -0500

martinlucan gravatar image

updated 2021-08-19 12:40:23 -0500

Hello,

I have successfully implemented joint_velocity_controller on my Maxon motor, which works pretty well. In my final setup, I plan to use joint_position_controller. Unfortunately, when I launch nodes with joint_position_controller, after rosservice call /steering_motor/driver/init the motor start to run itself to a certain position value, even though my position commands is 0. Moreover, when the motor stops at that "spontaneous" position, it does not react to any of my manual position control commands. There is also an EMCY error message: 81#2032040000000000 , does anyone know what it refers to? Do you know where this "initial" position command might come from?

Launchfile:

<?xml version="1.0"?>

<launch>  

  <param name="robot_description" command="$(find xacro)/xacro.py '$(find maxon_canopen)/urdf/robot.urdf'" />
  <node ns="steering_motor" name="driver" pkg="canopen_motor_node" type="canopen_motor_node" output="screen" clear_params="true"  required="true" launch-prefix=""> 
     <rosparam command="load" file="$(find maxon_canopen)/config/can0.yaml" />
     <rosparam command="load" file="$(find maxon_canopen)/config/maxon_driver.yaml" />
  </node>

  <!-- Load joint controller configurations from YAML file to parameter server -->
  <rosparam file="$(find maxon_canopen)/config/controllers.yaml" command="load" ns="steering_motor"/> 

  <!-- load the controllers -->
  <node name="controller_spawner" pkg="controller_manager" type="controller_manager" respawn="false"
      output="screen" ns="steering_motor" args="spawn
                                                joint_state_controller
                                                joint_position_controller"/>

</launch>

driver.yaml

name: steering_motor

defaults:
  eds_pkg: maxon_canopen
  eds_file: "config/steering_config_3.dcf"

  #the following scaling is due to 16bit value range limitation of velocity command in vl mode (2)
  #vel_to_device: "rint(rad2deg(vel)*250)"
  motor_allocator: canopen::Motor402::Allocator # select allocator for motor layer
  switching_state: 1 # (Operation_Enable), state for mode switching

  #overflow: 0
  #dcf_overlay: 

  #  "606B": "1" # vl dimension factor numerator
  #  "606C": "24000" # vl dimension factor denominator
 # list of objects to be published (one topic per node)
  publish: [607A]

nodes:
  arm_1_joint:
    id: 1

can.yaml

bus:
  device: can0
  baudrate: 500K  
  diagnostic_period: 10
sync:
  interval_ms: 10
  overflow: 0
heartbeat: # simple heartbeat producer, optional!
  rate: 20 # heartbeat rate
  msg: "1#05" # message to send, cansend format: heartbeat of node 127 with status 5=Started

controller.yaml

joint_state_controller:
    type: joint_state_controller/JointStateController
    joint: arm_1_joint
    publish_rate: 50
    required_drive_mode: 1

joint_position_controller:
    type: position_controllers/JointPositionController
    joint: arm_1_joint
    required_drive_mode: 1

joint_velocity_controller:
    type: velocity_controllers/JointVelocityController
    joint: arm_1_joint
required_drive_mode: 3

A snippet of a terminal after launchfile, which shows successful initialization:

SUMMARY
========

CLEAR PARAMETERS
 * /steering_motor/driver/

PARAMETERS
 * /robot_description: <?xml version="1....
 * /rosdistro: melodic
 * /rosversion: 1.14.11
 * /steering_motor/driver/bus/baudrate: 500K
 * /steering_motor/driver/bus/device: can0
 * /steering_motor/driver/bus/diagnostic_period: 10
 * /steering_motor/driver/defaults/eds_file: config/steering_c...
 * /steering_motor/driver/defaults/eds_pkg: maxon_canopen
 * /steering_motor/driver/defaults/motor_allocator: canopen::Motor402...
 * /steering_motor/driver/defaults/publish: ['607A']
 * /steering_motor/driver/defaults/switching_state: 1
 * /steering_motor/driver/heartbeat/msg: 1#05
 * /steering_motor/driver/heartbeat/rate: 20
 * /steering_motor/driver/name: steering_motor
 * /steering_motor/driver/nodes/arm_1_joint/id: 1
 * /steering_motor/driver/sync/interval_ms: 10
 * /steering_motor/driver/sync/overflow: 0
 * /steering_motor/joint_position_controller/joint: arm_1_joint
 * /steering_motor/joint_position_controller/required_drive_mode: 1
 * /steering_motor/joint_position_controller/type: position_controll...
 * /steering_motor/joint_state_controller/joint: arm_1_joint
 * /steering_motor/joint_state_controller/publish_rate: 50
 * /steering_motor/joint_state_controller/required_drive_mode: 1
 * /steering_motor/joint_state_controller/type: joint_state_contr...
 * /steering_motor/joint_velocity_controller/joint: arm_1_joint
 * /steering_motor/joint_velocity_controller/required_drive_mode: 3
 * /steering_motor/joint_velocity_controller/type: velocity_controll ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2021-08-20 06:32:15 -0500

Mathias Lüdtke gravatar image

EMCY error message: 81#2032040000000000 , does anyone know what it refers to?

These EMCY message must be documented in the manual.

You might have to recover from that error! Check /diagnostics

Do you know where this "initial" position command might come from?

Normally, there should not be any "initial position". JointPositionController should use the current position at start-up.

Try to decode your PDOs in your candump to see what actually gets command. Actually, it looks like you are commanding the target per SDO (which is fine).

even though my position commands is 0.

Where is "0"? Did you configure homing? Are you using an absolute encoder? Are you reading the position from the corresponding object?

edit flag offensive delete link more

Comments

Thanky you @Mathias Lüdtke , I have tried to find out the error meaning. According to general CANopen manuals, 0x20xx is supposed to present current issues. The manufacturer's manual does not explain this explicit error message. The error message does not disable the motor, therefore there is no need to recover the motor via rosservice. Indeed, a homing method is set to "Actual position", the motor should remain still. It uses only a rotary incremental encoder.

Do you recommend changing PDO parameters straight in DCF file or through dcf_overlay?

martinlucan gravatar image martinlucan  ( 2021-08-20 10:17:36 -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

2 followers

Stats

Asked: 2021-08-19 12:27:39 -0500

Seen: 28 times

Last updated: Aug 20