Skip to content

Commit

Permalink
Merge pull request #17 from loonwerks/Year_3
Browse files Browse the repository at this point in the history
Year 3 Integration
  • Loading branch information
ParthGaneriwala authored Mar 22, 2023
2 parents 5ebdaec + f5bc35a commit dd6f917
Show file tree
Hide file tree
Showing 42 changed files with 960 additions and 712 deletions.
3 changes: 3 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ sp {top-state*elaborate*error-info*current-value*imu


sp {top-state*elaborate*user-response*agree
(state <s> ^io.input-link.flightdata.sensor-alert-accepted yes)
(state <s> ^io.input-link.flightdata.pilot-decision yes)
-->
(<s> ^user-response yes)
}
sp {top-state*elaborate*user-response*disagree
(state <s> ^io.input-link.flightdata.sensor-alert-accepted no)
(state <s> ^io.input-link.flightdata.pilot-decision no)
-->
(<s> ^user-response no)
}
Expand Down Expand Up @@ -89,7 +89,7 @@ proc generateSafetyWarnCondition { types } {
}
}

generateSafetyWarnCondition { gps lidar imu }
generateSafetyWarnCondition { gps imu lidar }

##########################
### Detect high warn-condition for a sensor
Expand All @@ -108,7 +108,7 @@ proc generateHighWarnCondition { types } {
"
}
}
generateHighWarnCondition { gps lidar imu }
generateHighWarnCondition { gps imu lidar }

##########################
### Detect low warn-condition for a sensor
Expand All @@ -121,16 +121,16 @@ proc generateLowWarnCondition { types } {
^${type}-error-info <ei>)
(<ei> ^current-value >= <nv>)
(<ei> ^current-value < <hv>)


#(<ei> -^warn-condition safety)
#(<ei> -^warn-condition high)
-->
(<ei> ^warn-condition low)
"
}
}
generateLowWarnCondition { gps lidar imu }
generateLowWarnCondition { gps imu lidar }

proc generateDisplayWarnCondition { types } {
foreach type $types {
Expand All @@ -143,7 +143,7 @@ proc generateDisplayWarnCondition { types } {
"
}
}
#generateDisplayWarnCondition { gps lidar imu }
#generateDisplayWarnCondition { gps imu lidar }


######################
Expand All @@ -165,7 +165,7 @@ proc generateNormalWarnCondition { types } {
}
}

generateNormalWarnCondition { gps lidar imu }
generateNormalWarnCondition { gps imu lidar }

########################
### Any time one of the error values changes, record the change and set the ^error-changed flag
Expand All @@ -185,7 +185,7 @@ proc generateRecordChangedErrorPropose { types } {
"
}
}
generateRecordChangedErrorPropose { gps lidar imu }
generateRecordChangedErrorPropose { gps imu lidar }


############################
Expand Down Expand Up @@ -219,7 +219,7 @@ proc generateDecisionPropose { types } {
}
}

generateDecisionPropose { gps lidar imu }
generateDecisionPropose { gps imu lidar }

sp {warn*propose
(state <s> ^ready-to-decide yes)
Expand Down Expand Up @@ -247,14 +247,14 @@ proc generateRecordUserResponsePropose { types } {
(state <s> ^${type}-error-info <ei>)
(<s> ^flight-mode horizontal)
(<s> ^warning-issued ${type})
(<s> ^user-response <x> <> nil)
(<s> ^user-response <x> <> none)
(<ei> -^warning-accepted)
-->
(<s> ^operator <o> + >,=)
(<s> ^operator <o> + >,=)
(<o> ^name record-user-response)
(write (crlf) |Pilot response: | <x>)
"
}
}

generateRecordUserResponsePropose { gps lidar imu }
generateRecordUserResponsePropose { gps imu lidar }
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ proc generateRewardAccepted { types } {
(state <s> ^reward-link <rl>
^${type}-error-info.warning-accepted yes)
(<s> ^io.input-link.flightdata <fd>)
(<fd> ^learning_mode on)
(<fd> ^learning-mode on)
-->
(write (crlf) |User accepted warning. Reward value is 1.0 for ${type} |)
(<rl> ^reward <rr>)
Expand All @@ -48,15 +48,15 @@ proc generateRewardAccepted { types } {
}
}

generateRewardAccepted { gps lidar imu }
generateRewardAccepted { gps imu lidar }

