Skip to content

Adding existing Tasks into containers to create more complex tasks #716

@robotics-qc

Description

@robotics-qc

Hello!

I am curious to know if there is a way to add a Task into a container - so for example if we have a dual arm setup, and have pipelines for pick and place for each one -

Is there an easy way for me to create an alternatives container and just add two existing task pipelines into it/ extract the stages into a container to pass on to the alternatives block?

For example:
Provided I have functions that return task objects - is there a way to do something like this

    moveit::task_constructor::Task pickObjectEitherHandTask(std::string object)
    {
        // Initialize the task
        moveit::task_constructor::Task task;
        task.setName("pick object with both hands: " + object);

        // Load robot model
        task.loadRobotModel(shared_from_this());
        initialize_planners();

        // Create Alternatives stage to evaluate both arms
        auto alternatives = std::make_unique<moveit::task_constructor::Alternatives>("pick with left or right arm");

        // Add left arm task

        auto left_arm_task = pickObjectLeftTask(object);

        alternatives->add(std::move(left_arm_task.stages()));

        // Add right arm task

        auto right_arm_task = pickObjectRightTask(object);

        alternatives->add(std::move(right_arm_task.stages()));

        // Add Alternatives stage to the main task
        task.add(std::move(alternatives));

        return task;
    }

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