Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed ros_lib_kinetic
definitions.h@10:836e701d00a6, 2018-04-26 (annotated)
- Committer:
- MikeGray92
- Date:
- Thu Apr 26 18:33:11 2018 +0000
- Revision:
- 10:836e701d00a6
- Parent:
- 7:950b3c3b5a2b
Speed and Position controlled lift and gimbal
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 1 | #ifndef __DEFINITIONS_H__ |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 2 | #define __DEFINITIONS_H__ |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 3 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 4 | #include "mbed.h" |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 5 | #include <BNO055.h> |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 6 | #include <Mx28.h> |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 7 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 8 | // Generic definitions |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 9 | #define TRUE 1 |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 10 | #define FALSE 0 |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 11 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 12 | // ROS definitions |
MikeGray92 | 10:836e701d00a6 | 13 | #define ROSROLL 0 |
MikeGray92 | 10:836e701d00a6 | 14 | #define ROSPITCH 1 |
MikeGray92 | 7:950b3c3b5a2b | 15 | #define ROSYAW 2 |
MikeGray92 | 7:950b3c3b5a2b | 16 | #define ROSHEIGHT 3 |
MikeGray92 | 7:950b3c3b5a2b | 17 | #define ROSMODE 4 |
MikeGray92 | 10:836e701d00a6 | 18 | #define ROSYAWSP 5 |
MikeGray92 | 10:836e701d00a6 | 19 | #define ROSROLLSP 6 |
MikeGray92 | 10:836e701d00a6 | 20 | #define ROSPITCHSP 7 |
MikeGray92 | 10:836e701d00a6 | 21 | #define ROSHEIGHTSP 8 |
MikeGray92 | 10:836e701d00a6 | 22 | #define ROSDATALENGTH 9 |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 23 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 24 | // Gimbal definitions |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 25 | #define YAWID 1 |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 26 | #define PITCHID 2 |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 27 | #define ROLLID 3 |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 28 | #define YAWZERO 2015 |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 29 | #define PITCHZERO 2350 |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 30 | #define ROLLZERO 2302 |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 31 | #define YAWMIN 0 // -177 degrees. |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 32 | #define YAWMAX 4063 // +177 degrees. |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 33 | #define PITCHMIN 1326 // -90 degrees. |
MikeGray92 | 7:950b3c3b5a2b | 34 | #define PITCHMAX 3000 // +90 degrees is at 3374 |
MikeGray92 | 7:950b3c3b5a2b | 35 | #define ROLLMIN 2100 // -90 degrees is at 1278 |
MikeGray92 | 7:950b3c3b5a2b | 36 | #define ROLLMAX 2500 // +90 degrees is at 3374 |
MikeGray92 | 10:836e701d00a6 | 37 | #define SERVOSPEEDMIN 1 // Min speed for gimbal servos |
MikeGray92 | 10:836e701d00a6 | 38 | #define SERVOSPEEDMAX 200 // Max speed for gimbal servos |
MikeGray92 | 10:836e701d00a6 | 39 | #define DYNASCALE 11 // Should be 11.4, but int is currently being used |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 40 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 41 | // Lift definitions |
MikeGray92 | 10:836e701d00a6 | 42 | #define LIFTUP 1 |
MikeGray92 | 10:836e701d00a6 | 43 | #define LIFTDOWN 0 |
MikeGray92 | 4:89ebfa37663b | 44 | #define LIFTHEIGHTMAX 3000 // 119.6 cm should be 3000 |
MikeGray92 | 3:527f0b949839 | 45 | #define LIFTHEIGHTMIN 5 //51.6 cm |
MikeGray92 | 3:527f0b949839 | 46 | // Delta Height for Lift is 68cm |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 47 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 48 | // Classes |
MikeGray92 | 7:950b3c3b5a2b | 49 | struct fields{ |
MikeGray92 | 7:950b3c3b5a2b | 50 | volatile int yaw; |
MikeGray92 | 7:950b3c3b5a2b | 51 | int yawSpeed; |
MikeGray92 | 7:950b3c3b5a2b | 52 | volatile int pitch; |
MikeGray92 | 7:950b3c3b5a2b | 53 | int pitchSpeed; |
MikeGray92 | 7:950b3c3b5a2b | 54 | volatile int roll; |
MikeGray92 | 7:950b3c3b5a2b | 55 | int rollSpeed; |
MikeGray92 | 7:950b3c3b5a2b | 56 | volatile int height; |
MikeGray92 | 10:836e701d00a6 | 57 | volatile int heightSpeed; |
MikeGray92 | 7:950b3c3b5a2b | 58 | bool stabilize; |
MikeGray92 | 7:950b3c3b5a2b | 59 | bool masterOn; |
MikeGray92 | 7:950b3c3b5a2b | 60 | bool liftRun; |
MikeGray92 | 7:950b3c3b5a2b | 61 | bool gimbalRun; |
MikeGray92 | 7:950b3c3b5a2b | 62 | bool shutdown; |
MikeGray92 | 7:950b3c3b5a2b | 63 | bool initialize; |
MikeGray92 | 7:950b3c3b5a2b | 64 | volatile int mode; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 65 | }; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 66 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 67 | extern struct fields control; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 68 | extern struct fields rosInput; |
MikeGray92 | 1:1ac7d472cfa2 | 69 | extern volatile int currentPosition; |
MikeGray92 | 10:836e701d00a6 | 70 | extern float liftDutyCycle; |
MikeGray92 | 1:1ac7d472cfa2 | 71 | extern int prevPosition; |
MikeGray92 | 4:89ebfa37663b | 72 | extern bool stall; |
MikeGray92 | 4:89ebfa37663b | 73 | extern bool rosFlag; |
MikeGray92 | 10:836e701d00a6 | 74 | extern bool eStopFlag; |
MikeGray92 | 4:89ebfa37663b | 75 | extern int stallcount; |
MikeGray92 | 10:836e701d00a6 | 76 | extern const int addr; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 77 | extern Ticker hallInt; |
MikeGray92 | 1:1ac7d472cfa2 | 78 | extern Timer filter_hall1; |
MikeGray92 | 4:89ebfa37663b | 79 | extern Timer rosMode_Delay; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 80 | extern PwmOut liftSpeed; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 81 | extern DigitalOut liftDirection; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 82 | extern DynamixelClass gimbal; |
MikeGray92 | 10:836e701d00a6 | 83 | extern DigitalOut value0; |
MikeGray92 | 10:836e701d00a6 | 84 | extern DigitalOut value1; |
MikeGray92 | 10:836e701d00a6 | 85 | extern InterruptIn eStop; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 86 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 87 | #endif |