feathersdk.robot.services.imu_odometry_service Module

Dead-reckoning odometry for a planar base from the ZED 2i IMU.

Double-integrates linear acceleration for (x, y) and integrates the vertical gyro for yaw.

ZED 2i IMU frame (left camera): +X right, +Y down, +Z forward along the optical axis. Robot odometry frame: +X forward, +Y left, yaw positive counter-clockwise about +Z (up).

Assumes the camera is mounted looking forward and is roughly level with the base.

class feathersdk.robot.services.imu_odometry_service.OdometryPose(x, y, yaw)

Bases: NamedTuple

Dead-reckoned pose of the robot base in the world/odometry frame.

Parameters:
x: float

X position in meters. +X is forward at yaw=0.

y: float

Y position in meters. +Y is left at yaw=0.

yaw: float

Yaw in radians. Positive is counter-clockwise.

class feathersdk.robot.services.imu_odometry_service.IMUOdometryServiceConfig(*, odometry_source='imu', module_name='imu_odometry_service', operating_frequency=100.0)

Bases: PyDFrozenBaseModel

Configuration for the IMU odometry service.

Parameters:
  • odometry_source (Literal['imu'])

  • module_name (str)

  • operating_frequency (float)

odometry_source: Literal['imu']

Selects this config as ZED-IMU odometry on FeatherRobotConfig.odometry_service_config.

module_name: str

The name of the module.

operating_frequency: float

The operating frequency of the IMU odometry service in Hz.

model_config: ClassVar[ConfigDict] = {'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

class feathersdk.robot.services.imu_odometry_service.IMUOdometryService(config, *args, **kwargs)

Bases: RobotModule[IMUOdometryServiceConfig]

Integrates ZED 2i IMU samples into a rigid-body base pose.

At reset(), the robot is assumed stationary so the current accelerometer reading can be stored as gravity (in the IMU frame) and subtracted from later samples. Double integration of residual planar accel gives (x, y). Yaw is integrated from the IMU gyro about vertical; the accelerometer cannot observe yaw.

Requires robot.camera_service.

Parameters:
get_pose()

Return the current dead-reckoned pose (x, y, yaw) in meters / radians.

Return type:

OdometryPose

reset()

Reset the pose to (0, 0, 0) and re-seed gravity (robot should be stationary).

Return type:

None

update()

Integrate one IMU sample into pose.

Skips the step if dt is non-positive / too large. Seeds gravity on the first tick if reset() has not run yet.

Return type:

None