|
Ark
|
Public Member Functions | |
| None | initialize (self) |
| Initialize the PyBullet world. | |
| bool | is_ready (self) |
| Check whether the backend has finished initialization. | |
| None | set_gravity (self, tuple[float] gravity) |
| Set the world gravity. | |
| None | set_time_step (self, float time_step) |
| Set the simulation timestep. | |
| add_robot (self, str name, Dict[str, Any] robot_config) | |
| ROBOTS, SENSORS AND OBJECTS ####. | |
| None | add_sim_component (self, str name, Dict[str, Any] obj_config) |
| Add a generic simulated object. | |
| None | add_sensor (self, str name, Dict[str, Any] sensor_config) |
| Instantiate and register a sensor. | |
| None | remove (self, str name) |
| Remove a component from the simulator. | |
| None | step (self) |
| Advance the simulation by one timestep. | |
| save_render (self) | |
| Render the scene and write the image to disk. | |
| None | reset_simulator (self) |
| Reset the entire simulator state. | |
| float | get_current_time (self) |
| Return the current simulation time. | |
| shutdown_backend (self) | |
| Disconnect all components and shut down the backend. | |
| Public Member Functions inherited from ark.system.simulation.simulator_backend.SimulatorBackend | |
| None | __init__ (self, Dict[str, Any] global_config) |
| Create and initialize the backend. | |
Public Attributes | |
| client = self._connect_pybullet(self.global_config) | |
| save_render_config = self.global_config["simulator"].get("save_render", None) | |
| save_path = Path(self.save_render_config.get("save_path", "output/save_render")) | |
| save_interval = self.save_render_config.get("save_interval", 1 / 30) | |
| overwrite_file = self.save_render_config.get("overwrite_file", False) | |
| extrinsics = self.save_render_config.get("extrinsics", default_extrinsics) | |
| intrinsics = self.save_render_config.get("intrinsics", default_intrinsics) | |
| Public Attributes inherited from ark.system.simulation.simulator_backend.SimulatorBackend | |
| dict | robot_ref = {} |
| dict | object_ref = {} |
| dict | sensor_ref = {} |
| bool | ready = False |
| global_config = global_config | |
Protected Member Functions | |
| _connect_pybullet (self, dict[str, Any] config) | |
| Create and return the Bullet client. | |
| _all_available (self) | |
| SIMULATION ####. | |
| Protected Member Functions inherited from ark.system.simulation.simulator_backend.SimulatorBackend | |
| None | _step_sim_components (self) |
| Step all registered components. | |
| None | _spin_sim_components (self) |
| Spin components in manual mode. | |
Protected Attributes | |
| float | _rendered_time = -1.0 |
| _time_step = time_step | |
| Protected Attributes inherited from ark.system.simulation.simulator_backend.SimulatorBackend | |
| float | _simulation_time = 0.0 |
Backend wrapper around the PyBullet client. This class handles scene creation, stepping the simulation and managing simulated components such as robots, objects and sensors.
|
protected |
SIMULATION ####.
Check whether all registered components are active.
|
protected |
Create and return the Bullet client.
config must contain the connection_mode under the simulator section. Optionally mp4 can be provided to enable video recording.
| config | Global configuration dictionary. |
| pybullet_backend.PyBulletBackend.add_robot | ( | self, | |
| str | name, | ||
| Dict[str, Any] | robot_config ) |
ROBOTS, SENSORS AND OBJECTS ####.
Instantiate and register a robot in the simulation.
| name | Identifier for the robot. |
| robot_config | Robot specific configuration dictionary. |
Reimplemented from ark.system.simulation.simulator_backend.SimulatorBackend.
| None pybullet_backend.PyBulletBackend.add_sensor | ( | self, | |
| str | name, | ||
| Dict[str, Any] | sensor_config ) |
Instantiate and register a sensor.
| name | Name of the sensor component. |
| sensor_config | Sensor configuration dictionary. |
Reimplemented from ark.system.simulation.simulator_backend.SimulatorBackend.
| None pybullet_backend.PyBulletBackend.add_sim_component | ( | self, | |
| str | name, | ||
| Dict[str, Any] | obj_config ) |
Add a generic simulated object.
| name | Name of the object. |
| obj_config | Object specific configuration dictionary. |
Reimplemented from ark.system.simulation.simulator_backend.SimulatorBackend.
| float pybullet_backend.PyBulletBackend.get_current_time | ( | self | ) |
Return the current simulation time.
| None pybullet_backend.PyBulletBackend.initialize | ( | self | ) |
Initialize the PyBullet world.
The method creates the Bullet client, configures gravity and time step and loads all robots, objects and sensors defined in self.global_config. Optional frame capture settings are applied as well.
Reimplemented from ark.system.simulation.simulator_backend.SimulatorBackend.
| bool pybullet_backend.PyBulletBackend.is_ready | ( | self | ) |
Check whether the backend has finished initialization.
Reimplemented from ark.system.simulation.simulator_backend.SimulatorBackend.
| None pybullet_backend.PyBulletBackend.remove | ( | self, | |
| str | name ) |
Remove a component from the simulator.
| name | Name of the robot, object or sensor to remove. |
Reimplemented from ark.system.simulation.simulator_backend.SimulatorBackend.
| None pybullet_backend.PyBulletBackend.reset_simulator | ( | self | ) |
Reset the entire simulator state.
All robots, objects and sensors are destroyed and the backend is re-initialized using self.global_config.
Reimplemented from ark.system.simulation.simulator_backend.SimulatorBackend.
| pybullet_backend.PyBulletBackend.save_render | ( | self | ) |
Render the scene and write the image to disk.
The image is saved either as render.png when overwriting or with the current simulation time as filename when not.
| None pybullet_backend.PyBulletBackend.set_gravity | ( | self, | |
| tuple[float] | gravity ) |
Set the world gravity.
| gravity | Tuple (gx, gy, gz) specifying gravity in m/s^2. |
Reimplemented from ark.system.simulation.simulator_backend.SimulatorBackend.
| None pybullet_backend.PyBulletBackend.set_time_step | ( | self, | |
| float | time_step ) |
Set the simulation timestep.
| time_step | Length of a single simulation step in seconds. |
| pybullet_backend.PyBulletBackend.shutdown_backend | ( | self | ) |
Disconnect all components and shut down the backend.
This should be called at program termination to cleanly close the simulator and free all resources.
Reimplemented from ark.system.simulation.simulator_backend.SimulatorBackend.
| None pybullet_backend.PyBulletBackend.step | ( | self | ) |
Advance the simulation by one timestep.
The method updates all registered components, advances the physics engine and optionally saves renders when enabled.
Reimplemented from ark.system.simulation.simulator_backend.SimulatorBackend.
|
protected |
|
protected |
| pybullet_backend.PyBulletBackend.client = self._connect_pybullet(self.global_config) |
| pybullet_backend.PyBulletBackend.extrinsics = self.save_render_config.get("extrinsics", default_extrinsics) |
| pybullet_backend.PyBulletBackend.intrinsics = self.save_render_config.get("intrinsics", default_intrinsics) |
| pybullet_backend.PyBulletBackend.overwrite_file = self.save_render_config.get("overwrite_file", False) |
| pybullet_backend.PyBulletBackend.save_interval = self.save_render_config.get("save_interval", 1 / 30) |
| pybullet_backend.PyBulletBackend.save_path = Path(self.save_render_config.get("save_path", "output/save_render")) |
| pybullet_backend.PyBulletBackend.save_render_config = self.global_config["simulator"].get("save_render", None) |