Skip to content

Feature - load, save and loop waypoints#3165

Merged
SteveMacenski merged 48 commits intoros-navigation:mainfrom
padhupradheep:feature/koad-save-loop-wp
Jan 6, 2023
Merged

Feature - load, save and loop waypoints#3165
SteveMacenski merged 48 commits intoros-navigation:mainfrom
padhupradheep:feature/koad-save-loop-wp

Conversation

@padhupradheep
Copy link
Member


Basic Info

Info Please fill out this column
Ticket(s) this addresses (add tickets here #2826 )
Primary OS tested on Ubuntu
Robotic platform tested on Gazebo simulation of Neobotix

Description of contribution in a few bullet points

  • Added new feature to load and save waypoints in a yaml file for waypoint following
  • Added the loop functionality to revisit the waypoints
  • Pause and resume button for stopping and continuing through the waypoints.

Description of documentation updates required from your changes

  • Add an example yaml file
  • Description about the functionality

Future work that may be required in bullet points

  • Update the pause status in the plugin, currently the status reads cancelled when the robot is paused in between the waypoints (will be done as part of this PR).

For Maintainers:

  • Check that any new parameters added are updated in navigation.ros.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists

@mergify
Copy link
Contributor

mergify bot commented Sep 1, 2022

@padhupradheep, please properly fill in PR template in the future. @SteveMacenski, use this instead.

  • Check that any new parameters added are updated in navigation.ros.org
  • Check that any significant change is added to the migration guide
  • Check that any new features OR changes to existing behaviors are reflected in the tuning guide
  • Check that any new functions have Doxygen added
  • Check that any new features have test coverage
  • Check that any new plugins is added to the plugins page
  • If BT Node, Additionally: add to BT's XML index of nodes for groot, BT package's readme table, and BT library lists

@padhupradheep
Copy link
Member Author

padhupradheep commented Sep 1, 2022

Still have some work left such as updating the status for pausing in the RViz plugin and renaming the variables and / or functions. Hope to complete it on the weekend.

@padhupradheep padhupradheep changed the title Feature/koad save loop wp Feature - load, save and loop waypoints Sep 1, 2022
Copy link
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.

I think the loop stuff in the WP follower is great!

@SteveMacenski
Copy link
Member

any update?

@padhupradheep
Copy link
Member Author

Not yet, still away on PTO, hopefully this should be up by mid October. Sorry for the delay.

@SteveMacenski
Copy link
Member

OK! Wow, what do I need to do to get that kind of PTO 😉

Hey, no worries, enjoy vacation! Sorry to bother.

@padhupradheep
Copy link
Member Author

padhupradheep commented Oct 10, 2022

FYI, I'm back from my PTO. Hopefully would finish it ASAP.

Just doing a rebase, so that I can catch up with all the changes made in the last month or so.

@padhupradheep padhupradheep force-pushed the feature/koad-save-loop-wp branch from 87613aa to 74374f3 Compare October 10, 2022 09:57
@padhupradheep
Copy link
Member Author

padhupradheep commented Oct 11, 2022

Okay now handling everything in the panel level. Now in the below video you can see that I'm able to select waypoints, set number of loops, start waypoint following and pausing the waypoint following at the middle and resuming it again.

Additionally you can also see, there is a status on the panel saying at which waypoint and at which loop the current navigation is happening, also when you press the pause button, you also get a note saying that the last cancelled waypoint is stored, which could be resumed.

save_load-2022-10-11_20.00.29.mp4

It is not still yet perfect (need to solve edge cases), but just wanted to know, whether will this additional status stuff be interesting for you / users ? what do you think ?

(sorry for the poor quality video and simulation performance, for some reason my graphics card is behaving weird in the 22.04, which slows down RViz a lot.)

@SteveMacenski
Copy link
Member

Yeah! Super useful! Question: if you have looping of waypoint following where you set the poses via rviz (not a file), does the initial robot point count as a starting point? That way if you loop you have the initial segment included as well? Should it? I'm not sure, but seems reasonable.

Still not a fan of the goal_index as an entry in the waypoint follower - but I can live with it if we set it to 0 by default in the msg definition so if no one fills it in, it explicitly goes to use the full list

@padhupradheep
Copy link
Member Author

if you have looping of waypoint following where you set the poses via rviz (not a file), does the initial robot point count as a starting point?

No, If the user wants to use the initial starting point as well, then he has to select the initial starting pose as like the rest of the poses. I initially thought about adding the initial pose as part of the waypoint list, then anyways if the user wants it, then he's just a drag away.

That way if you loop you have the initial segment included as well? Should it? I'm not sure, but seems reasonable.

I feel, this depends more on the use-case that the user wants to handle. Say if the user is starting from a docking area, then he definitely does not want the starting point included.

Maybe we can just handle both the cases by having a check box for selecting if the start pose needs to be included or not. Leaving the choice to the users.

Still not a fan of the goal_index as an entry in the waypoint follower - but I can live with it if we set it to 0 by default in the msg definition so if no one fills it in, it explicitly goes to use the full list

goal_index has been removed from the waypoint follower, I'm now handling everything in the panel level. I just haven't pushed the changes. 😅

@SteveMacenski
Copy link
Member

SteveMacenski commented Oct 11, 2022

Maybe we can just handle both the cases by having a check box for selecting if the start pose needs to be included or not. Leaving the choice to the users.

I like that

goal_index has been removed from the waypoint follower, I'm now handling everything in the panel level. I just haven't pushed the changes. sweat_smile

Oh? It was starting to grow on me a bit 😉

@padhupradheep
Copy link
Member Author

padhupradheep commented Oct 12, 2022

You can avoid looking at the recent commit and providing a review for it, still need to clean out few things and test for edge cases.

I'll let you know, once I'm done.

Meanwhile, I added the check for including the initial_pose

Screenshot from 2022-10-12 19-40-08

@mergify
Copy link
Contributor

mergify bot commented Oct 12, 2022

@padhupradheep, your PR has failed to build. Please check CI outputs and resolve issues.
You may need to rebase or pull in main due to API changes (or your contribution genuinely fails).

@SteveMacenski
Copy link
Member

SteveMacenski commented Oct 12, 2022

Nice!

I do think the looping feature of the WP follower is valuable, I would actually like that logic back into the WPF server if possible. I can see that being a common feature request even outside of this navigation panel tool.

@padhupradheep
Copy link
Member Author

I do think the looping feature of the WP follower is valuable, I would actually like that logic back into the WPF server if possible.

No problem!

Only thing is that, we also need the ‘goal_index’ back as well, that is very much essential for the waypoint follower to know about the pausing. As you said earlier in this thread I can set it’s default to 0.

@SteveMacenski
Copy link
Member

Ok!

@padhupradheep
Copy link
Member Author

Would be nice to have some user feedback, before marking it ready for review.

Our nice friend @jwallace42 has agreed to test it and provide some feedback tomorrow. Meanwhile, I'll also test it a bit more, making sure, there are no edge cases.

@jwallace42
Copy link
Contributor

Looks pretty good :). Here is what I found.

  1. I can crash the waypoint server by trying to follow zero waypoints. We should protect against this and just fail the action right away.
  2. If I hit the pause waypoint button then cancel it stays stuck and I cannot start a new way point following. If I don't pause and just cancel, things work as expected.
  3. Before the robot is localized at the start the save wappoints, load wappoints and pause waypoints boxes have no text in them.
  4. Server crashes if I put a huge number for loops or something that is not a number :) I think you need to bound the inputs to only positive numbers within a range.
  5. I am also able to change the loop number in the text box during nav. if you can gray that out that would be good.
  6. Way points can be put in invalid places. (outside map, LETHAL area)
  7. If I pause the waypoint, should be able to save the waypoints.

