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: Servo ServoArm mbed
Fork of PES_Official by
Sources/Arm.cpp@11:292bdbd85a9c, 2017-05-06 (annotated)
- Committer:
- beacon
- Date:
- Sat May 06 13:33:23 2017 +0000
- Revision:
- 11:292bdbd85a9c
- Parent:
- 10:f76476943a6c
- Child:
- 12:c0bcb95885dd
Nenne dieses Programm "PES_Official" und l?sche das alte.
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| beacon | 6:ba26dd3251b3 | 1 | #include "Robot.h" | 
| beacon | 6:ba26dd3251b3 | 2 | #include "Declarations.h" | 
| beacon | 6:ba26dd3251b3 | 3 | |
| beacon | 4:67d7177c213f | 4 | |
| beacon | 6:ba26dd3251b3 | 5 | Arm::Arm(){ | 
| beacon | 6:ba26dd3251b3 | 6 | } | 
| beacon | 6:ba26dd3251b3 | 7 | |
| beacon | 10:f76476943a6c | 8 | Arm::Arm(ServoArm* arm){ | 
| beacon | 10:f76476943a6c | 9 | init(arm); | 
| beacon | 4:67d7177c213f | 10 | } | 
| beacon | 4:67d7177c213f | 11 | |
| beacon | 10:f76476943a6c | 12 | void Arm::init(ServoArm* arm){ | 
| beacon | 10:f76476943a6c | 13 | this->arm = arm; | 
| beacon | 4:67d7177c213f | 14 | |
| beacon | 10:f76476943a6c | 15 | this->arm->calibrate(0.0015f, 180.0f); | 
| beacon | 10:f76476943a6c | 16 | this->arm->position(COLLECT_POS); | 
| beacon | 4:67d7177c213f | 17 | } | 
| beacon | 4:67d7177c213f | 18 | |
| beacon | 11:292bdbd85a9c | 19 | int Arm::collectToDown(){ | 
| beacon | 6:ba26dd3251b3 | 20 | static float pos=COLLECT_POS; | 
| beacon | 6:ba26dd3251b3 | 21 | if(pos>TAKE_POS) { | 
| beacon | 11:292bdbd85a9c | 22 | pos-=3; | 
| beacon | 10:f76476943a6c | 23 | this->arm->position(pos); | 
| beacon | 11:292bdbd85a9c | 24 | return 0; | 
| beacon | 6:ba26dd3251b3 | 25 | } | 
| beacon | 6:ba26dd3251b3 | 26 | else{ | 
| beacon | 11:292bdbd85a9c | 27 | return 1; | 
| beacon | 6:ba26dd3251b3 | 28 | } | 
| beacon | 4:67d7177c213f | 29 | } | 
| beacon | 4:67d7177c213f | 30 | |
| beacon | 11:292bdbd85a9c | 31 | int Arm::downToCollect(){ | 
| beacon | 6:ba26dd3251b3 | 32 | static float pos=TAKE_POS; | 
| beacon | 6:ba26dd3251b3 | 33 | if(pos<COLLECT_POS) { | 
| beacon | 11:292bdbd85a9c | 34 | pos+=3; | 
| beacon | 10:f76476943a6c | 35 | this->arm->position(pos); | 
| beacon | 11:292bdbd85a9c | 36 | return 0; | 
| beacon | 11:292bdbd85a9c | 37 | } | 
| beacon | 6:ba26dd3251b3 | 38 | else{ | 
| beacon | 11:292bdbd85a9c | 39 | return 1; | 
| beacon | 6:ba26dd3251b3 | 40 | } | 
| beacon | 4:67d7177c213f | 41 | } | 
| beacon | 4:67d7177c213f | 42 | |
| beacon | 11:292bdbd85a9c | 43 | int Arm::collectToBack(){ | 
| beacon | 6:ba26dd3251b3 | 44 | static float pos=COLLECT_POS; | 
| beacon | 6:ba26dd3251b3 | 45 | if(pos<RELEASE_POS) { | 
| beacon | 11:292bdbd85a9c | 46 | pos+=3; | 
| beacon | 10:f76476943a6c | 47 | this->arm->position(pos); | 
| beacon | 11:292bdbd85a9c | 48 | return 0; | 
| beacon | 6:ba26dd3251b3 | 49 | } | 
| beacon | 6:ba26dd3251b3 | 50 | else{ | 
| beacon | 11:292bdbd85a9c | 51 | return 1; | 
| beacon | 6:ba26dd3251b3 | 52 | } | 
| beacon | 4:67d7177c213f | 53 | } | 
| beacon | 4:67d7177c213f | 54 | |
| beacon | 11:292bdbd85a9c | 55 | int Arm::backToCollect(){ | 
| beacon | 6:ba26dd3251b3 | 56 | static float pos=RELEASE_POS; | 
| beacon | 6:ba26dd3251b3 | 57 | if(pos>COLLECT_POS) { | 
| beacon | 11:292bdbd85a9c | 58 | pos-=3; | 
| beacon | 10:f76476943a6c | 59 | this->arm->position(pos); | 
| beacon | 11:292bdbd85a9c | 60 | return 0; | 
| beacon | 6:ba26dd3251b3 | 61 | } | 
| beacon | 6:ba26dd3251b3 | 62 | else{ | 
| beacon | 11:292bdbd85a9c | 63 | return 1; | 
| beacon | 6:ba26dd3251b3 | 64 | } | 
| beacon | 6:ba26dd3251b3 | 65 | } | 
