File tree Expand file tree Collapse file tree 3 files changed +20
-2
lines changed
ut-robomaster/src/subsystems/chassis Expand file tree Collapse file tree 3 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -31,9 +31,10 @@ void ChassisSubsystem::initialize()
3131
3232void ChassisSubsystem::refresh ()
3333{
34+ setAmputated (hardwareOk ());
3435 for (int8_t i = 0 ; i < WHEELS; i++)
3536 {
36- wheels[i].setActive (!drivers->isKillSwitched ());
37+ wheels[i].setActive (!drivers->isKillSwitched () && ! isAmputated () );
3738 wheels[i].updateVelocity (targetWheelVels[i] / M_TWOPI); // rad/s to rev/s
3839 }
3940
@@ -71,6 +72,19 @@ void ChassisSubsystem::runHardwareTests()
7172 // TODO
7273}
7374
75+ bool ChassisSubsystem::hardwareOk ()
76+ {
77+ for (int8_t i = 0 ; i < WHEELS; i++)
78+ {
79+ if (!wheels[i].isOnline ())
80+ {
81+ return false ;
82+ }
83+ }
84+
85+ return true ;
86+ }
87+
7488void ChassisSubsystem::input (Vector2f move, float spin)
7589{
7690 Vector2f v = move * MAX_LINEAR_VEL;
Original file line number Diff line number Diff line change 55
66#include " modm/math/geometry.hpp"
77#include " robots/robot_constants.hpp"
8+ #include " subsystems/subsystem.hpp"
89#include " utils/motors/motor_controller.hpp"
910#include " utils/power_limiter/power_limiter.hpp"
1011
@@ -18,7 +19,8 @@ namespace subsystems
1819{
1920namespace chassis
2021{
21- class ChassisSubsystem : public tap ::control::Subsystem
22+ // class ChassisSubsystem : public tap::control::Subsystem
23+ class ChassisSubsystem : public UTSubsystem
2224{
2325public:
2426 ChassisSubsystem (src::Drivers* drivers);
@@ -31,6 +33,8 @@ class ChassisSubsystem : public tap::control::Subsystem
3133
3234 void runHardwareTests () override ;
3335
36+ bool hardwareOk () override ;
37+
3438 // / @brief Update robot motion based on simple input controls. Inputs are scaled and corrected
3539 // / to avoid over-driving motors. This logic can be adjusted to create various input schemes.
3640 // / @param move Linear movement (magnitude should be within [0,1])
You can’t perform that action at this time.
0 commit comments