Skip to content

feat: add IMU integration with fall detection and recovery#2436

Open
Wanbogang wants to merge 3 commits intoOpenMind:mainfrom
Wanbogang:feature/imu-integration
Open

feat: add IMU integration with fall detection and recovery#2436
Wanbogang wants to merge 3 commits intoOpenMind:mainfrom
Wanbogang:feature/imu-integration

Conversation

@Wanbogang
Copy link
Collaborator

Summary

Adds full IMU (Inertial Measurement Unit) integration to OM1, enabling
robots to detect falls and impacts, then automatically execute recovery actions. #365

Components Added

Provider

  • IMUProvider — singleton that stores and distributes accelerometer,
    gyroscope, and orientation data to all OM1 components

Input

  • IMUInput — reads JSON data from serial IMU sensor (MPU6050, BNO055,
    or generic Arduino serial bridge)

Background

  • IMUFallDetector — continuously monitors IMU state and updates
    ContextProvider when fall or impact is detected

Action

  • FallRecovery — three supported actions:
    • stand_up — sends stand up command and resets IMU alerts
    • emergency_stop — sends emergency stop command
    • alert_operator — logs warning and notifies operator

Config

  • config/imu.json5 — ready-to-use robot config with IMU input,
    fall detector background, fall recovery + speak actions

Supported Sensors

  • MPU6050 (I2C, Raspberry Pi)
  • BNO055 (I2C, absolute orientation)
  • Generic Serial (Arduino with pre-processed IMU data)

Expected serial data format

{"ax": 0.1, "ay": 0.2, "az": 9.8,
 "gx": 0.0, "gy": 0.0, "gz": 0.0,
 "roll": 1.2, "pitch": 0.5, "yaw": 90.0}

- Add IMUProvider singleton for accelerometer/gyroscope/orientation data
- Add IMUInput plugin to read JSON data from serial IMU sensor
- Add IMUFallDetector background task for continuous fall monitoring
- Add FallRecovery action with serial connector for robot recovery
- Add config/imu.json5 for IMU robot configuration
- Support MPU6050, BNO055, and generic serial IMU sensors
- 51 tests, 100% coverage
@Wanbogang Wanbogang requested review from a team as code owners March 2, 2026 02:52
@github-actions github-actions bot added robotics Robotics code changes python Python code tests Test files config Configuration files labels Mar 2, 2026
@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

- Remove reset classmethod stub (handled by singleton decorator)
- Add type: ignore for IMUProvider.reset() pyright attribute access
- Add test_reset_class_method_callable test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Configuration files python Python code robotics Robotics code changes tests Test files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant