Skip to main content

motor-drive-layer

Python bindings for the Motor-Drive-Layer native C++ Damiao motor driver.

The package loads the two bundled native ABI libraries through Python ctypes and exposes SocketCAN, SocketCAN-FD, Damiao serial bridge, and optional DM_Device transports. libmotor_abi is the generic motor layer; libarticore_runtime is the separately versioned product safety runtime consumed by Articore SDKs. Use articore_runtime_abi_version() and articore_runtime_capabilities() to inspect that product runtime independently from abi_version() and abi_capabilities(). Runtime ABI 1.4 adds native atomic enable with parallel CH0/CH1 activation, immediate current-position hold, parallel feedback confirmation, and all-motor rollback. Runtime ABI 1.3 exposes the native latest-value joint mailbox and single active trajectory engine in addition to current_position_hold: arm safe hold snapshots fresh cached positions and rejects stale or faulted feedback instead of replaying the previous user target. SDK bindings use articore_runtime_create_ex() and pass the motor enable callbacks explicitly; the two packaged native libraries remain independently loadable on Linux, Windows, and macOS. Published wheels cover Linux x86_64/ARM64, macOS Intel/Apple Silicon, and Windows x64. The serial transport is cross-platform; SocketCAN transports remain Linux-only.

DM-USB2FDCAN Dual works with its original dual_app firmware through Controller.from_dm_device(device="usb2canfd-dual", channel=0, bitrate=1_000_000, data_bitrate=5_000_000). CH0 and CH1 are independently selectable, old positional arguments remain compatible, and the loader probes both vendor v1.0 and v1.1 ABIs. The matching vendor runtime is included in every platform wheel; no separate download command is required. Set MOTOR_DM_DEVICE_LIB only when intentionally overriding the packaged runtime. The current official macOS v1.1 dylib requires macOS 26, and the packaged wheel is tagged accordingly rather than claiming compatibility with an older system. Linux ARM64 wheels include a private libusb 1.0.27 build so the vendor v1.1 runtime can use libusb_init_context on Ubuntu 22.04 without replacing the host's libusb 1.0.25 package. Linux x86_64 wheels contain both v1.0 and a complete v1.1 environment using the same private libusb together with a private compatible libstdc++. v1.0 remains the default on x86_64 because the official v1.1 runtime batches receive callbacks at roughly 100 ms with dual_app v1.0.0.3; set MOTOR_DM_DEVICE_ABI=v1.1 to opt in without installing any host runtime. On final Controller close, v1.1 fully tears down its device session. The Linux v1.0 runtime instead closes the selected channels and motor-layer resources but retains its legacy context/device until process exit, allowing a later Controller.from_dm_device(...) call to reconnect reliably in the same Python process. The operating system reclaims those retained vendor objects at exit because calling the vendor destructor during static teardown can race libusb thread cleanup.

Use Motor.request_fresh_state(timeout_ms=50) when the caller must wait for a newly requested feedback frame. For multiple motors, Controller.request_feedback_all(timeout_ms=50) sends every request with the configured TX pacing and waits against one shared deadline; a timeout reports the missing motor IDs. The public method internally uses the structured native entry point and raises typed FeedbackTimeoutError, IncompleteFeedbackError, FeedbackTransportError, or FeedbackMotorFaultError exceptions. Each remains a CallError subclass and carries a stable error_code plus a FeedbackReport containing timeout, expected/received/missing counts, and missing motor IDs; no caller needs to use an _ex Python method. The lower-level request_feedback(), get_state(), and poll_feedback_once() methods remain non-blocking asynchronous/cache operations.

For synchronized multi-channel control, ControllerGroup([ch0, ch1]) creates one persistent native worker per Controller. send_pos_vel([...]) and send_mit([...]) dispatch typed PosVelCommand or MitCommand values across their owning controllers, overlap independent TX pacing waits, and return after every controller finishes. Errors retain the controller/channel, motor ID, and native reason. For fixed high-rate layouts, prepare_pos_vel(motors) and prepare_mit(motors) reuse one validated ctypes command array across calls. Controller.transport_capabilities() reports the active transport's CAN-FD, channel, parallel-send, reconnect, session-reuse, and timestamp capabilities. Controller.transport_health() reports live connection state, TX/RX counters, errors, and last activity ages without adding robot-product policy to the transport layer.

The motor-drive-layer-stress command provides a feedback-only DM_Device load/reconnect test and reports latency plus Linux file-descriptor/thread counts. It never enables or commands motors. The CLI scan command similarly uses one Controller and one batch discover_damiao_motors() call for its entire candidate range, then uses close_bus() plus close() so scanning never emits disable frames. The repository's scripts/test_dm_device_scan_lifecycle.py runs 100 scan-process/CH0+CH1-reader-process cycles.

The wheel includes py.typed and .pyi declarations for editor completion and static type checking. The main public APIs are:

  • Controller(...), from_socketcanfd(...), from_dm_serial(...), and from_dm_device(...).
  • Controller.add_damiao_motor(...), enable_all(), disable_all(), request_feedback_all(), set_tx_gap_us(), transport_capabilities(), shutdown(), and close_bus().
  • ControllerGroup(...), send_pos_vel(...), and send_mit(...) for persistent native multi-controller dispatch, plus reusable prepared batches for fixed layouts.
  • Motor.enable(), disable(), ensure_mode(), all four control-mode send methods, fresh/cached feedback methods, typed register access, parameter aliases, and store_parameters().
  • MitCommand, PosVelCommand, MotorState, FeedbackStats, Mode, register metadata/constants, and SDK exception classes.

Motor is a logical child of its creating Controller. After the parent closes, motor operations raise CallError; motor.close() can still release the handle. Both classes support context managers. Leaving a Motor context only frees its handle, while leaving a Controller context attempts to disable all motors before closing the bus.

