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

Autoparameterization does not run again if a parameter has been set by a previous skill #116

Open
matthias-mayr opened this issue Nov 2, 2024 · 0 comments
Labels
bug ROS 1 Issue affects ROS 1 ROS 2 Issue affects ROS 2

Comments

@matthias-mayr
Copy link
Member

[This is copy of https://github.com/matthias-mayr/skiros2_pyrobosim_lib/issues/2]
Let's assume we have the Drive skill from the examples

class Drive(SkillDescription):
    def createDescription(self):
        #=======Params=========
        self.addParam("StartLocation", Element("skiros:Location"), ParamTypes.Inferred)
        self.addParam("TargetLocation", Element("skiros:Location"), ParamTypes.Required)
        #=======PreConditions=========
        self.addPreCondition(self.getRelationCond("RobotAt", "skiros:at", "Robot", "StartLocation", True))
        #=======PostConditions=========
        self.addPostCondition(self.getRelationCond("NoRobotAt", "skiros:at", "Robot", "StartLocation", False))
        self.addPostCondition(self.getRelationCond("RobotAt", "skiros:at", "Robot", "TargetLocation", True))

We can use it without specifying StartLocation since this parameter can be automatically set by autoparameterization. However, this sets the StartLocation parameter on the blackboard.

Now if the robot is currently at Location0 and we use the drive skill twice in a row:

# Robot location in world model: {Location0}
# StartLocation parameter on blackboard: {}
self.skill("Drive", "", remap={"TargetLocation: "Location1"}),
# Robot location in world model: {Location1}
# StartLocation parameter on blackboard: {Location0}
self.skill("Drive", "", remap={"TargetLocation: "Location2"}),

the second execution would fail with a precondition error. This is because the first execution of Drive sets the blacboard parameter StartLocation to Location0. The robot would then move and the world model would be updated so that the robot is at Location1. Now the second Drive skill is started,but because the StartLocation parameter is already set on the blackboard, the autoparameterization does not run again. Unfortunately StartLocation contains the location value, so if this precondition is checked against the world model, it would fail.

A workaround is to "unset` the blackboard parameter with a special skill, but that is not very intuitive and makes BTs larger than necessary.

Some smart handling of this is needed. Maybe detect if a parameter is mapped implicitly, autoparameterization should run instead of taking the blackboard parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ROS 1 Issue affects ROS 1 ROS 2 Issue affects ROS 2
Projects
None yet
Development

No branches or pull requests

1 participant