Delta Robot example
Dependencies: BufferedSerial Eigen
Fork of TCPSocket_Example by
Axis.h@4:778bc352c47f, 2018-10-07 (annotated)
- Committer:
- je310
- Date:
- Sun Oct 07 19:40:12 2018 +0000
- Revision:
- 4:778bc352c47f
- Parent:
- 3:10fa3102c2d7
- Child:
- 5:01e1e68309ae
can work smoothly, though voltage reading not working;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
je310 | 3:10fa3102c2d7 | 1 | #ifndef AXIS_H |
je310 | 3:10fa3102c2d7 | 2 | #define AXIS_H |
je310 | 3:10fa3102c2d7 | 3 | |
je310 | 4:778bc352c47f | 4 | #include "odrive.h" |
je310 | 4:778bc352c47f | 5 | #include "mbed.h" |
je310 | 4:778bc352c47f | 6 | #include "calibration.h" |
je310 | 4:778bc352c47f | 7 | #include "comms.h" |
je310 | 4:778bc352c47f | 8 | #include <string> |
je310 | 4:778bc352c47f | 9 | #include <sstream> |
je310 | 4:778bc352c47f | 10 | |
je310 | 4:778bc352c47f | 11 | enum axisName { |
je310 | 4:778bc352c47f | 12 | AX_A, |
je310 | 4:778bc352c47f | 13 | AX_B, |
je310 | 4:778bc352c47f | 14 | AX_C, |
je310 | 4:778bc352c47f | 15 | }; |
je310 | 4:778bc352c47f | 16 | |
je310 | 3:10fa3102c2d7 | 17 | class Axis |
je310 | 3:10fa3102c2d7 | 18 | { |
je310 | 3:10fa3102c2d7 | 19 | public: |
je310 | 3:10fa3102c2d7 | 20 | |
je310 | 4:778bc352c47f | 21 | Axis(ODrive* od, int ax, DigitalIn* homeSwitch, calVals calibration_,axisName indentity); |
je310 | 3:10fa3102c2d7 | 22 | void homeAxis(); |
je310 | 3:10fa3102c2d7 | 23 | void goAngle(float angle); |
je310 | 3:10fa3102c2d7 | 24 | void goAngleSpeed(float angle, float speed); |
je310 | 4:778bc352c47f | 25 | void runState(int requestedState); |
je310 | 4:778bc352c47f | 26 | DigitalIn* homeSwitch_; |
je310 | 4:778bc352c47f | 27 | void setMaxVel(float stepsPerSec); |
je310 | 4:778bc352c47f | 28 | ODrive* odrive; |
je310 | 3:10fa3102c2d7 | 29 | |
je310 | 3:10fa3102c2d7 | 30 | private: |
je310 | 4:778bc352c47f | 31 | |
je310 | 4:778bc352c47f | 32 | int axNum; |
je310 | 4:778bc352c47f | 33 | int homeOffset; |
je310 | 4:778bc352c47f | 34 | float currentSetPos; |
je310 | 4:778bc352c47f | 35 | float currentSetVel; |
je310 | 4:778bc352c47f | 36 | |
je310 | 4:778bc352c47f | 37 | float maxAngle; //roughtly |
je310 | 4:778bc352c47f | 38 | float gearRatio_; |
je310 | 4:778bc352c47f | 39 | float pulse_per_rev; |
je310 | 4:778bc352c47f | 40 | float pulse_per_rad; |
je310 | 4:778bc352c47f | 41 | float rotation_offset; // defines the rotational ofset from flat, to be calibrated. |
je310 | 3:10fa3102c2d7 | 42 | |
je310 | 3:10fa3102c2d7 | 43 | |
je310 | 3:10fa3102c2d7 | 44 | }; |
je310 | 3:10fa3102c2d7 | 45 | |
je310 | 3:10fa3102c2d7 | 46 | |
je310 | 3:10fa3102c2d7 | 47 | |
je310 | 3:10fa3102c2d7 | 48 | |
je310 | 3:10fa3102c2d7 | 49 | |
je310 | 3:10fa3102c2d7 | 50 | #endif // COMMS_H |