Do NOT modify!

Dependencies:   mbed Servo ServoArm

Fork of PES_Yanick by zhaw_st16b_pes2_10

Committer:
beacon
Date:
Wed Apr 26 14:09:08 2017 +0000
Revision:
6:ba26dd3251b3
Parent:
4:67d7177c213f
Child:
7:6fed0dcae9c1
YESSS! On time!!

Who changed what in which revision?

UserRevisionLine numberNew 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 6:ba26dd3251b3 8 Arm::Arm(Servo* servoArm){
beacon 6:ba26dd3251b3 9 init(servoArm);
beacon 4:67d7177c213f 10 }
beacon 4:67d7177c213f 11
beacon 6:ba26dd3251b3 12 void Arm::init(Servo* servoArm){
beacon 6:ba26dd3251b3 13 this->servoArm = servoArm;
beacon 4:67d7177c213f 14
beacon 6:ba26dd3251b3 15 this->servoArm->calibrate(0.0015f, 180.0f);
beacon 6:ba26dd3251b3 16 this->servoArm->position(COLLECT_POS);
beacon 4:67d7177c213f 17 }
beacon 4:67d7177c213f 18
beacon 6:ba26dd3251b3 19 void Arm::collecttodown(int* done){
beacon 6:ba26dd3251b3 20 static float pos=COLLECT_POS;
beacon 6:ba26dd3251b3 21 if(pos>TAKE_POS) {
beacon 6:ba26dd3251b3 22 pos-=0.5f;
beacon 6:ba26dd3251b3 23 this->servoArm->position(pos);
beacon 6:ba26dd3251b3 24 }
beacon 6:ba26dd3251b3 25 else{
beacon 6:ba26dd3251b3 26 *done = 1;
beacon 6:ba26dd3251b3 27 }
beacon 4:67d7177c213f 28 }
beacon 4:67d7177c213f 29
beacon 6:ba26dd3251b3 30 void Arm::downtocollect(int* done){
beacon 6:ba26dd3251b3 31 static float pos=TAKE_POS;
beacon 6:ba26dd3251b3 32 if(pos<COLLECT_POS) {
beacon 6:ba26dd3251b3 33 pos+=0.5f;
beacon 6:ba26dd3251b3 34 this->servoArm->position(pos);
beacon 6:ba26dd3251b3 35 }
beacon 6:ba26dd3251b3 36 else{
beacon 6:ba26dd3251b3 37 *done = 1;
beacon 6:ba26dd3251b3 38 }
beacon 4:67d7177c213f 39 }
beacon 4:67d7177c213f 40
beacon 6:ba26dd3251b3 41 void Arm::collecttoback(int* done){
beacon 6:ba26dd3251b3 42 static float pos=COLLECT_POS;
beacon 6:ba26dd3251b3 43 if(pos<RELEASE_POS) {
beacon 6:ba26dd3251b3 44 pos+=0.5f;
beacon 6:ba26dd3251b3 45 this->servoArm->position(pos);
beacon 6:ba26dd3251b3 46 }
beacon 6:ba26dd3251b3 47 else{
beacon 6:ba26dd3251b3 48 *done = 1;
beacon 6:ba26dd3251b3 49 }
beacon 4:67d7177c213f 50 }
beacon 4:67d7177c213f 51
beacon 6:ba26dd3251b3 52 void Arm::backtocollect(int* done){
beacon 6:ba26dd3251b3 53 static float pos=RELEASE_POS;
beacon 6:ba26dd3251b3 54 if(pos>COLLECT_POS) {
beacon 6:ba26dd3251b3 55 pos-=0.5f;
beacon 6:ba26dd3251b3 56 this->servoArm->position(pos);
beacon 6:ba26dd3251b3 57 }
beacon 6:ba26dd3251b3 58 else{
beacon 6:ba26dd3251b3 59 *done = 1;
beacon 6:ba26dd3251b3 60 }
beacon 6:ba26dd3251b3 61 }