Vehicle
Classes:
Functions:
Get the local transformation of a prim using omni.usd.get_world_transform_matrix(). |
- class pegasus.simulator.logic.vehicles.vehicle.Vehicle
Bases:
Robot
Methods:
__del__
()Method that is invoked when a vehicle object gets destroyed.
__init__
(stage_prefix[, usd_path, init_pos, ...])Class that initializes a vehicle in the isaac sim's curent stage
apply_force
(force[, pos, body_part])Method that will apply a force on the rigidbody, on the part specified in the 'body_part' at its relative position given by 'pos' (following a FLU) convention.
apply_torque
(torque[, body_part])Method that when invoked applies a given torque vector to /<rigid_body_name>/"body" or to /<rigid_body_name>/<body_part>.
sim_start_stop
(event)Callback that is called every time there is a timeline event such as starting/stoping the simulation.
start
()Method that should be implemented by the class that inherits the vehicle object.
stop
()Method that should be implemented by the class that inherits the vehicle object.
update
(dt)Method that computes and applies the forces to the vehicle in simulation based on the motor speed.
update_graphical_sensors
(event)Callback that is called at every rendering steps and will call the graphical_sensor.update method to generate new sensor data.
update_sensors
(dt)Callback that is called at every physics steps and will call the sensor.update method to generate new sensor data.
update_sim_state
(dt)Callback that is used to "send" the current state for each backend being used to control the vehicle.
update_state
(dt)Method that is called at every physics step to retrieve and update the current state of the vehicle, i.e., get the current position, orientation, linear and angular velocities and acceleration of the vehicle.
Attributes:
The state of the vehicle.
Vehicle name.
- __del__()
Method that is invoked when a vehicle object gets destroyed. When this happens, we also invoke the ‘remove_vehicle’ from the VehicleManager in order to remove the vehicle from the list of active vehicles.
- __init__(stage_prefix, usd_path=None, init_pos=[0.0, 0.0, 0.0], init_orientation=[0.0, 0.0, 0.0, 1.0], sensors=[], graphical_sensors=[], graphs=[], backends=[])
Class that initializes a vehicle in the isaac sim’s curent stage
- Parameters:
stage_prefix (str) – The name the vehicle will present in the simulator when spawned. Defaults to “quadrotor”.
usd_path (str) – The USD file that describes the looks and shape of the vehicle. Defaults to “”.
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_orientation (list) – The initial orientation of the vehicle in quaternion [qx, qy, qz, qw]. Defaults to [0.0, 0.0, 0.0, 1.0].
- apply_force(force, pos=[0.0, 0.0, 0.0], body_part='/body')
Method that will apply a force on the rigidbody, on the part specified in the ‘body_part’ at its relative position given by ‘pos’ (following a FLU) convention.
- apply_torque(torque, body_part='/body')
Method that when invoked applies a given torque vector to /<rigid_body_name>/”body” or to /<rigid_body_name>/<body_part>.
- get_dc_interface()
- 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.
- start()
Method that should be implemented by the class that inherits the vehicle object.
- stop()
Method that should be implemented by the class that inherits the vehicle object.
- update(dt)
Method that computes and applies the forces to the vehicle in simulation based on the motor speed. This method must be implemented by a class that inherits this type and it’s called periodically by the physics engine.
- Parameters:
dt (float) – The time elapsed between the previous and current function calls (s).
- update_graphical_sensors(event)
Callback that is called at every rendering steps and will call the graphical_sensor.update method to generate new sensor data. For each data that the sensor generates, the backend.update_graphical_sensor method will also be called for every backend. For example, if new data is generated for a monocular camera and we have a ROS2Backend, then the update_graphical_sensor method will be called for that backend so that this data can latter be sent through a ROS2 topic.
- Parameters:
event (float) – The timer event that contains the time elapsed between the previous and current function calls (s).
- update_sensors(dt)
Callback that is called at every physics steps and will call the sensor.update method to generate new sensor data. For each data that the sensor generates, the backend.update_sensor method will also be called for every backend. For example, if new data is generated for an IMU and we have a PX4MavlinkBackend, then the update_sensor method will be called for that backend so that this data can latter be sent thorugh mavlink.
- Parameters:
dt (float) – The time elapsed between the previous and current function calls (s).
- update_sim_state(dt)
Callback that is used to “send” the current state for each backend being used to control the vehicle. This callback is called on every physics step.
- 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 vehicle, i.e., get the current position, orientation, linear and angular velocities and acceleration of the vehicle.
- Parameters:
dt (float) – The time elapsed between the previous and current function calls (s).
- property state
The state of the vehicle.
- Returns:
The current state of the vehicle, i.e., position, orientation, linear and angular velocities…
- Return type:
- pegasus.simulator.logic.vehicles.vehicle.get_world_transform_xform(prim)
Get the local transformation of a prim using omni.usd.get_world_transform_matrix(). See https://docs.omniverse.nvidia.com/kit/docs/omni.usd/latest/omni.usd/omni.usd.get_world_transform_matrix.html :param prim: The prim to calculate the world transformation. :type prim: Usd.Prim
- Returns:
Translation vector.
Rotation quaternion, i.e. 3d vector plus angle.
Scale vector.
- Return type:
A tuple of