Ark
Loading...
Searching...
No Matches
pybullet_camera_driver.BulletCameraDriver Class Reference
Inheritance diagram for pybullet_camera_driver.BulletCameraDriver:
ark.system.driver.sensor_driver.CameraDriver ark.system.driver.sensor_driver.SensorDriver ark.system.driver.component_driver.ComponentDriver

Public Member Functions

None __init__ (self, str component_name, Dict[str, Any] component_config, int attached_body_id=None, Any client=None)
 Create a new camera driver.
 get_images (self)
 Capture camera images from the simulator.
None shutdown_driver (self)
 Clean up any resources used by the driver.
Public Member Functions inherited from ark.system.driver.sensor_driver.CameraDriver
None __init__ (self, str component_name, Dict[str, Any] component_config=None, bool sim=True)
 Initialize the camera driver.
Public Member Functions inherited from ark.system.driver.sensor_driver.SensorDriver
None __init__ (self, str component_name, Dict[str, Any] component_config=None, bool sim=True)
 Initialize the sensor driver.
Public Member Functions inherited from ark.system.driver.component_driver.ComponentDriver
None __init__ (self, str component_name, Any component_config=None, bool sim=True)
 Initialize the driver.
 is_sim (self)
 Return whether this driver is running in simulation mode.

Public Attributes

 client = client
 attached_body_id = attached_body_id
 camera_type = CameraType(self.config["camera_type"])
 visual_body_id = None
 visualize = self.config["sim_config"].get("visualize", False)
 urdf_path = self.config["sim_config"].get("urdf_path", None)
 fov = self.config['sim_config'].get('fov', 60)
 near_val = self.config['sim_config'].get('near_val', 0.1)
 far_val = self.config['sim_config'].get('far_val', 100.0)
 camera_target_position = self.config['sim_config']["fix"]['camera_target_position']
 distance = self.config['sim_config']["fix"]['distance']
 yaw = self.config['sim_config']["fix"]['yaw']
 pitch = self.config['sim_config']["fix"]['pitch']
 roll = self.config['sim_config']["fix"]['roll']
 up_axis_index = self.config['sim_config']["fix"]['up_axis_index']
 current_position = -view_matrix_np[:3, :3].T @ view_matrix_np[:3, 3]
 current_orientation = self.client.getQuaternionFromEuler(rotation_matrix_to_euler(view_matrix_np[:3, :3].T))
 parent_name = self.config["sim_config"]['attach']["parent_name"]
 parent_link = self.config["sim_config"]['attach'].get("parent_link", None)
 offset_translation = self.config["sim_config"]['attach'].get("offset_translation", [0, 0, 0])
 offset_rotation = self.config["sim_config"]['attach'].get("offset_rotation", [0, 0, 0])
 rel_camera_target = self.config["sim_config"]['attach'].get("rel_camera_target", [1, 0, 0])
dict link_info = {}
dict parent_link_id = self.link_info.get(self.parent_link, None)
 width = self.config.get('width', 640)
 height = self.config.get('height', 480)
 aspect = self.width / self.height
bool color_stream = True
bool depth_stream = True
bool infrared_stream = False
bool segmentation_stream = True
Public Attributes inherited from ark.system.driver.component_driver.ComponentDriver
 component_name = component_name
 config = self._load_single_section(component_config, component_name)
 sim = sim

Protected Member Functions

Any _update_position (self)
 Update internal pose information.
Protected Member Functions inherited from ark.system.driver.component_driver.ComponentDriver
 _load_single_section (self, component_config, component_name)
 Load the configuration of a single component from a YAML file.

Detailed Description

Camera driver implementation for PyBullet.

Constructor & Destructor Documentation

◆ __init__()

None pybullet_camera_driver.BulletCameraDriver.__init__ ( self,
str component_name,
Dict[str, Any] component_config,
int attached_body_id = None,
Any client = None )

Create a new camera driver.

Parameters
component_nameName of the camera component.
component_configConfiguration dictionary for the camera.
attached_body_idID of the body to attach the camera to.
clientOptional PyBullet client.
Returns
None

Member Function Documentation

◆ _update_position()

Any pybullet_camera_driver.BulletCameraDriver._update_position ( self)
protected

Update internal pose information.

When the camera is attached to a body this queries PyBullet for the current link pose and updates self.current_position and self.current_orientation.

◆ get_images()

pybullet_camera_driver.BulletCameraDriver.get_images ( self)

Capture camera images from the simulator.

Depending on the enabled streams the returned dictionary can contain the keys color, depth and segmentation.

