Skip to content
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

Failure manager #10

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d235382
Create FailureManager object
eckshn Dec 3, 2020
c43c402
failure manager add methods and enums
eckshn Dec 15, 2020
f8259fe
created a flag map for the failures.
vmad18 Dec 17, 2020
5e410bc
Merge branch 'master' into failureManager
aidangoettsch Dec 17, 2020
a45add9
flesh out failuremanager, add test routine and associated commands
aidangoettsch Dec 17, 2020
aece5d4
add commands for failure manager
aidangoettsch Dec 18, 2020
30bc148
validate command complete
eckshn Dec 22, 2020
b37382b
Factory reset
vmad18 Jan 14, 2021
87a486c
Create FailureManager object
eckshn Dec 3, 2020
8f0ff47
failure manager add methods and enums
eckshn Dec 15, 2020
cac8d43
created a flag map for the failures.
vmad18 Dec 17, 2020
2f2d1db
flesh out failuremanager, add test routine and associated commands
aidangoettsch Dec 17, 2020
4d4b1ee
add commands for failure manager
aidangoettsch Dec 18, 2020
ef5914a
validate command complete
eckshn Dec 22, 2020
0de7556
Merge branch 'failureManager' of github.com:team4099/InfiniteRecharge…
aidangoettsch Jan 17, 2021
4d55db6
Merge branch 'master' into failureManager
vmad18 Jan 19, 2021
2657128
Added Test Command
vmad18 Jan 19, 2021
ca27705
Fixed Logic with TestCommand
vmad18 Jan 19, 2021
a0a7f8d
Merge branch 'failureManager' of github.com:team4099/InfiniteRecharge…
aidangoettsch Jan 20, 2021
163c45b
actually use logDashboard
aidangoettsch Jan 20, 2021
e7fd657
add event for failure manager log
aidangoettsch Jan 20, 2021
35f386c
added climber failure to failures.
vmad18 Jan 20, 2021
1975db1
Merge branch 'failureManager' of https://github.com/team4099/Infinite…
vmad18 Jan 20, 2021
b988657
added new errorflag
vmad18 Jan 21, 2021
71cb6e7
added pneumatic sensor code
vmad18 Jan 21, 2021
f9bccbe
added failure checks in move and unlock climber commands
RehanKabir Jan 21, 2021
743cc86
Add comment for commands & fix UnlockClimber
eckshn Jan 27, 2021
80d28bc
Finish Climber command descriptions
eckshn Jan 27, 2021
4893e92
Finish subsystem comments & progress on FailureManager
eckshn Jan 28, 2021
cdd22c2
Finish FailureManager comments
eckshn Jan 29, 2021
8d0b077
Remove constructor comment & fix others
eckshn Feb 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Finish FailureManager comments
  • Loading branch information
eckshn committed Jan 29, 2021
commit cdd22c237dd57adcd0207553123a14b25cff0c28
35 changes: 31 additions & 4 deletions src/main/kotlin/com/team4099/robot2021/loops/FailureManager.kt
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ object FailureManager: Sendable {
/**
* Failures
*
* @property severity Enum aboved giving classification of the severity level of the failure
* @property severity Enum above giving classification of the severity level of the failure
* @property description Gives details about the given failure
* @constructor Create empty Failures
*/
@@ -56,19 +56,31 @@ object FailureManager: Sendable {
/**
* Add failure
*
* @param failType
* @param latching
* @param condition
* @param failType Name implies
* @param latching If true failure can't be removed
* @param condition Given the condition will determine if there is a failure
* @receiver
*/
fun addFailure(failType: Failures, latching: Boolean = false, condition: () -> Boolean) {
failures.add(FailureSource(failType, latching, condition, false))
}

/**
* Add test failure (test mode)
*
* @param failType Name implies
* @param condition Given the condition will determine if there is a failure
* @receiver
*/
fun addTestFailure(failType: Failures, condition: () -> Boolean) {
failures.add(FailureSource(failType, true, condition, true))
}

/**
* Check failures
*
* Goes through each failure in the list and checks if it's true and if so logs it
*/
fun checkFailures() {
failures.forEach { failure ->
if (!failure.testOnly || Robot.isTest) {
@@ -83,17 +95,32 @@ object FailureManager: Sendable {
}
}

/**
* Reset
*
* Method that resets each failure to false
*/
fun reset(){
failures.forEach{failure -> errorFlags[failure.failType] = false}
log = ""
}

/**
* Log dashboard
*
* @param string Description of failure
*/
fun logDashboard(string: String) {
Logger.addEvent("FailureManager", string)
log += "\n$string"
log.trim()
}

/**
* Init sendable
*
* @param builder
*/
override fun initSendable(builder: SendableBuilder?) {
builder?.addStringProperty("Failures", { log }) {}
}