Move motor in velocity mode with ros_canopen

asked 2019-10-29 15:06:08 -0600

simons gravatar image

I am trying to get my nanotec motors running in velocity mode using ros_canopen. I managed to initialize the motor node, but I am stuck with sending commands to the motor. When I try to send commands with ./canopencomm I get discarded messages in the launch-terminal. Right now, I don't know how to get on going with the ros_canopen library.

Is there something obvious that I am missing or do you have some input for me? Is there from this starting point a guide that I can follow, so I can get my motors turning at a defined speed?

My reduced driver_controller.yaml:

## joint_names
joint_names: [orthos_motor_right_1_joint]

## control_mode_adapter
#max_command_silence: 0.5

## joint_state_controller
    type: joint_state_controller/JointStateController
    publish_rate: 50

## velocity controller
  type: velocity_controllers/JointVelocityController
  joint: orthos_motor_right_1_joint
  required_drive_mode: 2

my reduced controller.yaml

name: locomotion
  eds_pkg: orthos_driver
  eds_file: "/config/PD4.eds" # the parser reads EDS and DCF
    "1017": "1000"
    "6098": "34"
    "6502": "0x000003CF"

    "1A00sub1": "0x60410010"
    "1A00sub2": "0x60610008"
    "1A01sub1": "0x60640020"
    "1A02sub1": "0x60440010"
    "1A02sub2": "0x606C0020"
    "1A03sub1": "0x60FD0020"

    "1600sub1": "0x60400010"
    "1600sub2": "0x60600008"
    "1600sub3": "0x32020020"
    "1601sub1": "0x607A0020"
    "1601sub2": "0x60810020"
    "1602sub1": "0x60420010"

# optional, all defaults can be overwritten per node
  motor_allocator: canopen::Motor402::Allocator # select allocator for motor layer
  switching_state: 2


    id: 1

my robot.launch file, that I can launch without errors:

<?xml version="1.0"?>
  <!-- send urdf to param server -->
  <param name="robot_description" command="$(find xacro)/xacro --inorder '$(find orthos_description)/urdf/orthos.xacro'" />

<!-- motor node -->
  <node ns="locomotion" name="locomotion_driver" pkg="canopen_motor_node" type="canopen_motor_node" output="screen" clear_params="true" launch-prefix="">
     <rosparam command="load" file="$(find orthos_driver)/config/can0.yaml" />
     <rosparam command="load" file="$(find orthos_driver)/config/driver.yaml" />

  <!-- load controller-->
  <rosparam ns="locomotion" command="load" file="$(find orthos_driver)/config/driver_controller.yaml" />

  <!-- start/spawn controller-->
  <node ns="locomotion" name="locomotion_driver_spawner" pkg="controller_manager" type="controller_manager" args="spawn joint_state_controller" respawn="false" output="screen"/>  

  <node ns="locomotion" name="joint_states_relay" pkg="topic_tools" type="relay" args="joint_states /joint_states" cwd="node" respawn="true" output="screen"/>


The initialization:

rosservice call /locomotion/driver/init
success: True
message: ''
edit retag flag offensive close merge delete


Hi, I'm also trying to send a velocity command. Did you get it working ?

Cyril Jourdan gravatar image Cyril Jourdan  ( 2020-10-10 03:27:10 -0600 )edit