General understanding of ros-canopen
Hello, over the last couple days i tried to understand the concept of ros-canopen. I do have a drive motor from dunkermotor which conforms to CiA 402. Also i do have a PEAK-USB adapter to connect the motor to my PC.
From my understanding ros_canopen provides a driver for PEAK-USB in the package socketcan_interface. After some preperation i should be able to test my setup with can-utils.
For usage with other ROS nodes i have to use either canopen_chain_node or canopen_motor_node whereby canopen_motor_node implements the CiA 402 profiles. For configuration i have to follow the description on canopen_chain_node/Configuration. I guess i only have to set a single node here since i only want to drive a single motor for testing purposes. The .eds/.dcf files should be provided by the manufacturer of my motor right? If not, can i write it by myself?
With canopen_motor_node i really get lost. What i don't get is what it all has to do with ros_control as stated in canopen_motor_node/Concepts. I am also confused about joints and URDF, do I really need a robot_description for driving a single motor?
So for the .launch file i would do something like this:
<launch>
<node pkg="canopen_motor_node" name="canopen_motor_node" type="canopen_motor_node" >
<rosparam file="$(find pkgname)/params/canopen.yaml" command="load" />
</node>
</launch>
And for the .yaml i would do something like this:
#driver params
bus:
device: can0 # socketcan network
sync:
interval_ms: 10 # set to 0 to disable sync
overflow: 0 # overflow sync counter at value or do not set it (0, default)
#canopen_chain_node params
nodes:
- name: node1
id: 1
eds_file: "$(find pkgname)/params/my_config.eds" # path to EDS/DCF file
#canopen_motor_node params
...
edit:
For the #canopen_motor_node params
i used configs recomended by jdeleon in the comments and close to the defaults described on canopen_motor_node/Configuration.
defaults: # optional, all defaults can be overwritten per node
motor_allocator: canopen::Motor402::Allocator # select allocator for motor layer
motor_layer: #settings passed to motor layer (plugin-specific)
switching_state: 2 # (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
publish: ["6042"]
When i launch this i get the errors:
[ERROR] [1528373326.152068579]: Could not find parameter robot_description on parameter server
[ERROR] [1528373326.221375434]: joint node1 was not found in URDF
Although i am not quiet sure why i would need this i wrote an URDF file and puplished it through robot_state_publisher. I added those lines to the beginning of my launch file.
<param name="robot_description" textfile="$(find pkgname)/urdf/urdf.xml"/>
<node pkg="robot_state_publisher" type="robot_state_publisher" name="rob_st_pub" >
</node>
And for the URDF i wrote the urdf.xml
<robot name="test_robot">
<link name="link1" />
<link name="link2" />
<joint name="node1" type="continuous">
<parent link="link1"/>
<child link="link2"/>
</joint>
</robot>
Now i can launch my launch file without errors.
In a terminal ...