Skip to content

Commit

Permalink
fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tildezero committed Nov 9, 2024
1 parent b4bb19e commit c842a21
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 45 deletions.
8 changes: 4 additions & 4 deletions ut-robomaster/src/subsystems/agitator/agitator_subsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
78 changes: 38 additions & 40 deletions ut-robomaster/src/subsystems/odometry/odometry_subsystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
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

0 comments on commit c842a21

Please sign in to comment.