Remove usage of CHECK_NOTNULL
We want to switch to absl logging instead of glog. gtest and ceres are
going there, and we already have absl as a dependency. ABSL doesn't
have CHECK_NOTNULL, and we can move things over in an easier to review
fashion.
Change-Id: Ifd9a11ec34a2357cec43f88dba015db9c28ed2cf
Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/y2024/control_loops/superstructure/aiming.cc b/y2024/control_loops/superstructure/aiming.cc
index d8d336f..b53dbb5 100644
--- a/y2024/control_loops/superstructure/aiming.cc
+++ b/y2024/control_loops/superstructure/aiming.cc
@@ -11,7 +11,10 @@
Aimer::Aimer(aos::EventLoop *event_loop,
const y2024::Constants *robot_constants)
: event_loop_(event_loop),
- robot_constants_(CHECK_NOTNULL(robot_constants)),
+ robot_constants_([&]() {
+ CHECK(robot_constants != nullptr);
+ return robot_constants;
+ }()),
drivetrain_config_(
frc971::control_loops::drivetrain::DrivetrainConfig<double>::
FromFlatbuffer(*robot_constants_->common()->drivetrain())),
@@ -58,7 +61,7 @@
} else {
received_joystick_state_ = true;
- CHECK_NOTNULL(joystick_state_fetcher_.get());
+ CHECK(joystick_state_fetcher_.get() != nullptr);
alliance = joystick_state_fetcher_->alliance();
}
diff --git a/y2024/control_loops/superstructure/superstructure.cc b/y2024/control_loops/superstructure/superstructure.cc
index a485943..7f7da4f 100644
--- a/y2024/control_loops/superstructure/superstructure.cc
+++ b/y2024/control_loops/superstructure/superstructure.cc
@@ -36,7 +36,7 @@
: frc971::controls::ControlLoop<Goal, Position, Status, Output>(event_loop,
name),
constants_fetcher_(event_loop),
- robot_constants_(CHECK_NOTNULL(&constants_fetcher_.constants())),
+ robot_constants_(&constants_fetcher_.constants()),
drivetrain_status_fetcher_(
event_loop->MakeFetcher<frc971::control_loops::drivetrain::Status>(
"/drivetrain")),
diff --git a/y2024/control_loops/superstructure/superstructure_lib_test.cc b/y2024/control_loops/superstructure/superstructure_lib_test.cc
index 59398ab..719a29b 100644
--- a/y2024/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2024/control_loops/superstructure/superstructure_lib_test.cc
@@ -312,8 +312,7 @@
superstructure_(superstructure_event_loop.get()),
test_event_loop_(MakeEventLoop("test", roborio_)),
constants_fetcher_(test_event_loop_.get()),
- simulated_robot_constants_(
- CHECK_NOTNULL(&constants_fetcher_.constants())),
+ simulated_robot_constants_(&constants_fetcher_.constants()),
superstructure_goal_fetcher_(
test_event_loop_->MakeFetcher<Goal>("/superstructure")),
superstructure_goal_sender_(