Browse Source

Check for valid lane

master
Tim Zeuner 2 years ago
parent
commit
ff7634e0b0

+ 10
- 0
AutonomousMode/IntersectionHandler/intersection_handler.cpp View File

@@ -6,4 +6,14 @@ IntersectionHandler::IntersectionHandler(/* args */)

IntersectionHandler::~IntersectionHandler()
{
}

const bool IntersectionHandler::foundLane(const FrameData& data)
{
return data.boundingBoxes.size();
}

const bool IntersectionHandler::foundIntersection(const FrameData& data)
{
return data.boundingBoxes.size()>1;
}

+ 4
- 1
AutonomousMode/IntersectionHandler/intersection_handler.h View File

@@ -1,11 +1,14 @@
#pragma once
#include <utils.h>

class IntersectionHandler
{
private:
/* data */
public:
IntersectionHandler(/* args */);

~IntersectionHandler();

const bool foundLane(const FrameData& data);
const bool foundIntersection(const FrameData& data);
};

+ 10
- 3
AutonomousMode/autonomous_mode_main.cpp View File

@@ -40,9 +40,16 @@ int main(void)
double delta = static_cast<double>(deltaMs) / 1000.0;
double frameRate = 1.0 / static_cast<double>(delta);

std::cout << "Frame rate: " << frameRate << " angle: " << result.data.angle
<< " motor 1: " << result.motorSignals[0] << " motor 2: " << result.motorSignals[1]
<< " motor 3: " << result.motorSignals[2] << " motor 4: " << result.motorSignals[3] <<std::endl;
if (result.validLane)
{
std::cout << "Frame rate: " << frameRate << " angle: " << result.data.angle
<< " motor 1: " << result.motorSignals[0] << " motor 2: " << result.motorSignals[1]
<< " motor 3: " << result.motorSignals[2] << " motor 4: " << result.motorSignals[3] <<std::endl;
}
else
{
std::cout << "No lane found." << std::endl;;
}
last = now;
}
}, &mutex);

+ 6
- 4
AutonomousMode/lfr.cpp View File

@@ -68,10 +68,12 @@ void LFR::createThread()
processing.filterReflections(data);
processing.calcAngles(data, originalImage.cols, originalImage.rows, left);
controlModule.calcSpeeds(1,1, data.angle);

processedImage = provideOutput(originalImage, processedImage, data, roi);

result.validLane = intersectionHandler.foundLane(data);
if (result.validLane)
{
controlModule.calcSpeeds(1,1, data.angle);
processedImage = provideOutput(originalImage, processedImage, data, roi);
}
result.rawImage = originalImage;
result.processedImage = processedImage;
result.data = data;

+ 1
- 0
AutonomousMode/lfr.h View File

@@ -18,6 +18,7 @@ using namespace cv;

struct LFR_Result
{
bool validLane;
cv::Mat rawImage;
cv::Mat processedImage;
FrameData data;

Loading…
Cancel
Save