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/frc971/control_loops/drivetrain/splinedrivetrain.h b/frc971/control_loops/drivetrain/splinedrivetrain.h
index 24fb66c..09bdc71 100644
--- a/frc971/control_loops/drivetrain/splinedrivetrain.h
+++ b/frc971/control_loops/drivetrain/splinedrivetrain.h
@@ -48,15 +48,23 @@
// Accessor for the current goal state, pretty much only present for debugging
// purposes.
::Eigen::Matrix<double, 5, 1> CurrentGoalState() const {
- return executing_spline_ ? CHECK_NOTNULL(current_trajectory())
- ->GoalState(current_xva_(0), current_xva_(1))
- : ::Eigen::Matrix<double, 5, 1>::Zero();
+ if (executing_spline_) {
+ const FinishedTrajectory *finished = current_trajectory();
+ CHECK(finished != nullptr);
+ return finished->GoalState(current_xva_(0), current_xva_(1));
+ } else {
+ return ::Eigen::Matrix<double, 5, 1>::Zero();
+ }
}
bool IsAtEnd() const {
- return executing_spline_ ? CHECK_NOTNULL(current_trajectory())
- ->is_at_end(current_xva_.block<2, 1>(0, 0))
- : true;
+ if (!executing_spline_) {
+ return true;
+ }
+
+ const FinishedTrajectory *finished = current_trajectory();
+ CHECK(finished != nullptr);
+ return finished->is_at_end(current_xva_.block<2, 1>(0, 0));
}
size_t trajectory_count() const { return trajectories_.size(); }