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

Harpoon E-1 Guided Missile

4 posters

Go down

Harpoon E-1 Guided Missile Empty Harpoon E-1 Guided Missile

Post by Warbird Thu Dec 02, 2010 11:31 am

Here it is:
My first guided missile prototype.
At the moment it doesnt shoot/explode because its still not finished.
Im really happy about the stabilization and the guiding system this missile has. Although it doesnt hit anything at all because of the random error its pretty good so far.
The other aspect of this project was to make a foldable missile which made the whole project a lot more complex but its succesful after all!

Press A to start the missile, the missile does the rest (only short... and dont hold the key otherwise it will malfunction)
Oh and by the way: Dont start it when unbreakable is off....

Code:
// [RCD]
Val
{
   ARMED(default=0, max=1)
   BDX(default=0, min=-10000)
   BDY(default=0, min=-10000)
   BDZ(default=0, min=-10000)
   DX(default=0, min=-10000)
   DY(default=0, min=-10000)
   DZ(default=0, min=-10000)
   ENG(default=0)
   LAUNCH1(default=0, max=2)
   LAUNCH2(default=0, max=1)
   R(default=0, min=-25, max=25)
   STAB(default=0, min=-10000)
   U1(default=180, max=180)
   U2(default=150, min=-30, max=150)
   U3(default=0, max=90)
   U4(default=180, min=29, max=180)
   U5A(default=180, min=-180, max=180)
   U5V(default=180, min=-180, max=180)
}
Key
{
}
Body
{
   Core() {
      S:Frame(angle=-50) {
         S:Frame(angle=-100) {
            S:Jet(angle=90, power=ENG, effect=2, color=#000000, name=MCore) {
               N:Frame(angle=119, color=#000000) {
                  S:Arm(angle=209, color=#000000) { }
               }
               S:Frame(angle=119, color=#000000) {
                  S:Chip(angle=U2, color=#000000) {
                     S:Trim(angle=U3, color=#000000) {
                        S:Chip(angle=-U5V, color=#000000) { }
                        E:Trim(angle=-R, color=#000000) { }
                        W:Trim(angle=-R, color=#000000) { }
                     }
                     S:Chip(color=#000000, name=guide) {
                        N:Trim(angle=U3, color=#000000) {
                           N:Chip(angle=U1, color=#000000) {
                              N:Cowl(angle=U1, option=5, color=#000000) { }
                           }
                           N:Frame(angle=U4, color=#000000) {
                              N:Arm(angle=-209, color=#000000) { }
                           }
                           N:Frame(angle=-U4, color=#000000) {
                              N:Arm(angle=209, color=#000000) { }
                           }
                        }
                        S:Chip(angle=U1, color=#000000) { }
                        E:Trim(angle=-U5A, color=#000000) { }
                        W:Trim(angle=U5A, color=#000000) { }
                     }
                     N:Chip(angle=U1, option=5, color=#000000) {
                        N:Cowl(angle=U1, option=5, color=#000000) { }
                     }
                  }
                  N:Arm(angle=209, color=#000000) { }
               }
            }
         }
      }
      S:Chip() {
         S:Chip() {
            S:Chip() {
               S:Chip() {
                  S:Chip(angle=90) {
                     S:Weight() { }
                  }
               }
            }
         }
      }
      E:Chip() {
         E:Chip(angle=90) {
            E:Weight() { }
         }
      }
      W:Chip() {
         W:Chip(angle=90) {
            W:Weight() { }
         }
      }
      N:Chip() {
         N:Chip(angle=90) {
            N:Weight() { }
         }
      }
   }
}
Script
{
STAB = _AZ(guide)
if _key(7)>0 {Launch1=1}
if Launch1=1 {U1=U1-10}
if Launch1=1 {U2=U2-10}
if Launch1=1 {U3=U3+5}
if Launch1=1 {U4=U4-9}
if U2=-30 & Launch1=1 {Launch1=2}
if Launch1=2 {U5A=U5A-9}
if Launch1=2 {U5V=U5V-9}
if U5A=0 {Launch1=0}
if U5A=0 {Launch2=1}
if Launch2=1 {
           ENG=600000
      _BYE(MCore)
}
if ENG=600000 {ARMED=1}
if ARMED=1 {R=STAB*30}
if ARMED=1 {U5V=bdX/5}
if ARMED=1 {U5A=(bdy/5)}

dx = _PLAYERX(1)-_X(guide)
dy = _PLAYERY(1)-_Y(guide)
dz = _PLAYERZ(1)-_Z(guide)
bdx = dx*_XX(guide)+dy*_XY(guide)+dz*_XZ(guide)
bdy = dx*_YX(guide)+dy*_YY(guide)+dz*_YZ(guide)
bdz = dx*_ZX(guide)+dy*_ZY(guide)+dz*_ZZ(guide)
   
print 1,$_PLAYERNAME(0)," ID=",_PLAYERID(0)," Color=",_PLAYERCOLOR(0)," arm=",_PLAYERARMS(0)
print 2,"    crush=",_PLAYERCRUSHES(0)," init=",_PLAYERINITS(0)," reset=",_PLAYERRESETS(0)
print 3,"    x=",_PLAYERX(0)," y=",_PLAYERY(0)," z=",_PLAYERZ(0)
print 4,$_PLAYERNAME(1)," ID=",_PLAYERID(1)," Color=",_PLAYERCOLOR(1)," arm=",_PLAYERARMS(1)
print 5,"    crush=",_PLAYERCRUSHES(1)," init=",_PLAYERINITS(1)," reset=",_PLAYERRESETS(1)
print 6,"    x=",_PLAYERX(1)," y=",_PLAYERY(1)," z=",_PLAYERZ(1)
print 7,$_PLAYERNAME(2)," ID=",_PLAYERID(2)," Color=",_PLAYERCOLOR(2)," arm=",_PLAYERARMS(2)
print 8,"    crush=",_PLAYERCRUSHES(2)," init=",_PLAYERINITS(2)," reset=",_PLAYERRESETS(2)
print 9,"    x=",_PLAYERX(2)," y=",_PLAYERY(2)," z=",_PLAYERZ(2)
}

HAVE FUN!!!


Last edited by Warbird on Thu Dec 02, 2010 11:38 am; edited 1 time in total (Reason for editing : forgot to mention how to launch the missile... <.<)

Warbird
Tank
Tank

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

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by RA2lover Thu Dec 02, 2010 12:33 pm

use _SPLIT(chip) instead of _BYE(chip).

that will allow for unlimited fuel.

Edit : try to use thrust vectoring for the missile - it looks like fins just cant get it to turn enough.
RA2lover
RA2lover
Walker
Walker

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

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by Warbird Thu Dec 02, 2010 3:04 pm

hey thats great!
Now i can rebuild the alpha E-1 which also had 5 engines but of course didnt work with _BYE.
And yes: It does have quite some steering problems, especially with pitch manouvers and the gliding phase as it was originally designed to be a simple balisitic rocket and not a fast and maneuverable missile but it packs some serious punch with the 4 arms (i´ve been thinking about a power of about 4*10.000.000 so it kicks some serious ass)

Warbird
Tank
Tank

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

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by RA2lover Thu Dec 02, 2010 5:44 pm

i would suggest 3.2/6.4/12.8 million instead.

why?

because weights are the most resistent kind of chip. it's strength varies with its option setting, while the weight of that chip increases with it too.
option 8 weights are the strongest, and need a whooping 12.8 million damage to get destroyed.

for the gliding/thrust vectoring, you would want to learn PID control, as proportional control only wouldn't work very well with jets.
RA2lover
RA2lover
Walker
Walker

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

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by JHaskly Thu Dec 02, 2010 6:33 pm

If the missile is designed well, a PD controller works just fine.

JHaskly
Admin

Posts : 235
Join date : 2010-07-16
Age : 28
Location : Brisbane

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by bwansy Fri Dec 03, 2010 3:01 am

Try using _KEYDOWN() instead of _KEY() so that holding down the key wouldn't cause any errors.

As for the controller type, I agree that using PID controller is essential for an accurate missile, as it eliminates "steady-state error". However, the noise in online player tracking is going to ruin it, so I have to say PD controller is good enough in this case.

bwansy
Admin

Posts : 170
Join date : 2010-07-15

https://rigidchips.forumotion.com

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by RA2lover Fri Dec 03, 2010 5:26 am

Finn Peacock, an australian engineer wrote:These 3 modes(Proportional,integral and derivative) are used in different combinations:

P – Sometimes used

PI - Most often used

PID – Sometimes used

PD – rare as hen’s teeth but can be useful for controlling servomotors.

...
RA2lover
RA2lover
Walker
Walker

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

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by bwansy Fri Dec 03, 2010 7:40 am

You are just pulling quotes from a commercial website which says something completely unrelated to the topic.

bwansy
Admin

Posts : 170
Join date : 2010-07-15

https://rigidchips.forumotion.com

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by RA2lover Sat Dec 04, 2010 9:07 am

actually, the derivative control would be what ruins the accuracy - it just looks where the target will be on the future, but that would be useless with online noise.

so the best bet would be a PID controller with a negative D value.
RA2lover
RA2lover
Walker
Walker

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

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by JHaskly Sat Dec 04, 2010 5:28 pm

It all depends on what you are controlling with the PID. Bwansy and I are talking about a controller that controls the missile's state, rather that its state in relation to the missile.

JHaskly
Admin

Posts : 235
Join date : 2010-07-16
Age : 28
Location : Brisbane

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by bwansy Sun Dec 05, 2010 1:20 am

Oh yes, I was talking about SAS. As for CAS, personally I use a linear prediction rather than simple player tracking.

bwansy
Admin

Posts : 170
Join date : 2010-07-15

https://rigidchips.forumotion.com

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by Warbird Mon Dec 06, 2010 9:18 am

Well im currently working on the jet-steered Harpoon E-2
Its getting better but i had an idea about the random error

some kind of what capacitors do with alternating current: It collects the past 10 or 20 coordinates of the Player, adds them and divides them through their number so you get the average coordinate (each for x y and z seperatly)
.. but how to do that?

Warbird
Tank
Tank

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

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by bwansy Mon Dec 06, 2010 9:20 am

You can do that by taking the position of the player multiple times within one single frame. To do this, you have to learn how to use tables in Lua. Also, here's another tip: taking the mid-point between the min and the max among those values is more accurate then taking the average.

Good luck!

bwansy
Admin

Posts : 170
Join date : 2010-07-15

https://rigidchips.forumotion.com

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by Warbird Mon Dec 06, 2010 9:23 am

sounds good
but sry but im not Lua - Compatible

Warbird
Tank
Tank

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

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by bwansy Mon Dec 06, 2010 9:33 am

If you're going to do it in script, I'm afraid that you'll have to manually repeat the process a hundred times, literally. Rolling Eyes

EDIT: I have found out that you can use "LABEL" and "GOTO" commands in script, which allows you to make loops.
Code:

GOTO xxxx //jump to label with name xxxx
LABEL xxxx //set-up a label
The above was extracted from the Japanese wiki. I'm not sure if the labels should be numbers or strings, though.

bwansy
Admin

Posts : 170
Join date : 2010-07-15

https://rigidchips.forumotion.com

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by RA2lover Mon Dec 06, 2010 11:37 am

just plain text, without quotes.

RCD has a sample model, rollings, which uses those functions.
RA2lover
RA2lover
Walker
Walker

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

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by JHaskly Mon Dec 06, 2010 6:16 pm

It's a possibility, but... given the speed of RCScript, it may not be as fast as Lua.

JHaskly
Admin

Posts : 235
Join date : 2010-07-16
Age : 28
Location : Brisbane

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by Warbird Sat Jun 11, 2011 8:39 am

Okay... as i fixed the wobbly steering of the missile lately, i am trying to finish this thing now. It works fine besides the noise problem which i still wasnt able to fix because i dont know enough about scripting to make that buffer to kill the noise. My knowledge about scripting is simply to small to make something which "records" the coordinates every frame and to get the average out of these. Any suggestions?

Warbird
Tank
Tank

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

Back to top Go down

Harpoon E-1 Guided Missile Empty Re: Harpoon E-1 Guided Missile

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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