proc generateRewardRejected { types } {
foreach type $types {
sp "reward-link*elaborate*reward*rejected-warning*${type}
(state <s> ^reward-link <rl>
^${type}-error-info.warning-accepted no)
(<s> ^io.input-link.flightdata <fd>)
(<fd> ^learning_mode on)
(<fd> ^learning-mode on)
-->
(write (crlf) |User rejected warning. Reward value is -1.0 for ${type} |)
(<rl> ^reward <rr>)
Expand All @@ -65,4 +65,4 @@ proc generateRewardRejected { types } {
}
}

generateRewardRejected { gps lidar imu }
generateRewardRejected { gps imu lidar }
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ sp {do-not-warn*apply*warning-accepted*remove*gps
-->
(<ei> ^warning-accepted <x> -)
(<s> ^ready-to-decide yes -)
(write (crlf) |Warning Accepted|)
}

sp {do-not-warn*apply*warning-accepted*remove*lidar
Expand Down Expand Up @@ -82,6 +83,7 @@ sp {do-not-warn*apply*value-changed*remove*gps
-->
(<ei> ^value-changed true -)
(<s> ^ready-to-decide yes -)
(write (crlf) |Value Changed|)

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ proc generateRecordUserResponseYesApply { types } {
-->
(<ei> ^warning-accepted yes)
(<s> ^warning-issued ${type} -)
(<out> ^clear-sensor-alert-response yes)
(<out> ^clear-pilot-response-for-error yes)
(write (crlf) |User Response Yes|)
"
}
}

generateRecordUserResponseYesApply { gps lidar imu }
generateRecordUserResponseYesApply { gps imu lidar }

proc generateRecordUserResponseNoApply { types } {
foreach type $types {
Expand All @@ -38,12 +39,13 @@ proc generateRecordUserResponseNoApply { types } {
-->
(<ei> ^warning-accepted no)
(<s> ^warning-issued ${type} -)
(<out> ^clear-sensor-alert-response yes)
(<out> ^clear-pilot-response-for-error no)
(write (crlf) |User Response No|)
"
}
}

generateRecordUserResponseNoApply { gps lidar imu }
generateRecordUserResponseNoApply { gps imu lidar }


#sp {record-user-response*apply*gps
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ sp {warn*apply*warning-accepted*remove*gps
-->
(<ei> ^warning-accepted <x> -)
(<s> ^ready-to-decide yes -)
(write (crlf) |Warning Accepted so Removed|)
}

sp {warn*apply*warning-accepted*remove*lidar
Expand Down Expand Up @@ -78,6 +79,7 @@ sp {warn*apply*issue-warning*gps
(<s> ^warning-issued gps)
(<ei> ^value-changed true -)
(<s> ^ready-to-decide yes -)
(write (crlf) |Warning Issued|)
}

sp {warn*apply*issue-warning*lidar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ proc generateWarnBestSafetyCondition { types } {
"
}
}
generateWarnBestSafetyCondition { gps lidar imu }
generateWarnBestSafetyCondition { gps imu lidar }

### Always choose NOT to warn in the normal condition

Expand All @@ -36,11 +36,10 @@ proc generateDoNotWarnBestNormalCondition { types } {
(<ei> ^warn-condition <wc>)
-->
(<s> ^operator <o> >,=)
(write (crlf) |proposed do-not-warn in selection for ${type} | <wc> | condition |)
"
}
}
generateDoNotWarnBestNormalCondition { gps lidar imu }
generateDoNotWarnBestNormalCondition { gps imu lidar }

################################
### Learning conditions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# @created rjones 20210118

echo "\nLoading handle-error.soar"
#change_sensor_auth
#change-sensor-auth
### Original code commented out, refactored code below
#sp {propose*detect*gps*error
# (state <s> ^flight-mode horizontal)
Expand Down Expand Up @@ -66,7 +66,7 @@ echo "\nLoading handle-error.soar"
# }


# Previous Code
# Previous Code
# sp {top-state*elaborate*sensor-error-detected*lidar
# (state <s> ^flight-mode horizontal
# ^sensor-unreliable no
Expand All @@ -79,7 +79,7 @@ echo "\nLoading handle-error.soar"
# (write (crlf) |LIDAR is Unreliable!|)
# (<s> ^sensor-error-detected lidar)
# }
# Previous Code
# Previous Code
# sp {top-state*elaborate*sensor-error-detected*imu
# (state <s> ^flight-mode horizontal
# ^sensor-unreliable no
Expand All @@ -100,7 +100,8 @@ proc generateSensorErrorDetected { types } {
^sensor-unreliable no
^${type}-error-info <ei>
^io.input-link.flightdata <fd>)
(<fd> ^change_sensor_auth on)
(<fd> ^change-sensor-auth on
^learning-mode off )
(<ei> ^warning-accepted yes)
-->
(write (crlf) |${type} is Unreliable!|)
Expand All @@ -109,7 +110,7 @@ proc generateSensorErrorDetected { types } {
}
}

generateSensorErrorDetected { gps lidar imu }
generateSensorErrorDetected { gps imu lidar }


sp {propose*sensor-error-over-limit
Expand All @@ -127,7 +128,8 @@ sp {propose*pilot-agrees
^sensor-unreliable yes
-^error-handling-complete yes)
(<s> ^io.input-link.flightdata <fd>)
(<fd> ^pilot_decision agree)
(<fd> ^learning-mode off )
(<fd> ^pilot-decision-to-change yes)
-->
(write (crlf) |Pilot agrees.|)

Expand All @@ -141,7 +143,8 @@ sp {propose*pilot-disagrees
^sensor-unreliable yes
-^error-handling-complete yes)
(<s> ^io.input-link.flightdata <fd>)
(<fd> ^pilot_decision disagree)
(<fd> ^learning-mode off )
(<fd> ^pilot-decision-to-change no)
-->
(write (crlf) |Pilot disagrees.|)

Expand Down
Loading

0 comments on commit dd6f917

Please sign in to comment.