Useful on-the-fly equations for Orbiter

Enjo

Mostly harmless
Addon Developer
Tutorial Publisher
Donator
Joined
Nov 25, 2007
Messages
1,665
Reaction score
13
Points
38
Location
Germany
Website
www.enderspace.de
Preferred Pronouns
Can't you smell my T levels?
:hesaid:
You might want to read Launch MFD's documentation - information for developers at the end of the PDF. The PID is explained there as well in more detail (well PD actually).
 
Last edited:

C3PO

Addon Developer
Addon Developer
Donator
Joined
Feb 11, 2008
Messages
2,605
Reaction score
17
Points
53
If you can drive a bicycle, you know enough. If you have a deviation right, steer left.

Bad example! If you add motorbikes to your divers license you'll learn how to do an avoidance maneuver. You actually steer opposite to the way you want to go.
To change direction you have to move the center of gravity (CoG) in the direction you want to go, and you do that by steering the opposite way. The caster angle will make the bike turn after the CoG has moved. Try cycling really close to the curb.

That's why it takes children a bit of time to learn to ride a 2-wheeled bike.
 

Urwumpe

Not funny anymore
Addon Developer
Donator
Joined
Feb 6, 2008
Messages
37,632
Reaction score
2,351
Points
203
Location
Wolfsburg
Preferred Pronouns
Sire
Bad example! If you add motorbikes to your divers license you'll learn how to do an avoidance maneuver. You actually steer opposite to the way you want to go.
To change direction you have to move the center of gravity (CoG) in the direction you want to go, and you do that by steering the opposite way. The caster angle will make the bike turn after the CoG has moved. Try cycling really close to the curb.

That's why it takes children a bit of time to learn to ride a 2-wheeled bike.

The correct term for this is [ame=http://en.wikipedia.org/wiki/Countersteering]Countersteering[/ame].

"I have asked dozens of bicycle riders how they turn to the left. I have never found a single person who stated all the facts correctly when first asked. They almost invariably said that to turn to the left, they turned the handlebar to the left and as a result made a turn to the left. But on further questioning them, some would agree that they first turned the handlebar a little to the right, and then as the machine inclined to the left, they turned the handlebar to the left and as a result made the circle, inclining inward." (Wilbur Wright)

(Thinking about it, I also used countersteering pretty often at higher speeds, when I last sat on a bike)
 

Thorsten

Active member
Joined
Dec 7, 2013
Messages
785
Reaction score
56
Points
43
Bad example! If you add motorbikes to your divers license you'll learn how to do an avoidance maneuver. You actually steer opposite to the way you want to go.

To steer (definition): 1. To guide by means of a device such as a rudder, paddle, or wheel. 2. a. To direct the course of.

You're confusing steering with turning the handle.
 

BLANDCorporatio

New member
Joined
May 29, 2013
Messages
67
Reaction score
0
Points
0
:rolleyes: Aww come on, we're going to argue semantics when it was clear what everyone meant?
 

Thorsten

Active member
Joined
Dec 7, 2013
Messages
785
Reaction score
56
Points
43
Well, admittedly I find the whole detour to what direction to turn the handle a bit silly in the first place - so if we must take that detour for whatever reason, then we should take it based on what my words actually mean. If it's important in detail by what motions to steer a bicycle, then why is it not important what 'to steer' really means? I mean, if you want to toy around, I can do that. But I'd prefer to have the original discussion.


The discussion was about how complicated the math underlying certain things is, whether you need a differential equation solver or can just 'do it'. And my point was that you can just do it without understanding differential equations, and that point is what matters.

If you want to stop a bicycle at traffic lights, you need to get the position to a certain value and at the same time velocity to zero. In terms of differential equations, you simultaneously monitor errors from velocity integrals and velocity itself. And if you brake too hard, you'll fly over the handlebar, so you also have constraints on velocity differentials. That's Urwumpe's PID controller.

Yet - we can do this quite easily. We don't need to solve the math in our heads, we can just stop a bicycle at traffic lights. In the same way, it's far easier to fly a Shuttle back to the runway after re-entry than to write the guidance software that does it for you (I've been amusing myself playing with some AP filters for guided re-entry, and I agree with Urwumpe that this is a fairly tough problem to code in a stable manner).

Yeah, I know that control theory is just making adjustments to inputs based on outputs, but differential equations and applied maths in general really interest me.

Well, that's a different direction from the original thread. I think the math isn't that terribly hard to understand. What's hard in coding a guidance system is to tune it, i.e. to avoid overcorrections and pilot-induced oscillations - so to make it respond rapidly enough so that it can respond to changing environment, but not too rapidly so that it doesn't oscillate.

What I've tried for my re-entry guidance code was to define a target deceleration.

So in every timestep, I can compute Delta_a = a_actual - a_desired. Based on that, I adjust lift/drag from zero to some max. value of my spacecraft (technically I could control this via bank angle).

One trick is what filter to use - I've chosen a linear response such that there's full response if |Delta_a|>1
So that leads to oscillations. These I've damped by requiring that L/D (n) - L/D(n-1) < step, so each timestep I may only change the response of the spacecraft by so much. That helps a bit, but still leads to oscillations.

Next I've been monitoring the derivative of Delta_a, arguing that the guidance system should drive to make the change of acceleration small when we're close to the target value, so we won't overshoot.

So a second filter monitors Delta_a (n) - Delta_a (n-1) if |Delta_a|< 0.3 and adjusts L/D such as to drive the derivative of Delta_a to zero if its value is that close to target.

That gives me a satisfactory guidance, but I have to adjust all constants, the response and the timings, to the particular spacecraft layout in terms of L/D, and also somewhat to the trajectory - so it's a three parameter tuning problem. And in the acceleration curves, you can see how the guidance system struggles to keep the limit, but by and large it does a decent job. But I could do it better by hand, see above.

It's this kind of thing you need to consider. Actually my code isn't very lengthy - if you're interested and want to play with re-entry dynamics and the rudimentary guidance, I'd be happy to let you have it.
 
Last edited:
Top