API Question Set Center Of Pressure when key is pressed

zachary77

New member
Joined
Aug 31, 2017
Messages
80
Reaction score
1
Points
0
I'm a total newbie to C++ and the API, so please excuse my ignorance:)

I'm designing a tailsitter rocket (pain to land, I must say). So, to assist with keeping the nose vertical, I would like to implement a system that:
  • Sets the COP when a key is pressed (K to shift forward, M for aft)
  • Overrides HLVL AP to hold 90 deg pitch
  • Overrides ALT HOLD AP to use mains

How would I go about it? So far, whatever I've tried has broke my code:facepalm:

Any help would be welcome.

Thanks,
Zachary77
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,616
Reaction score
2,336
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Well, I would take a look at the lift function in your first case, especially the context parameter. To be specific - you can solve this by moving the COP as reference of the airfoil or by changing the moment function of the airfoil to have the effects of a different COP. I would try the latter if you try to create the COP shift by aerodynamic means. If you want to have a CoG shift instead by moving mass.

The second and third would be a bit harder, but AFAIR, Orbiter 2016 has a new callback for exactly those cases.
 
Last edited:

zachary77

New member
Joined
Aug 31, 2017
Messages
80
Reaction score
1
Points
0
Well, I would take a look at the lift function in your first case, especially the context parameter.

The second and third would be a bit harder, but AFAIR, Orbiter 2016 has a new callback for exactly those cases.

Err... that's the issue. I don't understand the lift function at all. (Using ShuttlePB as template) What would I need to change?

Thanks for reply, BTW.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,616
Reaction score
2,336
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Err... that's the issue. I don't understand the lift function at all. (Using ShuttlePB as template) What would I need to change?

Thanks for reply, BTW.

Did the PB ever really have one? :lol: Take a look at the DG there for some initial idea.

Basically, you are supposed to calculate the following values there:

Lift coefficient
Drag coefficient
Moment coefficient

The latter value should be zero if the COP is the same position as the reference position of the airfoil.

If you shift the COP, you can shift the whole air foil. Or you start generating moment/torque that rotates the vessel.
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,403
Reaction score
581
Points
153
Location
Vienna
Urwumpe is right, there is a new callback (API reference p. 581): VESSEL4::clbkNavProcess(int mode). However, it just allows you to tell Orbiter that it should do nothing for a specific AP mode, giving your code the chance to do your own autopilot procedures. The later are not trivial to code, if you want them somewhat realistic.

For the center of pressure, could you please explain why you want that moved? Rotation assist during transition phase?
 

zachary77

New member
Joined
Aug 31, 2017
Messages
80
Reaction score
1
Points
0
Urwumpe is right, there is a new callback (API reference p. 581): VESSEL4::clbkNavProcess(int mode). However, it just allows you to tell Orbiter that it should do nothing for a specific AP mode, giving your code the chance to do your own autopilot procedures. The later are not trivial to code, if you want them somewhat realistic.

For the center of pressure, could you please explain why you want that moved? Rotation assist during transition phase?

Yes, to help stall the wing. Right now I need very overpowered RCS, which isn't precise at all.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,616
Reaction score
2,336
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Yes, to help stall the wing. Right now I need very overpowered RCS, which isn't precise at all.

So you mean something like a spoiler on an aircraft and the problem is actually lift force? Like, minimal forward speed resulting in you flying a curve already?
 

zachary77

New member
Joined
Aug 31, 2017
Messages
80
Reaction score
1
Points
0
So you mean something like a spoiler on an aircraft and the problem is actually lift force? Like, minimal forward speed resulting in you flying a curve already?

No, when I try to pitch up to 90 deg from level flight, I can't. It just oscillates up and down. If you've ever tried to realistically reenter the stock DG or Shuttle, you know what I mean:)
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,616
Reaction score
2,336
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
No, when I try to pitch up to 90 deg from level flight, I can't. It just oscillates up and down. If you've ever tried to realistically reenter the stock DG or Shuttle, you know what I mean:)

Yes, the aircraft is too stable then. So you want to destabilize it?
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,616
Reaction score
2,336
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Yes, to land easier.

Then simply make all moments zero, reduce lift for landing and have COP = CoG. This can be done by the context parameter - you can pass data from the vessel to the lift function that way.
 

Thorsten

Active member
Joined
Dec 7, 2013
Messages
785
Reaction score
56
Points
43
No, when I try to pitch up to 90 deg from level flight, I can't. It just oscillates up and down.

Isn't there a possibility to just reduce the pitching moment as function of alpha? This is what causes this behavior - for large alpha the pitching moment generated by this coefficient is larger than whatever moments airfoils/thrusters can generate - moving center of pressure around or nulling moments sounds like fudging the real issue to me...

(Note that planes which can do this in real life - the Su-27 for instance - usually have thrust vector control because airfoils have little action at high AoA - and TVC gives you very powerful moments.)
 

zachary77

New member
Joined
Aug 31, 2017
Messages
80
Reaction score
1
Points
0
Isn't there a possibility to just reduce the pitching moment as function of alpha? This is what causes this behavior - for large alpha the pitching moment generated by this coefficient is larger than whatever moments airfoils/thrusters can generate - moving center of pressure around or nulling moments sounds like fudging the real issue to me...

(Note that planes which can do this in real life - the Su-27 for instance - usually have thrust vector control because airfoils have little action at high AoA - and TVC gives you very powerful moments.)

So TVC is the best solution?
 

Thorsten

Active member
Joined
Dec 7, 2013
Messages
785
Reaction score
56
Points
43
I'm not familiar with the API or what kind of spacecraft precisely you have in mind, but in reality it would seem TVC is the best option to go from horizontal to tail-down hover flight - basically aerodynamical control won't do (in static hover, you have zero dynamical pressure on the airfoils and hence they have no action - not to mention that they're oriented the wrong way) and RCS thrusters would have to be rather powerful.

So TVC seems the natural choice for that kind of problem to me. It's still hard, mind - there's a reason the tail-down VTOL concept for aircraft was given up and modern VTOL jet craft have more complicated (and heavier) engine arrangements instead. Handling in tail-down hover is very difficult - expect to have to provide massive automated flight assistance...
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,403
Reaction score
581
Points
153
Location
Vienna
I think for tailsitter concepts you should work out what the stall speed in cruise flight is. If it is low enough, you can probably work with RCS mechanisms. If it is too high, I guess you can't really go without thrust vectoring.

I can imagine that a low-stall-speed aircraft can be made "unstable" enough to be able to pitch up beyond laminar air flow break-down, at which point RCS can take over because the aerodynamic forces it has to counter are already small enough.

Perhaps this report gives some hints on the power of real-life VTOL RCS concepts: https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19940030488.pdf .
 
Top