github-actions[bot]
chore: deploy from GitHub Actions (2026-03-08T13:13:40Z)
d9d886e
Raw History Blame Contribute Delete
6.6 kB
const { common } = require('node-mavlink')
const _createPlotInterface = () => {
return new Object([
{
code: 'ASPD',
timeFrame: new Array(),
mavData: [
{
id: 0,
label: 'air speed',
borderColor: '#36A2EB',
data: new Array()
}
]
},
{
code: 'GSPD',
timeFrame: new Array(),
mavData: [
{
id: 0,
borderColor: '#36A2EB',
label: 'ground speed',
data: new Array()
}
]
},
{
code: 'ASPD_GSPD',
timeFrame: new Array(),
mavData: [
{
id: 0,
borderColor: '#36A2EB',
label: 'air speed',
data: new Array()
},
{
id: 1,
borderColor: '#FF6384',
label: 'ground speed',
data: new Array()
}
]
},
{
code: 'R',
timeFrame: new Array(),
mavData: [
{
id: 0,
borderColor: '#36A2EB',
label: 'roll',
data: new Array()
}
]
},
{
code: 'P',
timeFrame: new Array(),
mavData: [
{
id: 0,
borderColor: '#36A2EB',
label: 'pitch',
data: new Array()
}
]
},
{
code: 'Y',
timeFrame: new Array(),
mavData: [
{
id: 0,
borderColor: '#36A2EB',
label: 'pitch',
data: new Array()
}
]
},
{
code: 'RPY',
timeFrame: new Array(),
mavData: [
{
id: 0,
borderColor: '#36A2EB',
label: 'roll',
data: new Array()
},
{
id: 1,
borderColor: '#FF6384',
label: 'pitch',
data: new Array()
},
{
id: 2,
borderColor: '#EAB676',
label: 'yaw',
data: new Array()
}
]
},
{
code: 'AOA',
timeFrame: new Array(),
mavData: [
{
id: 0,
borderColor: '#36A2EB',
label: 'AOA',
data: new Array()
}
]
},
{
code: 'ALT',
timeFrame: new Array(),
mavData: [
{
id: 0,
borderColor: '#36A2EB',
label: 'altitude',
data: new Array()
}
]
},
{
code: 'RSSI',
timeFrame: new Array(),
mavData: [
{
id: 0,
borderColor: '#36A2EB',
label: 'RSSI',
data: new Array()
}
]
},
{
code: 'CLIMB',
timeFrame: new Array(),
mavData: [
{
id: 0,
borderColor: '#36A2EB',
label: 'climb',
data: new Array()
}
]
},
{
code: 'THROT',
timeFrame: new Array(),
mavData: [
{
id: 0,
borderColor: '#36A2EB',
label: 'throttle',
data: new Array()
}
]
}
])
}
const plotFilter = {
ASPD: 0,
GSPD: 1,
ASPD_GSPD: 2,
R: 3,
P: 4,
Y: 5,
RPY: 6,
AOA: 7,
ALT: 8,
RSSI: 9,
CLIMB: 10,
THROT: 11
}
const toPlotter = (categorical) => {
const plotInterface = _createPlotInterface()
let timeFrame = []
categorical[common.Attitude.MSG_NAME].data.forEach((data, i) => {
timeFrame.push(i)
plotInterface[plotFilter.R].mavData[0].data.push(data.mavData.roll)
plotInterface[plotFilter.P].mavData[0].data.push(data.mavData.pitch)
plotInterface[plotFilter.Y].mavData[0].data.push(data.mavData.yaw)
plotInterface[plotFilter.RPY].mavData[0].data.push(data.mavData.roll)
plotInterface[plotFilter.RPY].mavData[1].data.push(data.mavData.pitch)
plotInterface[plotFilter.RPY].mavData[2].data.push(data.mavData.yaw)
})
plotInterface[plotFilter.R].timeFrame = timeFrame
plotInterface[plotFilter.P].timeFrame = timeFrame
plotInterface[plotFilter.Y].timeFrame = timeFrame
plotInterface[plotFilter.RPY].timeFrame = timeFrame
plotInterface[plotFilter.AOA].timeFrame = timeFrame
categorical[common.GlobalPositionInt.MSG_NAME].data.forEach((data, i) => {
plotInterface[plotFilter.ALT].timeFrame.push(i)
plotInterface[plotFilter.ALT].mavData[0].data.push(data.mavData.relativeAlt)
})
timeFrame = []
categorical[common.VfrHud.MSG_NAME].data.forEach((data, i) => {
timeFrame.push(i)
plotInterface[plotFilter.ASPD].mavData[0].data.push(data.mavData.airspeed)
plotInterface[plotFilter.GSPD].mavData[0].data.push(data.mavData.groundspeed)
plotInterface[plotFilter.ASPD_GSPD].mavData[0].data.push(data.mavData.airspeed)
plotInterface[plotFilter.ASPD_GSPD].mavData[1].data.push(data.mavData.groundspeed)
plotInterface[plotFilter.CLIMB].mavData[0].data.push(data.mavData.climb)
plotInterface[plotFilter.THROT].mavData[0].data.push(data.mavData.throttle)
})
plotInterface[plotFilter.ASPD].timeFrame = timeFrame
plotInterface[plotFilter.GSPD].timeFrame = timeFrame
plotInterface[plotFilter.ASPD_GSPD].timeFrame = timeFrame
plotInterface[plotFilter.CLIMB].timeFrame = timeFrame
plotInterface[plotFilter.THROT].timeFrame = timeFrame
categorical[common.RcChannels.MSG_NAME].data.forEach((data, i) => {
plotInterface[plotFilter.RSSI].timeFrame.push(i)
plotInterface[plotFilter.RSSI].mavData[0].data.push(0)
})
// cate
return plotInterface
}
const filterFields = [
{
index: 0,
categoryName: 'Speed',
filterNames: [
{
code: 'ASPD',
name: 'Air Speed'
},
{
code: 'GSPD',
name: 'Ground Speed'
},
{
code: 'ASPD_GSPD',
name: 'Air Speed vs Ground Speed'
}
]
},
{
index: 1,
categoryName: 'Attitude',
filterNames: [
{
code: 'R',
name: 'Roll'
},
{
code: 'P',
name: 'Pitch'
},
{
code: 'Y',
name: 'Yaw'
},
{
code: 'RPY',
name: 'Roll vs Pitch vs Yaw'
},
{
code: 'AOA',
name: 'AOA'
}
]
},
{
index: 2,
categoryName: 'Plane Position',
filterNames: [
{
code: 'ALT',
name: 'Relative Altitude'
}
]
},
{
index: 3,
categoryName: 'Other',
filterNames: [
{
code: 'RSSI',
name: 'RSSI'
},
{
code: 'CLIMB',
name: 'Climb'
},
{
code: 'THROT',
name: 'Throttle'
}
]
}
]
module.exports = {
toPlotter,
filterFields
}