Ask Your Question
0

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

Michael

The robot: fh_base_control.py

#!/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.init_node('fh_basecontrol')
        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 = rospy.Time.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 """
        self.now = rospy.Time.now()



        if msg.node_id == 1:    
            self.motor_position_left_new = msg.motor_position
            self.waitforMotor_Infos|=0x01


        if msg.node_id == 2:    
            self.motor_position_right_new = msg.motor_position  
            self.waitforMotor_Infos|=0x02


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

        self.waitforMotor_Infos = 0

        now = rospy.Time.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 ...
(more)
edit retag flag offensive close merge delete

Comments

Please post results from view frames (http://www.ros.org/wiki/tf/Debugging%20tools#view_frames) and the move_base params yaml files.

weiin gravatar imageweiin ( 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 imagemharms ( 2013-06-20 04:46:08 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
0

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 http://www.ros.org/wiki/navigation/Tutorials to understand how to set up your robot for autonomous navigation

edit flag offensive delete link more

Comments

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 imagemharms ( 2013-07-04 19:27:15 -0500 )edit

http://www.ros.org/wiki/amcl 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 imageweiin ( 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 imagemharms ( 2013-07-05 08:50:02 -0500 )edit

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

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

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

base_local_planner_params
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: http://www.kunst-raum.de/frames.pdf

Hope that somebody may help me.

Thanks for reading

Michael

edit flag offensive delete link more

Comments

1

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

felix k gravatar imagefelix 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 imagemharms ( 2013-06-26 04:04:18 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

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

Seen: 1,356 times

Last updated: Jul 04 '13