Skip to content

Navigation following a set of waypoints#1327

Closed
fmrico wants to merge 2 commits intoros-navigation:masterfrom
fmrico:path_from_poses
Closed

Navigation following a set of waypoints#1327
fmrico wants to merge 2 commits intoros-navigation:masterfrom
fmrico:path_from_poses

Conversation

@fmrico
Copy link
Copy Markdown
Contributor

@fmrico fmrico commented Nov 5, 2019

Basic Info

Info Please fill out this column
Ticket(s) this addresses #803
Primary OS tested on Ubuntu
Robotic platform tested on gazebo simulation of turtlebot3)

Description of contribution in a few bullet points

  • I added multi waypoint navigation.
  • NavigateToPose action changed to NavigateToPoses, where the request is a path. If the path contains a single pose, it works in the same way as NavigateToPose, but it is more general.
  • I added a button to rviz plugin to test the functionality.
  • Video with the result in https://youtu.be/a9sD2xlZCek

Future work that may be required in bullet points

  • Finishing passing the tests, if you feel adequate this approach

@fmrico fmrico changed the title Path from poses Navigatiom following a ser of waypoints Nov 5, 2019
@fmrico fmrico changed the title Navigatiom following a ser of waypoints Navigation following a set of waypoints Nov 5, 2019
@bpwilcox
Copy link
Copy Markdown

bpwilcox commented Nov 5, 2019

What happens if you were to set a goal pose during the waypoint following? Would it be added to the queue, pre-empt the current waypoint but keep following the next, or pre-empt the entire queue and navigate only to the new goal?

Copy link
Copy Markdown
Contributor

@orduno orduno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'll leave the discussion about approaches to waypoint navigation to #803 and only
provide feedback about this particular solution.)

I have some minor comments and questions:

  • Compute a path through all waypoints at each update?
  • Should we differentiate between NavigateToPoses and NavigateWaypoints?
  • Should we support providing a single waypoint at a time instead of all upfront?

