People

File: person.py
Author: Marcelo Jacinto (marcelo.jacinto@tecnico.ulisboa.pt)
License: BSD-3-Clause. Copyright (c) 2024, Marcelo Jacinto. All rights reserved.
Description: Definition of the Person class which is used as the base for spawning people in the simulation world.

Classes:

Person

Class that implements a person in the simulation world.

class pegasus.simulator.logic.people.person.Person

Bases: object

Class that implements a person in the simulation world. The person can be controlled by a controller that inherits from the PersonController class.

Methods:

__init__(stage_prefix[, character_name, ...])

Initializes the person object

add_animation_graph_to_agent()

get_character_asset_list()

get_path_for_character_prim(agent_name)

get_usd_in_folder(character_folder_path)

sim_start_stop(event)

Callback that is called every time there is a timeline event such as starting/stoping the simulation.

spawn_agent(usd_file, stage_name, init_pos, ...)

start()

Method that is called when the simulation starts.

stop()

Method that is called when the simulation stops.

update(dt)

Method that implements the logic to make the person move around in the simulation world and also play the animation

update_state(dt)

Method that is called at every physics step to retrieve and update the current state of the person, i.e., get the current position, orientation, linear and angular velocities and acceleration of the person.

update_target_position(position[, walk_speed])

Method that updates the target position of the person to which it will move towards.

Attributes:

assets_root_path

character_root_prim_path

state

The state of the person.

__init__(stage_prefix, character_name=None, init_pos=[0.0, 0.0, 0.0], init_yaw=0.0, controller=None, backend=None)

Initializes the person object

Parameters:
  • stage_prefix (str) – The name the person will present in the simulator when spawned on the stage.

  • character_name (str) – The name of the person in the USD file. Use the Person.get_character_asset_list() method to get the list of available characters.

  • init_pos (list) – The initial position of the vehicle in the inertial frame (in ENU convention). Defaults to [0.0, 0.0, 0.0].

  • init_yaw (float) – The initial orientation of the person in rad. Defaults to 0.0.

  • controller (PersonController) – A controller to add some custom behaviour to the movement of the person. Defaults to None.

add_animation_graph_to_agent()
static get_character_asset_list()
static get_path_for_character_prim(agent_name)
static get_usd_in_folder(character_folder_path)
sim_start_stop(event)

Callback that is called every time there is a timeline event such as starting/stoping the simulation.

Parameters:

event – A timeline event generated from Isaac Sim, such as starting or stoping the simulation.

spawn_agent(usd_file, stage_name, init_pos, init_yaw)
start()

Method that is called when the simulation starts. This method can be used to initialize any variables.

stop()

Method that is called when the simulation stops. This method can be used to reset any variables.

update(dt)

Method that implements the logic to make the person move around in the simulation world and also play the animation

Parameters:

dt (float) – The time elapsed between the previous and current function calls (s).

update_state(dt)

Method that is called at every physics step to retrieve and update the current state of the person, i.e., get the current position, orientation, linear and angular velocities and acceleration of the person.

Parameters:

dt (float) – The time elapsed between the previous and current function calls (s).

update_target_position(position, walk_speed=1.0)

Method that updates the target position of the person to which it will move towards.

Parameters:

position (list) – A list with the x, y, z coordinates of the target position.

assets_root_path = 'omni.isaac.nucleus.get_assets_root_path/Isaac/People/Characters'
character_root_prim_path = '/World/Characters'
property state

The state of the person.

Returns:

The current state of the person, i.e., position, orientation, linear and angular velocities…

Return type:

State

File: person_controller.py
Author: Marcelo Jacinto (marcelo.jacinto@tecnico.ulisboa.pt)
Description: Base controller class that should be inherited to create a custom controller behaviour for a person in the simulation.
License: BSD-3-Clause. Copyright (c) 2024, Marcelo Jacinto. All rights reserved.

Classes:

PersonController

class pegasus.simulator.logic.people.person_controller.PersonController

Bases: object

Methods:

__init__()

Initialize the Backend class

initialize(person)

A method that can be invoked when the simulation is starting to give access to the person control backend to the entire person object.

reset()

Method that when implemented, should handle the reset of the person simulation to its original state

start()

Method that when implemented should handle the begining of the simulation of person

