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

move_base problem

asked 2013-06-02 23:51:04 -0500

mharms gravatar image

updated 2013-06-03 23:17:35 -0500

felix k gravatar image

Hello @all, I am still having a problem with our custom 4-wheel robot. I can move it with keyboard or ArbotixGUI an create a map, that's fine. With move_base started with launchfile and after click on 2D Nav Goal in RVIZ nothing happened. With additional started amcl node in rviz I see the computed route (blue and red) but the movement goes in wrong direction backwards.

Here my files. Maybe somebody can look over and may see an error. If you need more information or other files, please let me know.

Thank yo for your help


The robot:

#!/usr/bin/env python

# Stand 27.05.2013 mha

import roslib; roslib.load_manifest('fh_basecontroller')
import rospy
import tf
import math
from math import sin, cos, pi
import sys
import os
import time

from geometry_msgs.msg import Quaternion, Twist, Point, Pose, Pose2D, PoseWithCovariance, TwistWithCovariance, Vector3
from nav_msgs.msg import Odometry
from std_msgs.msg import String
from sensor_msgs.msg import JointState
from EposManager.msg import MotorInfo
from EposManager.msg import EPOSControl
import dynamic_reconfigure.server

class FH_Basectrl(object):  
    def __init__(self):

        rospy.loginfo("Init fh_basecontrol")

        # get values from conmon.launch
        self.ticks_per_meter = float(rospy.get_param("~ticks_per_meter", 1771))
        self.wheel_track = float(rospy.get_param("~wheel_track", 0.445))    # Distance of wheels, (Spurbreite)
        self.rate = float(rospy.get_param("~rate", 10))
        self.odom_angular_scale_correction = float(rospy.get_param("~odom_angular_scale_correction", 0.72))
        self.odom_linear_scale_correction = float(rospy.get_param("~odom_linear_scale_correction", 1))
        self.speed_factor = float(rospy.get_param("~speed_factor", 4000))   # for Eposmanager
        self.odom_frame = rospy.get_param("~odom_frame", "odom")
        self.base_frame = rospy.get_param("~base_frame", "base_link")

        now =
        self.timeold = now
        self.t_delta = rospy.Duration(1.0 / self.rate)
        self.t_next = now + self.t_delta
        self.then = now # time for determining dx/dy

        # reset on start
        self.x = 0
        self.y = 0
        self.theta = 0
        self.d_left = 0.0
        self.d_right = 0.0
        self.motor_position_left_old = 0
        self.motor_position_right_old = 0
        self.motor_position_left_new = 0
        self.motor_position_right_new = 0

        self.init = 1   # init counter: first Motor_Infos will be trashed
        self.waitforMotor_Infos = 0     # wait untill Motor_infos from both motors arrived 

        self._pos2D  = Pose2D()   # 2D Pose for odometrie       

        # subscriptions
        self.cmd_vel_sub = rospy.Subscriber("cmd_vel", Twist, self._HandleVelocityCommand)
        self.motorInfoSubscriber = rospy.Subscriber("motors/Motor_Info", MotorInfo, self._motorInfoCallback)

        # publisher
        self._OdometryTransformBroadcaster = tf.TransformBroadcaster()
        self._OdometryPublisher = rospy.Publisher("odom", Odometry)
        self._EPOSControlPublisher = rospy.Publisher("motors/Motor_Control", EPOSControl)

        self.joint_states_pub = rospy.Publisher('joint_states', JointState)     

    def _motorInfoCallback(self,msg):
        """ Handle EPOS Motorinfo requests """ =

        if msg.node_id == 1:    
            self.motor_position_left_new = msg.motor_position

        if msg.node_id == 2:    
            self.motor_position_right_new = msg.motor_position  

        # when both msg.motor_position arrived: go ahead
        if self.waitforMotor_Infos!=0x03:

        self.waitforMotor_Infos = 0

        now =
        if now > self.t_next:
            dt = now - self.timeold
            dt = dt.to_sec()
            self.timeold = now

        # calculate odometry
        self.d_left = (self.motor_position_left_new - self.motor_position_left_old)/ self.ticks_per_meter
        self.d_right = (self.motor_position_right_new - self.motor_position_right_old)/ self.ticks_per_meter

        # invert the direction of one motor
        self.d_right *= -1. 

        self.motor_position_left_old = self.motor_position_left_new
        self.motor_position_right_old = self.motor_position_right_new 

        # delete first values
        if self.init > 0:
            # rospy.logwarn("####### init:" + str(self.init) )
            self ...
