Robot does not rotate in the desired/efficient direction
I am using DWA_plannar and move_base in my robot. There are 2 ToF sensors and couple laser scanners attached to the robot. The robot reaches the goal and moves without any issuse but sometimes or rather often it rotates randomly and it rotates in an inefficient direction.
TrajectoryPlannerROS:
acc_lim_x: 2
acc_lim_y: 0.0
acc_lim_theta: 2.0
max_vel_x: 0.3
min_vel_x: 0.05
max_rotational_vel: 0.75
max_vel_theta: 0.4
min_vel_theta: -0.4
min_in_place_vel_theta: 0.32
holonomic_robot: false
escape_vel: -0.1
# Goal Tolerance Parameters
yaw_goal_tolerance: 0.09
xy_goal_tolerance: 0.1
latch_xy_goal_tolerance: false
# Forward Simulation Parameters
sim_time: 4.0
sim_granularity: 0.35
angular_sim_granularity: 0.07
vx_samples: 12
vtheta_samples: 50
controller_frequency: 20.0
# Trajectory scoring parameters
meter_scoring: true
occdist_scale: 0.02
pdist_scale: 1.6
gdist_scale: 0.8
heading_lookahead: 2.0
heading_scoring: true
heading_scoring_timestep: 2.0
dwa: true
simple_attractor: false
publish_cost_grid_pc: true
#Oscillation Prevention Parameters
oscillation_reset_dist: 0.1
escape_reset_dist: 0.2
escape_reset_theta: 0.1
DWAPlannerROS:
publish_traj_pc: true
global_frame_id: map
max_vel_y: 0
min_vel_y: 0
acc_lim_y: 0
vy_samples: 0
max_vel_trans: 0.4
min_vel_trans: 0.0
max_vel_x: 0.4
min_vel_x: 0.0
max_vel_theta: 0.6
min_vel_theta: 0.1
acc_lim_x: 0.8
acc_lim_theta: 2.66
The question is similar to this. Generally the planning and direction of movement to the goal is fine but sometimes the robot starts rotating and the rotation is not so efficient. For example, rotate 270 degrees to the right instead of just 90 to the left. Eventually it reaches the goal but not so efficiently. I am considering changing/tuning Goal tolerance or Forward Simulation or Trajectory Scoring params but I don't know the right way to tune them since one params influence the other.