Add support for ignoring vision for testing
Makes it easier to test.
Change-Id: I206b75ea1acf7fa0fc0eff66258c0958472b52fc
diff --git a/y2020/actors/autonomous_actor.cc b/y2020/actors/autonomous_actor.cc
index 2e0bebc..bc1d6f0 100644
--- a/y2020/actors/autonomous_actor.cc
+++ b/y2020/actors/autonomous_actor.cc
@@ -11,8 +11,9 @@
#include "y2020/actors/auto_splines.h"
#include "y2020/control_loops/drivetrain/drivetrain_base.h"
-DEFINE_bool(spline_auto, true, "If true, define a spline autonomous mode");
-DEFINE_bool(galactic_search, false,
+DEFINE_bool(spline_auto, false, "If true, define a spline autonomous mode");
+DEFINE_bool(ignore_vision, true, "If true, ignore vision");
+DEFINE_bool(galactic_search, true,
"If true, do the galactic search autonomous");
DEFINE_bool(bounce, false, "If true, run the AutoNav Bounce autonomous");
DEFINE_bool(barrel, false, "If true, run the AutoNav Barrel autonomous");
@@ -157,13 +158,12 @@
CHECK(galactic_search_splines_);
path_fetcher_.Fetch();
- CHECK(path_fetcher_.get() != nullptr)
- << "Expect at least one GalacticSearchPath message before running "
- "auto...";
- if (path_fetcher_->alliance() == y2020::vision::Alliance::kUnknown) {
- AOS_LOG(ERROR, "The galactic search path is unknown, doing nothing.");
- } else {
- SplineHandle *spline = nullptr;
+ SplineHandle *spline = nullptr;
+ if (path_fetcher_.get()) {
+ if (path_fetcher_->alliance() == y2020::vision::Alliance::kUnknown) {
+ AOS_LOG(ERROR, "The galactic search path is unknown, doing nothing.");
+ return;
+ }
if (path_fetcher_->alliance() == y2020::vision::Alliance::kRed) {
if (path_fetcher_->letter() == y2020::vision::Letter::kA) {
LOG(INFO) << "Red A";
@@ -183,20 +183,27 @@
spline = &galactic_search_splines_->red_b;
}
}
- CHECK_NOTNULL(spline);
-
- SendStartingPosition(spline->starting_position());
-
- set_intake_goal(1.2);
- set_roller_voltage(7.0);
- SendSuperstructureGoal();
-
- if (!spline->WaitForPlan()) return;
- spline->Start();
-
- if (!spline->WaitForSplineDistanceRemaining(0.02)) return;
- RetractIntake();
}
+ if (FLAGS_ignore_vision) {
+ LOG(INFO) << "Forcing Red B";
+ spline = &galactic_search_splines_->red_b;
+ }
+
+ CHECK(spline != nullptr)
+ << "Expect at least one GalacticSearchPath message before running "
+ "auto...";
+
+ SendStartingPosition(spline->starting_position());
+
+ set_intake_goal(1.25);
+ set_roller_voltage(12.0);
+ SendSuperstructureGoal();
+
+ if (!spline->WaitForPlan()) return;
+ spline->Start();
+
+ if (!spline->WaitForSplineDistanceRemaining(0.02)) return;
+ RetractIntake();
}
void AutonomousActor::AutoNavBounce() {