How to use canopen_master ?

asked 2018-03-14 10:07:47 -0500

Dizett gravatar image

How to use canopen_master ? I have .eds file. How to send data to device?

edit retag flag offensive close merge delete

Comments

Hi Dizett! I'm also in your situation. I can init the motors but I don't know how to give any order to move the motors.

If you get it, please, could you explain it?

Thank you!

jdeleon gravatar image jdeleon  ( 2018-06-04 03:00:55 -0500 )edit

make sure that the .eds file does not contain errors.

Dizett gravatar image Dizett  ( 2018-06-08 05:14:45 -0500 )edit

.launch file

<launch>
  <arg name="yaml"/>
  <node name="canopen_chain" pkg="canopen_chain_node" type="canopen_chain_node" output="screen" respawn= "true" clear_params="true">
    <rosparam command="load" file="$(find my_pkg)/eds/my_yaml.yaml" />
  </node>
</launch>
Dizett gravatar image Dizett  ( 2018-06-08 05:18:12 -0500 )edit

.yaml

bus:
  device: can0
  loopback: true # socket should loop back messages
  master_allocator: canopen::SimpleMaster::Allocator
sync:
  interval_ms: 10
  overflow: 10
nodes:
  device_name:
    id: 0x20 #you must know the address of the device
    eds_file: path_to_eds.eds
Dizett gravatar image Dizett  ( 2018-06-08 05:21:34 -0500 )edit

and using

rosservice call /driver/set_object "node: 'device_name '
object: '6200sub2' 
value: '5'
cached: false"

With this command, you send a value of 5 to the device "device_name" by the address from the .eds file.

Dizett gravatar image Dizett  ( 2018-06-08 05:26:48 -0500 )edit

or in code

  send_service_("device_name", "6200sub2", 5);
Dizett gravatar image Dizett  ( 2018-06-08 05:28:04 -0500 )edit

@Dizett, my launch file differs

<node ns="hexapodo" name="driver" pkg="canopen_motor_node" type="canopen_motor_node" output="screen" clear_params="true" launch-prefix="">
<rosparam command="load" file="$(find canopen_chain_node)/config/canopen.yaml" />
</node>
jdeleon gravatar image jdeleon  ( 2018-06-08 05:29:37 -0500 )edit

In the device_name, the ID is the serial number of the motor or the Node ID in the CAN network?

Which instruction is 6200 in your motor? I don't have that one in Maxon MCD Epos

jdeleon gravatar image jdeleon  ( 2018-06-08 05:34:45 -0500 )edit