edit retag flag offensive close merge delete


Please post results from view frames ( and the move_base params yaml files.

weiin gravatar image weiin  ( 2013-06-19 15:36:54 -0500 )edit

Hi Weiin, I posted the files and a link below. It would be great, if you can give me hint, where to look.

mharms gravatar image mharms  ( 2013-06-20 04:46:08 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2013-07-04 17:08:28 -0500

weiin gravatar image

A few things I noticed that may be causing your problem. Your velocity (twist in odom topic) seems quite high (-7m/s?). This does not match what you put in the yaml file (max_vel_x: 0.5). I suggest you review your calculation for the velocity and do a teleop check on your robot. eg, command robot to move at 0.1m/s. Check if odom twist gives 0.1m/s

You mentioned in your question you are using amcl. But the frames show /odom_map_broadcaster broadcasting map->odom. I suggest you read through to understand how to set up your robot for autonomous navigation

edit flag offensive delete link more


Hi, weiin, thanks for your answer. the error was a missing decimal point in my footprint. What do you mean with your last sentence? Can you please explain to use amcl? The right frames? thx

mharms gravatar image mharms  ( 2013-07-04 19:27:15 -0500 )edit amcl is just a method for localization within a known map. You mentioned using it in your question. But you are also using odom_map_broadcaster to broadcast a static transform. So you need to figure out what you really want. Reading through that tutorial will help.

weiin gravatar image weiin  ( 2013-07-04 20:33:18 -0500 )edit

Hi weiin, I believe that I understood the navigation-tutorials. I mentioned AMCL, because I was not sure where the error was. When I understand it right, I start AMCL on top, but dont have to create a transform manually?

mharms gravatar image mharms  ( 2013-07-05 08:50:02 -0500 )edit

yes, with amcl, you will not need the static transform /map->/odom

weiin gravatar image weiin  ( 2013-07-07 19:45:07 -0500 )edit

answered 2013-06-20 04:31:51 -0500

mharms gravatar image

updated 2013-06-20 04:43:51 -0500

Here the content of the move_base yaml-files

controller_frequency: 5.0 recovery_behavior_enabled: false clearing_rotation_allowed: false

TrajectoryPlannerROS: max_vel_x: 0.5 min_vel_x: 0.05 max_vel_theta: 2.0 min_vel_theta: 0.5 min_in_place_vel_theta: 0.5 max_rotational_vel: 2.0 min_in_place_rotational_vel: 1.0

holonomic_robot: false yaw_goal_tolerance: 0.3 # about 6 degrees xy_goal_tolerance: 0.10 # 5 cm gdist_scale: 0.6 pdist_scale: 0.8

heading_lookahead: 1.5 heading_scoring: true heading_scoring_timestep: 0.5 meter_scoring: false oscillation_reset_dist: 0.5

costmap_common_params obstacle_range: 2.5 raytrace_range: 3.0 footprint: [[27, -26], [27, 26], [-27, 26], [-27, -26]]# cw or ccw

robot_radius: 0.35

inflation_radius: 0.3 max_obstacle_height: 0.6 min_obstacle_height: 0.0 observation_sources: scan scan: {data_type: LaserScan, topic: /scan, marking: true, clearing: true, expected_update_rate: 0}

global_costmap_params.yaml global_costmap: global_frame: map robot_base_frame: base_link update_frequency: 5.0 publish_frequency: 1.0 static_map: false rolling_window: false resolution: 0.01 transform_tolerance: 2.0 map_type: costmap

local_costmap_params local_costmap: global_frame: odom robot_base_frame: base_link update_frequency: 5.0 publish_frequency: 1.0 static_map: false rolling_window: true width: 5.0 height: 5.0 resolution: 0.01 transform_tolerance: 1.0 map_type: costmap

Here the link to frames.pdf:

Hope that somebody may help me.

Thanks for reading


edit flag offensive delete link more



Please use correct highlighting, as I have done for you question, nobody can read this.

felix k gravatar image felix k  ( 2013-06-25 00:09:47 -0500 )edit

Ok, I founf out that I forgot the decimal-point in my values for the footprint ;-o, now it works fine. @felix k, I just copied the text, dont know from where the formatting comes...

mharms gravatar image mharms  ( 2013-06-26 04:04:18 -0500 )edit

Question Tools


Asked: 2013-06-02 23:51:04 -0500

Seen: 2,052 times

Last updated: Jul 04 '13