Claudio Posted March 23, 2014 Posted March 23, 2014 (edited) Hello Pilots I am wondering how to get the current Roll/Yaw position in degrees with Lua. Trying to export this values to a rapsberry pi. I am searching the forums for two days now, but i am still not able to export those values :(. So therefore i would have 3 Questions: 1. Tried with local pitch,roll,yaw = LoGetADIPitchBankYaw() local message = string.format("Roll:%.2f|Yaw:%.2f\n", roll, yaw) Questions number 1, what kind of value is the result from LoGetADIPitchBankYaw? Ive seen examples multiplying it with 1000.0 or one example multiplying it with 57.3 Confused about that 2. local heliData = LoGetHelicopterFMData() local message = string.format("Roll:%.2f|Yaw:%.2f\n", heliData.roll, heliData.yaw)Same here, i have no idea what kind of values i get, but its not in degree i think. 3. Ive found the Mist Tools which have a getRoll and getYaw function which should exactly do what i want. Therefore, my question is, how to get the current unit controlled by the player? --local planeId= LoGetPlayerPlaneId() --local unit = Unit.getById(planeId) This snippent wont do it unfortunately :noexpression: Thanks already, hope some of you pro guys can help me :) Claudio Edited March 23, 2014 by Claudio Fixed some typos
towsim Posted March 23, 2014 Posted March 23, 2014 The results are usually given in radians. To get degree, multiply the result with 57.2957795131. The factor comes from 180.0 / PI. As far as I know, the access to local plane data are only possible via export.lua functions. I never could get it with any MIST function. But I am not a MIST specialist. Via export.lua: local o = LoGetSelfData() -- the ownship data set o.LatLongAlt.Lat -- Latitude in degress o.LatLongAlt.Long -- Longitude in degress o.LatLongAlt.Alt -- Altitude in meters MSL o.Heading -- Heading in radians o.Pitch -- Pitch in radians o.Bank -- Bank in radians [sIGPIC][/sIGPIC]
Claudio Posted March 23, 2014 Author Posted March 23, 2014 Thank you very much for the explanation, this makes sense to me. The point with mist is, i extracted getRoll/getYaw and any needed mist.vec.* function its needing. The only point is, i should pass a Unit object to getRoll and i am not sure how to get the unit object which is currently player controlled in the Export.lua. Should be pretty simple i guess but i dont get it :( Anyway, will get deeper in what you said, thanks again Greets from switzerland and many happy landings
Claudio Posted March 23, 2014 Author Posted March 23, 2014 Ah very nice, i actually want pitch instead of yaw :D Works nicely since i know its radians, thanks again. PS: will post a link as soon as i put my code onto github. Maybe someone find it useful with a phyton daemon listening on a raspberry pi ;)
Claudio Posted March 23, 2014 Author Posted March 23, 2014 Its on github what i have so far. Now i am waiting for my stepper motors to move my cockpit model :) https://github.com/claudio-walser/SimCockpit
Recommended Posts