@jwallace42
Copy link
Contributor

Also,

pull in main :).

@padhupradheep padhupradheep force-pushed the feature/koad-save-loop-wp branch from 97c579d to 405803d Compare October 14, 2022 18:52
@padhupradheep
Copy link
Member Author

padhupradheep commented Oct 14, 2022

Once again, thanks for the nice feedback. @jwallace42

I am also able to change the loop number in the text box during nav. if you can gray that out that would be good.

do you mean during nav_through_poses?

Edit: Never mind! Found it!

@codecov
Copy link

codecov bot commented Oct 14, 2022

Codecov Report

Base: 89.03% // Head: 88.97% // Decreases project coverage by -0.06% ⚠️

Coverage data is based on head (c296463) compared to base (59f5a51).
Patch coverage: 88.88% of modified lines in pull request are covered.

❗ Current head c296463 differs from pull request most recent head 275ff88. Consider uploading reports for the commit 275ff88 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3165      +/-   ##
==========================================
- Coverage   89.03%   88.97%   -0.07%     
==========================================
  Files         351      351              
  Lines       15658    15662       +4     
==========================================
- Hits        13941    13935       -6     
- Misses       1717     1727      +10     
Impacted Files Coverage Δ
nav2_waypoint_follower/src/waypoint_follower.cpp 82.58% <88.88%> (-0.87%) ⬇️
nav2_costmap_2d/include/nav2_costmap_2d/layer.hpp 75.00% <0.00%> (-12.50%) ⬇️
...2_core/include/nav2_core/controller_exceptions.hpp 60.00% <0.00%> (-10.00%) ⬇️
..._planner/include/nav2_smac_planner/node_hybrid.hpp 92.85% <0.00%> (-7.15%) ⬇️
...stmap_2d/plugins/costmap_filters/binary_filter.cpp 94.80% <0.00%> (-2.60%) ⬇️
nav2_controller/src/controller_server.cpp 85.71% <0.00%> (-1.91%) ⬇️
...tree/include/nav2_behavior_tree/bt_action_node.hpp 84.21% <0.00%> (-1.76%) ⬇️
nav2_costmap_2d/src/layered_costmap.cpp 95.49% <0.00%> (-0.91%) ⬇️
nav2_navfn_planner/src/navfn_planner.cpp 96.90% <0.00%> (+1.03%) ⬆️
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@padhupradheep padhupradheep force-pushed the feature/koad-save-loop-wp branch from 05a0c85 to 68abd75 Compare October 17, 2022 10:05
@padhupradheep
Copy link
Member Author

