## Manipulating bodies under changing physical environment

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

### Manipulating bodies under changing physical environment

I was wondering if someone would share some insight into a bit of a conundrum I'm currently working on. This is a general physics question, nothing specific on Newton, but since I'm using Newton, I thought it would be appropriate to ask here.

I am trying to roll a cylinder by an exact amount of, let's say, 60 degrees. I am applying external forces to it which, in their configuration, produce a perfect longitudinal torque, thus rolling the cylinder on its longitudinal axis.

In ideal conditions, this would be fairly straight forward:

-Apply forces to initiate the roll
-At a half way point (30 degrees in this case) reverse the forces
-At zero axial omega, stop the forces. The body should be at exactly 60 degrees.

However - there are several factors I have to consider in my case:

-The body is losing mass - it is becoming lighter and thus has less moment of inertia with time
-The body has to contend with an angular damping coefficient which is decreasing with time.

This is due to the factors specific to my situation: It is a rocket, being launched through atmosphere. Cylinder is a rocket body, and it is losing mass as it burns fuel. Angular damping coefficient is the resistance to rotation in atmosphere, and it decreases as the atmosphere gets thinner.

With the factors above, it is apparent that if I reverse the forces at half way point, the roll will be stopped before I reach the goal of 60 degrees, since it requires less torque to stop a lighter body.

I need to calculate a point, during the roll, sometimes after 30-degree mark but before 60 degrees, where I can reverse the torque, to end up at exactly 60 degrees.

Any thoughts on this?
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho

Posts: 553
Joined: Tue May 04, 2010 10:13 am

### Re: Manipulating bodies under changing physical environment

that's actually very simple to do, you do not even need joints, unless there are other bodies attach to the cylinder.

Basically start form the pure definition of change of angular momentum in the local space of the cylinder, and there is already a one dimensional problem.

let:
L be the angular moementon
w the local angual velocity alone the cylinder axis.
I the local inertia along the
T the external torque you need to apply

from the definition, the rate of change of the angular momentum is equal to eth external torque.
here the Inertia is variable

so you write
L = I * w

the time derivative of the angular momentum is the torque, since I is variable, you need to apply the derivative of a product.
d(I * w)/dt = T
d(I)/dt * w + I * d(w)/dt = T

now d (I)/dt is the rate at which the cylinder gain or loose mass, (also know as trust) let of call that
small r, d(w)/dt is the acceleration

now re you have
r * w + I * a = T

an rearranging you get

I * a = T - r * w

let us say you apply some arbitrary torque, that opposes the motion
for example

when w > 0, T is a negative toque value. -T0
so you have

I * a = T0 - r * w

you calculate -T0 - r * w

and if the value is also positive, it means it will not reverse the rotation, so you calculate
a = (-T0 - r * w)/I
and integrate the cylinder.

if -T0 - r * w change sign, it means it will reverse the rotation so you need to determine the torque to reach zero
0 = -T0 - r * w
and T = -r * w

in general you apply a fraction of the exact value
T = - frac * r * w

now you calculate
a = (T - r * w)/I

and integrate the body

when the w < 0 you do the same except that now the torque is positive T0

derivatives are a wonderful thing, once you understand what the mean,
you can solve very much any problem that can have any analytical representation.
Julio Jerez
Moderator Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: Manipulating bodies under changing physical environment

Thanks! I KNEW there was calculus somewhere in there Unfortunately - There ARE bodies attached to the main rocket body (cylinder)... Two huge booster rockets, and they are also losing mass - and fast! They also might participate in rotating the assembly (although they are not at the present, I have to research this - but my solution needs to be universal)

Also - the whole assembly has about 25 bodies, all rocket parts. These body parts do not "participate" in thrust nor do they change weight. They are, however, integral parts of the rocket, which will be discarded at some point, or will also be under their own thrust (rocket stages)

Is calculus more complicated with the assembly of bodies?

I was hoping there was a different approach - sort of, "instrumentational", for example, monitoring the goal angle, the omega, and adjusting thrusts (torque) until the goal is reached...
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho

Posts: 553
Joined: Tue May 04, 2010 10:13 am

### Re: Manipulating bodies under changing physical environment

Yes is far more complicated if there are connected bodies that what a physics engine does. but you have a physics engine all you nee to know is that the magic of the system is that the rate ate which you lose mass is in fact a torque. so when you add that quantity as a external toque along the axis of interest, the object will spin in order to preserve momentum,

if there are bodies attached the solution is the same but is not longer one dimensional, for that you need to use a joint, that regulate the desire angular velocity, the only new thong is that you need to add the value -r * w and an external torque,

imagine a singe cylinder that you add a joint to control it angular velocity.
the cylinder will never do anything, even fi you deduce the mass.
but we know that as the mass reduces the collider will gain angular velocity.

well that happens if you add the value
Te = -r * w as external torque to the body, and you will see that like magic as the mass is reduced the cider gain angular velocity

now all you need to do is add a hinge that apply a velocity control if the target angle has no been reach. Is no different that using a motor, only the motor is a brake.
Julio Jerez
Moderator Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: Manipulating bodies under changing physical environment

