Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Fork of Robocode by
source/Safety.cpp
- Committer:
- aeschsim
- Date:
- 2017-05-16
- Revision:
- 136:b35f2d9b7402
- Parent:
- 130:0d6c072b23ca
File content as of revision 136:b35f2d9b7402:
#pragma once
#include "mbed.h"
#include "Safety.h"
bool safety()
{
float dist_ir = getDistanceIR(2);
if(getDistanceIR(2) < 0.1f) { //state 50: grabbing state
stop_move();
stop_turn();
printf("Stopped moving to prevent colission!\r\n");
return 1;
}
return 0;
}
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;
}
