Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / FlightPlan help - Automatic Smooth Rotation / Pitch of object to certain angle ?? HELP

Author
Message
Newbie5UK
20
Years of Service
User Offline
Joined: 13th Nov 2004
Location:
Posted: 19th Feb 2006 23:19
Hi,

I'm tryign to write a program where I can enter an ammount in say a flight plan and have an object slowly rotate to that angle over a period of time. i.e

After 10 Sec Roll to 90deg
After 60 sec Pitch to 30deg
After 100sec Pitch to 40deg and Roll to 80 Degrees.

I have inlcluded the main code exracts I have, and I'm sure they will be ripped to bits (be gentle) but I coudl really do with some guidance. I'm sure there is an easlier way.

The table in the Code is basically a predetermind flight plan for MET = Time against Altitude, Pitch and Roll...
Pheonixx
21
Years of Service
User Offline
Joined: 6th Oct 2003
Location: Columbus, Ohio
Posted: 19th Feb 2006 23:56
if you already have your time based code in place, it's just a matter of setting your target values, and then every cycle moving your current values to those target values by whatever speeds are allowed in each catagory.

if you are looking for a command entry delay, to give it kind of a 'thinking' effect.. just set a delay timer for each motion as well, and once that delay timer is over allow the actual values to progress towards the target values as explained above.

http://ausukusa.breakset.com
Newbie5UK
20
Years of Service
User Offline
Joined: 13th Nov 2004
Location:
Posted: 20th Feb 2006 00:07
Sounds simple, but how do I make the increments small and smooth, and when I get to a certain postion move to the next without the roll or pitch jumping back... did my code make any sense btw ?

I have tried to calcualte the time to do the movement but just can't make it move without jumping...
Barnski
19
Years of Service
User Offline
Joined: 26th Jan 2006
Location: Switzerland, Zurich
Posted: 20th Feb 2006 00:39
What Pheonixx described is what you actually are doing I think.

but shouldnt
Roll_Amount#(n)=Launch_Roll(n)-Launch_Roll(n+1)
Pitch_Amount#(n)=Launch_Pitch(n)-Launch_Pitch(n+1)

be the other way round:
Roll_Amount#(n)=Launch_Roll(n+1)-Launch_Roll(n)
Pitch_Amount#(n)=Launch_Pitch(n+1)-Launch_Pitch(n)

and what do you mean by "without the roll or pitch jumping back" when moving to next step?

I mean, after all what you actually are doing, is linear approximation, or, linear interpolation. Thus, whenever you go to next step, there will be a noticeble "EDGE" in the movement/rotation (an edge if you would look at it as a graph drawn on a 2D-table, where the x-axis is the time and the y-axis one of your properties, altitude, pitch, roll...)

so if you want your movement to be "smoother", not linear, you would have to interpolate it quadratic, or cubic. this means not only taking into account the next point (step), but also the 2nd next (quadratic) or even the 3rd step (cubic), and calculate polynomials that go through these points. this is quite math-intensive.

A commonly used approach to this is called "SPLINES", which are such cubic curves. Don't know if you want to go into this, but as far as I am concerned, I will have to go into this in the next two weeks, cause we will have an exam on that

hope I did not confuse you...

greets,
Barnski

-- I just started with DarkSDK, by translating DBP Projects. --
Newbie5UK
20
Years of Service
User Offline
Joined: 13th Nov 2004
Location:
Posted: 20th Feb 2006 01:36
No actually you make a lot of sense... thanks.. much appreciated..

Login to post a reply

Server time is: 2025-06-04 18:17:12
Your offset time is: 2025-06-04 18:17:12