Made vision work and tuned the delay.
Change-Id: I798ecb56307d5c692425357a91fa4c86a7257bf7
diff --git a/y2017/vision/target_finder.cc b/y2017/vision/target_finder.cc
index 22943ef..608ae75 100644
--- a/y2017/vision/target_finder.cc
+++ b/y2017/vision/target_finder.cc
@@ -157,7 +157,7 @@
// Write down the two indicies.
std::pair<int, int> selected;
// We are regressing the combined estimated center, might write that down.
- double regressed_y_center;
+ double regressed_y_center = 0;
Eigen::VectorXf b = Eigen::VectorXf::Zero(4);
for (size_t i = 0; i < component_list.size(); i++) {
@@ -274,7 +274,7 @@
double pl = std::sqrt(pz * pz + px * px);
*dist = kInchesToMeters * (world_height * pl / py - added_dist);
- *angle = std::atan2(px, pz);
+ *angle = -std::atan2(px, pz);
}
} // namespace vision
diff --git a/y2017/vision/target_receiver.cc b/y2017/vision/target_receiver.cc
index f96a95e..556ae2a 100644
--- a/y2017/vision/target_receiver.cc
+++ b/y2017/vision/target_receiver.cc
@@ -9,10 +9,12 @@
#include "y2017/vision/vision.q.h"
#include "y2017/vision/vision_result.pb.h"
+namespace y2017 {
+namespace vision {
+
using aos::monotonic_clock;
-int main() {
- using namespace y2017::vision;
+int Main() {
::aos::events::RXUdpSocket recv(8080);
char raw_data[65507];
// TODO(parker): Have this pull in a config from somewhere.
@@ -25,10 +27,10 @@
monotonic_clock::time_point now = monotonic_clock::now();
auto target_time = now -
std::chrono::nanoseconds(target.send_timestamp() -
- target.image_timestamp()) +
+ target.image_timestamp()) -
// It takes a bit to shoot a frame. Push the frame
// further back in time.
- std::chrono::milliseconds(10);
+ std::chrono::milliseconds(60);
if (!target.ParseFromArray(raw_data, size)) {
continue;
@@ -54,3 +56,11 @@
}
}
}
+
+} // namespace vision
+} // namespace y2017
+
+int main(int /*argc*/, char ** /*argv*/) {
+ ::aos::InitNRT();
+ ::y2017::vision::Main();
+}