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/aos/controls/control_loop-tmpl.h b/aos/controls/control_loop-tmpl.h
index 4f48737..7628c26 100644
--- a/aos/controls/control_loop-tmpl.h
+++ b/aos/controls/control_loop-tmpl.h
@@ -28,26 +28,26 @@
no_sensor_state_.Print();
motors_off_log_.Print();
- LOG_STRUCT(DEBUG, "position", position);
+ AOS_LOG_STRUCT(DEBUG, "position", position);
// Fetch the latest control loop goal. If there is no new
// goal, we will just reuse the old one.
goal_fetcher_.Fetch();
const GoalType *goal = goal_fetcher_.get();
if (goal) {
- LOG_STRUCT(DEBUG, "goal", *goal);
+ AOS_LOG_STRUCT(DEBUG, "goal", *goal);
} else {
- LOG_INTERVAL(no_goal_);
+ AOS_LOG_INTERVAL(no_goal_);
}
const bool new_robot_state = robot_state_fetcher_.Fetch();
if (!robot_state_fetcher_.get()) {
- LOG_INTERVAL(no_sensor_state_);
+ AOS_LOG_INTERVAL(no_sensor_state_);
return;
}
if (sensor_reader_pid_ != robot_state_fetcher_->reader_pid) {
- LOG(INFO, "new sensor reader PID %" PRId32 ", old was %" PRId32 "\n",
- robot_state_fetcher_->reader_pid, sensor_reader_pid_);
+ AOS_LOG(INFO, "new sensor reader PID %" PRId32 ", old was %" PRId32 "\n",
+ robot_state_fetcher_->reader_pid, sensor_reader_pid_);
reset_ = true;
sensor_reader_pid_ = robot_state_fetcher_->reader_pid;
}
@@ -70,7 +70,7 @@
joystick_state_fetcher_.Fetch();
if (motors_off) {
if (joystick_state_fetcher_.get() && joystick_state_fetcher_->enabled) {
- LOG_INTERVAL(motors_off_log_);
+ AOS_LOG_INTERVAL(motors_off_log_);
}
outputs_enabled = false;
}
@@ -87,7 +87,7 @@
RunIteration(goal, &position, output.get(), status.get());
output->SetTimeToNow();
- LOG_STRUCT(DEBUG, "output", *output);
+ AOS_LOG_STRUCT(DEBUG, "output", *output);
output.Send();
} else {
// The outputs are disabled, so pass nullptr in for the output.
@@ -96,7 +96,7 @@
}
status->SetTimeToNow();
- LOG_STRUCT(DEBUG, "status", *status);
+ AOS_LOG_STRUCT(DEBUG, "status", *status);
status.Send();
}
diff --git a/aos/controls/control_loop_test.h b/aos/controls/control_loop_test.h
index 85d610e..ff11987 100644
--- a/aos/controls/control_loop_test.h
+++ b/aos/controls/control_loop_test.h
@@ -98,7 +98,7 @@
new_state->autonomous = false;
new_state->team_id = team_id_;
- LOG_STRUCT(INFO, "joystick_state", *new_state);
+ AOS_LOG_STRUCT(INFO, "joystick_state", *new_state);
new_state.Send();
last_ds_time_ = monotonic_now();
@@ -123,7 +123,7 @@
new_state->voltage_roborio_in = battery_voltage_;
new_state->voltage_battery = battery_voltage_;
- LOG_STRUCT(INFO, "robot_state", *new_state);
+ AOS_LOG_STRUCT(INFO, "robot_state", *new_state);
new_state.Send();
}
diff --git a/aos/controls/polytope.h b/aos/controls/polytope.h
index 145b904..5248ea3 100644
--- a/aos/controls/polytope.h
+++ b/aos/controls/polytope.h
@@ -191,9 +191,9 @@
if (error != dd_NoError || polyhedra == NULL) {
dd_WriteErrorMessages(stderr, error);
dd_FreeMatrix(matrix);
- LOG_MATRIX(ERROR, "bad H", H);
- LOG_MATRIX(ERROR, "bad k_", k);
- LOG(FATAL, "dd_DDMatrix2Poly failed\n");
+ AOS_LOG_MATRIX(ERROR, "bad H", H);
+ AOS_LOG_MATRIX(ERROR, "bad k_", k);
+ AOS_LOG(FATAL, "dd_DDMatrix2Poly failed\n");
}
dd_MatrixPtr vertex_matrix = dd_CopyGenerators(polyhedra);
@@ -209,7 +209,7 @@
}
// Rays are unsupported right now. This may change in the future.
- CHECK_EQ(0, num_rays);
+ AOS_CHECK_EQ(0, num_rays);
Eigen::Matrix<double, number_of_dimensions, Eigen::Dynamic> vertices(
number_of_dimensions, num_vertices);
diff --git a/aos/controls/replay_control_loop.h b/aos/controls/replay_control_loop.h
index 1626c0a..23593ab 100644
--- a/aos/controls/replay_control_loop.h
+++ b/aos/controls/replay_control_loop.h
@@ -74,7 +74,7 @@
CaptureMessage() {}
void operator()(const S &message) {
- CHECK(!have_new_message_);
+ AOS_CHECK(!have_new_message_);
saved_message_ = message;
have_new_message_ = true;
}
@@ -118,14 +118,14 @@
fd = open(filename, O_RDONLY);
}
if (fd == -1) {
- PLOG(FATAL, "couldn't open file '%s' for reading", filename);
+ AOS_PLOG(FATAL, "couldn't open file '%s' for reading", filename);
}
replayer_.OpenFile(fd);
DoProcessFile();
replayer_.CloseCurrentFile();
- PCHECK(close(fd));
+ AOS_PCHECK(close(fd));
}
template <class T>
@@ -140,7 +140,7 @@
// Send out the position message (after adjusting the time offset) so the
// loop will run right now.
if (!position_.have_new_message()) {
- LOG(WARNING, "don't have a new position this cycle -> skipping\n");
+ AOS_LOG(WARNING, "don't have a new position this cycle -> skipping\n");
status_.clear_new_message();
position_.clear_new_message();
output_.clear_new_message();
@@ -150,7 +150,7 @@
{
auto position_message = loop_group_->position.MakeMessage();
*position_message = position_.saved_message();
- CHECK(position_message.Send());
+ AOS_CHECK(position_message.Send());
}
position_.clear_new_message();
@@ -159,8 +159,8 @@
// Point out if the status is different.
if (!loop_group_->status->EqualsNoTime(status_.saved_message())) {
- LOG_STRUCT(WARNING, "expected status", status_.saved_message());
- LOG_STRUCT(WARNING, "got status", *loop_group_->status);
+ AOS_LOG_STRUCT(WARNING, "expected status", status_.saved_message());
+ AOS_LOG_STRUCT(WARNING, "got status", *loop_group_->status);
}
status_.clear_new_message();
@@ -169,17 +169,17 @@
bool loop_new_output = loop_group_->output.FetchLatest();
if (output_.have_new_message()) {
if (!loop_new_output) {
- LOG_STRUCT(WARNING, "no output, expected", output_.saved_message());
+ AOS_LOG_STRUCT(WARNING, "no output, expected", output_.saved_message());
} else if (!loop_group_->output->EqualsNoTime(output_.saved_message())) {
- LOG_STRUCT(WARNING, "expected output", output_.saved_message());
- LOG_STRUCT(WARNING, "got output", *loop_group_->output);
+ AOS_LOG_STRUCT(WARNING, "expected output", output_.saved_message());
+ AOS_LOG_STRUCT(WARNING, "got output", *loop_group_->output);
}
} else if (loop_new_output) {
if (zero_output_.have_new_message()) {
if (!loop_group_->output->EqualsNoTime(zero_output_.saved_message())) {
- LOG_STRUCT(WARNING, "expected null output",
- zero_output_.saved_message());
- LOG_STRUCT(WARNING, "got output", *loop_group_->output);
+ AOS_LOG_STRUCT(WARNING, "expected null output",
+ zero_output_.saved_message());
+ AOS_LOG_STRUCT(WARNING, "got output", *loop_group_->output);
}
} else {
zero_output_(*loop_group_->output);