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
- numpy
- sockets
Install via:
pip3 install bitstring sockets numpy pandas
Documentation
- Useful videos:
- Datasheet
- Ben Katz 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
Note: Alternatively, one could run the shell script
setup_caninterface.sh
which will do the job for you. -
-
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:
Testing Communication: To enable one motor at 0x01
, set zero position and disable the motor, run: python3 can_motorlib_test.py can0
Use in Scripts: Add the following import to your python script: from canmotorlib import CanMotorController
after making sure this folder is available in the import path/PYTHONPATH.
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):
All functions return current position, velocity, torque in SI units except for send_deg_command
.
Performance Profiler: Sends and received 1000 zero commands to measure the communication frequency with 1/2 motors. Be careful as the motor torque will be set to zero.
Project details
Release history Release notifications | RSS feed
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
Hashes for mini-cheetah-motor-driver-socketcan-0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a1ddad8d54e205b1b00a71c4c3fed330bb1464110de61e668dc15c26d2bbaad6 |
|
MD5 | cfb5cc79f7c22e654ba1f069f8e69c12 |
|
BLAKE2b-256 | a4aac16eb489d749069a594fa628135a0ffb5d7133f61fe154908a54b5a40627 |
Hashes for mini_cheetah_motor_driver_socketcan-0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcc6acbfda66948169829e315469ca8ff5eb1391a7622f774be106382d322971 |
|
MD5 | 6b2c2674cb54b99ea88191cfa01c4bac |
|
BLAKE2b-256 | 5942bdff3759fc5759c3ebead2b1f84fcee0aaef2f8aa92ed857fab2c28a40c8 |