Tobis Programm forked to not destroy your golden files
Fork of Robocode by
source/Grabbing.cpp@66:87b615e4a842, 2017-04-19 (annotated)
- Committer:
- aeschsim
- Date:
- Wed Apr 19 08:59:53 2017 +0000
- Revision:
- 66:87b615e4a842
- Parent:
- 60:b57577b0072f
- Parent:
- 65:1f237921216d
- Child:
- 69:1fdcef6a7577
Test Tool for Grabbing, endless loop
Who changed what in which revision?
User | Revision | Line number | New 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 | } |
cittecla | 39:92723f7ea54f | 34 | return 0; |
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); |
cittecla | 39:92723f7ea54f | 41 | return 0; |
aeschsim | 65:1f237921216d | 42 | } |
cittecla | 39:92723f7ea54f | 43 | |
aeschsim | 55:a1e6fb87d648 | 44 | int open_grabber(){ |
aeschsim | 65:1f237921216d | 45 | set_servo_position(8, servo8min); |
cittecla | 39:92723f7ea54f | 46 | return 0; |
aeschsim | 65:1f237921216d | 47 | } |
cittecla | 39:92723f7ea54f | 48 | |
cittecla | 39:92723f7ea54f | 49 | int close_grabber(){ |
aeschsim | 65:1f237921216d | 50 | set_servo_position(8, servo8max); |
cittecla | 39:92723f7ea54f | 51 | return 0; |
aeschsim | 65:1f237921216d | 52 | } |