Browse Source

Check for valid lane

master
Tim Zeuner 2 years ago
parent
commit
ff7634e0b0

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



IntersectionHandler::~IntersectionHandler() 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

#pragma once #pragma once
#include <utils.h>


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


~IntersectionHandler(); ~IntersectionHandler();

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

+ 10
- 3
AutonomousMode/autonomous_mode_main.cpp View File

double delta = static_cast<double>(deltaMs) / 1000.0; double delta = static_cast<double>(deltaMs) / 1000.0;
double frameRate = 1.0 / static_cast<double>(delta); 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; last = now;
} }
}, &mutex); }, &mutex);

+ 6
- 4
AutonomousMode/lfr.cpp View File

processing.filterReflections(data); processing.filterReflections(data);
processing.calcAngles(data, originalImage.cols, originalImage.rows, left); 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.rawImage = originalImage;
result.processedImage = processedImage; result.processedImage = processedImage;
result.data = data; result.data = data;

+ 1
- 0
AutonomousMode/lfr.h View File



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

Loading…
Cancel
Save