Control single Maxon motor after successful ros_canopen initialization
Hello there,
I do have some decent experience with ROS, but I am quite a newbie in CANopen topic. My goal is to control a single Maxon EC-40 motor with EPOS 50/5 CAN controller through CANopen interface. From a hardware point of view, I communicate from the laptop to the EPOS controller through PEAK USB-CAN interface. I have basically followed steps (here) and set up all the required files. DCF file was exported directly from EPOS Studio.
CANopen bus layer:
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
ROS layer:
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)"
#dcf_overlay: "ObjectID": "ParameterValue" (both as strings)
# "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
Launch file
?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>
</launch>
Unfortunately, it still does not allow me to control the motor. I am currently able to successfully initialize the motor by rosservice call steering_motor/driver/init
, although with a few error messages received:
SUMMARY
========
CLEAR PARAMETERS
* /steering_motor/driver/
PARAMETERS
* /robot_description: <?xml version="1....
* /rosdistro: melodic
* /rosversion: 1.14.10
* /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/publish: ['607A!']
* /steering_motor/driver/defaults/vel_to_device: rint(rad2deg(vel)...
* /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
NODES
/steering_motor/
driver (canopen_motor_node/canopen_motor_node)
auto-starting new master
process[master]: started with pid [30268]
ROS_MASTER_URI=http://localhost:11311
setting /run_id to d947f37c-b72e-11eb-9f66-58961d164e50
process[rosout-1]: started with pid [30290]
started core service [/rosout]
process[steering_motor/driver-2]: started with pid [30297]
[ INFO] [1621269741.800681492]: Using fixed control period: 0.010000000
[ INFO] [1621269746.541325278]: Initializing...
[ INFO] [1621269746.541768368]: Current state: 1 device error: system:0 internal_error: 0 (OK)
[ INFO] [1621269746.542097004]: Current state: 2 device error: system:0 internal_error: 0 (OK)
[ERROR] [1621269746.545863050]: Received error frame: 20000004#0000000000000000
[ERROR] [1621269746.546110144]: Received error frame: 20000004#0020000000000000
[ERROR] [1621269746.549603030]: Received error frame: 20000004#0008000000000000
[ERROR] [1621269747.550652964]: Did not receive a response message
[ WARN] [1621269747.550928842]: discarded message
[ERROR] [1621269748.065201756]: EMCY received: 81#0000000000000000
[ INFO] [1621269748.065908210]: Initializing successful
But I am fairly unsure about the next step. Is it sufficient to simply publish required ...