Package com.marswars.subsystem
Class MwSubsystem<StateType extends Enum<StateType>,ConstantsType extends MwConstants>
java.lang.Object
com.marswars.subsystem.MwSubsystem<StateType,ConstantsType>
- All Implemented Interfaces:
MwSubsystemBase
public abstract class MwSubsystem<StateType extends Enum<StateType>,ConstantsType extends MwConstants>
extends Object
implements MwSubsystemBase
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ConstantsTypeprotected Stringprotected StateType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()Gets the name of the subsystem used to enable and disable.getNtKey()a common NT key to use for the subsystema common logging key to use for the subsystemGets the current state of the state machineprotected voidhandleStateTransition(StateType wanted) abstract voidreset()Called to reset and configure the subsystemvoidsetWantedState(StateType wanted) Sets the desired state for the state machinevoidupdate(double timestamp) DO NOT OVERRIDE THIS METHOD IN THE BASE CLASS IF YOU DO, BAD THINGS WILL HAPPEN! YOUR SUBSYSTEM WILL NOT TICK CORRECTLYabstract voidupdateLogic(double timestamp) Computes updated outputs for the actuatorsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.marswars.subsystem.MwSubsystemBase
getIos
-
Field Details
-
system_state_
-
CONSTANTS
-
subsystem_name_
-
-
Constructor Details
-
MwSubsystem
-
-
Method Details
-
handleStateTransition
-
updateLogic
public abstract void updateLogic(double timestamp) Computes updated outputs for the actuators -
reset
public abstract void reset()Called to reset and configure the subsystem- Specified by:
resetin interfaceMwSubsystemBase
-
setWantedState
Sets the desired state for the state machine- Parameters:
wanted- the desired state machine state to transition to
-
getSystemState
Gets the current state of the state machine- Returns:
- the current state of the state machine
-
update
public void update(double timestamp) DO NOT OVERRIDE THIS METHOD IN THE BASE CLASS IF YOU DO, BAD THINGS WILL HAPPEN! YOUR SUBSYSTEM WILL NOT TICK CORRECTLY- Specified by:
updatein interfaceMwSubsystemBase
-
getSubsystemKey
a common logging key to use for the subsystem- Specified by:
getSubsystemKeyin interfaceMwSubsystemBase- Returns:
- the logging key to use as a base. eg getSubsystemKey() + "Some Special Value"
-
getNtKey
a common NT key to use for the subsystem- Returns:
- the NT key to use as a base. eg getSubsystemKey() + "Some Special Value"
-
getName
Gets the name of the subsystem used to enable and disable. Also used for logging- Specified by:
getNamein interfaceMwSubsystemBase- Returns:
- the string name of the subsystem
-