Skip to content
Snippets Groups Projects

Quad i2c rework

Merged bbartels requested to merge quad-i2c-rework into master

Problem

Currently, the I2C device specific functions are residing in the application layer. This doesn't make much sense; it would be more appropriate for these hardware level details (registers numbers and offsets) to reside in the hardware layer.

Solution

Add a few more hardware interfaces, specifically one for each of the I2C sensors we use (IMU, Lidar, Optical flow). This will make dependency injection of the I2C bus on a particular bus much easier (which will be important if we want to make a new I2C bus specifically for the optical flow sensor). As a bonus, this change also makes it much easier to implement the I2C devices in the virtual quad, and allows us to make some cool tests (like verifying that certain motors get stronger when you "tilt" the quad...).

Reviewers

@dawehr
@ericm @jpbush @phjones

Merge request reports

Checking pipeline status.

Merged by avatar (Mar 13, 2025 8:36pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Author Contributor

    FYI @ericm: This will affect your work on your optical flow branch.

    Edited by bbartels
  • dawehr added 1 commit

    added 1 commit

    • 8ccfe097 - quad: move i2c device functions into the hardware interface

    Compare with previous version

  • bbartels unmarked as a Work In Progress

    unmarked as a Work In Progress

  • Author Contributor

    The functional virtual quad tests have been updated to included some "sanity" checks.

    Specifically, the test verifies that the correct motors have greater thrust when the quad is tilted in certain directions:

    Check that when quad is tilted, motors respond correctly
    Tilting forwards...
    [0.8060557999999999, 0.22479697999999965, 0.8067574399999998, 0.22403645999999963]
    Tilting backwards...
    [0.3412184299999999, 0.6907702600000002, 0.33985340999999986, 0.6921104600000002]
    Tilting right...
    [0.30387248999999944, 0.24451783999999993, 0.7873231000000003, 0.7273246900000007]
    Tilting left...
    [0.7837717200000002, 0.6890350400000002, 0.34151948, 0.2454619499999999]
  • merged

  • bbartels mentioned in commit 2888cf88

    mentioned in commit 2888cf88

Please register or sign in to reply
Loading