stop()

Method that when implemented should handle the stopping of the simulation of person

update(dt)

Method that when implemented, should be used to update the state of the backend and the information being sent/received from the communication interface.

update_state(state)

Method that when implemented, should handle the receival of the state of the person using this callback

Attributes:

person

A reference to the person associated with this backend.

__init__()

Initialize the Backend class

initialize(person)

A method that can be invoked when the simulation is starting to give access to the person control backend to the entire person object.

Parameters:

person (person) – A reference to the person that this sensor is associated with

reset()

Method that when implemented, should handle the reset of the person simulation to its original state

start()

Method that when implemented should handle the begining of the simulation of person

stop()

Method that when implemented should handle the stopping of the simulation of person

update(dt)

Method that when implemented, should be used to update the state of the backend and the information being sent/received from the communication interface. This method will be called by the simulation on every physics step

Parameters:

dt (float) – The time elapsed between the previous and current function calls (s).

update_state(state)

Method that when implemented, should handle the receival of the state of the person using this callback

Parameters:

state (State) – The current state of the person.

property person

A reference to the person associated with this backend.

Returns:

A reference to the person associated with this backend.

Return type:

person

File: people_manager.py
Author: Marcelo Jacinto (marcelo.jacinto@tecnico.ulisboa.pt)
License: BSD-3-Clause. Copyright (c) 2024, Marcelo Jacinto. All rights reserved.
Description: Definition of the PeopleManager class - a singleton used to manage the people that are spawned in the simulation world

Classes:

PeopleManager

The PeopleManager class is implemented following a singleton pattern.

class pegasus.simulator.logic.people_manager.PeopleManager

Bases: object

The PeopleManager class is implemented following a singleton pattern. This means that once a person is spawned on the world or an instance of the PeopleManager is created, no either will be running at the same time.

This class keeps track of all the people that are spawned in the simulation world, either trough the extension UI or via Python script. Every time a new person object is created, the ‘add_person’ method is invoked. Additionally, a person is removed, i.e. ‘remove_person’ gets invoked, every time the ‘__del__’ function of the “Person” object gets invoked.

Methods:

__del__()

Destructor for the object

__init__()

Constructor for the people manager class.

__new__(cls)

Method that allocated memory for a new people_manager.

add_person(stage_prefix, person)

Method that adds the people to the person manager.

get_people_manager()

Method that returns the current people manager.

get_person(stage_prefix)

Method that returns the person object given its stage prefix.

rebuild_nav_mesh([radius, ...])

Rebuild the navmesh with the correct settings.

remove_all_people()

Method that will delete all the people that were spawned from the people manager.

remove_person(stage_prefix)

Method that deletes a person from the person manager.

Attributes:

people

Returns: (list) List of people that were spawned.

__del__()

Destructor for the object

__init__()

Constructor for the people manager class.

static __new__(cls)

Method that allocated memory for a new people_manager. Since the PeopleManager follows a singleton pattern, only one instance of PeopleManger object can be in memory at any time.

Returns:

the single instance of the PeopleManager class.

Return type:

PeopleManger

add_person(stage_prefix, person)

Method that adds the people to the person manager.

Parameters:
  • stage_prefix (str) – A string with the name that the person is spawned in the simulator

  • person (Person) – The person object being added to the person manager.

static get_people_manager()

Method that returns the current people manager.

get_person(stage_prefix)

Method that returns the person object given its stage prefix. Returns None if there is no person associated with that stage prefix

Parameters:

stage_prefix (str) – A string with the name that the person is spawned in the simulator

Returns:

The person object associated with the stage_prefix

Return type:

Person

rebuild_nav_mesh(radius=0.5, auto_rebake_on_changes=False, auto_rebake_delay_seconds=4, exclude_rigid_bodies=True, view_nav_mesh=False, dynamic_avoidance_enabled=False, navmesh_enabled=False)

Rebuild the navmesh with the correct settings. Used for the people to move around. Called only when the sim with people is requested.

remove_all_people()

Method that will delete all the people that were spawned from the people manager.

remove_person(stage_prefix)

Method that deletes a person from the person manager.

Parameters:

stage_prefix (str) – A string with the name that the person is spawned in the simulator.

property people

Returns: (list) List of people that were spawned.