Nest all namespaces

The compiler supports this now.  We can type less going forward.
No functional changes.

Signed-off-by: Stephan Pleines <pleines.stephan@gmail.com>
Change-Id: I29d6fa4f9aacc0e381f1a7637294db0392466995
diff --git a/y2023/autonomous/auto_splines.cc b/y2023/autonomous/auto_splines.cc
index aa6497c..3607627 100644
--- a/y2023/autonomous/auto_splines.cc
+++ b/y2023/autonomous/auto_splines.cc
@@ -3,8 +3,7 @@
 #include "aos/flatbuffer_merge.h"
 #include "frc971/control_loops/control_loops_generated.h"
 
-namespace y2023 {
-namespace autonomous {
+namespace y2023::autonomous {
 
 namespace {
 flatbuffers::Offset<frc971::MultiSpline> FixSpline(
@@ -202,5 +201,4 @@
   return FixSpline(builder, multispline_builder.Finish(), alliance);
 }
 
-}  // namespace autonomous
-}  // namespace y2023
+}  // namespace y2023::autonomous
diff --git a/y2023/autonomous/autonomous_actor.cc b/y2023/autonomous/autonomous_actor.cc
index e452d21..652fe66 100644
--- a/y2023/autonomous/autonomous_actor.cc
+++ b/y2023/autonomous/autonomous_actor.cc
@@ -17,8 +17,7 @@
 DEFINE_bool(charged_up_cable, false, "If true run cable side autonomous mode");
 DEFINE_bool(do_balance, true, "If true run the balance.");
 
-namespace y2023 {
-namespace autonomous {
+namespace y2023::autonomous {
 
 using ::frc971::ProfileParametersT;
 
@@ -629,5 +628,4 @@
   return true;
 }
 
-}  // namespace autonomous
-}  // namespace y2023
+}  // namespace y2023::autonomous
diff --git a/y2023/constants.cc b/y2023/constants.cc
index 6b63cda..0154453 100644
--- a/y2023/constants.cc
+++ b/y2023/constants.cc
@@ -15,8 +15,7 @@
 #include "y2023/control_loops/superstructure/roll/integral_roll_plant.h"
 #include "y2023/control_loops/superstructure/wrist/integral_wrist_plant.h"
 
-namespace y2023 {
-namespace constants {
+namespace y2023::constants {
 
 Values MakeValues(uint16_t team) {
   LOG(INFO) << "creating a Constants for team: " << team;
@@ -179,5 +178,4 @@
 
 Values MakeValues() { return MakeValues(aos::network::GetTeamNumber()); }
 
-}  // namespace constants
-}  // namespace y2023
+}  // namespace y2023::constants
diff --git a/y2023/control_loops/drivetrain/drivetrain_base.cc b/y2023/control_loops/drivetrain/drivetrain_base.cc
index a11a896..63e7904 100644
--- a/y2023/control_loops/drivetrain/drivetrain_base.cc
+++ b/y2023/control_loops/drivetrain/drivetrain_base.cc
@@ -15,9 +15,7 @@
 
 namespace chrono = ::std::chrono;
 
-namespace y2023 {
-namespace control_loops {
-namespace drivetrain {
+namespace y2023::control_loops::drivetrain {
 
 using ::frc971::constants::ShifterHallEffect;
 
@@ -85,6 +83,4 @@
   return kDrivetrainConfig;
 };
 
-}  // namespace drivetrain
-}  // namespace control_loops
-}  // namespace y2023
+}  // namespace y2023::control_loops::drivetrain
diff --git a/y2023/control_loops/superstructure/arm/arm.cc b/y2023/control_loops/superstructure/arm/arm.cc
index 7144e57..51efc55 100644
--- a/y2023/control_loops/superstructure/arm/arm.cc
+++ b/y2023/control_loops/superstructure/arm/arm.cc
@@ -3,10 +3,7 @@
 #include "y2023/control_loops/superstructure/roll/integral_hybrid_roll_plant.h"
 #include "y2023/control_loops/superstructure/roll/integral_roll_plant.h"
 
-namespace y2023 {
-namespace control_loops {
-namespace superstructure {
-namespace arm {
+namespace y2023::control_loops::superstructure::arm {
 namespace {
 
 namespace chrono = ::std::chrono;
@@ -359,7 +356,4 @@
   return status_builder.Finish();
 }
 
-}  // namespace arm
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2023
+}  // namespace y2023::control_loops::superstructure::arm
diff --git a/y2023/control_loops/superstructure/arm/arm_design.cc b/y2023/control_loops/superstructure/arm/arm_design.cc
index 99ffa2c..e918746 100644
--- a/y2023/control_loops/superstructure/arm/arm_design.cc
+++ b/y2023/control_loops/superstructure/arm/arm_design.cc
@@ -17,10 +17,7 @@
 DEFINE_double(goal0, 0.0, "goal position on proximal");
 DEFINE_double(goal1, 0.0, "goal position on distal");
 
-namespace y2023 {
-namespace control_loops {
-namespace superstructure {
-namespace arm {
+namespace y2023::control_loops::superstructure::arm {
 
 int Main() {
   frc971::analysis::Plotter plotter;
@@ -182,10 +179,7 @@
   return 0;
 }
 
-}  // namespace arm
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2023
+}  // namespace y2023::control_loops::superstructure::arm
 
 int main(int argc, char **argv) {
   ::aos::InitGoogle(&argc, &argv);
diff --git a/y2023/control_loops/superstructure/arm/trajectory.cc b/y2023/control_loops/superstructure/arm/trajectory.cc
index cbdfee8..be339e4 100644
--- a/y2023/control_loops/superstructure/arm/trajectory.cc
+++ b/y2023/control_loops/superstructure/arm/trajectory.cc
@@ -15,10 +15,7 @@
 DEFINE_double(lqr_distal_pos, 0.5, "Position LQR gain");
 DEFINE_double(lqr_distal_vel, 5, "Velocity LQR gain");
 
-namespace y2023 {
-namespace control_loops {
-namespace superstructure {
-namespace arm {
+namespace y2023::control_loops::superstructure::arm {
 
 ::Eigen::Matrix<double, 3, 1> CosSpline::Theta(double alpha) const {
   ::Eigen::Matrix<double, 3, 1> result;
@@ -1005,7 +1002,4 @@
   omega_ = trajectory_->OmegaT(goal_(0), goal_(1));
 }
 
-}  // namespace arm
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2023
+}  // namespace y2023::control_loops::superstructure::arm
diff --git a/y2023/control_loops/superstructure/arm/trajectory_plot.cc b/y2023/control_loops/superstructure/arm/trajectory_plot.cc
index 16c8771..4db5080 100644
--- a/y2023/control_loops/superstructure/arm/trajectory_plot.cc
+++ b/y2023/control_loops/superstructure/arm/trajectory_plot.cc
@@ -23,10 +23,7 @@
 DEFINE_double(vmax_battery, 12.0, "Max battery voltage.");
 DEFINE_double(time, 2.0, "Simulation time.");
 
-namespace y2023 {
-namespace control_loops {
-namespace superstructure {
-namespace arm {
+namespace y2023::control_loops::superstructure::arm {
 using frc971::control_loops::MatrixGaussianQuadrature5;
 
 void Main() {
@@ -545,10 +542,7 @@
   }
 }
 
-}  // namespace arm
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2023
+}  // namespace y2023::control_loops::superstructure::arm
 
 int main(int argc, char **argv) {
   ::aos::InitGoogle(&argc, &argv);
diff --git a/y2023/control_loops/superstructure/arm/trajectory_test.cc b/y2023/control_loops/superstructure/arm/trajectory_test.cc
index 8af7ba7..666a702 100644
--- a/y2023/control_loops/superstructure/arm/trajectory_test.cc
+++ b/y2023/control_loops/superstructure/arm/trajectory_test.cc
@@ -8,11 +8,7 @@
 #include "y2023/control_loops/superstructure/roll/integral_hybrid_roll_plant.h"
 #include "y2023/control_loops/superstructure/roll/integral_roll_plant.h"
 
-namespace y2023 {
-namespace control_loops {
-namespace superstructure {
-namespace arm {
-namespace testing {
+namespace y2023::control_loops::superstructure::arm::testing {
 
 using frc971::control_loops::MatrixGaussianQuadrature5;
 using frc971::control_loops::arm::Dynamics;
@@ -226,8 +222,4 @@
       final_theta_t.isApprox(trajectory.path().Theta(follower.goal(0))));
 }
 
-}  // namespace testing
-}  // namespace arm
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2023
+}  // namespace y2023::control_loops::superstructure::arm::testing
diff --git a/y2023/control_loops/superstructure/end_effector.cc b/y2023/control_loops/superstructure/end_effector.cc
index 43f3d24..2f01128 100644
--- a/y2023/control_loops/superstructure/end_effector.cc
+++ b/y2023/control_loops/superstructure/end_effector.cc
@@ -5,9 +5,7 @@
 #include "frc971/control_loops/control_loop.h"
 #include "y2023/vision/game_pieces_generated.h"
 
-namespace y2023 {
-namespace control_loops {
-namespace superstructure {
+namespace y2023::control_loops::superstructure {
 
 using ::aos::monotonic_clock;
 
@@ -147,6 +145,4 @@
 
 void EndEffector::Reset() { state_ = EndEffectorState::IDLE; }
 
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2023
+}  // namespace y2023::control_loops::superstructure
diff --git a/y2023/control_loops/superstructure/superstructure.cc b/y2023/control_loops/superstructure/superstructure.cc
index 4919cd6..e11092a 100644
--- a/y2023/control_loops/superstructure/superstructure.cc
+++ b/y2023/control_loops/superstructure/superstructure.cc
@@ -10,9 +10,7 @@
 DEFINE_bool(ignore_distance, false,
             "If true, ignore distance when shooting and obay joystick_reader");
 
-namespace y2023 {
-namespace control_loops {
-namespace superstructure {
+namespace y2023::control_loops::superstructure {
 
 using ::aos::monotonic_clock;
 
@@ -148,6 +146,4 @@
                                               y2);
 }
 
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2023
+}  // namespace y2023::control_loops::superstructure
diff --git a/y2023/control_loops/superstructure/superstructure_lib_test.cc b/y2023/control_loops/superstructure/superstructure_lib_test.cc
index 926846e..d4fa653 100644
--- a/y2023/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2023/control_loops/superstructure/superstructure_lib_test.cc
@@ -18,10 +18,7 @@
 DEFINE_string(output_folder, "",
               "If set, logs all channels to the provided logfile.");
 
-namespace y2023 {
-namespace control_loops {
-namespace superstructure {
-namespace testing {
+namespace y2023::control_loops::superstructure::testing {
 namespace {
 constexpr double kNoiseScalar = 0.01;
 }  // namespace
@@ -926,7 +923,4 @@
 INSTANTIATE_TEST_SUITE_P(EndEffectorGoal, SuperstructureBeambreakTest,
                          ::testing::Values(vision::Class::CUBE));
 
-}  // namespace testing
-}  // namespace superstructure
-}  // namespace control_loops
-}  // namespace y2023
+}  // namespace y2023::control_loops::superstructure::testing
diff --git a/y2023/joystick_reader.cc b/y2023/joystick_reader.cc
index f4d9ea6..45418bc 100644
--- a/y2023/joystick_reader.cc
+++ b/y2023/joystick_reader.cc
@@ -39,9 +39,7 @@
 using y2023::control_loops::superstructure::RollerGoal;
 using Side = frc971::control_loops::drivetrain::RobotSide;
 
-namespace y2023 {
-namespace input {
-namespace joysticks {
+namespace y2023::input::joysticks {
 
 constexpr double kConeWrist = 0.4;
 constexpr double kCubeWrist = 1.0;
@@ -562,9 +560,7 @@
   const ArmSetpoint *current_setpoint_ = nullptr;
 };
 
-}  // namespace joysticks
-}  // namespace input
-}  // namespace y2023
+}  // namespace y2023::input::joysticks
 
 int main(int argc, char **argv) {
   ::aos::InitGoogle(&argc, &argv);
diff --git a/y2023/tof_controller/tof_controller.cc b/y2023/tof_controller/tof_controller.cc
index f8e8fb9..80102ae 100644
--- a/y2023/tof_controller/tof_controller.cc
+++ b/y2023/tof_controller/tof_controller.cc
@@ -13,8 +13,7 @@
 #include "pico/bootrom.h"
 #include "pico/stdlib.h"
 
-namespace y2023 {
-namespace tof_controller {
+namespace y2023::tof_controller {
 
 static constexpr uint kI2CBaudrate = 100000;
 static constexpr uint16_t kExpectedSensorId = 0xEBAA;
@@ -500,7 +499,6 @@
   }
 }
 
-}  // namespace tof_controller
-}  // namespace y2023
+}  // namespace y2023::tof_controller
 
 int main() { y2023::tof_controller::main(); }
diff --git a/y2023/vision/april_generator.cc b/y2023/vision/april_generator.cc
index 4ac389a..3746474 100644
--- a/y2023/vision/april_generator.cc
+++ b/y2023/vision/april_generator.cc
@@ -14,8 +14,7 @@
 // https://halide-lang.org/tutorials/tutorial_lesson_15_generators.html has an
 // introduction to much of the magic in this file.
 
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
 namespace {
 
 // Returns a function implementating a 1-dimensional gaussian blur convolution.
@@ -147,8 +146,7 @@
   }
 };
 
-}  // namespace vision
-}  // namespace frc971
+}  // namespace frc971::vision
 
 // TODO(austin): Combine the functions and optimize for device/host and all that
 // jazz.
diff --git a/y2023/vision/aprilrobotics.cc b/y2023/vision/aprilrobotics.cc
index f2e2592..0605eb2 100644
--- a/y2023/vision/aprilrobotics.cc
+++ b/y2023/vision/aprilrobotics.cc
@@ -20,8 +20,7 @@
 DEFINE_uint64(pose_estimation_iterations, 50,
               "Number of iterations for apriltag pose estimation.");
 
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
 
 namespace chrono = std::chrono;
 
@@ -374,5 +373,4 @@
   return {.detections = results, .rejections = rejections_};
 }
 
-}  // namespace vision
-}  // namespace y2023
+}  // namespace y2023::vision
diff --git a/y2023/vision/calibrate_extrinsics.cc b/y2023/vision/calibrate_extrinsics.cc
index 91bdefd..f0a0d71 100644
--- a/y2023/vision/calibrate_extrinsics.cc
+++ b/y2023/vision/calibrate_extrinsics.cc
@@ -31,8 +31,7 @@
               "Output json file to use for the resulting calibration "
               "(intrinsics and extrinsics).");
 
-namespace frc971 {
-namespace vision {
+namespace frc971::vision {
 namespace chrono = std::chrono;
 using aos::distributed_clock;
 using aos::monotonic_clock;
@@ -306,8 +305,7 @@
   }
 }  // namespace vision
 
-}  // namespace vision
-}  // namespace frc971
+}  // namespace frc971::vision
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
diff --git a/y2023/vision/calibrate_multi_cameras.cc b/y2023/vision/calibrate_multi_cameras.cc
index d3cfa6f..48dffb9 100644
--- a/y2023/vision/calibrate_multi_cameras.cc
+++ b/y2023/vision/calibrate_multi_cameras.cc
@@ -67,8 +67,7 @@
 // estimation, and probably also include camera->imu extrinsics from all
 // cameras, not just pi1
 
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
 using frc971::vision::DataAdapter;
 using frc971::vision::ImageCallback;
 using frc971::vision::PoseUtils;
@@ -699,8 +698,7 @@
     delete image_callbacks[i];
   }
 }
-}  // namespace vision
-}  // namespace y2023
+}  // namespace y2023::vision
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
diff --git a/y2023/vision/camera_reader.cc b/y2023/vision/camera_reader.cc
index d5f39a0..abffac0 100644
--- a/y2023/vision/camera_reader.cc
+++ b/y2023/vision/camera_reader.cc
@@ -22,8 +22,7 @@
 DEFINE_bool(send_downsized_images, false,
             "Whether to send downsized image for driver cam streaming.");
 
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
 namespace {
 
 using namespace frc971::vision;
@@ -202,8 +201,7 @@
 }
 
 }  // namespace
-}  // namespace vision
-}  // namespace y2023
+}  // namespace y2023::vision
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
diff --git a/y2023/vision/ccm.cc b/y2023/vision/ccm.cc
index 7f35ae5..d32cc2f 100644
--- a/y2023/vision/ccm.cc
+++ b/y2023/vision/ccm.cc
@@ -8,8 +8,7 @@
 #include "aos/init.h"
 #include "aos/time/time.h"
 
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
 namespace {
 
 // Adapted from the opencv example code for color calibration.
@@ -73,8 +72,7 @@
 }
 
 }  // namespace
-}  // namespace vision
-}  // namespace y2023
+}  // namespace y2023::vision
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
diff --git a/y2023/vision/game_pieces.cc b/y2023/vision/game_pieces.cc
index 8a0621d..68ff160 100644
--- a/y2023/vision/game_pieces.cc
+++ b/y2023/vision/game_pieces.cc
@@ -7,8 +7,7 @@
 #include "frc971/vision/vision_generated.h"
 #include "y2023/vision/yolov5.h"
 
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
 using aos::monotonic_clock;
 GamePiecesDetector::GamePiecesDetector(aos::EventLoop *event_loop)
     : game_pieces_sender_(event_loop->MakeSender<GamePieces>("/camera")) {
@@ -73,5 +72,4 @@
   builder.CheckOk(builder.Send(game_pieces_builder.Finish()));
 }
 
-}  // namespace vision
-}  // namespace y2023
+}  // namespace y2023::vision
diff --git a/y2023/vision/game_pieces_main.cc b/y2023/vision/game_pieces_main.cc
index 97940b6..b4ceff5 100644
--- a/y2023/vision/game_pieces_main.cc
+++ b/y2023/vision/game_pieces_main.cc
@@ -4,8 +4,7 @@
 
 DEFINE_string(config, "aos_config.json", "Path to the config file to use.");
 
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
 namespace {
 
 void GamePiecesDetectorMain() {
@@ -16,8 +15,7 @@
   event_loop.Run();
 }
 }  // namespace
-}  // namespace vision
-}  // namespace y2023
+}  // namespace y2023::vision
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
diff --git a/y2023/vision/target_mapping.cc b/y2023/vision/target_mapping.cc
index 83705b9..af4c36c 100644
--- a/y2023/vision/target_mapping.cc
+++ b/y2023/vision/target_mapping.cc
@@ -58,8 +58,7 @@
 DECLARE_int32(max_target_id);
 DECLARE_bool(visualize_solver);
 
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
 using frc971::vision::DataAdapter;
 using frc971::vision::ImageCallback;
 using frc971::vision::PoseUtils;
@@ -430,8 +429,7 @@
   mapper_replay.MaybeSolve();
 }
 
-}  // namespace vision
-}  // namespace y2023
+}  // namespace y2023::vision
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
diff --git a/y2023/vision/viewer.cc b/y2023/vision/viewer.cc
index e03680c..78731e5 100644
--- a/y2023/vision/viewer.cc
+++ b/y2023/vision/viewer.cc
@@ -18,8 +18,7 @@
 DEFINE_int32(rate, 100, "Time in milliseconds to wait between images");
 DEFINE_double(scale, 1.0, "Scale factor for images being displayed");
 
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
 namespace {
 
 using frc971::vision::CameraImage;
@@ -108,8 +107,7 @@
 }
 
 }  // namespace
-}  // namespace vision
-}  // namespace y2023
+}  // namespace y2023::vision
 
 int main(int argc, char **argv) {
   aos::InitGoogle(&argc, &argv);
diff --git a/y2023/vision/yolov5.cc b/y2023/vision/yolov5.cc
index ba2a9f7..e62b106 100644
--- a/y2023/vision/yolov5.cc
+++ b/y2023/vision/yolov5.cc
@@ -30,8 +30,7 @@
 
 DEFINE_bool(visualize_detections, false, "Display inference output");
 
-namespace y2023 {
-namespace vision {
+namespace y2023::vision {
 
 class YOLOV5Impl : public YOLOV5 {
  public:
@@ -303,5 +302,4 @@
   return filtered_detections;
 };
 
-}  // namespace vision
-}  // namespace y2023
+}  // namespace y2023::vision
diff --git a/y2023/wpilib_interface.cc b/y2023/wpilib_interface.cc
index 3bf6027..8438281 100644
--- a/y2023/wpilib_interface.cc
+++ b/y2023/wpilib_interface.cc
@@ -72,8 +72,7 @@
 namespace chrono = ::std::chrono;
 using std::make_unique;
 
-namespace y2023 {
-namespace wpilib {
+namespace y2023::wpilib {
 namespace {
 
 constexpr double kMaxBringupPower = 12.0;
@@ -1058,7 +1057,6 @@
   }
 };
 
-}  // namespace wpilib
-}  // namespace y2023
+}  // namespace y2023::wpilib
 
 AOS_ROBOT_CLASS(::y2023::wpilib::WPILibRobot);