CubeMars motor module for Aries exosuits.
Project description
Motor Control Software for Soft Exoskeleton
Motor control for the CubeMars AK60-6 actuator module used in Aries soft-exosuit development.
Current Status
- Primary interface: CAN on Jetson Orin Nano via Linux SocketCAN
- Current maintained CAN path: MIT-only control
- Supported high-level helpers:
set_position(),set_velocity(),set_current(),stop() - UART support remains available for compatibility and earlier bring-up workflows
This repository is the motor-module codebase, not a full exosuit application. Its current focus is a modular actuator-control layer plus the bench-side scripts used to validate it.
Key Features
- Transport-independent motor abstraction through
BaseMotor - Maintained SocketCAN backend for the CubeMars AK60-6
- MIT-only CAN control path with one consistent command model
- Background command refresh, feedback decoding, cached state handling, and staged recovery
- Bench-validation scripts for MIT mode, position stepping, velocity verification, and plotting
Installation
For normal development, testing, and analysis:
uv sync --all-groups
source .venv/bin/activate
If you only want to install the package itself:
uv pip install -e .
CAN Setup on Jetson Orin Nano
Recommended: systemd startup
Install the tracked can0.service once so can0 comes up automatically on boot:
sudo cp can0.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable can0.service
sudo systemctl start can0.service
This brings can0 up at 1 Mbps with bus-off auto-recovery.
Useful checks:
systemctl status can0.service
sudo systemctl restart can0.service
ip -details link show can0
Manual setup
If you do not want to use the service, configure the interface manually:
sudo ./setup_can.sh
Important Hardware Note
If the R-Link / UART cable is connected to the motor, CAN commands may be silently ignored even though feedback frames are still visible on the bus. For CAN operation, disconnect the UART cable and then reset the CAN interface.
Recommended Workflow
1. Confirm MIT/CAN communication
sudo ./setup_can.sh
.venv/bin/python scripts/mit_mode_test.py --motor-id 0x03
2. Validate sustained velocity behavior
.venv/bin/python scripts/verify_set_velocity.py --motor-id 0x03 --velocity-erpm 3000
3. Run repeated MIT position stepping
.venv/bin/python scripts/mit_position_steps.py --motor-id 0x03 --duration 180 --angle-deg 50 --velocity-deg-s 100
4. Generate comparison plots from recorded CSV files
.venv/bin/python scripts/plot_graph.py velocity --data-root CSV --out-dir CSV/plots
.venv/bin/python scripts/plot_graph.py position --data-root CSV --out-dir CSV/plots
Python API
The default convenience alias is the CAN motor class:
from motor_python import Motor
with Motor(motor_can_id=0x03) as motor:
motor.enable_mit_mode()
motor.set_velocity(3000)
motor.set_position(90.0)
motor.stop()
For direct access to the specific implementations:
from motor_python.cube_mars_motor_can import CubeMarsAK606v3CAN
from motor_python.cube_mars_motor import CubeMarsAK606v3
Main CAN lifecycle methods
| Method | Purpose |
|---|---|
enable_mit_mode() |
Enter MIT mode |
disable_mit_mode() |
Exit MIT mode |
check_communication() |
Verify that the motor responds on the bus |
get_status() |
Return the latest cached MotorState |
close() |
Stop and close transport resources |
Main CAN control methods
| Method | Purpose |
|---|---|
set_position(position_degrees) |
MIT-backed position command |
set_velocity(velocity_erpm, allow_low_speed=False) |
MIT-backed velocity command |
set_current(current_amps) |
Interpreted as MIT torque feedforward |
set_mit_mode(pos_rad, vel_rad_s, kp, kd, torque_ff_nm) |
Direct MIT command |
stop() |
Neutral MIT command and disable |
Useful Bench Scripts
These are the maintained scripts that matter most for the current implementation:
| Script | Purpose |
|---|---|
scripts/mit_mode_test.py |
Focused MIT/CAN protocol validation |
scripts/verify_set_velocity.py |
Bench verification of set_velocity() |
scripts/mit_position_steps.py |
Long-run MIT position stepping for bench tests |
scripts/plot_graph.py |
Chapter-4-style overlay and summary plots from recorded CSV files |
scripts/diagnose_can.py |
CAN bus diagnostics and recovery support |
scripts/scan_ids.py |
CAN ID discovery |
scripts/reset_degree.py |
Practical MIT recentering helper |
Additional exploratory and legacy scripts remain under scripts/, but they are not the primary maintained validation path.
Testing
Run unit tests:
make test
Run CAN hardware tests:
make test-hardware-can
Run all hardware tests:
make test-hardware-all
Project Structure
can0.service systemd unit for automatic can0 startup
setup_can.sh manual CAN setup and reset helper
src/motor_python/ package source
scripts/ bench and validation scripts
tests/ unit and hardware-oriented tests
data/csv_logs/.gitkeep placeholder for locally generated CSV logs
Test Rig CAD files/ CAD assets for the bench rig
Notes on Scope
- The current CAN implementation is MIT-only.
- Legacy servo transport modes are intentionally not part of the maintained CAN path.
- The repository includes bench-validation tooling, but not thesis-only notes, temporary files, or local analysis artifacts.
Run the Package Entry Point
uv run python -m motor_python
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file motor_python-0.0.7.tar.gz.
File metadata
- Download URL: motor_python-0.0.7.tar.gz
- Upload date:
- Size: 40.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7cc77ec6d9d9be432b85a9022bea2fe883c844fb34a9910a7574b6ceb356a37d
|
|
| MD5 |
fe7b9898fbd50b1bb5f63fb14fbbd467
|
|
| BLAKE2b-256 |
0f379ba23ba4ae955ddfe5ca146c3c0282ea18fca2f690e71651b8bca5887d44
|
Provenance
The following attestation bundles were made for motor_python-0.0.7.tar.gz:
Publisher:
pypi-publish.yml on TUM-Aries-Lab/motor-module
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
motor_python-0.0.7.tar.gz -
Subject digest:
7cc77ec6d9d9be432b85a9022bea2fe883c844fb34a9910a7574b6ceb356a37d - Sigstore transparency entry: 1342772143
- Sigstore integration time:
-
Permalink:
TUM-Aries-Lab/motor-module@973daa0023fc1e89e5b248436d778120b5c4b011 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/TUM-Aries-Lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@973daa0023fc1e89e5b248436d778120b5c4b011 -
Trigger Event:
push
-
Statement type:
File details
Details for the file motor_python-0.0.7-py3-none-any.whl.
File metadata
- Download URL: motor_python-0.0.7-py3-none-any.whl
- Upload date:
- Size: 41.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f5627712d6005c69ce77316b72d72af5d39bd421c2ff211bd4f143e4ecfea6d
|
|
| MD5 |
b3277685df3a3541ab84508991d13dd7
|
|
| BLAKE2b-256 |
ea6367548f4332f30871256b7ed14de6258e30e88ed630fc99bbde646efbba35
|
Provenance
The following attestation bundles were made for motor_python-0.0.7-py3-none-any.whl:
Publisher:
pypi-publish.yml on TUM-Aries-Lab/motor-module
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
motor_python-0.0.7-py3-none-any.whl -
Subject digest:
4f5627712d6005c69ce77316b72d72af5d39bd421c2ff211bd4f143e4ecfea6d - Sigstore transparency entry: 1342772162
- Sigstore integration time:
-
Permalink:
TUM-Aries-Lab/motor-module@973daa0023fc1e89e5b248436d778120b5c4b011 -
Branch / Tag:
refs/tags/v0.0.7 - Owner: https://github.com/TUM-Aries-Lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@973daa0023fc1e89e5b248436d778120b5c4b011 -
Trigger Event:
push
-
Statement type: