-
Notifications
You must be signed in to change notification settings - Fork 84
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
creating "safe mode" #2888
creating "safe mode" #2888
Changes from all commits
acbeb74
d4641ed
518d1ca
cca746e
db8c947
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<template> | ||
<v-overlay | ||
v-if="!is_safe" | ||
:absolute="true" | ||
:opacity="0.85" | ||
> | ||
<div class="d-flex flex-column justify-center align-center"> | ||
<p class="text-center"> | ||
This feature is disabled because the vehicle is armed. | ||
</p> | ||
<v-btn | ||
class="ml-auto mr-auto" | ||
color="warning" | ||
@click="override()" | ||
> | ||
I know what I'm doing, let me through | ||
</v-btn> | ||
</div> | ||
</v-overlay> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import autopilot_data from '@/store/autopilot' | ||
|
||
export default { | ||
name: 'NotSafeOverlay', | ||
data() { | ||
return { | ||
user_override: false, | ||
} | ||
}, | ||
computed: { | ||
is_safe(): boolean { | ||
return autopilot_data.is_safe || this.user_override | ||
}, | ||
}, | ||
methods: { | ||
override() { | ||
this.user_override = true | ||
}, | ||
}, | ||
} | ||
</script> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -290,6 +290,16 @@ async def available_boards() -> Any: | |
return await autopilot.available_boards(True) | ||
|
||
|
||
@app.get("/safe") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't make more sense to move to "armed" ? Safe is to abstracted, and armed is a common term. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @patrickelectric I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any idea of other things that the backend of ardupilot_manager may know ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if there's a flashing operation in progress, for example, I'll add comments and/or more checking There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. comment added, I'll leave the actual blocking checks to after @JoaoMario109 's refactor is done |
||
@version(1, 0) | ||
async def safe() -> bool: | ||
""" | ||
Checks if the vehicle is in a condition where it is safe to perform dangerous operations on it, | ||
Such as firmware flashing, parameter loading, rebooting, networking changes, etc. | ||
""" | ||
return bool(autopilot.vehicle_manager.vehicle_is_safe()) | ||
|
||
|
||
app = VersionedFastAPI(app, version="1.0.0", prefix_format="/v{major}.{minor}", enable_latest=True) | ||
|
||
|
||
|
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 is this not calling the backend instead?
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.
This will give us feedback at 1hz, I don't want yet another thing polling the backends at 1hz for no reason...
I can add to the comment "such as ardupilotManager's /safe endpoint"
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.
So why we have the safe endpoint in the backend ?
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.
hmm, so why was the backend endpoint added?
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.
for subsequent backend-based validations, such in ardupilot_manager.py and whatever else