Browse Source

motor signals in the loop

master
Tim Zeuner 2 years ago
parent
commit
7175b68abe
3 changed files with 7 additions and 1 deletions
  1. 3
    1
      AutonomousMode/autonomous_mode_main.cpp
  2. 3
    0
      AutonomousMode/lfr.cpp
  3. 1
    0
      AutonomousMode/lfr.h

+ 3
- 1
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 << std::endl;
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;
last = now; last = now;
} }
}, &mutex); }, &mutex);

+ 3
- 0
AutonomousMode/lfr.cpp View File

FrameData data = processing.calculateLineSegments(processedImage, roi); FrameData data = processing.calculateLineSegments(processedImage, roi);
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); processedImage = provideOutput(originalImage, processedImage, data, roi);


result.rawImage = originalImage; result.rawImage = originalImage;
result.processedImage = processedImage; result.processedImage = processedImage;
result.data = data; result.data = data;
result.motorSignals = controlModule.readMotors();
} }
catch(std::exception const &ex) catch(std::exception const &ex)
{ {

+ 1
- 0
AutonomousMode/lfr.h View File

cv::Mat rawImage; cv::Mat rawImage;
cv::Mat processedImage; cv::Mat processedImage;
FrameData data; FrameData data;
std::vector<float> motorSignals;
}; };


class LFR class LFR

Loading…
Cancel
Save