This repository contains the Python driver to easily interact with the 3D printed robotic actuator.
- can
- cantools
| Frame | Signal | Bit Position | Bit Length | Scale | Offset | Units | Notes |
|---|---|---|---|---|---|---|---|
| 0x001 |
|
|
|
|
|
|
|
| 0x002 |
|
|
|
|
|
|
|
| 0x003 |
|
|
|
|
|
|
|
| 0x004 |
|
|
|
|
|
|
|
| 0x005 |
|
|
|
|
|
|
|
| 0x006 |
|
|
|
|
|
|
|
| 0x007 |
|
|
|
|
|
|
import motor_driver
import numpy as np
if __name__ == '__main__':
motor = motor_driver.MotorDriver(cobid=10, channel='can0') # Instantiate the Python class
motor.send_config_1(P_controller=1.0, I_controller=0.1, D_controller=0.0) # Configure position PID with config1
motor.send_config_2(P_vel=2.0, I_vel=0.01, D_vel=0, Vel_lim=20.0) # Configure velocity PID and max vel with config2
motor.send_config_3(Volt_lim=20.0, V_aling=7.0, Calibrate=0, Zero_angle_elec=0.0) # Configure max volts and calibration params with config3
motor.send_transition(1) # Transition to preop
motor.send_transition(3) # Transition to run
x = np.linspace(1, 10, num=10)
y = np.sin(x)
for n in range(y.size):
print(n)
motor.send_command(y[n]) # send angle commands
print(m