ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

How to use controller_manager with ros_canopen

asked 2019-01-25 02:37:56 -0600

rhas gravatar image

updated 2019-01-25 04:22:58 -0600

Hi,

I am currently working on controlling two dc motors with integrated controller using ros_canopen, ROS kinetic, ubuntu 16.04.

So far I have done steps 1 through 7 in THIS answer. But I am stuck at the controller_manager part of getting it to work.

Just a tiny recap, I have made an URDF, made driver and controller configs, launched canopen_motor_node and i am able to use init, get/set_object and the other services canopen_motor_node provides.

However, as I am trying to control a diff drive robot I would like to use the diff_drive_controller so I have made the following config file for the controller:

raw19:
  mobile_base_controller:
    type        : "diff_drive_controller/DiffDriveController"
    #topic        : "test"
    left_wheel  : 'motor1'
    right_wheel : 'motor2'
    publish_rate: 50.0               # default: 50
    pose_covariance_diagonal : [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
    twist_covariance_diagonal: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 1000.0]
    required_drive_mode: 2

    # Wheel separation and diameter. These are both optional.
    # diff_drive_controller will attempt to read either one or both from the
    # URDF if not specified as a parameter
    wheel_separation : 0.42
    wheel_radius : 0.1313

    # Wheel separation and radius multipliers
    wheel_separation_multiplier: 1.0 # default: 1.0
    wheel_radius_multiplier    : 1.0 # default: 1.0

    # Velocity commands timeout [s], default 0.5
    cmd_vel_timeout: 0.25

    # Base frame_id
    base_frame_id: base_link #default: base_link

    # Velocity and acceleration limits
    # Whenever a min_* is unspecified, default to -max_*
    linear:
      x:
        has_velocity_limits    : true
        max_velocity           : 1.0  # m/s
        min_velocity           : -1.0 # m/s
        has_acceleration_limits: true
        max_acceleration       : 0.8  # m/s^2
        min_acceleration       : -0.8 # m/s^2
        has_jerk_limits        : true
        max_jerk               : 5.0  # m/s^3
    angular:
      z:
        has_velocity_limits    : true
        max_velocity           : 0.7  # rad/s
        has_acceleration_limits: true
        max_acceleration       : 0.5  # rad/s^2
        has_jerk_limits        : true
        max_jerk               : 2.5  # rad/s^3

I have tried following the edit/answer of THIS question and THIS video/answer but I can't seem to get it to work. But i don't if that is because I am not using Gazebo. I think my main issue is understanding ros_control/controller_manager and how to initiate/spawn the controllers. My preliminary thoughts are that the error is in my launch or urdf file.

Launch file

<?xml version="1.0"?>
<launch>

    <arg name="model" default="$(find robot)/urdf/rawcopy.xacro" />
    <arg name="rvizconfig" default="$(find robot)/rviz/urdf.rviz" />

  <!-- send urdf to param server -->
  <param name="/raw19/robot_description" 
     command="$(find xacro)/xacro $(arg model) --inorder" />

  <!-- robot state publisher -->
  <node ns="raw19"
    pkg="robot_state_publisher" 
    type="robot_state_publisher" 
    name="robot_state_publisher"/>

  <node ns="raw19"
    name="joint_state_publisher" 
    pkg="joint_state_publisher" 
    type="joint_state_publisher"
    output="screen"/>

  <!-- canopen_motor_node -->
  <node ns="raw19" 
        name="driver" 
        pkg="canopen_motor_node" 
        type="canopen_motor_node" 
        output="screen" 
        clear_params="true" 
        launch-prefix="">
     <rosparam command="load" file="$(find robot)/config/driver_config.yaml" />
  </node>


  <!-- controllers -->
  <rosparam command="load" 
        file="$(find robot)/config/diff_controller.yaml" />


  <!-- load_controllers -->
  <node ns="raw19"
    name="controller" 
    pkg="controller_manager" 
    type="controller_manager" 
    args="spawn
          joint_state_controller
          mobile_base_controller" 
    respawn="false" 
    output="screen"/>

  <!-- Show in Rviz   -->
  <node ns="raw19"
    name="rviz" 
    pkg="rviz" 
    type="rviz" 
    args="-d $(arg rvizconfig)" 
    required="true" />

</launch>

When i launch and run 'rostopic list' and 'rosservice list ... (more)

edit retag flag offensive close merge delete

Comments

What exactly is it that isn't working? What error message if any are you getting?

PeteBlackerThe3rd gravatar image PeteBlackerThe3rd  ( 2019-01-25 05:35:40 -0600 )edit

I would expect to get at least two services a la '*/command'. Am I wrong to assume this?

The wiki page shows no services at all.

What gave you the impression that you should see services?

gvdhoorn gravatar image gvdhoorn  ( 2019-01-25 05:51:35 -0600 )edit

As stated in Mathias' answer, I misunderstood where the service (that actually was a topic) originated from. I thought it was the controller_manager, but it was the canopen_motor_node once the system was initialized. Either way, I appreciate the help, thank you.

rhas gravatar image rhas  ( 2019-01-28 03:56:39 -0600 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2019-01-25 09:34:30 -0600

Mathias Lüdtke gravatar image

The controller manager interface will become available after a successful call to the init service (step 7). You might want to run your launchfile with roslaunch --screen to see all output.

edit flag offensive delete link more

Comments

Ah! sry, I should've caught that in the other answer. It works fine now. I ran into a problem caused by a missing default value in the eds file in 6502, as explained HERE. added it in this comment if others have same issue. Thx again

rhas gravatar image rhas  ( 2019-01-28 03:54:19 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-01-25 02:37:56 -0600

Seen: 619 times

Last updated: Jan 25 '19