Prefix LOG and CHECK with AOS_
This prepares us for introducing glog more widely and transitioning
things over where they make sense.
Change-Id: Ic6c208882407bc2153fe875ffc736d66f5c8ade5
diff --git a/y2017/control_loops/superstructure/column/column.cc b/y2017/control_loops/superstructure/column/column.cc
index 2a3cde7..ab1ff72 100644
--- a/y2017/control_loops/superstructure/column/column.cc
+++ b/y2017/control_loops/superstructure/column/column.cc
@@ -71,10 +71,10 @@
const double indexer_doffset = indexer_offset - offset_(0, 0);
const double turret_doffset = turret_offset - offset_(1, 0);
- LOG(INFO, "Adjusting indexer offset from %f to %f\n", offset_(0, 0),
- indexer_offset);
- LOG(INFO, "Adjusting turret offset from %f to %f\n", offset_(1, 0),
- turret_offset);
+ AOS_LOG(INFO, "Adjusting indexer offset from %f to %f\n", offset_(0, 0),
+ indexer_offset);
+ AOS_LOG(INFO, "Adjusting turret offset from %f to %f\n", offset_(1, 0),
+ turret_offset);
loop_->mutable_X_hat()(0, 0) += indexer_doffset;
loop_->mutable_X_hat()(2, 0) += turret_doffset + indexer_doffset;
@@ -99,7 +99,7 @@
estimators_[0].UpdateEstimate(new_position);
if (estimators_[0].error()) {
- LOG(ERROR, "zeroing error\n");
+ AOS_LOG(ERROR, "zeroing error\n");
return;
}
@@ -162,13 +162,13 @@
// Limit the goal to min/max allowable positions.
if (zeroed()) {
if ((*goal)(2, 0) > range_.upper) {
- LOG(WARNING, "Goal %s above limit, %f > %f\n", name, (*goal)(2, 0),
- range_.upper);
+ AOS_LOG(WARNING, "Goal %s above limit, %f > %f\n", name, (*goal)(2, 0),
+ range_.upper);
(*goal)(2, 0) = range_.upper;
}
if ((*goal)(2, 0) < range_.lower) {
- LOG(WARNING, "Goal %s below limit, %f < %f\n", name, (*goal)(2, 0),
- range_.lower);
+ AOS_LOG(WARNING, "Goal %s below limit, %f < %f\n", name, (*goal)(2, 0),
+ range_.lower);
(*goal)(2, 0) = range_.lower;
}
} else {
@@ -181,13 +181,13 @@
// Upper - lower hard may be a bit generous, but we are moving slow.
if ((*goal)(2, 0) > kMaxRange) {
- LOG(WARNING, "Goal %s above limit, %f > %f\n", name, (*goal)(2, 0),
- kMaxRange);
+ AOS_LOG(WARNING, "Goal %s above limit, %f > %f\n", name, (*goal)(2, 0),
+ kMaxRange);
(*goal)(2, 0) = kMaxRange;
}
if ((*goal)(2, 0) < -kMaxRange) {
- LOG(WARNING, "Goal %s below limit, %f < %f\n", name, (*goal)(2, 0),
- -kMaxRange);
+ AOS_LOG(WARNING, "Goal %s below limit, %f < %f\n", name, (*goal)(2, 0),
+ -kMaxRange);
(*goal)(2, 0) = -kMaxRange;
}
}
@@ -241,7 +241,7 @@
loop_->mutable_X_hat(4, 0) = 0.0;
loop_->mutable_X_hat(5, 0) = 0.0;
- LOG(INFO, "Resetting\n");
+ AOS_LOG(INFO, "Resetting\n");
stuck_indexer_detector_->mutable_X_hat() = loop_->X_hat();
should_reset_ = false;
saturated_ = false;
@@ -294,9 +294,9 @@
if (turret_position() > range_.upper_hard ||
turret_position() < range_.lower_hard) {
- LOG(ERROR,
- "ColumnProfiledSubsystem at %f out of bounds [%f, %f], ESTOPing\n",
- turret_position(), range_.lower_hard, range_.upper_hard);
+ AOS_LOG(ERROR,
+ "ColumnProfiledSubsystem at %f out of bounds [%f, %f], ESTOPing\n",
+ turret_position(), range_.lower_hard, range_.upper_hard);
return true;
}
@@ -465,7 +465,8 @@
profiled_subsystem_.goal(2, 0) -
kStuckZeroingTrackingError ||
profiled_subsystem_.saturated()) {
- LOG(INFO,
+ AOS_LOG(
+ INFO,
"Turret stuck going positive, switching directions. At %f, goal "
"%f\n",
profiled_subsystem_.turret_position(),
@@ -499,7 +500,8 @@
kStuckZeroingTrackingError ||
profiled_subsystem_.saturated()) {
// The turret got too far behind. Declare it stuck and reverse.
- LOG(INFO,
+ AOS_LOG(
+ INFO,
"Turret stuck going negative, switching directions. At %f, goal "
"%f\n",
profiled_subsystem_.turret_position(),
@@ -530,7 +532,8 @@
if (unsafe_turret_goal->track) {
if (vision_time_adjuster_.valid()) {
- LOG(INFO, "Vision aligning to %f\n", vision_time_adjuster_.goal());
+ AOS_LOG(INFO, "Vision aligning to %f\n",
+ vision_time_adjuster_.goal());
profiled_subsystem_.set_turret_unprofiled_goal(
vision_time_adjuster_.goal() + vision_error_);
}
@@ -552,7 +555,7 @@
} break;
case State::ESTOP:
- LOG(ERROR, "Estop\n");
+ AOS_LOG(ERROR, "Estop\n");
disable = true;
break;
}
@@ -574,8 +577,8 @@
indexer_state_ = IndexerState::REVERSING;
last_transition_time_ = monotonic_now;
profiled_subsystem_.PartialIndexerReset();
- LOG(INFO, "Partial indexer reset while going forwards\n");
- LOG(INFO, "Indexer RUNNING -> REVERSING\n");
+ AOS_LOG(INFO, "Partial indexer reset while going forwards\n");
+ AOS_LOG(INFO, "Indexer RUNNING -> REVERSING\n");
}
break;
case IndexerState::REVERSING:
@@ -588,12 +591,12 @@
monotonic_now > last_transition_time_ + kReverseMinTimeout) ||
monotonic_now > kReverseTimeout + last_transition_time_) {
indexer_state_ = IndexerState::RUNNING;
- LOG(INFO, "Indexer REVERSING -> RUNNING, stuck %d\n",
- profiled_subsystem_.IsIndexerStuck());
+ AOS_LOG(INFO, "Indexer REVERSING -> RUNNING, stuck %d\n",
+ profiled_subsystem_.IsIndexerStuck());
// Only reset if we got stuck going this way too.
if (monotonic_now > kReverseTimeout + last_transition_time_) {
- LOG(INFO, "Partial indexer reset while reversing\n");
+ AOS_LOG(INFO, "Partial indexer reset while reversing\n");
profiled_subsystem_.PartialIndexerReset();
}
last_transition_time_ = monotonic_now;
diff --git a/y2017/control_loops/superstructure/column/column_zeroing.cc b/y2017/control_loops/superstructure/column/column_zeroing.cc
index d5a378c..30500ca 100644
--- a/y2017/control_loops/superstructure/column/column_zeroing.cc
+++ b/y2017/control_loops/superstructure/column/column_zeroing.cc
@@ -25,7 +25,7 @@
void ColumnZeroingEstimator::TriggerError() {
if (!error_) {
- LOG(ERROR, "Manually triggered zeroing error.\n");
+ AOS_LOG(ERROR, "Manually triggered zeroing error.\n");
error_ = true;
}
}
diff --git a/y2017/control_loops/superstructure/hood/hood.cc b/y2017/control_loops/superstructure/hood/hood.cc
index 862a32c..8588a16 100644
--- a/y2017/control_loops/superstructure/hood/hood.cc
+++ b/y2017/control_loops/superstructure/hood/hood.cc
@@ -40,13 +40,13 @@
// enough to find them (and the index pulse which might be right next to
// one).
if ((*goal)(0, 0) > kMaxRange) {
- LOG(WARNING, "Goal %s above limit, %f > %f\n", name, (*goal)(0, 0),
- kMaxRange);
+ AOS_LOG(WARNING, "Goal %s above limit, %f > %f\n", name, (*goal)(0, 0),
+ kMaxRange);
(*goal)(0, 0) = kMaxRange;
}
if ((*goal)(0, 0) < -kMaxRange) {
- LOG(WARNING, "Goal %s below limit, %f < %f\n", name, (*goal)(0, 0),
- kMaxRange);
+ AOS_LOG(WARNING, "Goal %s below limit, %f < %f\n", name, (*goal)(0, 0),
+ kMaxRange);
(*goal)(0, 0) = -kMaxRange;
}
}
@@ -71,7 +71,7 @@
switch (state_) {
case State::UNINITIALIZED:
// Wait in the uninitialized state until the hood is initialized.
- LOG(DEBUG, "Uninitialized, waiting for hood\n");
+ AOS_LOG(DEBUG, "Uninitialized, waiting for hood\n");
if (profiled_subsystem_.initialized()) {
state_ = State::DISABLED_INITIALIZED;
}
@@ -163,7 +163,7 @@
} break;
case State::ESTOP:
- LOG(ERROR, "Estop\n");
+ AOS_LOG(ERROR, "Estop\n");
disable = true;
break;
}
diff --git a/y2017/control_loops/superstructure/intake/intake.cc b/y2017/control_loops/superstructure/intake/intake.cc
index 76c44a4..baa4693 100644
--- a/y2017/control_loops/superstructure/intake/intake.cc
+++ b/y2017/control_loops/superstructure/intake/intake.cc
@@ -39,7 +39,7 @@
switch (state_) {
case State::UNINITIALIZED:
// Wait in the uninitialized state until the intake is initialized.
- LOG(DEBUG, "Uninitialized, waiting for intake\n");
+ AOS_LOG(DEBUG, "Uninitialized, waiting for intake\n");
if (profiled_subsystem_.initialized()) {
state_ = State::DISABLED_INITIALIZED;
}
@@ -101,8 +101,8 @@
// Force the intake to be at least at min_position_ out.
if (profiled_subsystem_.unprofiled_goal(0, 0) < min_position_) {
- LOG(DEBUG, "Limiting intake to %f from %f\n", min_position_,
- profiled_subsystem_.unprofiled_goal(0, 0));
+ AOS_LOG(DEBUG, "Limiting intake to %f from %f\n", min_position_,
+ profiled_subsystem_.unprofiled_goal(0, 0));
profiled_subsystem_.set_unprofiled_goal(min_position_);
}
@@ -114,7 +114,7 @@
} break;
case State::ESTOP:
- LOG(ERROR, "Estop\n");
+ AOS_LOG(ERROR, "Estop\n");
disable = true;
break;
}
diff --git a/y2017/control_loops/superstructure/shooter/shooter.cc b/y2017/control_loops/superstructure/shooter/shooter.cc
index 5023e6f..2b668ae 100644
--- a/y2017/control_loops/superstructure/shooter/shooter.cc
+++ b/y2017/control_loops/superstructure/shooter/shooter.cc
@@ -145,7 +145,7 @@
} else if (!status->ready) {
min_ = ::std::min(min_, wheel_.dt_velocity());
} else if (!last_ready_ && status->ready) {
- LOG(INFO, "Shot min was [%f]\n", min_);
+ AOS_LOG(INFO, "Shot min was [%f]\n", min_);
}
if (output) {
diff --git a/y2017/control_loops/superstructure/superstructure.cc b/y2017/control_loops/superstructure/superstructure.cc
index e7f7ca8..3ad1747 100644
--- a/y2017/control_loops/superstructure/superstructure.cc
+++ b/y2017/control_loops/superstructure/superstructure.cc
@@ -58,7 +58,7 @@
const ::aos::monotonic_clock::time_point monotonic_now =
event_loop()->monotonic_now();
if (WasReset()) {
- LOG(ERROR, "WPILib reset, restarting\n");
+ AOS_LOG(ERROR, "WPILib reset, restarting\n");
hood_.Reset();
intake_.Reset();
shooter_.Reset();
@@ -96,7 +96,7 @@
if (::std::abs(robot_velocity) > 0.2) {
if (unsafe_goal->use_vision_for_shots) {
- LOG(INFO, "Moving too fast, resetting\n");
+ AOS_LOG(INFO, "Moving too fast, resetting\n");
}
distance_average_.Reset();
}
@@ -114,11 +114,12 @@
in_range = false;
}
}
- LOG(DEBUG, "VisionDistance %f, hood %f shooter %f, indexer %f * M_PI\n",
+ AOS_LOG(
+ DEBUG, "VisionDistance %f, hood %f shooter %f, indexer %f * M_PI\n",
status->vision_distance, hood_goal.angle,
shooter_goal.angular_velocity, indexer_goal.angular_velocity / M_PI);
} else {
- LOG(DEBUG, "VisionNotValid %f\n", status->vision_distance);
+ AOS_LOG(DEBUG, "VisionNotValid %f\n", status->vision_distance);
if (unsafe_goal->use_vision_for_shots) {
in_range = false;
indexer_goal.angular_velocity = 0.0;
@@ -174,7 +175,7 @@
// Make some noise if someone left this set...
if (ignore_collisions_) {
- LOG(ERROR, "Collisions ignored\n");
+ AOS_LOG(ERROR, "Collisions ignored\n");
}
intake_.Iterate(unsafe_goal != nullptr ? &(unsafe_goal->intake) : nullptr,
diff --git a/y2017/control_loops/superstructure/superstructure_lib_test.cc b/y2017/control_loops/superstructure/superstructure_lib_test.cc
index d1cb15f..1e763b8 100644
--- a/y2017/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2017/control_loops/superstructure/superstructure_lib_test.cc
@@ -308,18 +308,18 @@
? superstructure::intake::Intake::kOperatingVoltage
: superstructure::intake::Intake::kZeroingVoltage;
- CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_hood),
- voltage_check_hood);
+ AOS_CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_hood),
+ voltage_check_hood);
- CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_intake),
- voltage_check_intake);
+ AOS_CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_intake),
+ voltage_check_intake);
EXPECT_LE(::std::abs(superstructure_output_fetcher_->voltage_indexer),
voltage_check_indexer)
<< ": check voltage " << voltage_check_indexer;
- CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_turret),
- voltage_check_turret);
+ AOS_CHECK_LE(::std::abs(superstructure_output_fetcher_->voltage_turret),
+ voltage_check_turret);
::Eigen::Matrix<double, 1, 1> hood_U;
hood_U << superstructure_output_fetcher_->voltage_hood +
@@ -375,15 +375,15 @@
// The hood is special. We don't want to fault when we hit the hard stop.
// We want to freeze the hood at the hard stop.
if (angle_hood > constants::Values::kHoodRange.upper_hard) {
- LOG(INFO, "At the hood upper hard stop of %f\n",
- constants::Values::kHoodRange.upper_hard);
+ AOS_LOG(INFO, "At the hood upper hard stop of %f\n",
+ constants::Values::kHoodRange.upper_hard);
angle_hood = constants::Values::kHoodRange.upper_hard;
hood_plant_->mutable_X(0, 0) = angle_hood;
hood_plant_->mutable_X(1, 0) = 0.0;
hood_plant_->UpdateY(hood_U);
} else if (angle_hood < constants::Values::kHoodRange.lower_hard) {
- LOG(INFO, "At the hood lower hard stop of %f\n",
- constants::Values::kHoodRange.lower_hard);
+ AOS_LOG(INFO, "At the hood lower hard stop of %f\n",
+ constants::Values::kHoodRange.lower_hard);
angle_hood = constants::Values::kHoodRange.lower_hard;
hood_plant_->mutable_X(0, 0) = angle_hood;
hood_plant_->mutable_X(1, 0) = 0.0;
@@ -397,16 +397,16 @@
// The expected zeroing procedure involves yanking on the wires for the
// turret in some cases. So, implement the hard stop like the hood.
if (angle_turret > constants::Values::kTurretRange.upper_hard) {
- LOG(INFO, "At the turret upper hard stop of %f\n",
- constants::Values::kTurretRange.upper_hard);
+ AOS_LOG(INFO, "At the turret upper hard stop of %f\n",
+ constants::Values::kTurretRange.upper_hard);
angle_turret = constants::Values::kTurretRange.upper_hard;
column_plant_->mutable_X(2, 0) = angle_turret;
column_plant_->mutable_X(3, 0) = 0.0;
column_plant_->UpdateY(column_U);
} else if (angle_turret < constants::Values::kTurretRange.lower_hard) {
- LOG(INFO, "At the turret lower hard stop of %f\n",
- constants::Values::kTurretRange.lower_hard);
+ AOS_LOG(INFO, "At the turret lower hard stop of %f\n",
+ constants::Values::kTurretRange.lower_hard);
angle_turret = constants::Values::kTurretRange.lower_hard;
column_plant_->mutable_X(2, 0) = angle_turret;
column_plant_->mutable_X(3, 0) = 0.0;
@@ -1190,9 +1190,9 @@
chrono::milliseconds(1050));
EXPECT_TRUE(unstuck_detection_time - unstuck_start_time >
chrono::milliseconds(400));
- LOG(INFO, "Unstuck time is %" PRId64 "ms",
- static_cast<int64_t>(
- (unstuck_detection_time - unstuck_start_time).count() / 1000000));
+ AOS_LOG(INFO, "Unstuck time is %" PRId64 "ms",
+ static_cast<int64_t>(
+ (unstuck_detection_time - unstuck_start_time).count() / 1000000));
// Now, make sure it transitions to stuck again after a delay.
const auto restuck_start_time = monotonic_now();
diff --git a/y2017/control_loops/superstructure/vision_time_adjuster.cc b/y2017/control_loops/superstructure/vision_time_adjuster.cc
index 4952f6d..a67c5f2 100644
--- a/y2017/control_loops/superstructure/vision_time_adjuster.cc
+++ b/y2017/control_loops/superstructure/vision_time_adjuster.cc
@@ -140,9 +140,9 @@
&drivetrain_angle);
if (column_angle_is_valid && drivetrain_angle_is_valid) {
- LOG(INFO, "Accepting Vision angle of %f, age %f\n",
- most_recent_vision_angle_,
- ::aos::time::DurationInSeconds(monotonic_now - last_target_time));
+ AOS_LOG(INFO, "Accepting Vision angle of %f, age %f\n",
+ most_recent_vision_angle_,
+ ::aos::time::DurationInSeconds(monotonic_now - last_target_time));
most_recent_vision_reading_ = vision_status->angle;
most_recent_vision_angle_ =
vision_status->angle + column_angle + drivetrain_angle;
@@ -151,8 +151,8 @@
}
goal_ = most_recent_vision_angle_ - most_recent_drivetrain_angle_;
- LOG(DEBUG, "Vision angle %f drivetrain %f\n", most_recent_vision_angle_,
- most_recent_drivetrain_angle_);
+ AOS_LOG(DEBUG, "Vision angle %f drivetrain %f\n", most_recent_vision_angle_,
+ most_recent_drivetrain_angle_);
// Now, update the vision valid flag to tell us if we have a valid vision
// angle within the last seven seconds.