espp/motor_controller

1.3.1

Latest
uploaded 1 day ago
Shared motor-controller interface for espp: the MotorAxis channel selector and the MotorController concept satisfied by the Basicmicro (serial) and Mcp266 (CANopen) drivers

Readme

# Motor Controller Component

[![Badge](https://components.espressif.com/components/espp/motor_controller/badge.svg)](https://components.espressif.com/components/espp/motor_controller)

Header-only shared interface for the espp dual-channel motor-controller drivers
that model the same MCP236 / MCP266 (Basicmicro / RoboClaw-family) hardware over
different transports. It defines:

- `espp::MotorAxis` — the `M1` / `M2` channel selector, and
- `espp::MotorController` — a compile-time concept describing the common command
  and read surface (`drive_duty` / `drive_speed` by axis, `read_encoder` /
  `read_speed`, `reset_estop`, `read_main_battery_voltage`, `read_temperature`).

Keeping the contract in a small, dependency-light component lets the two sibling
drivers share it without depending on each other: `espp::Basicmicro` (packet
serial) and `espp::Mcp266` (CANopen) each `static_assert` that they satisfy
`MotorController`, so generic code can command either transport by axis.

This is an interface / types component (like `bldc_types`): it has no runnable
example of its own — it is exercised by the `basicmicro` and `mcp266` examples,
which build in CI and instantiate the drivers that implement the concept.

## Example

```cpp
#include "motor_controller.hpp"

// Works for either espp::Basicmicro or espp::Mcp266 (both satisfy the concept).
bool ramp(espp::MotorController auto &mc, std::error_code &ec) {
  return mc.drive_duty(espp::MotorAxis::M1, 4096, ec);
}
```

Links

Supports all targets

Maintainer

  • William Emfinger <waemfinger@gmail.com>
To add this component to your project, run:

idf.py add-dependency "espp/motor_controller^1.3.1"

download archive

Stats

  • Archive size
    Archive size ~ 5.19 KB
  • Downloaded in total
    Downloaded in total 0 times
  • Downloaded this version
    This version: 0 times

Badge

espp/motor_controller version: 1.3.1
|