RigidChips
Would you like to react to this message? Create an account in a few clicks or log in to continue.

my first ever spacecraft

5 posters

Go down

my first ever spacecraft Empty my first ever spacecraft

Post by Sting Auer Thu Sep 23, 2010 1:59 pm

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.

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
Sting Auer
Hover
Hover

Posts : 170
Join date : 2010-09-19
Location : Aw crap i think I'm lost.

Back to top Go down

my first ever spacecraft Empty Re: my first ever spacecraft

Post by bwansy Fri Sep 24, 2010 1:07 am

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:
Code:
PITCHJETS=_AX()*30000+_WX()*constant
EDIT: It should be _WX(), not _WY(). My bad. tongue

You have to adjust "constant" yourself to achieve the best result, and keep in mind that it may be negative. Good luck! Wink


Last edited by bwansy on Fri Sep 24, 2010 11:15 am; edited 1 time in total

bwansy
Admin

Posts : 170
Join date : 2010-07-15

https://rigidchips.forumotion.com

Back to top Go down

my first ever spacecraft Empty Re: my first ever spacecraft

Post by Sting Auer Fri Sep 24, 2010 10:37 am

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 lol! i made a mistake when testing the non-redundant thing. my bad. now it works.
Sting Auer
Sting Auer
Hover
Hover

Posts : 170
Join date : 2010-09-19
Location : Aw crap i think I'm lost.

Back to top Go down

my first ever spacecraft Empty Re: my first ever spacecraft

Post by Warbird Wed Oct 27, 2010 9:26 am

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
Tank

Posts : 60
Join date : 2010-10-27
Age : 29
Location : Germany

Back to top Go down

my first ever spacecraft Empty Re: my first ever spacecraft

Post by Sting Auer Wed Oct 27, 2010 7:26 pm

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.
Sting Auer
Sting Auer
Hover
Hover

Posts : 170
Join date : 2010-09-19
Location : Aw crap i think I'm lost.

Back to top Go down

my first ever spacecraft Empty Re: my first ever spacecraft

Post by Warbird Thu Oct 28, 2010 4:24 am

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
Tank

Posts : 60
Join date : 2010-10-27
Age : 29
Location : Germany

Back to top Go down

my first ever spacecraft Empty Re: my first ever spacecraft

Post by RA2lover Fri Oct 29, 2010 3:23 pm

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
RA2lover
Walker
Walker

Posts : 382
Join date : 2010-10-11
Age : 29
Location : Brazil

Back to top Go down

my first ever spacecraft Empty Re: my first ever spacecraft

Post by JHaskly Fri Oct 29, 2010 4:44 pm

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

Back to top Go down

my first ever spacecraft Empty Re: my first ever spacecraft

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum