Tobis Programm forked to not destroy your golden files

Dependencies:   mbed

Fork of Robocode by PES 2 - Gruppe 1

source/Safety.cpp

Committer:
aeschsim
Date:
2017-05-15
Revision:
131:0d6c072b23ca
Parent:
126:d0b2057272d0

File content as of revision 131:0d6c072b23ca:

#pragma once

#include "mbed.h"
#include "Safety.h"

int safety(int state){
    if(getDistanceIR(2) < 0.05f && state != 50) {   //state 50: grabbing state
        stop_move();
        stop_turn();
        printf("Stopped moving to prevent colission!\r\n");
        return 11;
    }
    return state;
}
    
int emergency_shutdown(){
    stop_move();
    stop_turn();
    disable_servos();
    disable_motors();
    return 0;
    }
    
int colision_detected(){
    
    return 0;
    }
    
int current_to_high(){
    
    return 0;
    }
    
int overheating(){
    
    return 0;
    }