-
Notifications
You must be signed in to change notification settings - Fork 1
Modules in Each State
/src/propulsion/main.cpp
- Only used for transitioning.
/src/propulsion/main.cpp
- Firstly, it checks if
state_processor
is initialised and if the motor data is ready - If
state_processor
is not initialized, it will initialize motors and send the motor data to the central database
Failure Condition: If state_processor
is in critical failure after intializing motors, handleCriticalFailure
is called which sets the running of the current thread to false, makes Propulsion enter critical failure and motor data is updated on the central data base.
/src/propulsion/main.cpp
- While in Ready, it is checked if the Pod has changed states (
encountered_transition
) - If so, the settings data is sent to motors using
prepareMotors
called bysendOperationalCommand
/src/propulsion/main.cpp
- Before everything else, it updates the motor data and velocity of the vehicle
- Three things are then calculated: the average RPM, maximum current from the batteries, and maximum temperature from the motors
- The code then sends the target rpm to the motor controllers, therefore accelerate the vehicle
- If everything is not initialised, a message will appear saying "State Processor not initialised"
src/propulsion/main.cpp
- Quick warning, although it is named
kEmergencyBraking
in the file, it technically useskFailureBraking
from the state machine codebase and the switch happens inmain.cpp
- It sends a message to the motor controllers to stop all processes and logs it in the console
src/propulsion/main.cpp
- In these states, a message is sent to motor controllers to stop all processes and logs it in the console
src/telemetry/main.cpp
- It sends and receive data from the main threads
src/telemetry/writer.cpp
- Sends a message for each state transition to the client
src/brakes/main.cpp
- If a nominal braking command is given, checks if the magnetic and frictional brakes are clamped
- If they are not clamped then commands to clamp them are sent
- {This thread now sleeps for 1000ms as detailed by
kBrakeCommandWaitTime
} - Then checks if the brake button for the magnetic and frictional brake are pressed
Failure Condition: After the above, braking failure (checkBrakingFailure
) is checked for, which is caused by brakes being retracted at this stage. If this condition is met, Brakes enters critical failure and the emergency brakes data is updated on the central data base.
- If no braking command is given, then it is checked if the brakes are clamped
- If they are, then brakes are retracted
- Similar to before, it is checked if the brake button for the magnetic and frictional brake are pressed
Failure Condition: After the above, accelerating failure (checkAccFailure
) is checked for, which is caused by brakes being clamped at this stage. If this condition is met, Brakes enters critical failure and the emergency brakes data is updated on the central data base.
src/brakes/main.cpp
- Checks if the magnetic and frictional brakes are clamped - if so, then they are retracted
- It is checked again whether both brakes are unclamped, if so, then Brakes enter the Ready state and updates the central data base with its emergency brakes data
- {This thread now sleeps for 1000ms as detailed by kBrakeCommandWaitTime}
- It is now checked if the brake button for the magnetic and frictional brake are pressed
Failure Condition: After the above, accelerating failure (checkAccFailure
) is checked for, which is caused by brakes being clamped at this stage. If this condition is met, Brakes enters critical failure and the emergency brakes data is updated on the central data base.
src/brakes/main.cpp
Failure Condition: Accelerating failure (checkAccFailure
) is checked for, which is caused by brakes being clamped at this stage. If this condition is met, Brakes enters critical failure and the emergency brakes data is updated on the central data base.
src/brakes/main.cpp
- Checks whether the magnetic and frictional brakes are clamped
- If not, then they are clamped
- {This thread now sleeps for 1000ms as detailed by
kBrakeCommandWaitTime
} - It is now checked if the brake button for the magnetic and frictional brake are pressed
Failure Condition: After the above, braking failure (checkBrakingFailure
) is checked for, which is caused by brakes being retracted at this stage. If this condition is met, Brakes enters critical failure and the emergency brakes data is updated on the central data base.
src/navigation/main.cpp
- Checks whether the navigation module has been initialized, if so, then it calibrates for gravity
src/navigation/main.cpp
- Checks if the initial timestamp has been set
- If not then a timestamp is initialized for integration and the function to check if the timestamp has been initialized (
setHasInit
) is set to true
src/navigation/main.cpp
- The
navigate
command is used here, which takes acceleration readings from IMU, applies the Kalman filter (link documentation here) , integrates and then updates the central data base with new values
src/navigation/main.cpp
- Only used for transitioning
src/sensors/gpio_manager.cpp
- Nothing is done
src/sensors/gpio_manager.cpp
-
clearHP
is called - It is logged that Sensors is in a emergency state
src/sensors/gpio_manager.cpp
There are two instances where Sensors acts during Ready:
- If there has been a change in battery status from previous then
-
sethp
is called and it is logged that Sensors is ready
- When the pod transitions into Ready
-
sethp
is called and it is logged that Sensors is in kReady
src/sensors/gpio_manager.cpp
-
clearHP
is called - It is logged that kFinished is reached
- Home
- How to add and edit pages on the wiki
- Glossary
- Admin
- Projects & Subsystems
- Motor Controllers
- Navigation
- Quality Assurance
- Sensors
- State Machine
- Telemetry
- Technical Guides
- BeagleBone Black (BBB)
- Configuration
- Contributing
- Testing
- Install VM on Mac
- Makefiles
- Reinstall MacOS Mojave
- Travis Troubleshooting
- Knowledge Base