my first ever spacecraft
5 posters
RigidChips :: Rigid-Chips :: Files :: Others
Page 1 of 1
my first ever spacecraft
well this is my first creation to ever use rotational script. It's ok, but it has some pitch problems. use it with gravity and air friction off.
Z and X for altitude, <- and -> arrows for yaw, ^ and V arrows for forward/back.
oh and does any1 have any tips on making it auto-balance it's pitch a little better?
- Code:
// [RCD]
Val
{
FORWARDJET(default=0, min=-50000, max=50000, step=50000)
MAINJET(default=0, min=-50000, max=50000, step=50000)
PITCHJETS(default=0, min=-9999999, max=9999999, step=9999999)
ROLLJETS(default=0, min=-9999999, max=9999999, step=9999999)
YAWJET(default=0, min=-5000, max=5000, step=5000)
}
Key
{
0:FORWARDJET(step=50000)
1:FORWARDJET(step=-50000)
2:YAWJET(step=-5000)
3:YAWJET(step=5000)
4:MAINJET(step=50000)
5:MAINJET(step=-50000)
}
Body
{
Core() {
E:Frame(angle=90) {
E:Frame(angle=-60) { }
N:Frame(angle=30) {
N:Chip(angle=-30) {
S:Frame(angle=30) { }
N:Frame() { }
}
}
}
N:Frame(angle=90) {
N:Frame(angle=-60) { }
}
W:Frame(angle=90) {
W:Frame(angle=-60) { }
S:Frame(angle=30) {
S:Jet(angle=-30, power=YAWJET) { }
}
}
E:Jet(power=-ROLLJETS) { }
W:Jet(power=ROLLJETS) { }
S:Jet(power=PITCHJETS) { }
N:Jet(power=-PITCHJETS) { }
S:Jet(angle=90, power=-FORWARDJET) {
S:Jet(angle=90, power=-MAINJET) { }
S:Frame(angle=-60) { }
}
}
}
Script
{if _TODEG(_AX(core))<(0){
PITCHJETS=_AX()*30000}
if _TODEG(_AX(core))>(0){
PITCHJETS=_AX()*30000}
if _TODEG(_AZ(core))<(0){
ROLLJETS=_AZ()*300000}
if _TODEG(_AZ(core))>(0){
ROLLJETS=_AZ()*300000}}
Z and X for altitude, <- and -> arrows for yaw, ^ and V arrows for forward/back.
oh and does any1 have any tips on making it auto-balance it's pitch a little better?
Sting Auer- Hover
- Posts : 170
Join date : 2010-09-19
Location : Aw crap i think I'm lost.
Re: my first ever spacecraft
First, I'm glad that you've worked out a "proportional controller", i.e. the jets' powers being proportional to the tilting angles, rather than the original "on/off" controller you had. This is how most modern controllers work. They act like springs that are constantly trying to pull the spacecraft back to level.
There is some redundancy in your script. Namely, your if statements are unnecessary. If you take a closer look, the control for PITCHJETS are the same in both statements are identical. That is like saying "if it's hot, play outside; if it's cold, play outside" XD When _AX() goes negative, PITCHJETS becomes negative as well, so it would work completely fine without those IF statements. The same applies to ROLLJETS.
As for the pitching problem, it is because there's no friction. Without friction to make the oscillation die out, the spacecraft would naturally pitch up and down indefinitely. To cope with this, we need to add some artificial friction: a force that reacts to the pitching speed. _WX() gives you the pitching rate, and we can simply add that to the PITCHJETS control, so that it becomes:
You have to adjust "constant" yourself to achieve the best result, and keep in mind that it may be negative. Good luck!
There is some redundancy in your script. Namely, your if statements are unnecessary. If you take a closer look, the control for PITCHJETS are the same in both statements are identical. That is like saying "if it's hot, play outside; if it's cold, play outside" XD When _AX() goes negative, PITCHJETS becomes negative as well, so it would work completely fine without those IF statements. The same applies to ROLLJETS.
As for the pitching problem, it is because there's no friction. Without friction to make the oscillation die out, the spacecraft would naturally pitch up and down indefinitely. To cope with this, we need to add some artificial friction: a force that reacts to the pitching speed. _WX() gives you the pitching rate, and we can simply add that to the PITCHJETS control, so that it becomes:
- Code:
PITCHJETS=_AX()*30000+_WX()*constant
You have to adjust "constant" yourself to achieve the best result, and keep in mind that it may be negative. Good luck!
Last edited by bwansy on Fri Sep 24, 2010 11:15 am; edited 1 time in total
Re: my first ever spacecraft
thanks bwansy.
oh and it seems like all of the X Y Z statements just have a different letter in front to change the type of X Y Z it is, am i right?
EDIT: i tested it without the other if statements.
it doesnt work. the jets only work in one direction at that point.
REEDIT(omg...): ok im an idiot i made a mistake when testing the non-redundant thing. my bad. now it works.
oh and it seems like all of the X Y Z statements just have a different letter in front to change the type of X Y Z it is, am i right?
EDIT: i tested it without the other if statements.
it doesnt work. the jets only work in one direction at that point.
REEDIT(omg...): ok im an idiot i made a mistake when testing the non-redundant thing. my bad. now it works.
Sting Auer- Hover
- Posts : 170
Join date : 2010-09-19
Location : Aw crap i think I'm lost.
Re: my first ever spacecraft
you are great! (omg i will spam the entire forum but i simply have to write this now!) thx for making and posting your spacecraft here. You saved me about 3 hours with your stabilizing script which i can now adapt for my cruiser (well it is about 400 times as heavy as your craft but im sure it will work)
Warbird- Tank
- Posts : 60
Join date : 2010-10-27
Age : 29
Location : Germany
Re: my first ever spacecraft
your welcome!
i was going to adapt it to make a space vehicle that has pitch/roll/yaw controls. i just havnt gotten around to it yet.
i was going to adapt it to make a space vehicle that has pitch/roll/yaw controls. i just havnt gotten around to it yet.
Sting Auer- Hover
- Posts : 170
Join date : 2010-09-19
Location : Aw crap i think I'm lost.
Re: my first ever spacecraft
well i would make controls for flying sidewise (just small jet bursts) instead of rolling controls as flying sidewise is quite useful in space when you have to manouver around in limited areas
Warbird- Tank
- Posts : 60
Join date : 2010-10-27
Age : 29
Location : Germany
Re: my first ever spacecraft
BTW, most modern controls are PID controllers, which to implement on rigidchips would require some extra math(but it's apparently possible(checking some of owhari's models)).
RA2lover- Walker
- Posts : 382
Join date : 2010-10-11
Age : 29
Location : Brazil
Re: my first ever spacecraft
PID Controllers are indeed possible, and without much maths. Bwansy and I both use them in most of our vehicles.
JHaskly- Admin
- Posts : 235
Join date : 2010-07-16
Age : 28
Location : Brisbane
RigidChips :: Rigid-Chips :: Files :: Others
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum