Skip to main content

A Python Driver for MIT Mini-Cheetah Actuator which uses SocketCAN for communication.

Project description

Python Motor Driver for Mini Cheetah Actuator: T-Motor AK80-6

Dependencies:

  • bitstring

Install via:

pip3 install bitstring

Documentation

Pre-requisites:

  • Setting up the CAN interface:

    • Run this command and make sure that can0 (or any other can interface depending on the system)shows up as an interface after connecting the USB cable to your laptop: ip link show

    • Configure the can0 interface to have a 1 Mbaud communication frequency: sudo ip link set can0 type can bitrate 1000000

    • To bring up the can0 interface, run: sudo ip link set up can0

  • To change motor parameters such as CAN ID or to calibrate the encoder, a serial connection is used. The serial terminal GUI used on linux for this purpose is cutecom

Usage:

Import: from motor_driver.canmotorlib import CanMotorController

Example Motor Initialization: motor = CanMotorController(can_socket='can0', motor_id=0x01, motor_type='AK80_6_V2', socket_timeout=0.5)

Available Functions:

  • enable_motor()
  • disable_motor()
  • set_zero_position()
  • send_deg_command(position_in_degrees, velocity_in_degrees, Kp, Kd, tau_ff):
  • send_rad_command(position_in_radians, velocity_in_radians, Kp, Kd, tau_ff):
  • change_motor_constants(P_MIN_NEW, P_MAX_NEW, V_MIN_NEW, V_MAX_NEW, KP_MIN_NEW, KP_MAX_NEW, KD_MIN_NEW, KD_MAX_NEW, T_MIN_NEW, T_MAX_NEW)

All motor communication functions return current position, velocity, torque in SI units except for send_deg_command. change_motor_constants does not return anything.

Supported Motor Configurations:

  • AK80-6 (From Cubemars, Firmware versions v1 and v2): motor_type='AK80_6_V1' and motor_type='AK80_6_V2'
  • AK80-9 (From Cubemars, Firmware version v2): motor_type='AK80_9_V2'
# Working parameters for AK80-6 V1.0 firmware
AK80_6_V1_PARAMS = {
                "P_MIN" : -95.5,
                "P_MAX" : 95.5,
                "V_MIN" : -45.0,
                "V_MAX" : 45.0,
                "KP_MIN" : 0.0,
                "KP_MAX" : 500,
                "KD_MIN" : 0.0,
                "KD_MAX" : 5.0,
                "T_MIN" : -18.0,
                "T_MAX" : 18.0,
                "AXIS_DIRECTION" : -1
                }

# Working parameters for AK80-6 V2.0 firmware
AK80_6_V2_PARAMS = {
                "P_MIN" : -12.5,
                "P_MAX" : 12.5,
                "V_MIN" : -38.2,
                "V_MAX" : 38.2,
                "KP_MIN" : 0.0,
                "KP_MAX" : 500.0,
                "KD_MIN" : 0.0,
                "KD_MAX" : 5.0,
                "T_MIN" : -12.0,
                "T_MAX" : 12.0,
                "AXIS_DIRECTION" : 1
                }

# Working parameters for AK80-9 V2.0 firmware
AK80_9_V2_PARAMS = {
                    "P_MIN" : -12.5,
                    "P_MAX" : 12.5,
                    "V_MIN" : -25.64,
                    "V_MAX" : 25.64,
                    "KP_MIN" : 0.0,
                    "KP_MAX" : 500.0,
                    "KD_MIN" : 0.0,
                    "KD_MAX" : 5.0,
                    "T_MIN" : -18.0,
                    "T_MAX" : 18.0,
                    "AXIS_DIRECTION" : 1
                    }

To add a new constants configuration use the change_motor_constants function or create an issue with the constants and motor information on the GitHub page to be added to the driver.

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

File details

Details for the file mini-cheetah-motor-driver-socketcan-0.2.1.tar.gz.

File metadata

  • Download URL: mini-cheetah-motor-driver-socketcan-0.2.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for mini-cheetah-motor-driver-socketcan-0.2.1.tar.gz
Algorithm Hash digest
SHA256 a4a4298859e4d297b9f247d20fae448fb588c2446d666bf2d61b3fbd881dc478
MD5 08fd904f2bd736e653de47dd5a0f1b79
BLAKE2b-256 cc7f5b71c8a4138d0ddee6544f825fd2ebdae68405e137b75f828bc67f5d94b5

See more details on using hashes here.

File details

Details for the file mini_cheetah_motor_driver_socketcan-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mini_cheetah_motor_driver_socketcan-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 39441c7c1faf771d80833deb54f68d72d65ae881d794614128f53b7341f2d3af
MD5 35dad51d992e54ade01a7b343a68ac94
BLAKE2b-256 e57eb16761eecea07a85eb2e44a494d85896be240ce5922e4ec23c51dd187eab

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page