See the project README for build instructions, architecture, configuration, safety guidance, and examples.

This package is distributed under the MIT License. The optional DM_Device vendor runtime is distributed separately and may have its own license terms.

Metadata

Release files for motor-drive-layer 0.7.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for motor-drive-layer 0.7.7
File
motor_drive_layer-0.7.7-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
motor_drive_layer-0.7.7-py3-none-manylinux_2_35_aarch64.whl Python 3 none Linux glibc 2.35+ ARM64 Details
motor_drive_layer-0.7.7-py3-none-manylinux_2_34_x86_64.whl Python 3 none Linux glibc 2.34+ x86-64 Details
motor_drive_layer-0.7.7-py3-none-macosx_26_0_x86_64.whl Python 3 none macOS 26.0+ x86-64 Details
motor_drive_layer-0.7.7-py3-none-macosx_26_0_arm64.whl Python 3 none macOS 26.0+ ARM64 Details

Total release size: 3.0 MB

Release files / motor_drive_layer-0.7.7-py3-none-win_amd64.whl

Download URL motor_drive_layer-0.7.7-py3-none-win_amd64.whl
Size 334.1 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
68b2841a30d73eacf68009562768297ce6d8bf481f7cbc73c42a0473f47cf533
BLAKE2b-256 checksum
How to use checksums
44818b57e918ff28f62ab57c5a8ef457b6527ca0b35a0bda394bd62323d0ff34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Release files / motor_drive_layer-0.7.7-py3-none-manylinux_2_35_aarch64.whl

Download URL motor_drive_layer-0.7.7-py3-none-manylinux_2_35_aarch64.whl
Size 528.6 kB
Tags Linux glibc 2.35+ ARM64 Python 3
SHA-256 checksum
How to use checksums
fa51a145893024f1feecb4f304a9ec68c54d75b07cd02cd682df8fdf0e2cee65
BLAKE2b-256 checksum
How to use checksums
407586409d2f51ec6d1d797c4b4910a63bb3fb3560997f2e215052e731da28d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Release files / motor_drive_layer-0.7.7-py3-none-manylinux_2_34_x86_64.whl

Download URL motor_drive_layer-0.7.7-py3-none-manylinux_2_34_x86_64.whl
Size 1.5 MB
Tags Linux glibc 2.34+ x86-64 Python 3
SHA-256 checksum
How to use checksums
e4e1273daff68bf557cb4766f913de82d2ffb70c20cbd6caace08c77cee6fe4b
BLAKE2b-256 checksum
How to use checksums
9405ff813dabda85a8c67021e93b107c04a1c734ccc91bc6ce71e79d3a5d4c6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Release files / motor_drive_layer-0.7.7-py3-none-macosx_26_0_x86_64.whl

Download URL motor_drive_layer-0.7.7-py3-none-macosx_26_0_x86_64.whl
Size 321.9 kB
Tags Python 3 macOS 26.0+ x86-64
SHA-256 checksum
How to use checksums
4df32ed514e121bbdccf7adb8eaadf3ec1a18e994fe056a42bea8802eae71679
BLAKE2b-256 checksum
How to use checksums
d85639553e2bd61fd1ca39ad67f4a11bd3ba9b08f390714b17f22bbe347eedac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Release files / motor_drive_layer-0.7.7-py3-none-macosx_26_0_arm64.whl

Download URL motor_drive_layer-0.7.7-py3-none-macosx_26_0_arm64.whl
Size 306.0 kB
Tags Python 3 macOS 26.0+ ARM64
SHA-256 checksum
How to use checksums
af8fb7782559c66f3d4bb499b30319873ee750e5763bf779c1fd7e28616fb2c0
BLAKE2b-256 checksum
How to use checksums
2d8032bb78161f9146a7794b3be29a42471a6cfe584895196b57cc95b697dee1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.20

Release history Release notifications | RSS feed

0.25.0

2 release files

0.24.0

2 release files

0.23.0

2 release files

0.22.5

2 release files

0.22.3

2 release files

0.22.2

2 release files

0.22.1

2 release files

0.22.0

2 release files

0.21.0

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.1

2 release files

0.15.0

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.13.1

2 release files

0.13.0

2 release files

0.12.9

2 release files

0.12.8

2 release files

0.12.7

2 release files

0.12.6

2 release files

0.12.5

2 release files

0.12.4

2 release files

0.12.3

2 release files

0.12.2

2 release files

0.12.1

2 release files

0.12.0

2 release files

0.11.1

1 release file

0.11.0

1 release file

0.10.30

1 release file

0.10.29

1 release file

0.10.28

1 release file

0.10.27

1 release file

0.10.26

1 release file

0.10.25

1 release file

0.10.14

1 release file

0.10.9

2 release files

0.10.8

2 release files

0.10.7

3 release files

0.10.6

2 release files

0.10.5

1 release file

0.10.4

1 release file

0.10.3

1 release file

0.10.2

1 release file

0.10.1

2 release files

0.10.0

1 release file

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

0.8.9

1 release file

0.8.8

1 release file

0.8.7

1 release file

0.8.5

5 release files

0.8.4

5 release files

0.8.3

5 release files

0.8.2

5 release files

0.7.9

5 release files

This release

0.7.7 This release

5 release files

0.7.6

5 release files

0.7.5

5 release files

0.7.4

5 release files

0.7.3

1 release file

0.7.0

1 release file

0.6.2

5 release files

0.6.1

5 release files

0.6.0

5 release files

0.5.11

2 release files

0.5.10

2 release files

0.5.9

5 release files

0.5.8

5 release files

0.5.7

5 release files

0.5.6

5 release files

0.5.4

5 release files

0.5.3

5 release files

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page