Removing tasks from the world

Hello there :)

Is there anyway to remove tasks from the world after it is added?
I am adding a task to the world as follows:

world.add_task(task)

I would like to remove this task if it exists.
Thank you in advance.

Hi @CaioViturino. Looks like this is an Isaac Sim question so I’m moving it over to the right forum.

Hi @CaioViturino

Attending the implementation of the next methods for the World class (exts/omni.isaac.core/omni/isaac/core/world/world.py)

    def add_task(self, task: BaseTask) -> None:
        """Tasks should have a unique name.


        Args:
            task (BaseTask): [description]
        """
        if task.name in self._current_tasks:
            raise Exception("Task name should be unique in the world")
        self._current_tasks[task.name] = task
        return

    def get_current_tasks(self) -> List[BaseTask]:
        """[summary]

        Returns:
            List[BaseTask]: [description]
        """
        return self._current_tasks

… and identifying that self._current_tasks = dict(), you should be able to remove a task by doing:

del world.get_current_tasks()[task.name]
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.