Looping omni.anim.people commands

Isaac Sim Version

4.5.0
4.2.0
4.1.0
4.0.0
4.5.0
2023.1.1
2023.1.0-hotfix.1
Other (please specify):

Operating System

Ubuntu 22.04
Ubuntu 20.04
Windows 11
Windows 10
Other (please specify):

GPU Information

  • Model: NVIDIA GeForce RTX 4080 SUPER
  • Driver Version: 550.127.08

Topic Description

Detailed Description

When using omni.anim.people extension with a commands.txt file, the simulation stops after all the commands have been executed. For example, with a commands file such as:

female_adult_business_02 GoTo 2.7 -3.8 0 _
female_adult_business_02 LookAround 5
female_adult_business_02 GoTo 3.45 1.6 0 _

the simulation stops when the character reaches the final position (3.45, 1.6, 0), and then the character remains in the idle animation state until the simulation is stopped. Is there a way to loop all the commands in a way that when reaching the final position, the character would start all over again from the first command? I would like to make an infinite loop that stops only when the simulation is stopped.

Thanks in advance!

I don’t know if there is a way to achieve this through the GUI, but the implementation already supports loops. Check the script that is attached to the character (/World/Characters/worker_04/male_adult_construction_01/ManRoot/male_adult_construction_01). this should be character_behavior.py in omni.anim.people.

In renew_character_state you will find ‘self.loop_commands_count = 1’ so you’ll have to overwrite this variable.

One way to do this would be to create your own BehaviorScript that inherits from the CharacterBehavior. I think this already should do the job:

class LoopedPerson(CharacterBehavior):
    def on_play(self):
        super().on_init() # -> calls renew_character_state
        self.loop_commands_count = 42

The first call to on_update will call init_character, that copies the current commands into self.loop_commands and also adds a GoTo to the current position so that the person takes no shortcut on the second round.

Assign this 4-line script to the SkelRoot instead of the character_behavior.py and your person should be occupied for quite some time.

Thanks for the reply,

I tried this but unfortunately the character still remains in idle animation state after executing the last command. Could I still be missing something? Is overwriting that one variable enough? Also, I would need this to loop infinitely.

Did you step through the code to find out why it’s not working?

“infinitely”
You can just set the variable to 1e100. That should be close enough for infinity for all practical purposes.