desiredPitch and desiredRoll at a specific waypoint

All discussions & material related to Command's Lua interface

Moderators: angster, RoryAndersonCDT, michaelm75au, MOD_Command

Post Reply
Cheche
Posts: 11
Joined: Sun Feb 05, 2023 6:23 pm

desiredPitch and desiredRoll at a specific waypoint

Post by Cheche »

Hello,

I'm trying to use desiredPitch and desiredRoll (roll and pitch which can be modified), but not successfully.

Example :
local aircraft = ScenEdit_AddUnit({name='MF51', side='BLUE', DBID='3931', LoadoutID='6201', type='Air', latitude='48.1', longitude='2', altitude='1500 ft', heading=090, manualSpeed=350});

If i type :
aircraft.pitch=40;
the aircraft pitches to +40°
Same if i use :
aircraft.roll=-40;
the aircraft rolls to the left 40°
It then come back to it's initial attitude.

Now, what i would like to do is to have an aircraft flying, and at a specific waypoint i want this aircraft to take a specific Roll or Pitch.

Example :
local aircraft = ScenEdit_AddUnit({name='MF51', side='BLUE', DBID='3931', LoadoutID='6201', type='Air', latitude='48.1', longitude='2', altitude='1500 ft', heading=090, manualSpeed=350});
local route = {[1] = {description='wpt1', latitude='48.1', longitude='2.1', DesiredAltitude='1500 ft', desiredSpeed=350}, [2] = {description='wpt2', latitude='48.1', longitude='2.2', DesiredAltitude='1500 ft', desiredSpeed=360}, [3] = {description='wpt3', latitude='48.1', longitude='2.3', DesiredAltitude='1500 ft', desiredSpeed=370}};
avion.course = route;

I've tried to had desiredPitch or desiredRoll data in the table of route but it's not working (i think because it's not included in waypoint wrapper).
local route = {[1] = {description='wpt1', latitude='48.1', longitude='2.1', DesiredAltitude='1500 ft', desiredSpeed=350, desiredPitch=40}, [2] = {description='wpt2', latitude='48.1', longitude='2.2', DesiredAltitude='2000 ft', desiredSpeed=360, desiredPitch=-20}, [3] = {description='wpt3', latitude='48.1', longitude='2.3', DesiredAltitude='1500 ft', desiredSpeed=370}};

Any idea how to solve this ? Maybe create a function which look continuously to the aircraft position and when it reaches the good coordinates it acts on the pitch / roll ?

Many thanks.
Post Reply

Return to “Lua Legion”