ros_canopen with joint_position_controller does not work
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 ...