Skip to content

Commit

Permalink
update docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
pengzhenghao committed Feb 23, 2024
1 parent 6cb4315 commit 6aed0d0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
19 changes: 15 additions & 4 deletions metadrive/component/sensors/base_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def perceive(
self, to_float=True, new_parent_node: Union[NodePath, None] = None, position=None, hpr=None
) -> np.ndarray:
"""
When clip is set to False, the image will be represented by unit8 with component value ranging from [0-255].
When to_float is set to False, the image will be represented by unit8 with component value ranging from [0-255].
Otherwise, it will be float type with component value ranging from [0.-1.]. By default, the reset parameters are
all None. In this case, the camera will render the result with poses and position set by track() function.
Expand All @@ -130,13 +130,24 @@ def perceive(
camera to capture a new image and return the camera to the owner. This usually happens when using one camera to
render multiple times from different positions and poses.
new_parent_node should be a NodePath like object.origin and vehicle.origin or self.engine.origin, which
means the world origin. When new_parent_node is set, both position and hpr have to be set as well. The position
new_parent_node should be a NodePath like object.origin or vehicle.origin or self.engine.origin, which
means the world origin. When new_parent_node is set, both position and hpr have to be set as well. The position
and hpr are all 3-dim vector representing:
1) the relative position to the reparent node
2) the heading/pitch/roll of the sensor
"""
Args:
to_float: When to_float is set to False, the image will be represented by unit8 with component value ranging
from [0-255]. Otherwise, it will be float type with component value ranging from [0.-1.].
new_parent_node: new_parent_node should be a NodePath like object.origin or vehicle.origin or
self.engine.origin, which means the world origin. When new_parent_node is set, both position and hpr
have to be set as well. The position and hpr are all 3-dim vector representing:
position: the relative position to the reparent node
hpr: the heading/pitch/roll of the sensor
Return:
Array representing the image.
"""
if new_parent_node:
if position is None:
position = constants.DEFAULT_SENSOR_OFFSET
Expand Down
16 changes: 14 additions & 2 deletions metadrive/engine/core/main_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ def perceive(
self, to_float=True, new_parent_node: Union[NodePath, None] = None, position=None, hpr=None
) -> np.ndarray:
"""
When clip is set to False, the image will be represented by unit8 with component value ranging from [0-255].
When to_float is set to False, the image will be represented by unit8 with component value ranging from [0-255].
Otherwise, it will be float type with component value ranging from [0.-1.]. By default, the reset parameters are
all None. In this case, the camera will render the result with poses and position set by track() function.
Expand All @@ -461,11 +461,23 @@ def perceive(
camera to capture a new image and return the camera to the owner. This usually happens when using one camera to
render multiple times from different positions and poses.
new_parent_node should be a NodePath like object.origin and vehicle.origin or self.engine.origin, which
new_parent_node should be a NodePath like object.origin or vehicle.origin or self.engine.origin, which
means the world origin. When new_parent_node is set, both position and hpr have to be set as well. The position
and hpr are all 3-dim vector representing:
1) the relative position to the reparent node
2) the heading/pitch/roll of the sensor
Args:
to_float: When to_float is set to False, the image will be represented by unit8 with component value ranging
from [0-255]. Otherwise, it will be float type with component value ranging from [0.-1.].
new_parent_node: new_parent_node should be a NodePath like object.origin or vehicle.origin or
self.engine.origin, which means the world origin. When new_parent_node is set, both position and hpr
have to be set as well. The position and hpr are all 3-dim vector representing:
position: the relative position to the reparent node
hpr: the heading/pitch/roll of the sensor
Return:
Array representing the image.
"""

if new_parent_node:
Expand Down

0 comments on commit 6aed0d0

Please sign in to comment.