xplane udp
1.0.0
Node.js 的 XPlane UDP 客户端
// Import XPlane class from the package
import { XPlaneClient } from "xplane-udp"
// Create a client on a specific port (this is a value you define in your xplane game settings)
const client = new XPlaneClient ( 49000 )
// Start the UDP listener
client . start ( )
// Subscribe to the updated event
// This will fire at the rate at which you send UDP updates (set in-game)
client . on ( "updated" , ( data ) => {
// Do something with the data
console . log ( data )
} )
// You can also access the data directly from the client instance
callMeMaybe ( ( ) => {
// Access data in the following format `<client>.data.<group>.<value>`
console . log ( client . data . time . real )
console . log ( client . data . airspeed . indicated )
} )
以下是updated
事件中返回的数据对象的结构,或者可以直接从client.data.<group>.<value>
访问。
time
real
- [s]total
- [秒]mission
- [s]timer
- [s]zulu
- [hh.ss]local
- [hh.ss]hobbs
airspeed
indicated
- KIAS [kts]equivalent
- KEAS [kts]true
- KTAS [kts]truegnd
- KTGS [kts]mph
- IAS [英里/小时]mphair
- [英里/小时]mphgnd
- [英里/小时]gload
mach
- 马赫数[比率]vvi
- VVI [fpm]normal
axial
side
angularmoment
m
- [英尺磅]l
- [英尺磅]n
- [英尺磅]angularvelocity
q
- [弧度/秒]p
- [弧度/秒]r
- [弧度/秒]attitude
pitch
- [度]roll
- [度]truehdg
- [度]maghdg
- [度]aoa
alpha
- [度]beta
- [度]hpath
- [度]vpath
- [度]slip
- [度]compass
mag
- [合成]mavar
- [度]globalposition
lat
- [度]lon
- [度]altmsl
- [英尺]altagl
- [英尺]runway
- [跑道号]altind
- [ft]latnorm
lonnorm
simposition
x
- [米]y
- [米]z
- [米]vx
- [米/秒]vy
- [米/秒]vz
- [米/秒]distft
- [ft]distnm
- [nm]throttlecommand
[1..8]
throttleactual
[1..8]
enginepower
[1..8]
- [马力]enginethrust
[1..8]
enginetorque
[1..8]
enginerpm
[1..8]
proprpm
[1..8]
proppitch
[1..8]
enginewash
- 螺旋桨清洗或喷射清洗[1..8]
- [节]n1
- 涡轮机 N1 %[1..8]
- [%]n2
- 涡轮机N2 %[1..8]
- [%]fuelflow
[1..8]
- [磅/小时]itt
[1..8]
- [度]egt
[1..8]
- [度]cht
[1..8]
- [度]oilpressure
[1..8]
- [psi]oiltemp
[1..8]
- [度]fuelpressure
[1..8]
- [psi]aeroforce
lift
- [磅]drag
- [磅]side
- [磅]engineforce
normal
- [磅]axial
- [磅]side
- [磅] npm i
npm run typescript
(或typescript-watch
来观看)npm i
npm run typescript
npm run test