Revision 513
fixed memory leak in vision code
PositionMonitor.cpp | ||
---|---|---|
36 | 36 |
} |
37 | 37 |
} |
38 | 38 |
|
39 |
int PositionMonitor::stopMonitoring() { |
|
40 |
//TODO: fill this in when this becomes asynchronous |
|
41 |
return 0; |
|
42 |
} |
|
43 |
|
|
44 | 39 |
int PositionMonitor::updatePositions() { |
45 | 40 |
VisionPosition * positions = NULL; |
46 | 41 |
|
... | ... | |
126 | 121 |
|
127 | 122 |
int PositionMonitor::getRobotPosition(int robot_id, int* xbuf, int* ybuf) { |
128 | 123 |
//TODO: figure out what a map returns if the element doesn't exist |
129 |
|
|
124 |
|
|
130 | 125 |
pthread_mutex_lock(&position_map_lock); |
131 | 126 |
|
132 |
|
|
133 | 127 |
if (positionMap.find(robot_id) == positionMap.end()){ |
134 | 128 |
return -1; |
135 | 129 |
} |
... | ... | |
147 | 141 |
bool PositionMonitor::isProbablySameRobot(VisionPosition p1, VisionPosition p2) { |
148 | 142 |
int xDiff = p1.x - p2.x; |
149 | 143 |
int yDiff = p1.y - p2.y; |
150 |
return (xDiff*xDiff + yDiff*yDiff < MAX_DISTANCE*MAX_DISTANCE);
|
|
144 |
return (xDiff*xDiff + yDiff*yDiff < SAME_ROBOT_DISTANCE_THRESHOLD*SAME_ROBOT_DISTANCE_THRESHOLD);
|
|
151 | 145 |
} |
Also available in: Unified diff