{

class NavigateToPoseAction : public BtActionNode<nav2_msgs::action::NavigateToPose>
class NavigateToPoseAction : public BtActionNode<nav2_msgs::action::NavigateToPoses>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change NavigateToPoseAction to NavigateToPosesAction.

- /Global Planner1/Global Costmap1
Splitter Ratio: 0.5833333134651184
Tree Height: 464
Tree Height: 452
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the changes to this file needed?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I should not have committed this file.

<Fallback>
<GoalReached/>
<ComputePathToPose goal="{goal}"/>
<ComputePathToPoses goal="{goal}"/>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think this would be a better name?

<ComputeWaypointsPath goal="{goal}"/>

@@ -1,5 +1,5 @@
#goal definition
Copy link
Copy Markdown
Contributor

@orduno orduno Nov 5, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NavigateToPoses or NavigateWaypoints? Former could mean that robot's pose should align with intermediate poses. The latter could have a final PoseStamped msg and Point array for waypoint

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a separate PR we could add feedback as waypoints are reached.


result->path.poses.clear();
result->path.poses.push_back(start);
for (auto current_waypoint : goal->poses.poses)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we're computing a path from the current location to final path going through all waypoints at each cycle. It might be more efficient to only compute a path to the next one or two waypoints.

Also the dwb controller will be receiving the entire path and given some configurations trying to align with respect to the final pose instead of the next waypoint.

{
auto partial_path = planner_->createPlan(result->path.poses.back(), current_waypoint);
result->path.header = partial_path.header;
result->path.poses.insert(result->path.poses.end(), partial_path.poses.begin(), partial_path.poses.end());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run ament_cpplint, ament_uncrustify.

result->path.poses.push_back(start);
for (auto current_waypoint : goal->poses.poses)
{
auto partial_path = planner_->createPlan(result->path.poses.back(), current_waypoint);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this would fail immediately if a path to the current_waypoint is not possible or continue the loop for the next waypoints.

@orduno
Copy link
Copy Markdown
Contributor

orduno commented Nov 5, 2019

What happens if you were to set a goal pose during the waypoint following? Would it be added to the queue, pre-empt the current waypoint but keep following the next, or pre-empt the entire queue and navigate only to the new goal?

@bpwilcox I think, @fmrico correct me if I'm wrong, but when a new nav goal (defined as an array of waypoints, not as a single pose or waypoint) comes in, it will preempt the old goal (replacing the entire array of poses). I have a question about this here.

@SteveMacenski
Copy link
Copy Markdown
Member

SteveMacenski commented Nov 6, 2019

I have implementation issues here but in spirit this seems like something we could do.

That ticket was referencing something completely different to give an example application using the navigation stack, but I don’t think that blocks this from also being a possibility, but it does bring up some optionality this PR will need to support.

Lets talk next week. I might be able to review tomorrow afternoon.

Copy link
Copy Markdown
Member

@SteveMacenski SteveMacenski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, on a first go, I have a conceptual issue with this.

I think there's alot of complexity being added that should be placed a layer up from here. The question this asks is: should navigation care about more than its current task, and my opinion is a resounding no.

Navigation is the process of going from one place to another, it's trivial to add a layer above navigation to chose to go from one navigation goal to the next using the exposed action server interface. This lets a user specify exactly what they want to have happen in a failure mode or in a stuck condition. This adds a great deal of ambiguity as to what happens when a single point task in the task list fails or what happens in a timeout condition. These are things we can create parameters to fix, but I wonder if that's architecturally the right thing to try to propagate to the navigator level. This would specify too much for a user in terms of faulty behavior that's very case dependent.

My current opinion is that this doesn't merge, but I'm very open to changing that opinion with additional context and thoughts about why its done this way in particular.

Now that would be really terrible of me to just say "no" and not offer an alternative. I think the alternative that I like (and would be willing to implement) is a package that uses the nav2 action server to accomplish waypoint following and gives the user parameters of what to do on failure (die, or continue to next one). This is what I proposed in the ticket to both give the community that capability but also give a concrete example of a use of the navigation stack that ROS1 never provided.

<BehaviorTree ID="MainTree">
<Sequence name="root">
<ComputePathToPose goal="${goal}"/>
<ComputePathToPoses goal="${goal}"/>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

goals then?

<Fallback>
<GoalReached/>
<ComputePathToPose goal="${goal}"/>
<ComputePathToPoses goal="${goal}"/>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then goals


goal_sub_ = create_subscription<geometry_msgs::msg::PoseStamped>(
"goal_pose",
goal_sub_ = create_subscription<nav_msgs::msg::Path>(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You cannot change this, revert.


RCLCPP_INFO(get_logger(), "Begin navigating from current location to (%.2f, %.2f)",
goal->pose.pose.position.x, goal->pose.pose.position.y);
RCLCPP_INFO(get_logger(), "Begin navigating from current location to (%.2f, %.2f) in %zu steps",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't accurate, you're not navigating to the last in this vector


// Update the goal pose on the blackboard
blackboard_->set("goal", goal->pose);
blackboard_->set("goal", goal->poses);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

goals

@@ -1,5 +1,5 @@
#goal definition
geometry_msgs/PoseStamped pose
nav_msgs/Path poses
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I.... don't know how I feel right now about using the nav_msgs/Path type for this. In one way of thinking about this, you could consider a set of waypoint goals to be a .... path. However, we generally talk about a path as a set of waypoints a planner creates to a goal, so this is really messing with definitions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I doubted if using nav_msgs/Path or geometry_smsgs/PoseStamped[]. You are right; it is not very accurate to call path to a sequence of waypoints.

@fmrico
Copy link
Copy Markdown
Contributor Author

fmrico commented Nov 6, 2019

Hi all,

After reading your comments and questions in this PR, and the related issue, I think that I should change the approach.

The approach presented in this PR does not support preempt, add or cancel waypoints. Monitorization is not allowed either, as information about waypoints is also lost once the path is created.

I agree with @SteveMacenski ; another layer should provide this functionality. As @orduno commented on the issue, a Mission Executor or a Bt Waypoint Navigator could be a better approach. I developed a related feature using AI planning, with ROSPlan, here [1], without modifications of the original ROS Navigation packages.

Instead of fixing this PR with the reviews that you made in the code, I think it would be better to close this PR and to work on any of the approaches you suggested to me.

Thank you for your comments and the revisions!!!
Francisco

[1] "Planning Topological Navigation for complex Indoor Environments." Francisco Martín, Jonathan Ginés, David Vargas, Francisco J. Rodríguez-Lera, Vicente Matellán. 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS 2018), October 2018.

@SteveMacenski
Copy link
Copy Markdown
Member

If you’re also willing to wait on me, I can submit what I think is the way to go and hear folks thoughts.

Its a few days of work but frankly you’ve started a good dialog and I think it would be good to have a bunch of concrete ideas taking shape to pick from.

How do you feel about that?

@orduno
Copy link
Copy Markdown
Contributor

orduno commented Nov 7, 2019

I think we need to do some prep work before jumping to the implementation. Here's what I suggest:

  • Agree on the requirements Implement waypoint following #803, fill gaps. Francisco: Are we missing requirements in order to successfully implement your paper using nav2?
  • Brainstorm/Identify possible solutions. Roughly describe the implementation.
  • Agree on one to actually code and test.

@fmrico
Copy link
Copy Markdown
Contributor Author

fmrico commented Nov 8, 2019

Hi @orduno

We are discussing this topic both in this PR and in #803. Maybe we could unify the conversation.

I agree with the requirements in #803 . I should have read this list carefully before starting my approach. I don't meet most of them.

I agree with @SteveMacenski with the idea of “stupid” navigation. But, if we want that robot does not stop and ignores rotation in intermediate waypoints, some "intelligence" must be added anywhere.

A solution could be complete the FollowPath action with a feedback value (percentage of completion, or distance to goal). We could implement a new behavior tree action that delivers the path to the next waypoint as soon the robot is near to reach the current waypoint. This BT action should manage the preemption or cancelation of waypoints.

What do you think about this approach?

Regarding implementing the approach of my paper, I could do at the current state of nav2. After porting ROSPlan to ROS2, of course, but I think that this is out of the scope of Nav2.

@SteveMacenski SteveMacenski mentioned this pull request Nov 11, 2019
@SteveMacenski
Copy link
Copy Markdown
Member

Hi,

See #1338 for what I was referring to. @fmrico let me know your thoughts.

But, if we want that robot does not stop and ignores rotation in intermediate waypoints, some "intelligence" must be added anywhere.

True, but this wouldn't do that either. One of the value propositions of an action server is that you can preempt with a new goal and not stop. So its easy to modify this code to change the goal before reaching the "end" condition (within some radius of a goal) if you choose so you don't stop. This would be easier to implement in my framework I believe, however you could also implement it in yours with a custom BT node like you mention but probably using the feedback topic (that doesn't currently exist unfortunately)

What paper are you referring to? Sorry, I guess I wasn't involved in that context.

@mkhansenbot mkhansenbot added nav2_wg Request discussion in the nav2 working group and removed nav2_wg Request discussion in the nav2 working group labels Nov 14, 2019
@mkhansenbot
Copy link
Copy Markdown
Collaborator

Based on the discussion in the Nav2 WG, we decided to use the other method to implement this (#1338).

Thank you anyway for the contribution and we hope that you will continue to contribute going forward!

@mkhansenbot
Copy link
Copy Markdown
Collaborator

Oh, one thing I forgot to discuss - the RViz part of this PR. I actually really like that and think it would be useful. @ fmrico, any chance you might want to provide that in a separate PR but change it to use the new Waypoint Follower in #1338?

@fmrico
Copy link
Copy Markdown
Contributor Author

fmrico commented Nov 15, 2019

Great @mkhansen-intel !! I will make a separate PR with the RViz part. I am happy to be able to take advantage of some of the work of this PR :)

@SteveMacenski
Copy link
Copy Markdown
Member

@fmrico what's the rviz functionality you added, can you be specific?

Is this like a "drop a bunch of markers for waypoints then execute"-type thing?

@fmrico
Copy link
Copy Markdown
Contributor Author

fmrico commented Nov 15, 2019

Hi @SteveMacenski,

It would work as shown in the video of this PR, but with the approach of #1338.

I added a button for changing from single pose navigation to waypoint navigation. You can start collecting waypoints by pushing this button and using the navigation2 Goal button of the toolbar. You can cancel this process at any time. When you had selected all the waypoints, push the button again (now the label of this button is start navigation), you call the action (it will be your action in #1338 ) with all the Poses collected.

The only weakness of this change in RViz plugin is that you don't see the accumulated waypoints. Maybe I could publish these waypoints using visualization markers to be displayed in RViz. What do you think?

@SteveMacenski
Copy link
Copy Markdown
Member

SteveMacenski commented Nov 15, 2019

Got it, more or less what I expected. I see you hover over reset after selecting each waypoint, are you selecting it or ...?

Feel free to PR that against my branch and I'll merge it in. That would be very helpful for me to test with when finishing up my PR.

It would be trivial to make the rviz panel take the points and publish a marker at the position to keep it marked for visualization.

One thing this shows that my approach wont do is plan all the waypoint paths at once. I don't know if that's good or bad, just different. I would say its bad if the plans made an attempt for continuity between waypoints (ei. smooth, continuous) but it doesn't do that since the planner has no constraints on the orientations. Also when replanning, does that replan the full trajectory between all N waypoints or just the current waypoint leg?

@fmrico
Copy link
Copy Markdown
Contributor Author

fmrico commented Nov 15, 2019

Got it, more or less what I expected. I see you hover over reset after selecting each waypoint, are you selecting it or ...?

No, I am not selecting anything. It's just a confusing mouse movement that I noticed when I uploaded the video :S

It would be trivial to make the rviz panel take the points and publish a marker at the position to keep it marked for visualization.

Ok

One thing this shows that my approach wont do is plan all the waypoint paths at once. I don't know if that's good or bad, just different. I would say its bad if the plans made an attempt for continuity between waypoints (ei. smooth, continuous) but it doesn't do that since the planner has no constraints on the orientations. Also when replanning, does that replan the full trajectory between all N waypoints or just the current waypoint leg?

I think it's good as we discussed yesterday in the nav2 WG. This video shows the third design option that presented Carlos in the diagram at #803, which we decided to discard. Now, implementing the first design option, you'll be showing only the path to the next waypoint, I guess.

@fmrico
Copy link
Copy Markdown
Contributor Author

fmrico commented Dec 16, 2019

Dear @orduno @SteveMacenski and @mkhansen-intel

I know that this PR is closed, but since Nov 7th @orduno told me:

Francisco: Are we missing requirements in order to successfully implement your paper using nav2?

I have been working on Plansys2, which was a requirement for doing topological navigation.

Today, Plansys2 is a reality, and I have an example of mixing planning and navigation

Patrolling example

I don't know if you find it interesting for any future development in Navigation2. Maybe a topological navigation?

Best regards
Francisco

@orduno orduno added the nav2_wg Request discussion in the nav2 working group label Dec 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

nav2_wg Request discussion in the nav2 working group

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants