Refactor game piece position code & latch in target selector
Move the conversions to where they belong in the superstructure code,
and make the target selector latch the game piece position while it
has a target.
Change-Id: I4cd96fad9f327a241a146024ba38bcf34dfc8564
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/y2023/constants/simulated_constants_sender.cc b/y2023/constants/simulated_constants_sender.cc
index f18c3c1..8bfc17d 100644
--- a/y2023/constants/simulated_constants_sender.cc
+++ b/y2023/constants/simulated_constants_sender.cc
@@ -5,7 +5,7 @@
#include "frc971/constants/constants_sender_lib.h"
namespace y2023 {
-void SendSimulationConstants(aos::SimulatedEventLoopFactory *factory, int team,
+bool SendSimulationConstants(aos::SimulatedEventLoopFactory *factory, int team,
std::string constants_path) {
for (const aos::Node *node : factory->nodes()) {
std::unique_ptr<aos::EventLoop> event_loop =
@@ -13,5 +13,6 @@
frc971::constants::ConstantSender<Constants, ConstantsList> sender(
event_loop.get(), constants_path, team, "/constants");
}
+ return true;
}
} // namespace y2023
diff --git a/y2023/constants/simulated_constants_sender.h b/y2023/constants/simulated_constants_sender.h
index 44a868c..096ee20 100644
--- a/y2023/constants/simulated_constants_sender.h
+++ b/y2023/constants/simulated_constants_sender.h
@@ -5,7 +5,9 @@
#include "aos/testing/path.h"
namespace y2023 {
-void SendSimulationConstants(
+// Returns true, to allow this to be easily called in the initializer list of a
+// constructor.
+bool SendSimulationConstants(
aos::SimulatedEventLoopFactory *factory, int team,
std::string constants_path =
aos::testing::ArtifactPath("y2023/constants/test_constants.json"));
diff --git a/y2023/constants/test_data/test_team.json b/y2023/constants/test_data/test_team.json
index f09b23e..a1e77af 100644
--- a/y2023/constants/test_data/test_team.json
+++ b/y2023/constants/test_data/test_team.json
@@ -14,5 +14,19 @@
}
],
"target_map": {% include 'y2023/constants/test_data/target_map.json' %},
- "scoring_map": {% include 'y2023/constants/test_data/scoring_map.json' %}
+ "scoring_map": {% include 'y2023/constants/test_data/scoring_map.json' %},
+ "robot": {
+ "tof": {
+ "interpolation_table": [
+ {
+ "tof_reading": 0.1,
+ "lateral_position": 0.2
+ },
+ {
+ "tof_reading": 0.90,
+ "lateral_position": -0.2
+ }
+ ]
+ }
+ }
}