Revision 508
position updating in separate thread. incomplete SIGINT handler
PositionMonitor.cpp | ||
---|---|---|
22 | 22 |
//TODO: check for error returned from init |
23 | 23 |
vision_init("/var/www/colonet.jpg"); |
24 | 24 |
newIdToAssign = -1; |
25 |
|
|
26 |
pthread_mutex_init(&position_map_lock, NULL); |
|
25 | 27 |
} |
26 | 28 |
|
27 | 29 |
PositionMonitor::~PositionMonitor() { |
28 | 30 |
} |
29 | 31 |
|
30 |
int PositionMonitor::startMonitoring() { |
|
31 |
//TODO: fill this in when this becomes asynchronous |
|
32 |
return 0; |
|
32 |
void PositionMonitor::run() { |
|
33 |
while (1) { |
|
34 |
updatePositions(); |
|
35 |
usleep(500000); |
|
36 |
} |
|
33 | 37 |
} |
34 | 38 |
|
35 | 39 |
int PositionMonitor::stopMonitoring() { |
... | ... | |
107 | 111 |
} |
108 | 112 |
|
109 | 113 |
map<int, VisionPosition> PositionMonitor::getAllRobotPositions() { |
110 |
//TODO do this in another thread! |
|
111 |
updatePositions(); |
|
112 |
|
|
113 | 114 |
return positionMap; |
114 | 115 |
} |
115 | 116 |
|
Also available in: Unified diff