ME 405 Documentation for Joshua Clemens, Cal Poly SLO 06/09/20
ME 405 Documentation for Joshua Clemens, Cal Poly SLO 06/09/20 Documentation

Introduction

This project contains code for the motor drive, encoder, proportional controller, and IMU controller classes completed as of 5/20/20 1:35 AM. The scripts for the modules described below can be found at https://bitbucket.org/JClemens1996/me_405/src/master/

Motor Driver

The Motor Driver class is capable of enabling, disabling, or changing the duty cycle of a user-specified motor. Details found at motor.MotorDriver

Encoder Driver

The Encoder class is capable of reading and setting the optical encoders built into the ME 405 DC motors. The corresponding script includes classes to get and set position, along with calculate differential changes of encoders readings between updates. Details found at encoder.Encoder

Proportional Controller

The controller class is capable of taking a setpoint input from the user and converting that to an error signal and then actuation signal based on the difference in current motor position and setpoint position. The actuation signal is then sent to the motor driver which begins moving towards the desired setpoint, and then the new motor position is read and recorded using the encoder module. Tuning is shown on the separate Controller Tuning page. Details on this class can be found at controller.P_controller . Finally, a step response of the system is shown below or can be viewed through this externally hosted video: https://vimeo.com/418321606

Step Response of Motor with Setpoint = 4000 and Kp = 0.1

Inertial Measurement Unit

The IMU class is responsible for The IMU class is responsible for using the 3 built in sensors of the IMU to generate the inertial/positional coordinates of the device. The accelerometer provides angular velocity data while the magnetometer and gyroscope provide spatial coordinate data which dictates the position of the IMU. This class is responsible for enabling or disabling an IMU object that has been created. Once it has been calibrated, it will continuously return values for the angular position and angular velocity of the IMU every two seconds. Details can be found at IMU_Controller.IMU

Main Scripts

The main script imports all the previously detailed modules and runs the loops that engage the user for input and calls all other necessary modules. The main scripts for each project can be found at main_Pcontrol.py and main_IMU.py ; Further details on these can be found at https://bitbucket.org/JClemens1996/me_405/src/master/

Author
Joshua Clemens
Date
May 20th, 2020