Revert "Log images on the jevois."
With this patch, the localizer tracks very poorly. It's likely added
delay somewhere. Let's roll it back for now. We can figure out what
makes sense later.
This reverts commit e9775c378d9706048a1cd59e033d552a944fcd22.
Change-Id: I7d83e15812e5173f9447bcce746a0d18bfe09c06
diff --git a/y2019/vision/BUILD b/y2019/vision/BUILD
index e19c8cd..5cfc52b 100644
--- a/y2019/vision/BUILD
+++ b/y2019/vision/BUILD
@@ -34,13 +34,6 @@
tools = [":constants_formatting"],
)
-cc_library(
- name = "image_writer",
- srcs = ["image_writer.cc"],
- hdrs = ["image_writer.h"],
- deps = ["//aos/vision/image:image_types"],
-)
-
sh_test(
name = "constants_formatting_test",
srcs = ["constants_formatting_test.sh"],
@@ -98,7 +91,6 @@
srcs = ["target_sender.cc"],
restricted_to = VISION_TARGETS,
deps = [
- ":image_writer",
":target_finder",
"//aos/logging",
"//aos/logging:implementations",
diff --git a/y2019/vision/image_writer.cc b/y2019/vision/image_writer.cc
deleted file mode 100644
index a2c5f0e..0000000
--- a/y2019/vision/image_writer.cc
+++ /dev/null
@@ -1,50 +0,0 @@
-#include <fstream>
-#include <sys/stat.h>
-
-#include "y2019/vision/image_writer.h"
-
-namespace y2019 {
-namespace vision {
-
-void ImageWriter::WriteImage(::aos::vision::DataRef data) {
- LOG(INFO, "Writing image %d", image_count_);
- std::ofstream ofs(
- dir_path_ + file_prefix_ + std::to_string(image_count_) + ".yuyv",
- std::ofstream::out);
- ofs << data;
- ofs.close();
- ++image_count_;
-}
-
-void ImageWriter::ProcessImage(::aos::vision::DataRef data,
- size_t num_targets) {
- ++debounce_count_;
- if (debounce_count_ < 10) {
- return;
- }
- // Write the image if there are fewer targets in this frame than the last.
- if (num_targets < previous_num_targets_) {
- WriteImage(previous_image_);
- WriteImage(data);
- debounce_count_ = 0;
- }
- //data.swap(previous_image_);
- data.copy(previous_image_, sizeof(previous_image_));
-}
-
-void ImageWriter::SetDirPath() {
- std::string base_path = "/jevois/data/run_";
- for (int i = 0;; ++i) {
- struct stat st;
- std::string option = base_path + std::to_string(i);
- if (stat(option.c_str(), &st) != 0) {
- file_prefix_ = option + "/";
- LOG(INFO, "Writing to %s\n", file_prefix_.c_str());
- mkdir(file_prefix_.c_str(), 0777);
- break;
- }
- }
-}
-
-} // namespace vision
-} // namespace y2019
diff --git a/y2019/vision/image_writer.h b/y2019/vision/image_writer.h
deleted file mode 100644
index 3d0d934..0000000
--- a/y2019/vision/image_writer.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef _Y2019_VISION_IMAGE_WRITER_H_
-#define _Y2019_VISION_IMAGE_WRITER_H_
-
-#include <string>
-
-#include "aos/logging/logging.h"
-#include "aos/vision/image/image_types.h"
-
-namespace y2019 {
-namespace vision {
-
-class ImageWriter {
- public:
- ImageWriter() {
- LOG(INFO, "Initializing image writer\n");
- SetDirPath();
- }
-
- // This is destructive to data.
- void ProcessImage(::aos::vision::DataRef data, size_t num_targets);
- private:
- void SetDirPath();
-
- void WriteImage(::aos::vision::DataRef data);
-
- std::string file_prefix_ = std::string("debug_viewer_jpeg_");
- std::string dir_path_;
-
- size_t previous_num_targets_ = 0;
- char previous_image_[640 * 480 * 2];
-
- unsigned int image_count_ = 0;
- unsigned int debounce_count_ = 0;
-};
-
-} // namespace vision
-} // namespace y2017
-
-#endif // _Y2019_VISION_IMAGE_WRITER_H_
diff --git a/y2019/vision/target_sender.cc b/y2019/vision/target_sender.cc
index 6515e5b..6dcf6c0 100644
--- a/y2019/vision/target_sender.cc
+++ b/y2019/vision/target_sender.cc
@@ -12,7 +12,6 @@
#include "y2019/jevois/serial.h"
#include "y2019/jevois/structures.h"
#include "y2019/jevois/uart.h"
-#include "y2019/vision/image_writer.h"
#include "y2019/vision/target_finder.h"
using ::aos::events::DataSocket;
@@ -289,7 +288,6 @@
// dup2(itsDev, 2);
TargetFinder finder_;
- ImageWriter writer_;
aos::vision::CameraParams params0;
params0.set_exposure(50);
@@ -373,8 +371,6 @@
LOG(INFO, "Some problem happened");
}
}
-
- writer_.ProcessImage(data, results.size());
});
aos::events::EpollLoop loop;
diff --git a/y2019/vision/tools/deploy.sh b/y2019/vision/tools/deploy.sh
index 28da309..3c16b03 100755
--- a/y2019/vision/tools/deploy.sh
+++ b/y2019/vision/tools/deploy.sh
@@ -24,10 +24,10 @@
echo "OK"
echo "Copying files ..."
-sudo cp ./austin_cam.sh "${TARGET_DIR}"/
-sudo cp ./launch.sh "${TARGET_DIR}"/deploy/
+cp ./austin_cam.sh "${TARGET_DIR}"/
+cp ./launch.sh "${TARGET_DIR}"/deploy/
-sudo cp "${BAZEL_BIN}/y2019/vision/target_sender" \
+cp "${BAZEL_BIN}/y2019/vision/target_sender" \
"${BAZEL_BIN}/y2019/vision/serial_waiter" \
"${TARGET_DIR}"/deploy/