What should I do next with the ros_canopen when I stuck in how to change the motor velocity

asked 2020-08-13 07:06:21 -0600

HHHCMH gravatar image

updated 2020-08-15 21:34:48 -0600

I am confused on the problem I met.First here is my configuration.

When I use roslaunch test.launch Then I am stuck in what the picture shows to you: image description

It's stuck here and don't move,what should I do to make the motor move ?(This is the first problem)

Then I am confused on the problem that I want use the ros_canopen to control BLDC. How can I change the velocity of the motor ? I intend to use the linux as a canopen master , I can change the VI target velocity(6042h:00h) of master's dictionary, then the master can change the velocity of the motor by PDO. Or ros_canopen use the ros_control to change the motor velocity, if yes, what the launch file or ros instruction is ?(This is the second problem)

The test.launch:

<?xml version="1.0"?>
        <arg name="name" value="test"/>
        <include file="$(find myrobot)/launch/can/test.xml">
            <arg name="name" value="$(arg name)"/>

Here is my test.xml:

<?xml version="1.0"?>
    <arg name="name"/>
    <arg name="timeout" default="180" /> <!-- Timeout (s) for the controller spawners -->
    <!-- drivers -->
    <node ns="$(arg name)" name="driver" pkg="canopen_motor_node" type="canopen_motor_node" output="screen" clear_params="true" launch-prefix="">
        <rosparam command="load" file="$(find myrobot)/cfg/can_conf.yaml" />
        <rosparam command="load" file="$(find myrobot)/cfg/test_limits.yaml" />
        <remap from="joint_states" to="/joint_states"/>

    <!-- controllers -->
    <rosparam ns="$(arg name)" command="load" file="$(find myrobot)/cfg/test_controller.yaml" />
    <node ns="$(arg name)" name="left_wheel_velocity_controller_spawner" pkg="controller_manager" type="spawner" args="--stopped joint_velocity_controller --timeout $(arg timeout)" />
    <node ns="$(arg name)" name="$(arg name)_state_controller_spawner" pkg="controller_manager" type="spawner" args="joint_state_controller" />
    <!-- send urdf to param server -->
    <group ns="$(arg name)">
        <param name="robot_description" command="xacro --inorder '$(find myrobot)/cfg/myrobot.urdf.xacro'" />

Here is my can_conf.yaml:

  device: can0

  interval_ms: 10
  overflow: 0

defaults: # optional, all defaults can be overwritten per node
  ### 301
  eds_pkg: myrobot # optionals package name for relative path
  eds_file: "cfg/CL4-E-2-12.eds" # path to EDS/DCF file
    "3202": "65"
  motor_allocator: canopen::Motor402::Allocator # select allocator for motor layer plugin
  motor_layer: # settings passed to motor layer (plugin-specific)
    switching_state: 2 # (Switched on), state for mode switching
    monitor_mode: true # read operation mode in every cycle

    id: 4
    publish: ["6044!"]

Here is my test_limits.yaml:

      has_position_limits: true
      min_position: -10000.0
      max_position: 10000.0
      has_velocity_limits: true
      max_velocity: 500.0
      has_acceleration_limits: true
      max_acceleration: 10.0
      has_jerk_limits: true
      max_jerk: 200.0
      has_effort_limits: true
      max_effort: 100.0

Here is my test_controller.yaml:

  type: velocity_controllers/JointVelocityController
  joint: left_wheel
  required_drive_mode: 3

    type: joint_state_controller/JointStateController
    joints: [left_wheel]
    publish_rate: 50

Here is my myrobot.urdf.xacro:

<?xml version="1.0"?>
<robot xmlns:xacro="http://www.ros.org/wiki/xacro" name="myrobot">
<link name="base_link">
            <box size="5.0 0 ...
edit retag flag offensive close merge delete


Did you call the init service? (http://wiki.ros.org/canopen_chain_nod...)

Mathias Lüdtke gravatar image Mathias Lüdtke  ( 2020-08-15 07:42:04 -0600 )edit

And in general: ROS answers only show the beginning of a question, if it is very long. Better put your problem/question first.

Mathias Lüdtke gravatar image Mathias Lüdtke  ( 2020-08-15 07:44:42 -0600 )edit