I have added couple of additional checks to verify the specified waypoints are valid and there are no obstacle in that particular point in the map and also checked if the waypoints are specified inside the map bounds.

@jwallace42 I think I have handled all your points and most of the other edge cases, do you mind testing it once again and giving again your feedback if you have time? Your insights were really helpful last time around. Nothing urgent though, anyways Steve is away for ROSCon.

@jwallace42
Copy link
Contributor

@padhupradheep
Yeah,

I will test this today and if all goes well I will review the code :).

Do you have a docs pr up?

@padhupradheep padhupradheep force-pushed the feature/koad-save-loop-wp branch from 642d03e to 679b90a Compare January 2, 2023 12:04
Copy link
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.

I'm happy with this! Anything else before merging?

You should post on discourse about this!

@padhupradheep
Copy link
Member Author

I'm happy with this! Anything else before merging?

I was actually looking for something to update in docs. But I think the plugin is easy to understand, there is not much of a trick there.

You should post on discourse about this!

Sure, I'll take it to our community..

@SteveMacenski
Copy link
Member

I think a migration guide entry just to acknowledge the changes would be good!

I'm also going to re-run CI, I see the WPF test failed and given there are substantive changes there, its important that passes

@SteveMacenski
Copy link
Member

@padhupradheep definitely post on discourse with a nice video / gif of this is action!

@padhupradheep
Copy link
Member Author

definitely post on discourse with a nice video / gif of this is action!

Sure!

Thanks for the consistent motivation and bearing with me through the feature design. 😃

@SteveMacenski
Copy link
Member

SteveMacenski commented Jan 6, 2023

No worries at all, glad to have this in! Only took... 3 months largely due to my delays in reviews 😆

andrewlycas pushed a commit to StratomInc/navigation2 that referenced this pull request Feb 23, 2023
* able to loop, load and save wp using json

* replacing the file format to yaml from json

* feedback received and ready to be handled for pause and resume

* handling loops in waypoint follower server and adding the corresponding variables in the waypoint action

* handling goal_index

* adding pause and resume functionality for waypoint following

* handling loops and making it available only for nav through poses

* handling exceptions when invalid files are loaded

* input the file name in which waypoints need to be saved

* satisfying linters

* update

* publish waypoints after loading

* add logs for the loops

* handling everything at the panel level

* fix missing

* handling loops from the wp follower

* fixing linters

* removing rclcpp expression

* setting the default of goal_index to 0

* adding comments

* correction

* Update nav2_waypoint_follower/src/waypoint_follower.cpp

Co-authored-by: Steve Macenski <stevenmacenski@gmail.com>

* update review

* add the missing feedback

* fixes

* adding a pause state indicator, handling zero waypoints, handling cancel during pause

* greying out number of loops during nav_through_poses

* handling edge cases

* adding option to save waypoints while paused

* checking for the validity of waypoint, if it is inside the map and not in an obstacle w.r.t global costmap

* Fix pre_initial states

* solving further edge cases

* sanity check for the loaded waypoints

* clearing loaded acumulated poses, when navigating to single goal

* function name change

* renaming variable

* handling invalid punctuation

* making costmap_subs as uniqur_ptrs

* checking if the selected waypoints will be in collision - also considered footprint collsion

* jumping to accumulating state once waypoint or nav_through_pose is complete

* updates for handling 1st goal in the 1st loop + fixed pausing issue

* updates after review + adding small logo

* review fix - 1

* map frame is derived from accumulated_poses and base_frame has the option to take it from params or the default

* removing mistakes from merge

* re-add reset for navigation feedback indicator

* minors

* review update

Co-authored-by: Steve Macenski <stevenmacenski@gmail.com>
xerathyang pushed a commit to xerathyang/navigation2 that referenced this pull request Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Console screen jumps back to "normal" screen after way point following or navigating through poses.

3 participants