Returns
Dictionary mapping stream names to numpy.ndarray images. @rtype Dict[str, np.ndarray]

Reimplemented from ark.system.driver.sensor_driver.CameraDriver.

◆ shutdown_driver()

None pybullet_camera_driver.BulletCameraDriver.shutdown_driver ( self)

Clean up any resources used by the driver.

Called when the simulator is shutting down. The PyBullet camera driver currently does not allocate additional resources so the method is empty.

Reimplemented from ark.system.driver.component_driver.ComponentDriver.

Member Data Documentation

◆ aspect

pybullet_camera_driver.BulletCameraDriver.aspect = self.width / self.height

◆ attached_body_id

pybullet_camera_driver.BulletCameraDriver.attached_body_id = attached_body_id

◆ camera_target_position

pybullet_camera_driver.BulletCameraDriver.camera_target_position = self.config['sim_config']["fix"]['camera_target_position']

◆ camera_type

pybullet_camera_driver.BulletCameraDriver.camera_type = CameraType(self.config["camera_type"])

◆ client

pybullet_camera_driver.BulletCameraDriver.client = client

◆ color_stream

bool pybullet_camera_driver.BulletCameraDriver.color_stream = True

◆ current_orientation

pybullet_camera_driver.BulletCameraDriver.current_orientation = self.client.getQuaternionFromEuler(rotation_matrix_to_euler(view_matrix_np[:3, :3].T))

◆ current_position

pybullet_camera_driver.BulletCameraDriver.current_position = -view_matrix_np[:3, :3].T @ view_matrix_np[:3, 3]

◆ depth_stream

bool pybullet_camera_driver.BulletCameraDriver.depth_stream = True

◆ distance

pybullet_camera_driver.BulletCameraDriver.distance = self.config['sim_config']["fix"]['distance']

◆ far_val

pybullet_camera_driver.BulletCameraDriver.far_val = self.config['sim_config'].get('far_val', 100.0)

◆ fov

pybullet_camera_driver.BulletCameraDriver.fov = self.config['sim_config'].get('fov', 60)

◆ height

pybullet_camera_driver.BulletCameraDriver.height = self.config.get('height', 480)

◆ infrared_stream

bool pybullet_camera_driver.BulletCameraDriver.infrared_stream = False

◆ link_info

dict pybullet_camera_driver.BulletCameraDriver.link_info = {}

◆ near_val

pybullet_camera_driver.BulletCameraDriver.near_val = self.config['sim_config'].get('near_val', 0.1)

◆ offset_rotation

pybullet_camera_driver.BulletCameraDriver.offset_rotation = self.config["sim_config"]['attach'].get("offset_rotation", [0, 0, 0])

◆ offset_translation

pybullet_camera_driver.BulletCameraDriver.offset_translation = self.config["sim_config"]['attach'].get("offset_translation", [0, 0, 0])

◆ parent_link

pybullet_camera_driver.BulletCameraDriver.parent_link = self.config["sim_config"]['attach'].get("parent_link", None)

◆ parent_link_id

dict pybullet_camera_driver.BulletCameraDriver.parent_link_id = self.link_info.get(self.parent_link, None)

◆ parent_name

pybullet_camera_driver.BulletCameraDriver.parent_name = self.config["sim_config"]['attach']["parent_name"]

◆ pitch

pybullet_camera_driver.BulletCameraDriver.pitch = self.config['sim_config']["fix"]['pitch']

◆ rel_camera_target

pybullet_camera_driver.BulletCameraDriver.rel_camera_target = self.config["sim_config"]['attach'].get("rel_camera_target", [1, 0, 0])

◆ roll

pybullet_camera_driver.BulletCameraDriver.roll = self.config['sim_config']["fix"]['roll']

◆ segmentation_stream

bool pybullet_camera_driver.BulletCameraDriver.segmentation_stream = True

◆ up_axis_index

pybullet_camera_driver.BulletCameraDriver.up_axis_index = self.config['sim_config']["fix"]['up_axis_index']

◆ urdf_path

pybullet_camera_driver.BulletCameraDriver.urdf_path = self.config["sim_config"].get("urdf_path", None)

◆ visual_body_id

pybullet_camera_driver.BulletCameraDriver.visual_body_id = None

◆ visualize

pybullet_camera_driver.BulletCameraDriver.visualize = self.config["sim_config"].get("visualize", False)

◆ width

pybullet_camera_driver.BulletCameraDriver.width = self.config.get('width', 640)

◆ yaw

pybullet_camera_driver.BulletCameraDriver.yaw = self.config['sim_config']["fix"]['yaw']

The documentation for this class was generated from the following file: