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

Suggestion: Use SubTree in a compact form #482

Open
5730289021-NN opened this issue Dec 6, 2022 · 2 comments
Open

Suggestion: Use SubTree in a compact form #482

5730289021-NN opened this issue Dec 6, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@5730289021-NN
Copy link
Contributor

In my work, there's some simple task like Gripping object. Our implementation required to set 2 coil of PLC aka. a gripping coil and a releasing coil. Let me show you the example:

<!-- Just a simple implementation of a "Grip" SubTree -->
<root BTCPP_format="4">
    <BehaviorTree ID="Grip">
        <Sequence>
            <Script code="ungrip_coil:=5" />
            <Script code="grip_coil:=6" />
            <Switch2 variable="{close}" case_1="True" case_2="False">
                <Sequence>
                    <!-- Grip -->
                    <SetIOOutput coil="{grip_coil}" />
                    <ResetIOOutput coil="{ungrip_coil}" />
                </Sequence>

                <Sequence>
                    <!-- Ungrip -->
                    <ResetIOOutput coil="{grip_coil}" />
                    <SetIOOutput coil="{ungrip_coil}" />
                </Sequence>

                <Sequence>
                    <!-- Ungrip -->
                    <ResetIOOutput coil="{grip_coil}" />
                    <SetIOOutput coil="{ungrip_coil}" />
                </Sequence>
            </Switch2>

            <Delay delay_msec="100">
                <AlwaysSuccess />
            </Delay>

        </Sequence>
    </BehaviorTree>
</root>

If this tree is already loaded, I think we should be able to use the compact representation like
<Grip close="True"/> <!-- To close the gripper -->

But with the current implementation, it is limited to
<SubTree ID='Grip' close="True"/>

I personally think that it'll be much more elegant if the SubTree could be used in compact form

AFAIK the compact representation does only support action Compact vs Explicit.

@facontidavide
Copy link
Collaborator

I think it might be a good idea. I will consider it, thanks

@facontidavide facontidavide added the enhancement New feature or request label Feb 3, 2023
@OPerepadia
Copy link
Contributor

I also like this idea. However, I can see one issue with it. Currently, it's possible to have a node and a subtree with the same name, and if the syntax is the same, it will not be possible to distinguish them. One solution I can think of is adding some prefix to the name of the tree, but after all, it might not be a big issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants