update global path manually
I am using neolocalplanner to control my robot. But as i observed when i use this base local plnner even if obstacle in in the global path the path is not being updated. This doesn't happens when i use dwalocalplanner. Navfn is being used as global path planner. Here is the parameter of neolocalplanner:
NeoLocalPlanner:
# The x acceleration limit of the robot in meters/sec^2
acc_lim_x : 0.25
# The rotational acceleration limit of the robot in radians/sec^2
acc_lim_theta : 0.8
# The maximum x velocity for the robot in m/s.
max_vel_x : 0.8
# The minimum x velocity for the robot in m/s, negative for backwards motion.
min_vel_x : -0.1
# The absolute value of the maximum rotational velocity for the robot in rad/s
max_rot_vel : 0.8
# The absolute value of the minimum rotational velocity for the robot in rad/s
min_rot_vel : 0.1
# The absolute value of the maximum translational velocity for the robot in m/s
max_trans_vel : 0.8
# The absolute value of the minimum translational velocity for the robot in m/s
min_trans_vel : 0.1
# The tolerance in radians for the controller in yaw/rotation when achieving its goal
yaw_goal_tolerance : 0.523599
# The tolerance in meters for the controller in the x & y distance when achieving a goal
xy_goal_tolerance : 0.1
# How long to fine tune for goal position after reaching tolerance limits [s]
goal_tune_time : 0.5
# How far to predict control pose into the future based on latest odometry [s]
lookahead_time : 0.2
# How far to look ahead when computing path orientation [m]
lookahead_dist : 0.5
# Threshold yaw error below which we consider to start moving [rad]
start_yaw_error : 0.2
# Gain when adjusting final x position for goal [1/s]
pos_x_gain : 1
# Gain for lane keeping based on y error (differential only) [rad/s^2]
pos_y_yaw_gain : 1
# Gain for lane keeping based on yaw error (differential only) [1/s]
yaw_gain : 1
# Gain for adjusting yaw when not translating, or in case of holonomic drive [1/s]
static_yaw_gain : 3
# Gain for y cost avoidance (differential only)
cost_y_yaw_gain : 0.1
# How far ahead to compute y cost gradient (constant offset) [m]
cost_y_lookahead_dist : 0
# How far ahead to compute y cost gradient (dynamic offset) [s]
cost_y_lookahead_time : 1
# Gain for yaw cost avoidance
cost_yaw_gain : 1
# Gain for final control low pass filter
low_pass_gain : 0.5
# Max cost to allow, above we slow down to min_trans_vel or even stop
max_cost : 0.95
# Max velocity based on curvature [rad/s]
max_curve_vel : 0.2
# Max distance to goal when looking for it [m]
max_goal_dist : 0.5
# Max distance allowable for backing up (zero = unlimited) [m]
max_backup_dist : 0.5
# Minimal distance for stopping [m]
min_stop_dist : 0.5
# If robot has differential drive, holonomic otherwise
differential_drive : true
max_update_count: 20
Asked by dinesh on 2021-11-04 02:27:48 UTC
Answers
Studying the dwa_local_planner
code I learned a few things. I will list first the sources of information used:
https://www.youtube.com/watch?v=tNtUgMBCh2g very good short explanation http://wiki.ros.org/dwa_local_planner ROS wiki
As show in the picture the robot samples the robot control space, performs forward simulation to predict what would happen and evaluates each trajectory.
In code:
The method bool DWAPlannerROS::computeVelocityCommands(geometry_msgs::Twist& cmd_vel)
it calls for
base_local_planner::prunePlan(global_pose, transformed_plan, global_plan_);
Looking at what prunePan is doing as per the method description
void prunePlan(const geometry_msgs::PoseStamped& global_pose, std::vector<geometry_msgs::PoseStamped>& plan, std::vector<geometry_msgs::PoseStamped>& global_plan);
/**
* @brief Transforms the global plan of the robot from the planner frame to the frame of the costmap,
* selects only the (first) part of the plan that is within the costmap area.
* @param tf A reference to a transform listener
* @param global_plan The plan to be transformed
* @param robot_pose The pose of the robot in the global frame (same as costmap)
* @param costmap A reference to the costmap being used so the window size for transforming can be computed
* @param global_frame The frame to transform the plan to
* @param transformed_plan Populated with the transformed plan
*/
So I believe this is the point of interaction with the costmap.
Asked by osilva on 2021-11-06 09:44:46 UTC
Comments
Well i looked at its definition here but i didn't found any logic which is either checking if global path in valid or updating the global path if inside local costmap/invalid.
Asked by dinesh on 2021-11-07 00:06:57 UTC
You are correct @dinesh. There is no check for global path planning in this function but it happens just before this function is called:
costmap_2d::Costmap2D costmap;
costmap_ros_->getCostmapCopy(costmap);
std::vector<geometry_msgs::PoseStamped> transformed_plan;
//get the global plan in our frame
if(!base_local_planner::transformGlobalPlan(*tf_, global_plan_, *costmap_ros_, costmap_ros_->getGlobalFrameID(), transformed_plan)){
ROS_WARN("Could not transform the global plan to the frame of the controller");
return false;
}
Asked by osilva on 2021-11-07 05:22:28 UTC
But as i observed when i use this base local plnner even if obstacle in in the global path the path is not being updated.
This is expected behavior.
In standard move_base, the global planner and the local planner are never active at the same time. move_base first calls the global planner. If the global planner succeeds, move_base calls the local planner and waits for it to declare success or failure. Note that the local planner is not required to use the global plan that it is passed to it; the global plan is just a hint that the local planner may use or ignore.
If the local planner declares failure, then move_base checks whether error recovery is enabled. If it is, then move_base repeats the above sequence of operations.
If the global planner is called again, and if the obstacle is present in the global costmap, then I would expect the global plan to adjust for that obstacle. The global planner does not look at the local costmap, so any obstacles in there have no effect on the global plan.
Asked by Mike Scheutzow on 2021-11-07 10:23:19 UTC
Comments
Can you show me the file and code segment where move_base or local_base_planner checks if local_path is valid or not by using local costmaps?
Asked by dinesh on 2021-11-08 01:55:37 UTC
I can not, because the answer is different for every local planner. What is it that you are trying to do?
Asked by Mike Scheutzow on 2021-11-08 09:47:31 UTC
for local planner i'm using neo_local_planner and for global planner i'm using navfn ros package.
Asked by dinesh on 2021-11-09 04:31:49 UTC
Comments
Hi @dinesh, this planner fairly new so I am not very familiar and i couldn't too much info in the documentation or repo. Could share your settings please. I am looking at the source code, and it should be updating when obstacles are encountered: https://github.com/neobotix/neo_local_planner/blob/kinetic/src/NeoLocalPlanner.cpp
Asked by osilva on 2021-11-04 16:23:06 UTC
I've updated the setting. Can you show me from which code segment does the dwa_local_planner updates the global path and how interacts with global planner i.e NavFn to update new global path?
Asked by dinesh on 2021-11-05 00:27:30 UTC
This is the link for the source for
dwa_local_planner
: https://github.com/strawlab/navigation/blob/master/dwa_local_planner/src/dwa_planner_ros.cppWhen initializing:
Asked by osilva on 2021-11-05 07:22:40 UTC
Also here:
Asked by osilva on 2021-11-05 07:23:57 UTC
I am sure I missed some other parts but hope this helps. This weekend I will try to do a side by side comparisons of these different local planners by studying the source code and any info I can get. From what I read
neo_local_planner
is only pure pursuit.Asked by osilva on 2021-11-05 07:25:28 UTC
Have you played with the
look_ahead_time
andlook_ahead_distance
?Asked by osilva on 2021-11-05 07:27:06 UTC
yes. but those variables has to do nothing to do with global path update when inside obstacle scenario.
Asked by dinesh on 2021-11-05 22:51:12 UTC
Do you know how local_base_planner like dwa_local_planner checks if global path is valid i.e not inside costmap and updates the global path?
Asked by dinesh on 2021-11-05 22:57:27 UTC
@dinesh, I'd add further information as answer as I am limited with comments formatting.
Asked by osilva on 2021-11-06 09:23:49 UTC