Used by my rover controller OmniCtrl and Dug the robot
- Supports different CanBus motors on the same CAN bus
- ODrive and odrive-compatible motors
- Xiaomi CyberGear motors
- Robstride motors: in development
- Environment independent CAN support
- Arduino, PlatformIO, ESP-IDF, linux, etc.
- Includes support for ESP32's native TWAI CanBus library
- Add additional CAN motor drivers
- MJBot Moteus protocol
- Add RS-485 and UART motor support
- Hiwonder/LewanSoul bus servos (like the LX-16A)
- Feetech bus servos (like the STS3215)
- Python wrapper
Join my 3D Design Discord and say hi and talk shop!
- Include the library in your project (see below)
- Create a
CanInterfaceobject, for example theCanEsp32Twaiclass that's included:CanEsp32Twai interface; interface.setup(PIN_CAN_RX, PIN_CAN_TX, 250000, &Serial); - Create a driver object (on stack, heap, etc)
ODriveDriver omotor(ID1, &interface); CyberGearDriver cmotor(ID2, &interface);
- Handle incoming messages in your loop:
void loop() { // (other loop code) while (interface.available()) { CanMessage message = interface.readOne(); bool handled = false; for (int i = 0; i < NUM_DRIVES; i++) { if (drives_[i]->handleIncoming(message.id, message.data, message.len, now)) handled = true; } } }
- If you use PlatformIO, add the following to your
platformio.ini:lib_deps = https://github.com/t413/multimotor.git - Or use via submodule:
git submodule add https://github.com/t413/multimotor.git