Skip to content

Fix launch files for C++ lifecycle node, add I2C launch variant#9

Draft
Copilot wants to merge 6 commits intocopilot/convert-bno055-driver-to-cppfrom
copilot/compare-bno-driver-implementation
Draft

Fix launch files for C++ lifecycle node, add I2C launch variant#9
Copilot wants to merge 6 commits intocopilot/convert-bno055-driver-to-cppfrom
copilot/compare-bno-driver-implementation

Conversation

Copy link

Copilot AI commented Feb 12, 2026

Sensor data quality improvements (Boardoza reference comparison)

Compared the Boardoza BNO055 driver with this repo's C++ implementation. Found several deficiencies affecting data quality.

Calibration offset writing was a no-op

The most critical issue: set_offsets: true logged "Setting calibration offsets" but never actually wrote to registers 0x55–0x6A. Now writes all 9 offsets + 2 radius values:

// Before: offsets declared but never written
if (config_.set_offsets) {
  RCLCPP_INFO(..., "Setting calibration offsets");
  // ... nothing written ...
  set_mode(config_.operation_mode);
}

// After: offsets written to sensor registers
if (config_.set_offsets) {
  write_offset(ACCEL_OFFSET_X_LSB_ADDR, config_.offset_acc[0]);
  write_offset(ACCEL_OFFSET_Y_LSB_ADDR, config_.offset_acc[1]);
  // ... all 9 offsets + 2 radius values ...
}

Other sensor quality fixes

  • Mode transition delaysset_mode() had no delay; BNO055 datasheet requires ~19ms, Boardoza uses 25–50ms. Added 30ms.
  • Sensor reset on configure — Issue SYS_TRIGGER=0x20 before configuration for clean state
  • Self-test verification — Check SELFTEST_RESULT register with per-sensor (ACC/MAG/GYR/MCU) reporting
  • Euler angles topic — Buffer indices 18–23 were already read but discarded; now published on bno055/euler
  • is_fully_calibrated() per operation mode — Calibration status now includes fully_calibrated field, checking only sensors relevant to current mode (e.g. IMUPLUS → accel+gyro only)
  • Named constantsSELFTEST_ALL_PASSED, CALIBRATION_FULLY_CALIBRATED replace magic numbers

Launch file fixes

bno055.launch.py referenced executable='bno055' (the Python entry point) but the build is ament_cmake — only bno055_lifecycle_node gets built. The old launch file was non-functional.

  • Fix bno055.launch.py — Use LifecycleNode(executable='bno055_lifecycle_node') with auto configure→activate
  • Add bno055_i2c.launch.py — I2C variant using bno055_params_i2c.yaml (config existed, launch didn't)
  • Update READMEs — Document all launch options
# UART (default)
ros2 launch bno055 bno055.launch.py

# I2C
ros2 launch bno055 bno055_i2c.launch.py

# Manual lifecycle control
ros2 launch bno055 bno055_lifecycle.launch.py

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 12, 2026 08:20
…ays, Euler angles, calibration check

Compared Boardoza BNO055 reference driver with saha-robotics implementation.
Key improvements for sensor data quality:

1. Implement actual calibration offset writing to sensor registers (was declared but never written)
2. Write accelerometer/magnetometer radius calibration values
3. Add sensor reset before configuration for clean state
4. Add self-test verification during configuration with detailed per-sensor results
5. Add proper mode transition delays (30ms per BNO055 datasheet)
6. Add Euler angles publication (data already in buffer, now published on euler topic)
7. Add operation-mode-aware isFullyCalibrated check in calibration status
8. Add proper timing delays during initialization sequence

Co-authored-by: ROSSARP <117314787+ROSSARP@users.noreply.github.com>
- Add SELFTEST_ALL_PASSED and CALIBRATION_FULLY_CALIBRATED constants to registers.hpp
- Use named constants instead of magic numbers for self-test (0x0F) and calibration (3)
- Add return value checking and warning logging in write_offset method

Co-authored-by: ROSSARP <117314787+ROSSARP@users.noreply.github.com>
Copilot AI changed the title [WIP] Compare BNO driver implementation for sensor data quality Implement missing BNO055 calibration offset writing and sensor init improvements Feb 12, 2026
Copilot AI requested a review from ROSSARP February 12, 2026 08:24
Copy link

@ROSSARP ROSSARP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not tested

- Fix bno055.launch.py: replace broken Python Node reference with C++
  LifecycleNode (executable='bno055_lifecycle_node') with auto
  configure/activate lifecycle management
- Add bno055_i2c.launch.py: launch file for I2C connection using
  bno055_params_i2c.yaml
- Update README.md: document all launch options (UART, I2C, lifecycle)
- Update CPP_README.md: add I2C and UART launch commands

Co-authored-by: ROSSARP <117314787+ROSSARP@users.noreply.github.com>
Copilot AI changed the title Implement missing BNO055 calibration offset writing and sensor init improvements Fix launch files for C++ lifecycle node, add I2C launch variant Feb 12, 2026
Copilot AI requested a review from ROSSARP February 12, 2026 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants