Add field name to TargetMap flatbuffer
We'll use this to know which map we're using in code once we load it on
the robot.
Signed-off-by: Milind Upadhyay <milind.upadhyay@gmail.com>
Change-Id: Id54b82e7b7f07b767a84e266d47468973cbe319e
diff --git a/frc971/vision/target_mapper.h b/frc971/vision/target_mapper.h
index df9f5b4..4dbe52b 100644
--- a/frc971/vision/target_mapper.h
+++ b/frc971/vision/target_mapper.h
@@ -35,11 +35,13 @@
TargetMapper(std::map<TargetId, ceres::examples::Pose2d> target_poses,
std::vector<ceres::examples::Constraint2d> target_constraints);
- // If output_path is set, the map will be saved to that file as a json
- void Solve(std::optional<std::string_view> output_path = std::nullopt);
+ // Solves for the target map. If output_dir is set, the map will be saved to
+ // output_dir/field_name.json
+ void Solve(std::string_view field_name,
+ std::optional<std::string_view> output_dir = std::nullopt);
// Prints target poses into a TargetMap flatbuffer json
- std::string MapToJson() const;
+ std::string MapToJson(std::string_view field_name) const;
static std::optional<TargetPose> GetTargetPoseById(
std::vector<TargetPose> target_poses, TargetId target_id);