blob: dc7f02fd65f813ed93a5641e8699b3eef4ad1045 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/*
* Notbremse.cpp
*
* Created on: 01.12.2010
* Author: sven
*/
#include "Notbremse.h"
#include <iostream>
#include <stdlib.h>
#include <cmath>
using namespace std;
Notbremse::Notbremse(int t)
:Task(t),DIST_THRESHOLD(50)
{
}
Notbremse::~Notbremse() {
// TODO Auto-generated destructor stub
}
void Notbremse::execute() {
cout << "...Notbremse::executeT=" << T <<endl;
while(true) {
pthread_mutex_lock(&vehicleMutex);
double dist = Abstand(vehiclePosition,lineDir);
if(abs(dist) > DIST_THRESHOLD) {
cout << "NOTBREMSE" << endl;
exit(1);
}
pthread_mutex_unlock(&vehicleMutex);
waitForNextCycle();
}
}
|