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

diff_drive_controller not publish odometry data

asked 2020-05-03 08:15:25 -0500

EmanueleCa gravatar image

I, i'm new to ROS. I'm trying to compose my personal wheeled robot but i'm encountered a trouble. I'have configured robot in this mode and i 'm able to command it through the keyboard, so the structure is fine but the diif_drive_controller drive me crazy because not publish the odometry change in it's topic.

My controller config:

joint_state_controller:
  type: joint_state_controller/JointStateController
  publish_rate: 50

mobile_base_controller:
  type        : "diff_drive_controller/DiffDriveController"
  left_wheel  : 'joint_left_wheel'
  right_wheel : 'joint_right_wheel'
  publish_rate: 10.0
  pose_covariance_diagonal : [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 0.03]
  twist_covariance_diagonal: [0.001, 0.001, 1000000.0, 1000000.0, 1000000.0, 0.03]

  # 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.220
  wheel_radius : 0.023

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

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

  # Base frame_id
  base_frame_id: base_footprint

  linear:
    x:
      has_velocity_limits    : true
      max_velocity           : 0.5  # m/s
      min_velocity           : -0.5 # m/s
      has_acceleration_limits: true
      max_acceleration       : 1.0  # m/s^2
      min_acceleration       : -1.0 # m/s^2
      has_jerk_limits        : false
      max_jerk               : 5.0  # m/s^3
  angular:
    z:
      has_velocity_limits    : true
      max_velocity           : 15.0 # rad/s
      has_acceleration_limits: false
      max_acceleration       : 1.5  # rad/s^2
      has_jerk_limits        : false
      max_jerk               : 2.5  # rad/s^3

  # Publish the velocity command to be executed.
  # It is to monitor the effect of limiters on the controller input.
  publish_cmd: true

  enable_odom_tf: true

My launch file:

<?xml version="1.0" encoding="UTF-8"?>
<launch>

    <node name='armve_control_ardu' type='serial_node.py' pkg='rosserial_python'>
        <param name='port' value='/dev/ttyACM0'/>
        <param name='baud' value='57600'/>
    </node>

    <param name="robot_description" command="$(find xacro)/xacro '$(find armve_control)/urdf/armve.xacro'" />

    <rosparam file="$(find armve_control)/config/armve_controller.yaml" command="load"/>

    <rosparam file="$(find armve_control)/config/joint_limits.yaml" command="load"/>

    <arg name="x" default="0"/>
    <arg name="y" default="0"/>
    <arg name="z" default="0.0"/>
    <arg name="use_tf_static" default="false"/> 
    <arg name="use_sim_time" default="true"/> 

    <node name="ROBOT_hardware_interface" pkg="armve_control" type="speed_wheel_hardware_interface" output="screen"/>

    <node name="robot_state_publisher" pkg="robot_state_publisher" type="robot_state_publisher" respawn="false" output="screen">
      <param name="use_tf_static" value="$(arg use_tf_static)"/>
    </node>

    <node name="controller_spawner" pkg="controller_manager" type="spawner" respawn="false" output="screen"
        args="joint_state_controller mobile_base_controller"/>

    <include file="$(find armve_control)/launch/rplidar.launch"/>

    <include file="$(find armve_control)/launch/pid.launch"/>

    <include file="$(find armve_control)/launch/imu.launch"/>

    <!-- <include file="$(find armve_control)/launch/laser_scan.launch"/> -->

    <node name="rviz" pkg="rviz" type="rviz"/>

</launch>

And this is my hardware interface that receive the velocity (rad/sec) inside the velocity interface:

#include <armve_hardware_interface/ROBOT_hardware_interface.h>

ROBOTHardwareInterface::ROBOTHardwareInterface(ros::NodeHandle& nh) : nh_(nh) {
    init();
    controller_manager_.reset(new controller_manager::ControllerManager(this, nh_));
    loop_hz_=10;
    ros::Duration update_freq = ros::Duration(1.0/loop_hz_);

    pub_l = nh_.advertise<std_msgs::Float64>("/left_wheel/setpoint",10);
    pub_r = nh_.advertise<std_msgs::Float64>("/right_wheel/setpoint ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-07-14 05:39:36 -0500

Hi, i hope you fixed the problem. if not, the odometry data is computed by the diff_drive_controller with the position data (check the implementation here). So you have to update the position of the wheel through whatever method you want. Check the Husky robot implementation , it may help you.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-05-03 08:15:25 -0500

Seen: 521 times

Last updated: May 03 '20