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>存取。
timereal - [s]total - [秒]mission - [s]timer - [s]zulu - [hh.ss]local - [hh.ss]hobbsairspeedindicated - KIAS [kts]equivalent - KEAS [kts]true - KTAS [kts]truegnd - KTGS [kts]mph - IAS [英里/小時]mphair - [英里/小時]mphgnd - [英里/小時]gloadmach - 馬赫數[比率]vvi - VVI [fpm]normalaxialsideangularmomentm - [英尺磅]l - [英尺磅]n - [英尺磅]angularvelocityq - [弧度/秒]p - [弧度/秒]r - [弧度/秒]attitudepitch - [度]roll - [度]truehdg - [度]maghdg - [度]aoaalpha - [度]beta - [度]hpath - [度]vpath - [度]slip - [度]compassmag - [合成]mavar - [度]globalpositionlat - [度]lon - [度]altmsl - [英尺]altagl - [英尺]runway - [跑道號]altind - [ft]latnormlonnormsimpositionx - [米]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]aeroforcelift - [磅]drag - [磅]side - [磅]engineforcenormal - [磅]axial - [磅]side - [磅] npm inpm run typescript (或typescript-watch來觀看)npm inpm run typescriptnpm run test