ornithopter help

View previous topic View next topic Go down

ornithopter help

Post by Sting Auer on Sun Sep 26, 2010 3:34 pm

ok well this was originally posted on the ipbfree forums, but i didnt understand it then. now that i am in high school, i am starting to learn some more advance mathematical equations, and i think i will be able to understand it.

so, what was the equation again to make oscillation?
avatar
Sting Auer
Hover
Hover

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

View user profile

Back to top Go down

Re: ornithopter help

Post by bwansy on Sun Sep 26, 2010 9:47 pm

sin or cos

_________________
A.K.A. Bernard

bwansy
Admin

Posts : 170
Join date : 2010-07-15

View user profile http://rigidchips.forum-motion.com

Back to top Go down

Re: ornithopter help

Post by JHaskly on Mon Sep 27, 2010 1:11 am

or... sin(asin(sin(, if you want to get excessive.

_________________
Previously (and currently) known as Juz.

Please do not write "LUA", beause it's "Lua". It's Moon in Portuguese, not a Limited User Account, Last Universal Ancestor, or the Lukla Airport in Nepal.

JHaskly
Admin

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

View user profile

Back to top Go down

Re: ornithopter help

Post by Sting Auer on Tue Sep 28, 2010 7:29 pm

ok i tried to use the _SIN functions. i dont know how.
avatar
Sting Auer
Hover
Hover

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

View user profile

Back to top Go down

Re: ornithopter help

Post by bwansy on Wed Sep 29, 2010 12:41 am

Basically, sin(x) takes in x as an angle in radians. If you have learnt basic trigonometry, you'd know the relationship between the angles and their sine values. sin(0) = 0, sin(90) = 1, sin(180) = 0, sin(270) = -1. As such, you can increase the value of x each frame so that it keeps oscillating. Because a full circle is 360 degrees, e.g. sin(0) = sin(360), it will work just fine even when the angle exceeds 360 degrees. But for elegance's sake, personally I would reset it to zero when it reaches 360, so that it would never approach infinity.

And there's a twist: trig functions in RC (and in general) take angles in radians, which is another unit for angles. Therefore in RC, you should use
Code:
ANGLE = amplitude*_SIN(_TORAD(x))
Note that the amplitude is important because it amplifies the oscillation. Without it, sine only goes from -1 to 1, and an oscillation of 2 degrees is hardly even noticeable. Wink

Good luck!

_________________
A.K.A. Bernard

bwansy
Admin

Posts : 170
Join date : 2010-07-15

View user profile http://rigidchips.forum-motion.com

Back to top Go down

Re: ornithopter help

Post by Sting Auer on Wed Sep 29, 2010 5:09 pm

ok thank you bwansy!

EDIT: wait it isnt working...

heres the code for the test. what do i do?

Code:


// [RCD]
Val
{
   ANGLE(default=0, max=360)
}
Key
{
   4:ANGLE(step=2)
}
Body
{
   Core() {
      S:Frame(angle=90) {
         S:Frame() {
            S:Chip(angle=90) {
               E:Chip() { }
               S:Chip() { }
               W:Chip() { }
               N:Chip() { }
            }
         }
      }
      E:Chip(angle=ANGLE, name=wing) { }
   }
}
Script
{ANGLE = 360*_SIN(_TODEG(360))}


avatar
Sting Auer
Hover
Hover

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

View user profile

Back to top Go down

Re: ornithopter help

Post by bwansy on Thu Sep 30, 2010 12:14 am

Oh, as I said, x needs to be changing constantly in order for the oscillation to work. So rather than having a fixed number inside _SIN(), you need something like
Code:
x = x+2
ANGLE = 360*_SIN(_TODEG(x))

I hope that helps.

_________________
A.K.A. Bernard

bwansy
Admin

Posts : 170
Join date : 2010-07-15

View user profile http://rigidchips.forum-motion.com

Back to top Go down

Re: ornithopter help

Post by Sting Auer on Fri Oct 01, 2010 4:03 pm

ok i aded the x=x+2 and even tried x=x*2

it still doesn't work.
avatar
Sting Auer
Hover
Hover

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

View user profile

Back to top Go down

Re: ornithopter help

Post by JHaskly on Sat Oct 02, 2010 1:17 am

It could be that you don't have local variables in script...

Try adding a VAL to the model, called X, with no maximum and a step of 0.

_________________
Previously (and currently) known as Juz.

Please do not write "LUA", beause it's "Lua". It's Moon in Portuguese, not a Limited User Account, Last Universal Ancestor, or the Lukla Airport in Nepal.

JHaskly
Admin

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

View user profile

Back to top Go down

Re: ornithopter help

Post by bwansy on Sat Oct 02, 2010 11:27 am

JHaskly wrote:It could be that you don't have local variables in script...

Ah, I forgot about that. Embarassed Sorry for the confusion.

_________________
A.K.A. Bernard

bwansy
Admin

Posts : 170
Join date : 2010-07-15

View user profile http://rigidchips.forum-motion.com

Back to top Go down

Re: ornithopter help

Post by Sting Auer on Sat Oct 02, 2010 1:14 pm

ah ok thank you
avatar
Sting Auer
Hover
Hover

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

View user profile

Back to top Go down

Re: ornithopter help

Post by JHaskly on Sat Oct 02, 2010 7:41 pm

Hahahaa bwansy, we're to used to Lua Razz

_________________
Previously (and currently) known as Juz.

Please do not write "LUA", beause it's "Lua". It's Moon in Portuguese, not a Limited User Account, Last Universal Ancestor, or the Lukla Airport in Nepal.

JHaskly
Admin

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

View user profile

Back to top Go down

Re: ornithopter help

Post by freek4ever on Fri Dec 02, 2011 1:47 pm

here is my model i made before seen this post i dint make the script
Code:
// [RCD]
Val
{
   D(default=0, min=-20, max=20, step=25)
   FLAPSPEED(default=0, min=-1000000000000, max=10000000000, step=100000)
   PITCH(default=0, min=-10, max=10, step=5)
   ROLL(default=0, min=-20, max=20, step=10)
   WINGANGLE(default=0, min=-45, max=45)
   WINGS(default=0, min=-40, max=40)
   X(default=0)
}
Key
{
   0:PITCH(step=-4)
   1:PITCH(step=4)
   2:ROLL(step=-4)
   3:ROLL(step=4)
   4:FLAPSPEED(step=-12000), D(step=20)
   5:FLAPSPEED(step=-1200), D(step=20)
}
Body
{
   Core() {
      N:Chip() { }
      W:Frame(angle=WINGS) {
         W:Trim(angle=WINGANGLE) {
            W:Chip() {
               S:Chip() {
                  S:Chip() { }
               }
               W:Chip() {
                  S:Chip() {
                     S:Chip() { }
                  }
                  W:Chip() {
                     S:Chip() {
                        S:Chip() { }
                     }
                  }
               }
            }
         }
      }
      E:Frame(angle=WINGS) {
         E:Trim(angle=-WINGANGLE) {
            E:Chip() {
               E:Chip() {
                  E:Chip() {
                     S:Chip() {
                        S:Chip() { }
                     }
                  }
                  S:Chip() {
                     S:Chip() { }
                  }
               }
               S:Chip() {
                  S:Chip() { }
               }
            }
         }
      }
      E:Frame(angle=-WINGS) {
         E:Trim(angle=WINGANGLE, color=#FF0000) {
            E:Chip() {
               E:Chip() {
                  E:Chip() {
                     S:Chip(color=#FF0000) {
                        S:Chip() { }
                     }
                  }
                  S:Chip() {
                     S:Chip() { }
                  }
               }
               S:Chip() {
                  S:Chip() { }
               }
            }
         }
      }
      W:Frame(angle=-WINGS) {
         W:Trim(angle=-WINGANGLE, color=#FF0000) {
            W:Chip() {
               S:Chip() {
                  S:Chip() { }
               }
               W:Chip() {
                  S:Chip() {
                     S:Chip() { }
                  }
                  W:Chip() {
                     S:Chip(color=#FF0000) {
                        S:Chip() { }
                     }
                  }
               }
            }
         }
      }
      S:Chip() {
         S:Chip(option=8) {
            S:Chip() {
               S:Chip() {
                  S:Chip(angle=PITCH) {
                     E:Chip() {
                        S:Chip() { }
                     }
                     W:Chip() {
                        S:Chip() { }
                     }
                     S:Chip() { }
                  }
                  S:RudderF(angle=ROLL, option=1) {
                     S:TrimF(angle=90, option=1) {
                        N:Chip() {
                           E:Chip() { }
                           W:Chip() { }
                        }
                     }
                  }
               }
            }
         }
      }
   }
}
Script
{X=X+ FLAPSPEED

WINGS= D *_SIN(X)

WINGANGLE=D *_COS(X)
    }

z and x are move
somtime it fails at stop
avatar
freek4ever
Tank
Tank

Posts : 97
Join date : 2011-08-26
Age : 20
Location : nederland holand

View user profile

Back to top Go down

Re: ornithopter help

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


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