-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Drive on heading #2898
Drive on heading #2898
Conversation
@jwallace42, please properly fill in PR template in the future. @SteveMacenski, use this instead.
|
What you suggest is definitely not unreasonable, but it is a very large change which will effect every user's configurations since that plugin will cease to exist and all behavior trees will need a different BT node used. I would like to be cautious due to that to try to make this as least disruptive as possible. Semantically, I think about "back up" versus "drive straight" as 2 different action contexts even though they're representing related things. Within the BT, would it be possible to have a derived class from drive on heading for I'm debating what I would want for the plugins in the behavior server. From one perceptive, we could do the analog thing here to have both a drive on current heading + backup behavior plugins. But that feels really redundant, and the BT node of I've never done this before, but I think if you created 2 instances in here https://github.com/ros-planning/navigation2/blob/a32ebfaa0ca161de9f6a0841fc1a536c3a0e75ba/nav2_behaviors/behavior_plugin.xml#L9 of the name "backup" and of "driveonheading", then it should make it so that you can load this same plugin based on both names if specified in a parameter file. You'd have to check though. If we did that, we could not duplicate any code, but also not require users to update their YAML files based on the change to load. We could add a depreciation warning into the description. That leaves the only open question is the action topic ID. For the high level BT node, both can use the drive on current heading name. Or, for the backup version, we could use the original backup name when it is registered. For the behavior plugin, the drive on current heading is fine. If we aliased the backup plugin loading name, I think it would load the plugin correctly, but if we didn't replace the behavior ID in the yaml from but that would brake the use of Options, options, options... I need to think about this. I'm leaning towards duplication though so we can have both forward and backward compatibility, even though they're pretty much the same thing. But if we use derived classes, we can at least reduce the code duplication to the bare minimum on registering topic IDs and checking negative signs. At some point in the medium term or distant future, we can deprecate Thoughts? |
It is a lot of changes but the only thing they have to do is switch the BT xml file right? Just change the node names and switch sign of the values. But I really don't know much about the how the upgrading from galactic to humble works. It there something else they would have to do? |
This pull request is in conflict. Could you fix it @jwallace42? |
If you derive from this as a base class and make a derived class for backup, it would be the sign and when registering the plugin, using the backup name / action rather than drive on heading.
If we didn't make it easy for them, they'd have to modify their configs and BT XMLs because the backup action wouldn't exist and the backup BT node wouldn't exist anymore. |
Alright, so the goal is still support old BT xml. I will just create a derived backup class. Would there be a plan to faze out the backup node or would we always have it? |
This is a good question. I think the BT node would be there forever, I think the actual backend separate action server / behavior plugin would be deprecated. The Backup BT node would just be redirected to that new server after the next distribution release. I think "DriveOnHeading" vs "BackUp" are semantically different to a autonomy system designer, so having both would make more clear in design context the intent of the move, so both would be nice. I figure once we have the drive on heading + rotate, we can do a little demo of having the robot drive in a shape or something (e.g. drive 1 meter, turn 90 deg, drive 1 meter, turn 90 deg, ...) which could be helpful for calibration and a POC of its use. Those primitives are common for students in entry-level robotics courses to need to use, so I figure having them around is helpful. Updating the Python API with them would be even more useful. But that takes like 15 minutes, not a big deal |
nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/back_up_action.hpp
Outdated
Show resolved
Hide resolved
nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/drive_on_heading_action.hpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really good -- if I wasn't trying to reduce code duplication, I think we could even call it done right here.
Something I think worth trying, it might not work out due to complexities, but I think it should at least from a architect's 30,000 ft view:
- I looked at what is involved at deriving backup from the drive on heading BT node, and it literally turns into just as much code, just shuffled around. So no need to do that.
- I looked at what's involved at deriving backup behavior from the drive on heading behavior plugins, and I think you can reduce essentially all the code. Then you just need to export the plugin and set the different action definition. I think that might need to make
DriveOnHeading
to be itself templated with a default toDriveOnHeading
's message. But that should be a few just method definition changes, in exchange, we have no duplicate code in the behavior plugins for duplicate behavior.
nav2_behavior_tree/include/nav2_behavior_tree/plugins/action/drive_on_heading_action.hpp
Outdated
Show resolved
Hide resolved
Fixed of test errors. The xml linter complains but the the structure is actually correct. |
I think that should help? from https://stackoverflow.com/questions/22463154/unescaped-not-allowed-in-attributes-values-error-in-r If my memory doesn't fault me, I think I've seen that in use other places in ROS as well for this reason |
@SteveMacenski should be gtg! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some changes on parameterization, but otherwise LGTM!
Did you test manually adding the drive on heading BT XML node in a BT and it worked as you expect?
I tested it though the behavior tree by manually adding it and it worked as expected. I also made a bunch of action calls to drive_on_heading. |
@jwallace42 LGTM last is docs:
Also test coverage is missing https://codecov.io/gh/ros-planning/navigation2/tree/c04e9f73a7f61022ee8bbb7f5a562c86f5354887/nav2_behaviors/plugins
Well actually the testing bits might be due to caching issues. In the circleCI directory, change these 3 instances of v9 to v11 https://github.com/ros-planning/navigation2/blob/main/.circleci/config.yml#L36-L61 to break the cache. But make sure to test and look at the codecov results |
@jwallace42, your PR has failed to build. Please check CI outputs and resolve issues. |
A bit more test coverage on these would be good -- the cache breaking fixed the issue. This PR would drop the coverage % below 90% for the package |
* renamed class * rename backup to drive_on_heading * test file rename * renamed backup bt node * renamed ports * renamed binaries * named backup cancel * renamed backup action * rename yaml * fixing tests * undid cmake * add backup back in for old users * added back_up back in * remove commented tests * rename server * code review * code review fixes * code review * templated the drive on heading * fully templated drive on heading * template fixes for drive on heading * template working * linting and boolean fix * fixed tests * added multiple files for recoveries * xml fix * fixed copyright * revert * Update nav2_behaviors/plugins/drive_on_heading.hpp * Update nav2_behaviors/plugins/drive_on_heading.hpp * update circleci config * fixed back_up test * fixed drive on heading test Co-authored-by: Steve Macenski <[email protected]>
* renamed class * rename backup to drive_on_heading * test file rename * renamed backup bt node * renamed ports * renamed binaries * named backup cancel * renamed backup action * rename yaml * fixing tests * undid cmake * add backup back in for old users * added back_up back in * remove commented tests * rename server * code review * code review fixes * code review * templated the drive on heading * fully templated drive on heading * template fixes for drive on heading * template working * linting and boolean fix * fixed tests * added multiple files for recoveries * xml fix * fixed copyright * revert * Update nav2_behaviors/plugins/drive_on_heading.hpp * Update nav2_behaviors/plugins/drive_on_heading.hpp * update circleci config * fixed back_up test * fixed drive on heading test Co-authored-by: Steve Macenski <[email protected]>
Basic Info
Description of contribution in a few bullet points
Extended the backup behavior to drive on heading. The behavior can now go forwards or backwards.
Description of documentation updates required from your changes
Changes to the behavior server docs and bt nodes docs.
Future work that may be required in bullet points
For Maintainers: