Skip to content

ManuelSanchezMo/Robotic_actuator_python_driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Introduction

This repository contains the Python driver to easily interact with the 3D printed robotic actuator.

Finite State Machine

Dependencies

  • can
  • cantools

CAN Protocol

Frame Signal Bit Position Bit Length Scale Offset Units Notes
0x001
  • 0
  • 16
  • 32
  • 16
  • 16
  • 16
  • 0.125
  • 0.125
  • 0.125
  • 0
  • 0
  • 0
  • -
  • -
  • -
  • P value for the PID position control
  • I value for the PID position control
  • D value for the PID position control
0x002
  • 0
  • 16
  • 32
  • 48
  • 16
  • 16
  • 16
  • 16
  • 0.125
  • 0.125
  • 0.125
  • 0.125
  • 0
  • 0
  • 0
  • 0
  • -
  • -
  • -
  • rad/s
  • P value for the PID speed control
  • I value for the PID speed control
  • D value for the PID speed control
  • Speed limit
0x003
  • 0
  • 16
  • 32
  • 48
  • 16
  • 16
  • 16
  • 16
  • 0.125
  • 0.125
  • 1
  • 0.125
  • -4095
  • -4095
  • -4095
  • -4095
  • V
  • V
  • -
  • rad
  • Voltage limit for motor input
  • Voltage limit for aligning in calibration
  • Calibration (1 skip, 0 calibrate)
  • Electric angle offset
0x004
  • 0
  • 16
  • 32
  • 48
  • 16
  • 16
  • 16
  • 16
  • 0.125
  • 0.125
  • 1
  • 0.125
  • -4095
  • -4095
  • -4095
  • -4095
  • V
  • V
  • I
  • rad
  • Ua component of voltage input
  • Ub component of voltage input
  • Current drawn by motor
  • Electric angle
0x005
  • 0
  • 16
  • 32
  • 16
  • 16
  • 16
  • 0.125
  • 0.125
  • 0.125
  • -4095
  • -4095
  • -4095
  • rad
  • rad
  • rad/s
  • Current mechanical angle
  • Mechanical angle setpoint
  • Shaft speed
0x006
  • 0
  • 16
  • 1
  • 0
  • -
  • Finite State Machine transition
0x007
  • 0
  • 16
  • 0.125
  • -4095
  • rad
  • Motor set point command

Usage Example

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

About

Python driver for the 3D printed robotic actuator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages