Question Raising landing gear via API

Mogeley

New member
Joined
Jan 4, 2009
Messages
38
Reaction score
0
Points
0
I'm using Lua scripting to write a general purpose autopilot. I've looked everywhere in the Orbiter API doc for how to raise the landing gear. I must be missing it somewhere. Does anyone know how to raise the landing gear using the regular Orbiter API. From that I can apply it the Lua scripting.

Thanks!
 

dbeachy1

O-F Administrator
Administrator
Orbiter Contributor
Addon Developer
Donator
Beta Tester
Joined
Jan 14, 2008
Messages
9,218
Reaction score
1,566
Points
203
Location
VA
Website
alteaaerospace.com
Preferred Pronouns
he/him
Unfortunately you cannot operate a ship's landing gear via an Orbiter API call; landing gear is vessel-specific. Some vessels, such as capsules and deep-space vessels, do not even have landing gear. If a vessel has landing gear it must be manipulated by code in its DLL that 1) performs the animation, 2) updates the indicators on the panel (if any), 3) invokes RecordEvent for playback purposes later, 4) updates (changes) the ship's touchdown points, etc.
 

orb

New member
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
I'm using Lua scripting to write a general purpose autopilot. I've looked everywhere in the Orbiter API doc for how to raise the landing gear. I must be missing it somewhere. Does anyone know how to raise the landing gear using the regular Orbiter API. From that I can apply it the Lua scripting.

Thanks!
There is nothing like retractable gear defined in the API. There are only definable touchdown points and surface friction coefficient for vessel and set of animations for gear mesh groups, and that's all what simulates gear raising or deploying in vessel modules.

Most vessels define 'G' key for operating gear, so you can use send_bufferedkey to retract or deploy gear from LUA script.
 

martins

Orbiter Founder
Orbiter Founder
Joined
Mar 31, 2008
Messages
2,448
Reaction score
462
Points
83
Website
orbit.medphys.ucl.ac.uk
The landing gear is not controlled by the API, but by individual vessel implementations. If you want a Lua interface for manipulating a vessel's landing gear, you need to implement the clbkGeneric method for the vessel, to respond to VMSG_LUAINTERPRETER and VMSG_LUAINSTANCE messages.

The VMSG_LUAINTERPRETER is called whenever an interpreter is opened inside a specific vessel context (e.g. a Lua MFD for that vessel).

The VMSG_LUAINSTANCE is called whenever an instance of the vessel is created within a Lua session.

If you want Lua to support custom commands for a vessel class, implement the corresponding commands inside the response to VMSG_LUAINSTANCE. See for example the DeltaGlider sources. File DGLua.cpp contains the implementations for the responses to both VMSG_LUAINTERPRETER (auto-loads the atmospheric autopilot) and VMSG_LUAINSTANCE (implements custom Lua commands, including landing gear control).

Note that the HST code also implements some custom Lua controls. This may be a bit easier to read than the DG sources, since there is not so much other stuff around.
 

Mogeley

New member
Joined
Jan 4, 2009
Messages
38
Reaction score
0
Points
0
Thanks for the feedback. I should be able to figure it out from what you told me.
 
Top