Julio Jerez wrote:now all you need to do is add a hinge that apply a velocity control if the target angle has no been reach. Is no different that using a motor, only the motor is a brake.

Yes - but that is not realistic - is it? I think what you are suggesting is adding another influence into the system - almost something like a CMG (control moment gyro) to stop the rotation.

But I cannot do that. All I have to use is the thrust itself. Torque is created by vectored thrust, and my control over this is changing force vector direction, that is all. That's how real rockets work - they gimbal their thrust nozzles to steer the rocket in desired direction, or, as in my case, induce the roll.
Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho

Posts: 553
Joined: Tue May 04, 2010 10:13 am

### Re: Manipulating bodies under changing physical environment

It is realistic, that's how thrust is calculated is the rate at which you lose or gain mass time the velocity vector, and that quantity is a real force or torque.
let it be angular of linear if you look up for thrust calculation in the internet you will find it,
here this is from nasa.
https://www.grc.nasa.gov/www/k-12/airplane/thrsteq.html

which remarkable is like word for word what I said except they do it for linear velocity which is more intuitive but my explanation of more mathematically sound, a rate of change in calculi is just a derivative. the let you calculate nit just mass lose but also position changes (gyro, Coriolis, centripetal, flow, etc) and all kind of other effects generated anything changing.

The newton engine does consider that the mass of inertia of the body is variable. but like I said before you can just add and add it in the force and torque callback as

the rater of mass lost that's r = delta mass / dt
time the angular of linear velocity

that is T = - r * w

and you will see that the while thing will start move.

then you nee some damper, whi you can model with a joint, because you

if you do not want to use a joint, you can still use the same idea wan invert the thruster the is ejecting the mass to apply the damper. but that is how thrust is generated by the book.
Julio Jerez
Moderator Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: Manipulating bodies under changing physical environment

Thanks Julio! Let me chew on this for a bit, see how far I can get... I'm sure I'll have more questions soon Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho

Posts: 553
Joined: Tue May 04, 2010 10:13 am

### Re: Manipulating bodies under changing physical environment

Ok - I am stuck on this and getting nowhere fast. I understand the math (I think), but the problem is in the nature of how much control I have over the factors, namely:

I only have control over a set amount of thrust - the thruster force is constant, I cannot vary it.

The rocket body is controlled by the thrusters positioned on the rocket body, which produce a set amount of thrust, and they are either on or off. They also have directional nozzles pointing in fixed directions. Let me illustrate using this pretty diagram I put together Below is the image of a cross section of the rocket body (Cylinder) with 4 thrusters mounted every 90 degrees along the circumference of the body. Each thruster has 2 nozzles pointing in opposite directions. They are used to control rocket body roll. First case is where the rocket body has a constant mass (let's assume that the thrusters don't lose any mass when firing). The goal is to rotate rocket body by exactly 60 degrees clockwise:

Diagram A: thrusters fire (red arrows) and set clockwise rotation in motion
Diagram B: at exactly half point (30 degrees) thrusters reverse direction
Diagram C: at exactly 60 degrees, rocket body roll is stopped and thrusters cut out

With no other external factors (damping, drag, etc) this maneuver would result in the exact desired amount of roll. Next, let's consider the case where the rocket is losing mass (due to, let's say, main rocket engines firing and spending fuel). Same setup - we want to use thrusters only to roll the rocket by 60 degrees: Same sequence:

Diagram A: thrusters fire (red arrows) and set clockwise rotation in motion
Diagram B: at exactly half point (30 degrees) thrusters reverse direction
Diagram C: this time, when the rocket body roll is stopped and the thrusters are cut, the ending rotation falls short of desired 60 degrees, because the rocket lost mass during the roll time, and it was "easier" to stop it.

So - the problem is, using nothing but the thruster firing timing - I need to calculate when, during the roll cycle, should the thruster direction be reversed in order to stop the rotation at exactly the desired angle amount. This value will be (in this case) sometimes after the 30 degree roll point, and obviously before the 60 degree roll target.

In the first case, with mass being constant, the problem is linear, and that's why it can be solved using constant thrust. In the second case, the mass loss is introduced, and IF I could control the amount of thrust coming out of the thrusters (variable thrust), I could compensate for mass loss and make the problem linear again. But, I can't - the thrusters have one, constant thrust setting. So, the problem becomes the one of timing the thruster firing.

And that's where I'm (still) stuck - how to calculate at which point, going from 0 to 60 degrees, should I reverse thrusters so that they would stop the body rotation at exactly 60 degrees.  Misho Katulic
CTO, FSX SpacePort
TerraBuilder
www.terrabuilder.com
misho

Posts: 553
Joined: Tue May 04, 2010 10:13 am

### Re: Manipulating bodies under changing physical environment

but that should not be that complicated.
the relation between torque and angular velocity is linear for small angular velocities. you can make a plot that let you determine the effective inertia, any you can use that to make small corrections.
Julio Jerez
Moderator Posts: 11048
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles 