Tobis Programm forked to not destroy your golden files

Dependencies:   mbed

Fork of Robocode by PES 2 - Gruppe 1

Committer:
aeschsim
Date:
Thu Apr 20 05:52:22 2017 +0000
Revision:
69:1fdcef6a7577
Parent:
66:87b615e4a842
Child:
78:d9138c6f82a8
changed return values of grabbing-functions

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cittecla 12:91c2e07d2b5b 1 /**
cittecla 12:91c2e07d2b5b 2 * Grabbing function library
cittecla 12:91c2e07d2b5b 3 * Handels grabbing of the LEGO-stones
cittecla 12:91c2e07d2b5b 4 **/
cittecla 12:91c2e07d2b5b 5
cittecla 39:92723f7ea54f 6 #include "Grabbing.h"
cittecla 12:91c2e07d2b5b 7
aeschsim 66:87b615e4a842 8 #define servo4min 280 //unten
aeschsim 65:1f237921216d 9 #define servo4max 495 //oben
aeschsim 65:1f237921216d 10 #define servo6min 270 //oben
aeschsim 65:1f237921216d 11 #define servo6max 480 //unter
aeschsim 65:1f237921216d 12 #define servo8min 120 //offen
aeschsim 65:1f237921216d 13 #define servo8max 260 //zu
aeschsim 65:1f237921216d 14 //Servo 4 Ausleger Servo 6 Gelenk Servo 8 Greifer
aeschsim 65:1f237921216d 15
aeschsim 65:1f237921216d 16
cittecla 39:92723f7ea54f 17 int grabbing(){
aeschsim 55:a1e6fb87d648 18 //void
cittecla 39:92723f7ea54f 19 return 0;
cittecla 39:92723f7ea54f 20 }
cittecla 39:92723f7ea54f 21
cittecla 39:92723f7ea54f 22 int arm_position_move(){
aeschsim 55:a1e6fb87d648 23 //void (Mittelstellung für Fahrt)
cittecla 39:92723f7ea54f 24 return 0;
cittecla 39:92723f7ea54f 25 }
cittecla 39:92723f7ea54f 26
cittecla 39:92723f7ea54f 27 int arm_position_grabbing(){
aeschsim 66:87b615e4a842 28 for(int i = servo4max; i > servo4min; i = i-5) {
aeschsim 65:1f237921216d 29 set_servo_position(4, i);
aeschsim 66:87b615e4a842 30 if (i == 450) {
aeschsim 65:1f237921216d 31 set_servo_position(6, servo6max);
aeschsim 65:1f237921216d 32 }
aeschsim 65:1f237921216d 33 }
aeschsim 69:1fdcef6a7577 34 return 56; //close grabber
aeschsim 65:1f237921216d 35 }
cittecla 39:92723f7ea54f 36
cittecla 39:92723f7ea54f 37 int arm_position_release(){
aeschsim 65:1f237921216d 38 set_servo_position(4, servo4max);
aeschsim 66:87b615e4a842 39 wait_ms(400);
aeschsim 65:1f237921216d 40 set_servo_position(6, servo6min);
aeschsim 69:1fdcef6a7577 41 return 55; //open grabber
aeschsim 65:1f237921216d 42 }
cittecla 39:92723f7ea54f 43
aeschsim 55:a1e6fb87d648 44 int open_grabber(){
aeschsim 65:1f237921216d 45 set_servo_position(8, servo8min);
aeschsim 69:1fdcef6a7577 46 return 35; //select target
aeschsim 65:1f237921216d 47 }
cittecla 39:92723f7ea54f 48
cittecla 39:92723f7ea54f 49 int close_grabber(){
aeschsim 65:1f237921216d 50 set_servo_position(8, servo8max);
aeschsim 69:1fdcef6a7577 51 return 53; //release position
aeschsim 65:1f237921216d 52 }