4throck
Enthusiast !
- Joined
- Jun 19, 2008
- Messages
- 3,502
- Reaction score
- 1,008
- Points
- 153
- Location
- Lisbon
- Website
- orbiterspaceport.blogspot.com
Since there are few simple LUA examples, here's something I'm playing with:
This will make a vessel named "VS-40" appear tilted to about ~85º launch angle. I'm using empirical values, because the rocket is elevated above ground (COG is set to 12 in the multistage .ini file) to match a launch tower.
This is typical of sounding rockets, for example, that have no RCS system, and are stabilized by fins.
To simulate the effect of tail fin induced roll I then manipulate the vessels angular velocity , according to dynamic pressure.
I've tested this with a multistage+guidance+sc3 simple rocket and it works perfectly, adding realism and custom behaviour :thumbup:
Code:
v1 = vessel.get_interface('VS-40')
v1:set_adcmode(0)
mode=RCSMODE.OFF
v1:set_rcsmode(mode)
pt1,pt2,pt3 = v1:get_touchdownpoints()
pt1.z=-18
v1:set_touchdownpoints(pt1,pt2,pt3)
pt1,pt2,pt3 = v1:get_touchdownpoints()
i = 1
while i <= 5 do
av = v1:get_angvel()
p = v1:get_dynpressure()
pav=p/100000*.01
b= vec.set(0.0,0.0,pav)
av=vec.add(av,b)
v1:set_angvel(av)
proc.wait_sysdt(.01)
end
This will make a vessel named "VS-40" appear tilted to about ~85º launch angle. I'm using empirical values, because the rocket is elevated above ground (COG is set to 12 in the multistage .ini file) to match a launch tower.
This is typical of sounding rockets, for example, that have no RCS system, and are stabilized by fins.
To simulate the effect of tail fin induced roll I then manipulate the vessels angular velocity , according to dynamic pressure.
I've tested this with a multistage+guidance+sc3 simple rocket and it works perfectly, adding realism and custom behaviour :thumbup: