Tobis Programm forked to not destroy your golden files
Fork of Robocode by
source/Safety.cpp@136:906ac19fb850, 2017-05-22 (annotated)
- Committer:
- PESGruppe1
- Date:
- Mon May 22 13:18:13 2017 +0000
- Revision:
- 136:906ac19fb850
- Parent:
- 131:0d6c072b23ca
New finepostitioning mit vor und zur?ckdrehen 1 grad;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cittecla | 38:3526c36e4c73 | 1 | #pragma once |
cittecla | 38:3526c36e4c73 | 2 | |
cittecla | 38:3526c36e4c73 | 3 | #include "mbed.h" |
cittecla | 38:3526c36e4c73 | 4 | #include "Safety.h" |
cittecla | 38:3526c36e4c73 | 5 | |
aeschsim | 131:0d6c072b23ca | 6 | int safety(int state){ |
aeschsim | 131:0d6c072b23ca | 7 | if(getDistanceIR(2) < 0.05f && state != 50) { //state 50: grabbing state |
aeschsim | 131:0d6c072b23ca | 8 | stop_move(); |
aeschsim | 131:0d6c072b23ca | 9 | stop_turn(); |
aeschsim | 131:0d6c072b23ca | 10 | printf("Stopped moving to prevent colission!\r\n"); |
aeschsim | 131:0d6c072b23ca | 11 | return 11; |
cittecla | 38:3526c36e4c73 | 12 | } |
aeschsim | 131:0d6c072b23ca | 13 | return state; |
aeschsim | 131:0d6c072b23ca | 14 | } |
cittecla | 38:3526c36e4c73 | 15 | |
cittecla | 38:3526c36e4c73 | 16 | int emergency_shutdown(){ |
cittecla | 126:d0b2057272d0 | 17 | stop_move(); |
cittecla | 126:d0b2057272d0 | 18 | stop_turn(); |
cittecla | 126:d0b2057272d0 | 19 | disable_servos(); |
cittecla | 126:d0b2057272d0 | 20 | disable_motors(); |
cittecla | 38:3526c36e4c73 | 21 | return 0; |
cittecla | 38:3526c36e4c73 | 22 | } |
cittecla | 38:3526c36e4c73 | 23 | |
cittecla | 38:3526c36e4c73 | 24 | int colision_detected(){ |
cittecla | 38:3526c36e4c73 | 25 | |
cittecla | 38:3526c36e4c73 | 26 | return 0; |
cittecla | 38:3526c36e4c73 | 27 | } |
cittecla | 38:3526c36e4c73 | 28 | |
cittecla | 38:3526c36e4c73 | 29 | int current_to_high(){ |
cittecla | 38:3526c36e4c73 | 30 | |
cittecla | 38:3526c36e4c73 | 31 | return 0; |
cittecla | 38:3526c36e4c73 | 32 | } |
cittecla | 38:3526c36e4c73 | 33 | |
cittecla | 38:3526c36e4c73 | 34 | int overheating(){ |
cittecla | 38:3526c36e4c73 | 35 | |
cittecla | 38:3526c36e4c73 | 36 | return 0; |
cittecla | 38:3526c36e4c73 | 37 | } |
cittecla | 38:3526c36e4c73 | 38 |