Step Impulse Jet Experiment
3 posters
RigidChips :: Rigid-Chips :: Files :: Others
Page 1 of 1
Step Impulse Jet Experiment
Hmm... so, what do I make of it? It is an experimental control system that exploits the characteristics of the RC engine for very precise altitude control. In RC (and any physics simulation), time is broken down into intervals (frames), and in most of them, RC included, any physical property (position, velocity, force, etc.) within one interval is assumed to be constant. In other words, any force applied to a chip, e.g. jet thrust, is assumed to be acting onto the jet constantly over the entire time interval, and that the jet would be accelerated to a certain velocity based on the given resulting impulse:
dV = F/m*dt, where
dV = change in velocity
F = jet thrust
m = mass of the jet
dt = time interval
Afterwards, it's easy to set a jet's velocity so that it jumps to the target altitude within one frame, or up to the speed limit, whichever is lower.
You may notice that the only one jet in this model magically stays upright, courtesy to another property of the RC engine: that the jet's thrust acts exactly at the centre of it, and that it experiences no air resistance or other external forces. Its balance would be thrown off if it hits the terrain of if any chip except cowl is attached to it. For this reason, this control system, as it is, has no use besides looking cool.
dV = F/m*dt, where
dV = change in velocity
F = jet thrust
m = mass of the jet
dt = time interval
Afterwards, it's easy to set a jet's velocity so that it jumps to the target altitude within one frame, or up to the speed limit, whichever is lower.
You may notice that the only one jet in this model magically stays upright, courtesy to another property of the RC engine: that the jet's thrust acts exactly at the centre of it, and that it experiences no air resistance or other external forces. Its balance would be thrown off if it hits the terrain of if any chip except cowl is attached to it. For this reason, this control system, as it is, has no use besides looking cool.
- Code:
// [RCD]
Val
{
JETPWR(default=0, min=-999999999, max=999999999, disp=0)
STEPTIMESWITCH(default=0, max=1, disp=0)
}
Key
{
}
Body
{
Core() {
N:Jet(power=JETPWR, name=JET) { }
}
}
Lua
{require("Bernard/Basic.lua")
function init()
_SPLIT(JET)
m = _M(JET)
g = 9.806
wt = m*g
y0 = _Y(JET)
vy0 = 0
tgty = 45
settgty = tgty
maxvy = 150
jet = {p = 0, i = 0, d = 0}
end
function OnInit()
init()
end
function OnReset()
init()
end
function OnFrame()
dt = _DT()*10
maxstep = maxvy*dt
y = _Y(JET)
vy = (y-y0)/dt
dy = y-tgty
ay = (vy-vy0)/dt
y0 = y
vy0 = vy
settgty = settgty+(_KEYDOWN(9)-_KEYDOWN(6))
settgty = settgty+10*(_KEYDOWN(8)-_KEYDOWN(5))
settgty = settgty+100*(_KEYDOWN(7)-_KEYDOWN(4))
settgty = limit(settgty,45,1000)
if _KEYDOWN(13) > 0 then
tgty = settgty
if _KEY(12) > 0 then
STEPTIMESWITCH = 1
end
end
if _KEY(0) > 0 or _KEY(1) > 0 then
tgty = limit(tgty+(_KEY(0)-_KEY(1))*maxvy*dt,45,1000)
settgty = tgty
end
-- tgty = 50+5*sind(_TICKS()*30)
tgtvy = limit(-dy/dt,maxvy,-maxvy)
thr = (tgtvy-vy)/dt
JETPWR = 6*m*(g+thr)
out(0,"Step impulse jet experiment by Bernard (bwansy)")
out(1,"Target altitude: ",settgty)
out(2,"Current altitude: ",y)
out(3,"Velocity: ",vy)
out(4,"[A/Z/S/X/D/C] to change altitude, press [G] to travel")
out(5,"[Up/Down] to traverse in real time")
out(6,"Setting camera focus onto the jet is recommended")
end}
Re: Step Impulse Jet Experiment
WHOA
I like how you made it able to 'sense' where the 'ground' is, so I doesn't go below or get stuck in walls.
Though I think I'm getting an error, I have your Library, but I can not us A/Z/S/X/D/C what so ever, G will work once and a while, but that only brings me 'one' level higher, and Up/Down works, so I have a bit of travel.
I can't move from X or Z but I can on Y
Hope this helps, maybe I'm doing something wrong?
I like how you made it able to 'sense' where the 'ground' is, so I doesn't go below or get stuck in walls.
Though I think I'm getting an error, I have your Library, but I can not us A/Z/S/X/D/C what so ever, G will work once and a while, but that only brings me 'one' level higher, and Up/Down works, so I have a bit of travel.
I can't move from X or Z but I can on Y
Hope this helps, maybe I'm doing something wrong?
Last edited by Timothy Ashtön on Sat Jan 14, 2012 1:28 pm; edited 1 time in total (Reason for editing : Error's like usual...)
Re: Step Impulse Jet Experiment
That's because there is no means to apply force along the X or Z plane with this. There is only the one perfectly balanced jet.Timothy Ashtön wrote:I can't move from X or Z but I can on Y
MrSparks- Tank
- Posts : 73
Join date : 2012-01-05
Age : 33
Location : Michigan
Re: Step Impulse Jet Experiment
No, it doesn't. There's a hard-coded lower limit on height of 45m (and an upper limit of 1000m).Timothy Ashtön wrote:I like how you made it able to 'sense' where the 'ground' is
As for the controls, I admit that I didn't have it explained well. Basically, those 6 keys (A/Z/S/X/D/C) are responsible for changing the target height. D/C changes the units digit, S/X changes the tens, and A/Z, the hundreds. Only when the target height is changed from the current height will pressing G have any effect.
Re: Step Impulse Jet Experiment
bwansy wrote:No, it doesn't. There's a hard-coded lower limit on height of 45m (and an upper limit of 1000m).Timothy Ashtön wrote:I like how you made it able to 'sense' where the 'ground' is
? It stop'd for me on other maps.
RigidChips :: Rigid-Chips :: Files :: Others
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum