Public API¶
cubemarsPyCAN - CAN control for CubeMars AK-series actuators.
Importing this package pulls in python-can and nothing else. In particular it never
imports pyserial, which lives behind the [slcan] extra.
Every constant carries its own provenance - the manual page, the datasheet, or the bench
run it came from - readable through Sourced and printed by
cubemars dump-spec.
Everything below is importable directly from cubemarspycan. The headings are the
modules where each name is defined, which is also the only place it is documented — see
the note on Motors for why that matters.
Motors and transport¶
|
Routes frames between a transport and a set of motors. |
|
An AK actuator in MIT (impedance) mode. |
|
Which arbitration id the driver answers on. |
|
An AK actuator in servo mode over CAN. |
|
Wraps an injected |
The motor data model¶
|
Everything known about one motor variant. |
|
A constant together with its provenance. |
|
Where a number came from, loosely ordered by how much it should be trusted. |
|
The scaling of one CAN bit-field. |
|
What the motor can actually do. |
|
Constants that relate the rotor to the output shaft and current to torque. |
|
What this variant's hardware supports. |
|
The five MIT command fields. |
|
Servo-mode wire scaling. |
|
Which side of the gearbox a mechanical quantity refers to. |
|
What the driver does when position leaves the field's range. |
State and faults¶
|
One decoded MIT feedback frame. |
|
One decoded servo feedback frame (function id 0x29). |
|
A servo frame that is not state. |
|
A latched driver fault. |
|
Fault code from a CAN feedback frame (MIT and servo). |
|
|
|
Map a raw fault byte to |
Policy, frames and tracking¶
|
Limits and reactions chosen by the caller, not read off the motor. |
|
What to do with a command outside the usable range. |
|
What a command had to be changed to before it could be sent. |
|
What |
|
One classic-CAN data frame: an arbitration id, up to 8 payload bytes, and a flag. |
|
Turns a wrapping field reading into a continuous value. |
|
Argument to |
Exceptions¶
Base class for every error this library raises. |
|
Base for runtime problems with a specific motor. |
|
The driver reported a non-zero fault code. |
|
No fresh feedback within the configured window; the motor may be gone. |
|
Commanded a motor that is not inside its |
|
This motor variant does not support the requested operation. |
|
Something on the wire did not match the protocol. |
|
A frame could not be decoded. |
|
The driver never confirmed it is in servo mode. |
|
The motor specification cannot support what was asked of it. |
|
A conversion needs a constant this spec does not know. |
|
The value exists on the wire but which side of the gearbox it refers to is unknown. |
|
The CAN link failed. |
|
A frame could not be put on the bus. |
|
The requested backend does not exist on this platform (e.g. socketcan on macOS). |
The registry¶
|
Model names as the manual's field-range table spells them. |
|
Variant keys that carry datasheet-verified physical constants. |
get_spec is the public name for the registry’s get; the alias exists because a
bare get reads badly at a call site. It is documented here rather than under
Core data model, so that there is exactly one entry for it.