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
gimbal.cpp@0:3a767f41cf04, 2018-01-31 (annotated)
- Committer:
- group-UVic-Assistive-Technolog
- Date:
- Wed Jan 31 05:24:12 2018 +0000
- Revision:
- 0:3a767f41cf04
- Child:
- 2:0537a8007a39
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 1 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 2 | #include <stdint.h> |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 3 | #include "mbed.h" |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 4 | #include <ros.h> |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 5 | #include <std_msgs/Empty.h> |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 6 | #include <std_msgs/Float32MultiArray.h> |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 7 | #include <BNO055.h> |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 8 | #include <initializations.h> |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 9 | #include <definitions.h> |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 10 | #include <prototypes.h> |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 11 | #include <Mx28.h> |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 12 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 13 | static int i = 0; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 14 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 15 | void runGimbal(void){ |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 16 | |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 17 | // At 1ms update the gimbal. |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 18 | if (motorFlag && control.gimbalRun){ |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 19 | motorFlag = 0; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 20 | switch(i){ |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 21 | case(0): |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 22 | gimbal.servo(YAWID, control.yaw, 30); |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 23 | i++; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 24 | break; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 25 | case(1): |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 26 | gimbal.servo(PITCHID, control.pitch, 30); |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 27 | i++; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 28 | break; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 29 | case(2): |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 30 | gimbal.servo(ROLLID, control.roll, 30); |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 31 | i = 0; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 32 | break; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 33 | } |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 34 | control.gimbalRun = FALSE; |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 35 | } |
group-UVic-Assistive-Technolog | 0:3a767f41cf04 | 36 | } |