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

update global path manually

asked 2021-11-04 02:27:48 -0600

dinesh gravatar image

updated 2021-11-05 00:26:15 -0600

I am using neo_local_planner 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 dwa_local_planner. Navfn is being used as global path planner. Here is the parameter of neo_local_planner:

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
edit retag flag offensive close merge delete

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...

osilva gravatar image osilva  ( 2021-11-04 16:23:06 -0600 )edit

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?

dinesh gravatar image dinesh  ( 2021-11-05 00:27:30 -0600 )edit

This is the link for the source for dwa_local_planner: https://github.com/strawlab/navigatio...

When initializing:

  g_plan_pub_ = pn.advertise<nav_msgs::Path>("global_plan", 1);
  l_plan_pub_ = pn.advertise<nav_msgs::Path>("local_plan", 1);

//to get odometry information, we need to get a handle to the topic in the global namespace
      ros::NodeHandle gn;
      odom_sub_ = gn.subscribe<nav_msgs::Odometry>("odom", 1, boost::bind(&DWAPlannerROS::odomCallback, this, _1));
osilva gravatar image osilva  ( 2021-11-05 07:22:40 -0600 )edit

Also here:

//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;
    }
osilva gravatar image osilva  ( 2021-11-05 07:23:57 -0600 )edit

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.

osilva gravatar image osilva  ( 2021-11-05 07:25:28 -0600 )edit

Have you played with the look_ahead_time and look_ahead_distance?

osilva gravatar image osilva  ( 2021-11-05 07:27:06 -0600 )edit

yes. but those variables has to do nothing to do with global path update when inside obstacle scenario.

dinesh gravatar image dinesh  ( 2021-11-05 22:51:12 -0600 )edit

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?

dinesh gravatar image dinesh  ( 2021-11-05 22:57:27 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2021-11-07 09:23:19 -0600

Mike Scheutzow gravatar image

updated 2021-11-08 08:46:15 -0600

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.

edit flag offensive delete link more

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?

dinesh gravatar image dinesh  ( 2021-11-08 00:55:37 -0600 )edit

I can not, because the answer is different for every local planner. What is it that you are trying to do?

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-11-08 08:47:31 -0600 )edit

for local planner i'm using neo_local_planner and for global planner i'm using navfn ros package.

dinesh gravatar image dinesh  ( 2021-11-09 03:31:49 -0600 )edit
0

answered 2021-11-06 09:44:46 -0600

osilva gravatar image

updated 2021-11-06 10:27:11 -0600

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=tNtUg... 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.

image description

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.

edit flag offensive delete link more

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.

dinesh gravatar image dinesh  ( 2021-11-07 00:06:57 -0600 )edit

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;
    }
osilva gravatar image osilva  ( 2021-11-07 04:22:28 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2021-11-04 02:27:48 -0600

Seen: 220 times

Last updated: Nov 08 '21