Nathaniel Honka / Mbed 2 deprecated Motion-Control

Dependencies:   FiniteStateMachine HipControl Knee LinearBlend1 LocalFileSystem_Read dataComm hapticFeedback initExoVars mbed Blend_Generator Brad_poly_gait Gait_Generator MM_gait Encoders IMUdriver

Fork of Motion Control by HEL's Angels

Committer:
cashdollar
Date:
Wed Feb 25 19:23:41 2015 +0000
Revision:
5:498c9bfc56f0
Parent:
1:6f18fad9984e
Added safety checks. Safety checks include: 1. both encoders: range, parity, flag 2.both knees: status 3. IMU whoamI. Safety is checked every control cycle and send to dataBed.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cashdollar 5:498c9bfc56f0 1 /** Knee class.
cashdollar 5:498c9bfc56f0 2 * Used to control knee mechanism in conjunction with StepperDriver.h.
cashdollar 5:498c9bfc56f0 3 * L6482 Stepper Driver code communicated via SPI.
cashdollar 5:498c9bfc56f0 4 * 02/25/2015 Edited by Hayley Cashdollar
cashdollar 5:498c9bfc56f0 5 */
perr1940 0:d38d627c922f 6
perr1940 0:d38d627c922f 7 #ifndef KNEE_H
perr1940 0:d38d627c922f 8 #define KNEE_H
perr1940 0:d38d627c922f 9
perr1940 0:d38d627c922f 10 #include "mbed.h"
perr1940 0:d38d627c922f 11 #include "StepperDriver.h"
perr1940 0:d38d627c922f 12
perr1940 0:d38d627c922f 13 class Knee
perr1940 0:d38d627c922f 14 {
perr1940 1:6f18fad9984e 15 public:
perr1940 0:d38d627c922f 16 // Constructor
perr1940 0:d38d627c922f 17 Knee(PinName CSPin, PinName mosi, PinName miso, PinName sck);
perr1940 1:6f18fad9984e 18
perr1940 0:d38d627c922f 19 void lock();
perr1940 0:d38d627c922f 20 void unlock();
perr1940 0:d38d627c922f 21 void init();
cashdollar 5:498c9bfc56f0 22
cashdollar 5:498c9bfc56f0 23 /** Create status instance
cashdollar 5:498c9bfc56f0 24 * status() gathers the current status from the knee stepper.
cashdollar 5:498c9bfc56f0 25 * @returns
cashdollar 5:498c9bfc56f0 26 * 2 byte status from Stepper. See page 58 of L6482 Stepper Spec for detail.
cashdollar 5:498c9bfc56f0 27 *
cashdollar 5:498c9bfc56f0 28 */
perr1940 0:d38d627c922f 29 int status();
cashdollar 5:498c9bfc56f0 30
cashdollar 5:498c9bfc56f0 31 /** Create knee_status instance.
cashdollar 5:498c9bfc56f0 32 * knee_status() compares stepper status to safe status.
cashdollar 5:498c9bfc56f0 33 * @ returns
cashdollar 5:498c9bfc56f0 34 * 0 for safe
cashdollar 5:498c9bfc56f0 35 * 1 for unsafe
cashdollar 5:498c9bfc56f0 36 */
cashdollar 5:498c9bfc56f0 37 int knee_status();
cashdollar 5:498c9bfc56f0 38
cashdollar 5:498c9bfc56f0 39 /** Create knee_error instance.
cashdollar 5:498c9bfc56f0 40 * knee_error is the output of knee_status.
cashdollar 5:498c9bfc56f0 41 * knee_error = 0 is safe
cashdollar 5:498c9bfc56f0 42 * knee_error = 1 is unsafe.
cashdollar 5:498c9bfc56f0 43 */
cashdollar 5:498c9bfc56f0 44 int knee_error;
cashdollar 5:498c9bfc56f0 45
cashdollar 5:498c9bfc56f0 46 /** Create knee_flag instance.
cashdollar 5:498c9bfc56f0 47 * knee_flag is an intermediate integer in computation of knee_status
cashdollar 5:498c9bfc56f0 48 */
cashdollar 5:498c9bfc56f0 49 int knee_flag;
cashdollar 5:498c9bfc56f0 50
perr1940 1:6f18fad9984e 51 void debug();
cashdollar 5:498c9bfc56f0 52
perr1940 1:6f18fad9984e 53 private:
perr1940 1:6f18fad9984e 54 StepperDriver stepper;
perr1940 1:6f18fad9984e 55
perr1940 0:d38d627c922f 56 };
perr1940 1:6f18fad9984e 57
perr1940 0:d38d627c922f 58 #endif
perr1940 0:d38d627c922f 59
perr1940 0:d38d627c922f 60