You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
2.3 KiB
Markdown

# Learning how to use the Moteus BLDC controller
## The EIL5 of communication with the Moteus
There are two protocol's at play with the Moteus you need to be aware of:
1. **Diagnostic**: This is used by the `tview` and `moteus_tool` applications and is of the text form `d pos`
- Calibration of the motor used with the Moteus as of 05/04/2023 still requires the `moteus_tool` you cannot calibrate the motor from within your application.
- `conf write` will persist the configuration you have set in tview to the motor controller. It's the easiest way to change the gains you or whatever.
- [Getting Started with the DevKit](https://youtu.be/HHCBohdrCH8) Has a great explaination of a lot of the tools.
2. **Register**: This is the protocol used under the hood with the Python library. It read/writes to registers on the Micro over CANBus FD.
- __BE AWARE__: There is a watchdog timer set per servo that defaults to `servo.default_timeout_s=0.1`. This means that you you need to send a valid command at least every 100ms or you will trip the fault state. TODO add how to get out of fault state. END TODO. YOu can change this value in tview and persist with `conf write` or you can can use `watchdog_timeout` kwarg in the `set_postion` command. ALSO! You can use diagnotic protocol from python programs to programtically set it #TODO add an example python file showing how to do this END TODO#.
## Firmware updates
Firmware updates will unlock newer features of the boards. Follow these instructions https://github.com/mjbots/moteus/blob/main/docs/reference.md#flashing-over-can when you need to upgrade the controllers.
## Quickstart
Launching t-view
```
python -m moteus_gui.tview
```
Calibrating a new motor. Note the calibration process will require free movement.
```
python3 -m moteus.moteus_tool --target 1 --calibrate
```
The first movement. This will be a [position control movemen](https://github.com/mjbots/moteus/blob/main/docs/reference.md#d-pos) from an arbitrary start point.
This command is of the form `d pos <pos> <vel> <max_torque> [options...]`
In tview terminal
```
d pos nan 0.2 0.3 s0.8
```
d: diagnostic command
pos: position control
nan: Uses not a number (nan) to state from any position
0.2: positive movement at 0.2 revolutions per second
0.3: a max torque of 0.3 Nm
s0.8: Position stop at 0.8