I’ve added a “I2CCommander” class in the SimpleFOC drivers repository, you can find it here:
The goal is to allow programmatic control of a SimpleFOC motor driver in an easy way. I know there are better (esp. faster) protocols than I2C out there, but I2C is widely supported, simple to use, sufficient for many use cases and only uses 2 wires. It will be familiar to many users, for example I2C is already used in many of the Arduino DC-motor or servo driver boards out there.
The code has interfaces for both target device (the motor driver running SimpleFOC) and the controller device (some kind of coordinating MCU that is trying to send control messages to one or more motor drivers). The code defines a set of registers which expose the SimpleFOC variables and allow reading/writing them.
It can in theory control up to 256 motors, and deals with multiple target devices, multiple I2C buses and multiple motors (up to 8) per target device. So now nothing stands between you and that kinetic sculpture of 200 motors you were planning
The code is still very new, and barely tested, but the simple use cases I’ve tried so far are working. If anyone is interested, feedback (and bug reports) are welcome!