Add field for image channel in charuco lib

Allows us to easily send it to /camera/decimated for mapping, which is
what we're using until we start logging at full frequency.

Also, move some command line flags out of charuco lib to avoid manually setting flags.

Signed-off-by: Milind Upadhyay <milind.upadhyay@gmail.com>
Change-Id: Iae4d9ed06260154a0fb4d4c67ea03b06a28e4411
diff --git a/frc971/vision/charuco_lib.h b/frc971/vision/charuco_lib.h
index 362bb7d..02bad18 100644
--- a/frc971/vision/charuco_lib.h
+++ b/frc971/vision/charuco_lib.h
@@ -2,13 +2,12 @@
 #define Y2020_VISION_CHARUCO_LIB_H_
 
 #include <functional>
-#include <string_view>
-
 #include <opencv2/aruco/charuco.hpp>
 #include <opencv2/calib3d.hpp>
+#include <string_view>
+
 #include "Eigen/Dense"
 #include "Eigen/Geometry"
-
 #include "absl/types/span.h"
 #include "aos/events/event_loop.h"
 #include "aos/network/message_bridge_server_generated.h"
@@ -16,7 +15,6 @@
 #include "y2020/vision/sift/sift_training_generated.h"
 
 DECLARE_bool(visualize);
-DECLARE_string(target_type);
 
 namespace frc971 {
 namespace vision {
@@ -62,6 +60,14 @@
   std::function<void(cv::Mat, aos::monotonic_clock::time_point)> handle_image_;
 };
 
+// Types of targets that a CharucoExtractor can detect in images
+enum class TargetType : uint8_t {
+  kAprilTag = 0,
+  kAruco = 1,
+  kCharuco = 2,
+  kCharucoDiamond = 3
+};
+
 // Class which calls a callback each time an image arrives with the information
 // extracted from it.
 class CharucoExtractor {
@@ -80,7 +86,8 @@
   // multiple targets in an image; for charuco boards, there should be just one
   // element
   CharucoExtractor(
-      aos::EventLoop *event_loop, std::string_view pi,
+      aos::EventLoop *event_loop, std::string_view pi, TargetType target_type,
+      std::string_view image_channel,
       std::function<void(cv::Mat, aos::monotonic_clock::time_point,
                          std::vector<cv::Vec4i>,
                          std::vector<std::vector<cv::Point2f>>, bool,
@@ -122,7 +129,12 @@
   cv::Ptr<cv::aruco::Dictionary> dictionary_;
   cv::Ptr<cv::aruco::CharucoBoard> board_;
 
-  // Length of a side of the aruco marker
+  // Type of targets to detect
+  TargetType target_type_;
+  // Channel to listen on for images
+  std::string_view image_channel_;
+
+  // Length of a side of the target marker
   double marker_length_;
   // Length of a side of the checkerboard squares (around the marker)
   double square_length_;