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

Show topbar icons for 2 Gps systems, display yaw if available #2909

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion core/frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
<v-spacer />
<beacon-tray-menu />
<health-tray-menu />
<gps-tray-menu />
<gps-tray-menu :instance="1" />
<gps-tray-menu :instance="2" />
<theme-tray-menu />
<system-checker-tray-menu />
<vehicle-reboot-required-tray-menu />
Expand Down
27 changes: 24 additions & 3 deletions core/frontend/src/components/health/GpsTrayMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,21 @@ import Vue from 'vue'

import mavlink2rest from '@/libs/MAVLink2Rest'
import { GpsFixType } from '@/libs/MAVLink2Rest/mavlink2rest-ts/messages/mavlink2rest-enum'
import { GlobalPositionInt, GpsRawInt } from '@/libs/MAVLink2Rest/mavlink2rest-ts/messages/mavlink2rest-message'
import {
GlobalPositionInt,
Gps2Raw,
GpsRawInt,
} from '@/libs/MAVLink2Rest/mavlink2rest-ts/messages/mavlink2rest-message'
import autopilot_data from '@/store/autopilot'

export default Vue.extend({
name: 'GpsTrayMenu',
props: {
instance: {
type: Number,
required: true,
},
},
data() {
return {
mouse_hover: false,
Expand Down Expand Up @@ -174,6 +184,16 @@ export default Vue.extend({
},
)
}
if (this.gps_raw_int?.yaw !== 0) {
values.push(
{
name: 'Yaw',
value: `${(this.gps_raw_int.yaw / 100).toFixed(2)}º`,
tooltip: 'Yaw',
icon: 'mdi-compass',
},
)
}

return values
},
Expand Down Expand Up @@ -255,13 +275,14 @@ export default Vue.extend({
this.global_position_int = message?.message as GlobalPositionInt
}).setFrequency(0)

mavlink2rest.startListening('GPS_RAW_INT').setCallback((message) => {
const message_name = this.instance === 1 ? 'GPS_RAW_INT' : 'GPS2_RAW'
mavlink2rest.startListening(message_name).setCallback((message) => {
if (message?.header.system_id !== autopilot_data.system_id || message?.header.component_id !== 1) {
return
}

this.last_message_date = new Date()
this.gps_raw_int = message?.message as GpsRawInt
this.gps_raw_int = message?.message as GpsRawInt | Gps2Raw
this.gps_detected = this.gps_raw_int?.fix_type?.type !== GpsFixType.GPS_FIX_TYPE_NO_GPS
}).setFrequency(0)
},
Expand Down
Loading