This is a C++ library that provides a convenient API for controlling and monitoring an mjbots moteus brushless servo controller. It uses the ACAN2517FD library to perform CAN-FD communications, but could be easily modified to work with other libraries.
Note that this library can only communicate and operate a moteus controller which has already been calibrated. Calibration currently can not be performed via an Arduino and requires moteus_tool
executing on a desktop computer with some CAN-FD adapter. See the moteus getting started guide for details. The only controllers sold by mjbots.com which are pre-calibrated are those included in development kits.
You will need to have hardware that is compatible with the ACAN2517FD library, this will be something that has the MCP2517FD or MCP2518FD CAN-FD controller onboard.
The CAN-FD bus needs to be connected to moteus, typically this would be at least the CANL and CANH wires, and likely the ground as well. For more than 2 or 3 controllers, separate 120 ohm termination resistors will be required on each end of the CAN bus. Some Arduino CAN-FD shields, like the CANBed FD, have one termination resistor built in.
If you are using version 1.6.x or later of the Arduino software (IDE) you can use the Library Manager to install this library:
- In the Arduino IDE, open the "Sketch" menu, select "Include Library", then "Manage Libraries...".
- Search for "moteus"
- Click the moteus entry in the list.
- Click "Install".
If this does not work, you can manually install the library:
- Download the latest release archive from GitHub and decompress it
- Rename the folder "moteus-arduino" to "moteus"
- Drag the "moteus" folder into the "libraries" directory inside your Arduino sketchbook directory. You can view your sketchbook location by opening the "File" menu and selecting "Preferences" in the Arduino IDE. If there is not already a "libraries" folder in that location, you should make the folder yourself.
- After installing the library, restart the Arduino IDE.
Several examples are available. You can access them from the Arduino IDE by opening the "File" menu, selecting "Examples", and then selecting "moteus".
For complete documentation, see [docs/reference.md](the reference documentation).