simulo.SensorOffset
Offset configuration for sensor placement relative to parent frame.
Used to specify the position and orientation of a sensor relative to its attachment point (e.g., camera offset from robot base).
Attributes:
pos— Position offset (x, y, z) in metersrot— Rotation as quaternion (w, x, y, z) - wxyz conventionconvention— Coordinate frame convention (“opengl”, “ros”, “world”)
For cameras, hand-tuning rot quaternions is error-prone — identity
rotation in ROS convention makes the camera stare straight up at the
parent’s +Z axis, not forward. Prefer look_at() to derive the
quaternion from a camera position and a target point.
simulo.SensorOffset( pos: Tuple[float, float, float] = (0.0, 0.0, 0.0), rot: Tuple[float, float, float, float] = (1.0, 0.0, 0.0, 0.0), convention: str = 'opengl',)look_at()
Section titled “look_at()”SensorOffset.look_at( pos: Tuple[float, float, float], target: Tuple[float, float, float] = (0.0, 0.0, 0.0), up_hint: Tuple[float, float, float] = (0.0, 0.0, 1.0), convention: str = 'ros',) -> SensorOffsetclassmethod
Return a SensorOffset whose camera looks at target from pos.
Computes a ROS-optical-frame quaternion so the camera’s +Z axis
(forward) points from pos toward target and the camera’s +Y
axis (down in image) is perpendicular to up_hint. The
degenerate case (forward parallel to up_hint — i.e., camera looking
straight up or down along the parent’s Z axis) returns the
canonical (0, 1, 0, 0) “look down” quaternion when looking down,
identity “look up” when looking up.
Args:
pos— Camera position in the parent (attachment) frame.target— Point the camera should point at, in the parent frame. Defaults to the parent’s origin.up_hint— World-space “up” direction. Defaults to (0, 0, 1).convention— Frame convention passed through to the returned SensorOffset. Defaults to “ros” since look-at math is expressed in ROS optical-frame convention.
Examples: Top-down camera 4m above the torso looking straight down:
offset = SensorOffset.look_at(pos=(0, 0, 4))Side camera 3m to the right + 2m up, looking back at the robot:
offset = SensorOffset.look_at(pos=(3, 0, 2))Over-the-shoulder camera 2m behind + 1.5m up:
offset = SensorOffset.look_at(pos=(-2, 0, 1.5))