Ark
|
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. |
Camera driver implementation for PyBullet.
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.
component_name | Name of the camera component. |
component_config | Configuration dictionary for the camera. |
attached_body_id | ID of the body to attach the camera to. |
client | Optional PyBullet client. |
|
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.
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.
Reimplemented from ark.system.driver.sensor_driver.CameraDriver.
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.
pybullet_camera_driver.BulletCameraDriver.aspect = self.width / self.height |
pybullet_camera_driver.BulletCameraDriver.attached_body_id = attached_body_id |
pybullet_camera_driver.BulletCameraDriver.camera_target_position = self.config['sim_config']["fix"]['camera_target_position'] |
pybullet_camera_driver.BulletCameraDriver.camera_type = CameraType(self.config["camera_type"]) |
pybullet_camera_driver.BulletCameraDriver.client = client |
bool pybullet_camera_driver.BulletCameraDriver.color_stream = True |
pybullet_camera_driver.BulletCameraDriver.current_orientation = self.client.getQuaternionFromEuler(rotation_matrix_to_euler(view_matrix_np[:3, :3].T)) |
pybullet_camera_driver.BulletCameraDriver.current_position = -view_matrix_np[:3, :3].T @ view_matrix_np[:3, 3] |
bool pybullet_camera_driver.BulletCameraDriver.depth_stream = True |
pybullet_camera_driver.BulletCameraDriver.distance = self.config['sim_config']["fix"]['distance'] |
pybullet_camera_driver.BulletCameraDriver.far_val = self.config['sim_config'].get('far_val', 100.0) |
pybullet_camera_driver.BulletCameraDriver.fov = self.config['sim_config'].get('fov', 60) |
pybullet_camera_driver.BulletCameraDriver.height = self.config.get('height', 480) |
bool pybullet_camera_driver.BulletCameraDriver.infrared_stream = False |
dict pybullet_camera_driver.BulletCameraDriver.link_info = {} |
pybullet_camera_driver.BulletCameraDriver.near_val = self.config['sim_config'].get('near_val', 0.1) |
pybullet_camera_driver.BulletCameraDriver.offset_rotation = self.config["sim_config"]['attach'].get("offset_rotation", [0, 0, 0]) |
pybullet_camera_driver.BulletCameraDriver.offset_translation = self.config["sim_config"]['attach'].get("offset_translation", [0, 0, 0]) |
pybullet_camera_driver.BulletCameraDriver.parent_link = self.config["sim_config"]['attach'].get("parent_link", None) |
dict pybullet_camera_driver.BulletCameraDriver.parent_link_id = self.link_info.get(self.parent_link, None) |
pybullet_camera_driver.BulletCameraDriver.parent_name = self.config["sim_config"]['attach']["parent_name"] |
pybullet_camera_driver.BulletCameraDriver.pitch = self.config['sim_config']["fix"]['pitch'] |
pybullet_camera_driver.BulletCameraDriver.rel_camera_target = self.config["sim_config"]['attach'].get("rel_camera_target", [1, 0, 0]) |
pybullet_camera_driver.BulletCameraDriver.roll = self.config['sim_config']["fix"]['roll'] |
bool pybullet_camera_driver.BulletCameraDriver.segmentation_stream = True |
pybullet_camera_driver.BulletCameraDriver.up_axis_index = self.config['sim_config']["fix"]['up_axis_index'] |
pybullet_camera_driver.BulletCameraDriver.urdf_path = self.config["sim_config"].get("urdf_path", None) |
pybullet_camera_driver.BulletCameraDriver.visual_body_id = None |
pybullet_camera_driver.BulletCameraDriver.visualize = self.config["sim_config"].get("visualize", False) |
pybullet_camera_driver.BulletCameraDriver.width = self.config.get('width', 640) |
pybullet_camera_driver.BulletCameraDriver.yaw = self.config['sim_config']["fix"]['yaw'] |