Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Added GoalUpdatedController BT plugin node #3044

Conversation

relffok
Copy link
Contributor

@relffok relffok commented Jun 25, 2022

Signed-off-by: relffok [email protected]


Basic Info

Info Please fill out this column
Ticket(s) this addresses #3037
Primary OS tested on Ubuntu
Robotic platform tested on turtlebot (simulation)

Description of contribution in a few bullet points

  • Added a draft of the GoalUpdatedController plugin node

Description of documentation updates required from your changes

  • Plugin needs to be listed under Decorator Plugin List

Future work that may be required in bullet points

  • Tests missing
  • Documentation missing

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 Jun 25, 2022

@relffok, 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

@relffok
Copy link
Contributor Author

relffok commented Jun 25, 2022

@SteveMacenski, is this how you had the GoalUpdatedController in mind?

@SteveMacenski
Copy link
Member

@naiveHobo mind reviewing this?

@SteveMacenski
Copy link
Member

SteveMacenski commented Jun 27, 2022

Couple of things off the bat - there's no reason you should know these things so no worries

Ignoring the new server code, this PR is a good example of where all these things reside / examples: #2904


setStatus(BT::NodeStatus::RUNNING);

if (first_time_) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think first_time_ is required, if you place the 2 initial gets inside of the if IDLE condition above. I'm not sure (?) that first_time_ is required in the main if in L65.

Thinking through the logic, if this is called a 2nd time, the goal_was_updated_ will be true. If the child action is still continuing, it'll tick again. So its really just the first time we need to specifically say to go for it.

We could just in if (status() == BT::NodeStatus::IDLE) { say goal_was_updated_ = true since its updated from the idle state reference. That would be the same logic without the first_time_ variable.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree with this, first_time_ isn't required.

Although, does it make sense for this node to tick its child when it's updated from IDLE state to RUNNING state on the first tick? The node is only meant to tick its child when goal is updated on the blackboard. But with this logic, we assume that the decorator should tick its child on the first tick and any further ticks where the goal is updated. This logic made sense for RateController and DistanceController where we start the logic at 0 seconds or 0 meters traveled but I'm not sure if GoalUpdated condition requires a mandatory execution of its child on its first tick, that should happen automatically on the first tick when if (goal_ != current_goal || goals_ != current_goals) condition is true.

We could just remove first_time_ and place to 2 initial gets inside the if (status() == BT::NodeStatus::IDLE) condition while setting goal_was_updated_ = false within the condition and leave everything else as it is. That would mean that this node would tick its child only when the goal is updated on the blackboard.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Fully agree with the first_time parameter, I wanted to keep it to make it obvious but since the code is so easy, it's quickly figured out.

  2. I think from the naming it makes sense not to tick the child on the first visit, I am just wondering if application-wise it makes sense to tick it anyway for the first time. Either way, it's a quick change.

Copy link
Member

Choose a reason for hiding this comment

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

We should always tick on the first visit for this kind of thing - or else when you submitted a navigation request, it would never plan at all (you'd have to issue another new goal afterwards)

Copy link
Contributor

@naiveHobo naiveHobo left a comment

Choose a reason for hiding this comment

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

Logically, everything seems alright to me. Just looking for a BT node test to make sure the node actually works as intended.

@relffok
Copy link
Contributor Author

relffok commented Jun 28, 2022

Updated PR with all the comments, I am not quite sure about the test though.
Is it necessary to check the tick conditions only or also the different status returns of the child node? (I implemented that by setting the status to sucess and false).

It needs to be decided if the child should be ticket when visiting the first time or not. If not, I need to adapt (more of a note to myself):

  • node: the goal_updated value to false
  • example: navigate_w_replanning_only_if_goal_is_updated.xml logic
  • test: status for first tick

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.

LGTM! Thanks for the contribution! That came through surprisingly fast, good job! I'd welcome your help with any bug/feature in the future!

@SteveMacenski SteveMacenski merged commit 28d16ab into ros-navigation:main Jun 28, 2022
@relffok relffok deleted the adding-goal-updated-controller-bt-plugin branch June 30, 2022 12:33
redvinaa pushed a commit to EnjoyRobotics/navigation2 that referenced this pull request Jun 30, 2022
* first draft for goal updated controller

Signed-off-by: relffok <[email protected]>

* added goal_updated_controller to all yamls

* added GoalUpdatedController API

* added GoaUpdatedController to default plugins

* removed first_time param

* added test for GoalUpdatedController

* linter fix
relffok added a commit to relffok/navigation2 that referenced this pull request Jul 1, 2022
…3044)

* first draft for goal updated controller

Signed-off-by: relffok <[email protected]>

* added goal_updated_controller to all yamls

* added GoalUpdatedController API

* added GoaUpdatedController to default plugins

* removed first_time param

* added test for GoalUpdatedController

* linter fix
@relffok
Copy link
Contributor Author

relffok commented Jul 1, 2022

@SteveMacenski Will this be backported to galactic since it doesn't break anything? Do you do backports in complete sweeps or can I open a PR for that?

relffok added a commit to relffok/navigation2 that referenced this pull request Jul 1, 2022
relffok added a commit to relffok/navigation2 that referenced this pull request Jul 1, 2022
…3044)

* first draft for goal updated controller

Signed-off-by: relffok <[email protected]>

* added goal_updated_controller to all yamls

* added GoalUpdatedController API

* added GoaUpdatedController to default plugins

* removed first_time param

* added test for GoalUpdatedController

* linter fix
@SteveMacenski
Copy link
Member

Yes! It'll be backported next time I do a sync to galactic, I do them in batches. But if you're building Galactic from source and want it sooner, we can backport it more immediately

mergify bot pushed a commit that referenced this pull request Jul 1, 2022
* first draft for goal updated controller

Signed-off-by: relffok <[email protected]>

* added goal_updated_controller to all yamls

* added GoalUpdatedController API

* added GoaUpdatedController to default plugins

* removed first_time param

* added test for GoalUpdatedController

* linter fix

(cherry picked from commit 28d16ab)
mergify bot pushed a commit that referenced this pull request Jul 1, 2022
* first draft for goal updated controller

Signed-off-by: relffok <[email protected]>

* added goal_updated_controller to all yamls

* added GoalUpdatedController API

* added GoaUpdatedController to default plugins

* removed first_time param

* added test for GoalUpdatedController

* linter fix

(cherry picked from commit 28d16ab)

# Conflicts:
#	nav2_behavior_tree/nav2_tree_nodes.xml
#	nav2_behavior_tree/test/plugins/decorator/CMakeLists.txt
SteveMacenski pushed a commit that referenced this pull request Jul 1, 2022
* first draft for goal updated controller

Signed-off-by: relffok <[email protected]>

* added goal_updated_controller to all yamls

* added GoalUpdatedController API

* added GoaUpdatedController to default plugins

* removed first_time param

* added test for GoalUpdatedController

* linter fix

(cherry picked from commit 28d16ab)

Co-authored-by: relffok <[email protected]>
SteveMacenski pushed a commit that referenced this pull request Jul 1, 2022
* first draft for goal updated controller

Signed-off-by: relffok <[email protected]>

* added goal_updated_controller to all yamls

* added GoalUpdatedController API

* added GoaUpdatedController to default plugins

* removed first_time param

* added test for GoalUpdatedController

* linter fix
SteveMacenski added a commit that referenced this pull request Jul 1, 2022
* first draft for goal updated controller

Signed-off-by: relffok <[email protected]>

* added goal_updated_controller to all yamls

* added GoalUpdatedController API

* added GoaUpdatedController to default plugins

* removed first_time param

* added test for GoalUpdatedController

* linter fix

Co-authored-by: relffok <[email protected]>
@relffok
Copy link
Contributor Author

relffok commented Jul 4, 2022

Yes! It'll be backported next time I do a sync to galactic, I do them in batches. But if you're building Galactic from source and want it sooner, we can backport it more immediately

No need but thanks for doing it right away anyway! :)

hodgespodge pushed a commit to RobotCodeLab/navigation2 that referenced this pull request Sep 12, 2022
… (ros-navigation#3058)

* first draft for goal updated controller

Signed-off-by: relffok <[email protected]>

* added goal_updated_controller to all yamls

* added GoalUpdatedController API

* added GoaUpdatedController to default plugins

* removed first_time param

* added test for GoalUpdatedController

* linter fix

Co-authored-by: relffok <[email protected]>
jwallace42 pushed a commit to jwallace42/navigation2 that referenced this pull request Dec 14, 2022
* first draft for goal updated controller

Signed-off-by: relffok <[email protected]>

* added goal_updated_controller to all yamls

* added GoalUpdatedController API

* added GoaUpdatedController to default plugins

* removed first_time param

* added test for GoalUpdatedController

* linter fix
TanmayDeshmukh pushed a commit to cmrobotics/navigation2 that referenced this pull request Mar 28, 2023
… (ros-navigation#3058)

* first draft for goal updated controller

Signed-off-by: relffok <[email protected]>

* added goal_updated_controller to all yamls

* added GoalUpdatedController API

* added GoaUpdatedController to default plugins

* removed first_time param

* added test for GoalUpdatedController

* linter fix

Co-authored-by: relffok <[email protected]>
TanmayDeshmukh pushed a commit to cmrobotics/navigation2 that referenced this pull request Apr 17, 2023
… (ros-navigation#3058)

* first draft for goal updated controller

Signed-off-by: relffok <[email protected]>

* added goal_updated_controller to all yamls

* added GoalUpdatedController API

* added GoaUpdatedController to default plugins

* removed first_time param

* added test for GoalUpdatedController

* linter fix

Co-authored-by: relffok <[email protected]>
savalena pushed a commit to savalena/navigation2 that referenced this pull request Jul 5, 2024
* first draft for goal updated controller

Signed-off-by: relffok <[email protected]>

* added goal_updated_controller to all yamls

* added GoalUpdatedController API

* added GoaUpdatedController to default plugins

* removed first_time param

* added test for GoalUpdatedController

* linter fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants