Tobis Programm forked to not destroy your golden files

Dependencies:   mbed

Fork of Robocode by PES 2 - Gruppe 1

Committer:
aeschsim
Date:
Tue Apr 25 11:42:45 2017 +0000
Revision:
78:d9138c6f82a8
Parent:
69:1fdcef6a7577
Child:
84:435ec041fd0d
to do: change 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 78:d9138c6f82a8 34 //move_forward_for_distance(float distance)
aeschsim 69:1fdcef6a7577 35 return 56; //close grabber
aeschsim 65:1f237921216d 36 }
cittecla 39:92723f7ea54f 37
cittecla 39:92723f7ea54f 38 int arm_position_release(){
aeschsim 65:1f237921216d 39 set_servo_position(4, servo4max);
aeschsim 66:87b615e4a842 40 wait_ms(400);
aeschsim 65:1f237921216d 41 set_servo_position(6, servo6min);
aeschsim 69:1fdcef6a7577 42 return 55; //open grabber
aeschsim 65:1f237921216d 43 }
cittecla 39:92723f7ea54f 44
aeschsim 55:a1e6fb87d648 45 int open_grabber(){
aeschsim 65:1f237921216d 46 set_servo_position(8, servo8min);
aeschsim 69:1fdcef6a7577 47 return 35; //select target
aeschsim 65:1f237921216d 48 }
cittecla 39:92723f7ea54f 49
cittecla 39:92723f7ea54f 50 int close_grabber(){
aeschsim 65:1f237921216d 51 set_servo_position(8, servo8max);
aeschsim 78:d9138c6f82a8 52 return 53; //release position -> get_color()...
aeschsim 65:1f237921216d 53 }