-
Notifications
You must be signed in to change notification settings - Fork 0
Update FSM #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update FSM #40
Conversation
|
I have some questions about the
|
|
It seems that in the ERROR ON GROUND part of the Wiki FSM we are missing a 'from' row as in the diagram we can go to the error on ground state from the armed state. |
this is correct please add it to this PR |
|
I updated the wiki : https://rocket-team.epfl.ch/en/competition/firehorn/avionics/2024_C_AV_FINITE-STATE-MACHINE |
| uint32_t norm_squared (){ | ||
| return x*x + y*y + z*z; | ||
| } | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are those helper functions used ? If we only need the norm in the FSM or high level modules, then it might be better to implement this function in the Vector3 struct in data.h/cpp. Also as it is a common function to any 3D data, implementing it only once would be better. Also why the need of an uint32_t return type ?
the tests will be in another branch
# Conflicts: # tests/CMakeLists.txt
# Conflicts: # src/flight_control/av_state.cpp # tests/AvState_test.cpp # tests/CMakeLists.txt
| adxl2.calibrate(); | ||
| } | ||
|
|
||
| double Vector3::norm() const { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why defining this in a different TU than its declaration ? Might be better to define in data.cpp, or even consider making it inline in data.h, as it is a helper function of Vector3.
Also, if used only for comparison, no need to get the sqrt, we can compare it with squared thresholds to avoid this heavy instruction. (Req FSM frequency >= 100Hz).
|
|
||
| // Initial state should be INIT | ||
| fsm.update(dump); | ||
| assert(fsm.getCurrentState() == State::INIT); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, check first after constructor call, but might also be good to check after the first fsm.update() the state remains INIT.
| { | ||
| return State::READY; | ||
| } | ||
| return State::ARMED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These conditions overall need some correction. The switch over the telemetry_cmd.id seems deprecated.
The transition ARMED->READY is OK for the moment but will later be determined by the feedback from DPR boards (PR tanks pressure regulators).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear we don't verify the tanks, we just get the go from DPR ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, once we receive PRESSURIZE command from GS and we send PRESSURIZE to the DPRs, we wait for their GO
|


The goal of this PR is to implement the Finite State Machine in the
AVState.cppfile to match the description provided in the ERT Wiki