Skip to content

Proposal: remove motion primatives #691

Closed

Description

@SteveMacenski

We probably shouldn't be having anything except the controller send velocity commands to the base, or else we end up with a number of async or fighting issues. Having a separate server to process these commands seems a little unnecessary and adds to the complexity of the project. I think a good goal is to make sure anything touching the cmd_vel should be handled through their the controller or defined recoveries (where I'm personally of the opinion that the recoveries themselves should actually call controller methods).

I propose that the actions of spinning, backup, stop can remain, but they should be header primatives for the controller and recoveries to use, not act as a separate server. For things like stop or backup, I think we'd be fine just removing those primatives altogether as backup should really only be called in 1 particular recovery case (probably doesnt have use else where) and stop is just sending an empty Twist() it might be overkill to try to separate that out.

The project is starting to get a little hard to follow and this is a relatively simple but high impact way of simplifying the uses. Lets discuss below

Activity

  1. bpwilcox commented on May 8, 2019

    @bpwilcox

    In MoveBase, recovery behaviors were instanced as plugins, using the costmap and local planner methods to perform recoveries while checking for collisions. I'm currently working on integrating collision checking within our motion primitives, however there is a design refactor involved since the current motion primitives are independent of the costmap and controller. Part of this refactor involves grabbing the costmap and robot footprint from the world model instead of instancing the costmap_2d_ros in the controller, which we have proposed before. In this proposal, we could place motion primitives as servers or instance within the controllers as internal recovery behaviors.

  2. SteveMacenski commented on May 8, 2019

    @SteveMacenski
    MemberAuthor

    If motion primatives are actually recovery behaviors we should rename them as such. The name primatives by itself is asking people to call these servers as basic building blocks for other task development.

    With the server-oriented rearchitecture of nav2 I agree having the separate servers aligns with that. I suppose then if that's the way these are meant to be used for, nav2_recoveries would make most sense. I would be more than happy to do all those changes and PR @bpwilcox if you agree.

  3. bpwilcox commented on May 8, 2019

    @bpwilcox

    I agree that a rename to recovery makes sense for how we are currently using them, however, I can imagine using the same behaviors as a building block for complex tasks or user commands even if not recovery-related. For instance, if I wanted to execute a spin outside of recovery, then this would make sense I think. Currently, our recovery behaviors are configured via the primitives in the behavior tree, so if anything, I might propose we create a nav2_bt_recoveries folder that contains some stock recovery behavior tree templates that we can drop into the bt_navigator as opposed to hard-coding the primitives into the nav2_bt_navigator behavior tree xmls.

  4. mkhansenbot commented on May 9, 2019

    @mkhansenbot
    Collaborator

    My main goal here is to remove the hard-coding of the recovery flow and behaviors. The 'motion primitives' idea was to create generalized actions that could be executed either as part of the recovery flow of a behavior tree, or separately if desired. The latter part is semi-questionable since we haven't really ID a use case where a motion primitive is needed other than recovery. So I'm fine with renaming or replacing them, as long as we leave the ability to create them as actions executed from the BT engine. I also do agree that they need to check for collisions.

    At least to me, this is one of the benefits of moving away from move_base hard-coding behavior flow to the BT in the first place, is to add this extensibility / configurability.

  5. SteveMacenski commented on May 9, 2019

    @SteveMacenski
    MemberAuthor

    Ok, I'll take this on

  6. mhpanah commented on May 9, 2019

    @mhpanah
    Contributor

    @mkhansen-intel Motion primitives are also being used in Auto Localization in addition to recovery behaviors.

    @SteveMacenski I agree that we shouldn't have anything except the controller to send velocity commands, but the motion primitives are suppose to be a simple controller to either spin the robot or actuate the robot forward/backward based on angle or distance. Also, we should not actuate the robot before checking the direction of motion for obstacles.

    Currently the motion primitives have lots of redundant code for simple velocity commands that they are sending. I think we should just have a single simple controller for this purpose.

  7. orduno commented on May 10, 2019

    @orduno
    Contributor

    On renaming the package: If nav2_motion_primitives are currently exclusively being used for recovery, I'm ok with renaming to something like nav2_recovery_motions (not sure if we could use "behavior" here).

    On moving the primitives to the controller: Currently, dwb is a path-based controller, and the approach suggested requires to extend the functionality of dwb to implement simple motions like forward, spin, etc. If that's the consensus, I would be inclined to define a nav2_controller package which internally specifies a follow_path controller (dwb, timed elastic bands) and primitives/recovery controller. That would simplify the architecture, avoid code duplication and address the problem of having a second server sending velocity commands.

    If the decision is to keep the primitives/recoveries as a separate package and avoid having multiple nodes publishing to \cmd_vel, then having a robot class would be useful.

  8. SteveMacenski commented on May 10, 2019

    @SteveMacenski
    MemberAuthor

    Since the recoveries are handled through the behavior tree, I think we can allow velocity command to come out of a recovery behavior server like they are now, just renamed to make it clear that they are not primatives for use, but default recoveries exposed by a server. If in recovery mode, the navigator shouldn't be letting the controller do "stuff" so there shouldn't be async artifacts.

    As I have thought about how I'd personally implement a system like this, I'm a believer that all commands should funnel through a single "thing" (lets call it a controller for this case). Now that doesn't mean the controller needs itself to contain these base actions, but rather that these actions call the publishers within the controller such that the controller at the end of the day is the one sending the commands to the base. This lets us have access in the controller server to the state of recovery in case of asynchronous interactions. (i.e. we expose a topic that it funnels to the base, and when that is called we have some muxing lock-out of the controller while recovery actions are being taken).

    For now, renaming recoveries rather than primitives solves my core desire to make this clearer to the reader. Then its a 1:1 to the original recovery behaviors in Navigation1, which did themselves leave much to be desired. Its a starting point though.

  9. SteveMacenski commented on May 15, 2019

    @SteveMacenski
    MemberAuthor

    PR #705 covers, but the spirit of the original ticket was to remove, we decided to rename, so closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions