From c842a216ea5baad32ba0748ef60f9eed8212519b Mon Sep 17 00:00:00 2001 From: suhas Date: Sat, 9 Nov 2024 00:03:54 +0000 Subject: [PATCH] fix errors --- .../agitator/agitator_subsystem.cpp | 8 +- .../odometry/odometry_subsystem.cpp | 2 +- .../odometry/odometry_subsystem.hpp | 78 +++++++++---------- 3 files changed, 43 insertions(+), 45 deletions(-) diff --git a/ut-robomaster/src/subsystems/agitator/agitator_subsystem.cpp b/ut-robomaster/src/subsystems/agitator/agitator_subsystem.cpp index 23c52ad1..2567ddf6 100644 --- a/ut-robomaster/src/subsystems/agitator/agitator_subsystem.cpp +++ b/ut-robomaster/src/subsystems/agitator/agitator_subsystem.cpp @@ -50,9 +50,9 @@ void AgitatorSubsystem::refresh() return; #endif - setAmputated(!hardwareOk()) + setAmputated(!hardwareOk()); - float time = getTimeMilliseconds() / 1000.0f; + float time = getTimeMilliseconds() / 1000.0f; float velocity = getShapedVelocity(time, 1.0f, 0.0f, ballsPerSecond); bool killSwitch = drivers->isKillSwitched() || !flywheel->isActive() || isAmputated(); @@ -78,9 +78,9 @@ float AgitatorSubsystem::getVelocity() { return agitator.measureVelocity(); } bool AgitatorSubsystem::hardwareOk() { #ifdef TARGET_HERO - return flywheel.hardwareOk() && agitator.isOnline() && feeder.isOnline() + return flywheel->hardwareOk() && agitator.isOnline() && feeder.isOnline(); #else - return flywheel.hardwareOk() && agitator.isOnline() + return flywheel->hardwareOk() && agitator.isOnline(); #endif } diff --git a/ut-robomaster/src/subsystems/odometry/odometry_subsystem.cpp b/ut-robomaster/src/subsystems/odometry/odometry_subsystem.cpp index ec456b66..a628ec7c 100644 --- a/ut-robomaster/src/subsystems/odometry/odometry_subsystem.cpp +++ b/ut-robomaster/src/subsystems/odometry/odometry_subsystem.cpp @@ -28,7 +28,7 @@ void OdometrySubsystem::refresh() } } -bool OdometrySubsystem::hardwareOk() { return chassis.hardwareOk() && turret.hardwareOk(); } +bool OdometrySubsystem::hardwareOk() { return chassis->hardwareOk() && turret->hardwareOk(); } Vector2f OdometrySubsystem::getPosition() { diff --git a/ut-robomaster/src/subsystems/odometry/odometry_subsystem.hpp b/ut-robomaster/src/subsystems/odometry/odometry_subsystem.hpp index 7a156a6b..f7f1dd29 100644 --- a/ut-robomaster/src/subsystems/odometry/odometry_subsystem.hpp +++ b/ut-robomaster/src/subsystems/odometry/odometry_subsystem.hpp @@ -15,44 +15,42 @@ #include "utils/robot_comms.hpp" #include "drivers.hpp" +namespace subsystems { - namespace odometry - { - - using chassis::ChassisSubsystem; - using tap::algorithms::odometry::Odometry2DTracker; - using turret::TurretSubsystem; - - class OdometrySubsystem : public UTSubsystem - { - public: - OdometrySubsystem( - src::Drivers* drivers, - ChassisSubsystem* chassis, - TurretSubsystem* turret); - void initialize() override; - void refresh() override; - const char* getName() override { return "Odometry subsystem"; } - - Vector2f getPosition(); - Vector2f getLinearVelocity(); - - float getChassisYaw(); - float getChassisAngularVelocity(); - - float getTurretLocalYaw(); - float getTurretLocalPitch(); - bool hardwareOk() override; - - private: - src::Drivers* drivers; - ChassisSubsystem* chassis; - TurretSubsystem* turret; - - ChassisDisplacementObserver chassisDisplacement; - ChassisWorldYawObserver chassisYaw; - Odometry2DTracker chassisTracker; - }; - } // namespace odometry -} // namespace subsyste -} // namespace subsystemsms \ No newline at end of file +namespace odometry +{ + +using chassis::ChassisSubsystem; +using tap::algorithms::odometry::Odometry2DTracker; +using turret::TurretSubsystem; + +class OdometrySubsystem : public UTSubsystem +{ +public: + OdometrySubsystem(src::Drivers* drivers, ChassisSubsystem* chassis, TurretSubsystem* turret); + void initialize() override; + void refresh() override; + const char* getName() override { return "Odometry subsystem"; } + + Vector2f getPosition(); + Vector2f getLinearVelocity(); + + float getChassisYaw(); + float getChassisAngularVelocity(); + + float getTurretLocalYaw(); + float getTurretLocalPitch(); + bool hardwareOk() override; + +private: + src::Drivers* drivers; + ChassisSubsystem* chassis; + TurretSubsystem* turret; + + ChassisDisplacementObserver chassisDisplacement; + ChassisWorldYawObserver chassisYaw; + Odometry2DTracker chassisTracker; +}; +} // namespace odometry +} // namespace subsystems + // namespace subsystemsms \ No newline at end of file