How to modify move_base minimum velocities?

asked 2019-01-16 04:26:04 -0500

stevemartin gravatar image

updated 2019-01-17 02:01:05 -0500

I am using navigation stack in order to navigate my robot. I know that after giving a goal, move_pase constructs global and local plans. Using local plan, move_base publisher to /cmd_vel topic in order to move my robot.

I have written yaml file to set the parameters for the local plan like this: ecovery_behavior_enabled: true clearing_rotation_allowed: true

TrajectoryPLannerROS:
  acc_lim_x: 1
  acc_lim_y: 0 # as we have a differential robot
  acc_lim_theta: 1.6
  max_vel_x: 1.6 # configure, was 0.2
  min_vel_x: 0.8 # was 0.1
  max_vel_y: 0.0  # zero for a differential drive robot
  min_vel_y: 0.0
  max_vel_theta: 1.0 # 0.35
  min_vel_theta: 0.0 #-0.35
  min_in_place_vel_theta: 0.4 #0.25
  min_rot_vel: 0.1
  escape_vel: 0.0

  holonomic_robot: false

  meter_scoring: true

  xy_goal_tolerance: 0.3 # 0.15, 0.3->about 20 cm
  yaw_goal_tolerance: 0.20 # 0.25, about 11 degrees
  latch_xy_goal_tolerance: true  #false

  sim_time: 4 # <2 values not enough time for path planning and can't go through narrow
  sim_granularity: 0.05 # How frquent should the points on trajectory be examined
  angular_sim_granularity: 0.025
  vx_samples: 5
  vy_samples: 0 # 0 for differential robots
  vtheta_samples: 5
  controller_frequency: 15

  pdist_scale: 0.8
  gdist_scale: 0.4
  occdist_scale: 0.01
  oscillation_reset_dist: 0.2
  heading_scoring: false
  heading_lookahead: 0.1 # how far to look ahead in meters
  heading_scoring_timestep: 0.8
  dwa: true
  publish_cost_grid_pc: false
  global_frame_id: odom
  simple_attractor: false

  reset_distance: 4

  prune_plan: true

As you can see, I specifically said that the minimum x vel is 0.8 because from my motor speed calculations:

def callback(self, msg):
    transVelocity = msg.linear.x
    rotVelocity = msg.angular.z
    velDiff = (self.wheelSep * rotVelocity) / 2.0
    leftPower = (transVelocity + velDiff) / self.wheelRadius
    rightPower = (transVelocity - velDiff) / self.wheelRadius
    self.pwm_left.ChangeDutyCycle(leftPower)
    self.pwm_right.ChangeDutyCycle(rightPower)

When the x.linear velocity is small my wheels do not spin as it has not enough power. However, after setting a goal and listening to /cmd_vel topic I get this message:

linear: 
  x: 0.55
  y: 0.0
  z: 0.0
angular: 
  x: 0.0
  y: 0.0
  z: -0.368421052632

Why is linar X is below 0.8? having those values, from my callback formula it will only deliver 20% of duty cycle and it is not enough.

My move_base launch file:

 <!-- Launch move_base -->
   <node pkg="move_base" type="move_base" name="move_base" output="screen"> 
     <!--param name="base_global_planner" value="simple_planner/SimplePlanner"/-->
   <rosparam file="$(find map)/config/costmap_common_params.yaml" command="load" ns="global_costmap" />
   <rosparam file="$(find map)/config/costmap_common_params.yaml" command="load" ns="local_costmap" />
   <rosparam file="$(find map)/config/local_costmap_params.yaml" command="load"/>
   <rosparam file="$(find map)/config/global_costmap_params.yaml" command="load"/>
   <rosparam file="$(find map)/config/trajectory_planner.yaml" command="load"/>
   <rosparam file="$(find map)/config/move_base_params.yaml" command="load"/>
   <rosparam file="$(find map)/config/global_planner_params.yaml" command="load"/>
   </node>
edit retag flag offensive close merge delete

Comments

Where are you using this callback? Maybe you are overwriting the cmd_vel somewhere. The local planner will limit the cmd vel to 0.8 in its output but that can be overwritten, especialy if topics are renamed. Can you also post the contents of your move_base.launch?

pavel92 gravatar image pavel92  ( 2019-01-17 01:34:01 -0500 )edit
1

@pavel92 I can confirm that no other topic publishes to cmd_vel (by rostopic info ...). I have also added the move_base launch I am using the callback inside other package where I control my motor

stevemartin gravatar image stevemartin  ( 2019-01-17 02:00:35 -0500 )edit

Please make sure that no one access cmd_vel while move_base is using it. Keyboard teleop is always flooding 0 velocities too.

For the left and right power, you might need to have the effort multiplier to tune cmd_vel to equal actual speed - by physically or visually measuring on actual robot

C3MX gravatar image C3MX  ( 2019-01-17 02:23:05 -0500 )edit
1

or use the wheel encoder output topic (/odom) to measure how exactly the wheel speed is and try to multiply the power to match the output velocities>

C3MX gravatar image C3MX  ( 2019-01-17 02:25:29 -0500 )edit
1

@C3MX Yes I did tune the velocity and I got around 0.5 m/s (0.47 -> 0.52) on 100% duty cycle. I just tried again on my PC and it worked, will try again on Embedded

stevemartin gravatar image stevemartin  ( 2019-01-17 02:28:44 -0500 )edit
1

A comment: move base outputs velocity commands. It sounds like you're using it as a torque command. Not the same thing. Your robot is responsible for outputting whatever duty cycle is required to meet the velocity requirements. You may get it to work, but unlikely to work well. Do you have encoders?

billy gravatar image billy  ( 2019-01-17 11:58:19 -0500 )edit
1

@billy Then how would you recommend me using the velocity commands and duty cycle? Yes I do have encoders, optical ones. Can you answer below? As I have wasted a lot of time trying to figure out how to combine those.

stevemartin gravatar image stevemartin  ( 2019-01-17 12:23:19 -0500 )edit
1

@billy Also, I managed to get the velocity restrictions, just rewrote everything.

stevemartin gravatar image stevemartin  ( 2019-01-17 12:24:22 -0500 )edit