Can Veeky Forums help a dumb /v/irgin?

Can Veeky Forums help a dumb /v/irgin?

I'm trying to move a ship to a target point by accelerating in one direction and then accelerating in the opposite direction to bring the ship to a stop, but I can't quite get it right.

It's entirely a 1D problem and we don't need to consider mass.

I have the following information: current position, target position, distance to target, current total velocity, current acceleration in both directions (forward and back), acceleration rate.

How can I work out when to properly accelerate in the opposite direction to come to a complete stop as close to the target as possible? It's okay if it overshoots by a bit.

Thanks.

Other urls found in this thread:

en.m.wikipedia.org/wiki/Control_theory
twitter.com/SFWRedditVideos

Consider pic related.

I have a better idea considering your given limitations

Make a game where your ship cannot stop, ever

It can only accelerate

en.m.wikipedia.org/wiki/Control_theory

forward and backwards acceleration? Uhhh... You only need one acceleration since the resultant acceleration is the same regardless... It's like:

2 = 3-1 = 4-2 = 5-3 =...

that being said, you wanna have your final velocity = 0 and acceleration = 0 when you get there, which you can just turn off, it doesn't have to happen smoothly.

looks like overkill (and greek)

seems silly

seems like overkill

forward acceleration would be like, the amount of burn on the main engine in the rear and backward acceleration would be like, the amount of burn on the engines at the front of the ship

Yeah. I'm telling you don't do that

1 unit of forward acceleration and 2 units of backwards acceleration is the same as just 1 unit of backwards acceleration.

Seeing your webm and how the ship slowly re-accelerates, I'm almost 100% sure its a rounding problem. The reason that happens is because there's a very tiny "leftover" of the right-side acceleration that compounds on itself because of the flawed code you've written

Round the velocity better and have it simply equate to 0 should you reach a low enough threshold, that way you wont get an unrounded 0.0000001 leftover that will compound to high speeds.

So we know x, delta x, and v max. If we don't, you need to set the max v. You can let v max be dependent on the distance.

v(t0)=0, v(delta t) = 0, and somewhere in the middle we want a max.

x-x^2 is a good polynomial that goes through zero twice, so you could let [math] \displaystyle v(t)= \frac {-4 v_m t^2 + 4 v_m \Delta \mathbb { x } t } { \Delta \mathbb{ x } ^ 2 } [/math]

Which would make [math] \displaystyle x(t) = \frac { \frac {-4 v_m } {3} t^3 + \frac {4 v_m \Delta \mathbb { x } } {3} t^3 } { \Delta \mathbb { x } ^ 2 } [/math] by taking an integral.

Finally, acceleration would be [math] \displaystyle a(t) = \frac {-8 v_m t + 4 v_m \Delta \mathbb { x } } { \Delta \mathbb { x } ^2 } [/math]

You could use any equation you want, I just thought a simple polynomial would do the trick. You could mess around with some sliders on desmos.com/calculator to see what that actually looks like.

Oops, for x(t), it should be (for the added part) ...-4v_m t^3 / 3 + [math]2 v_m \Delta \mathbb { x } t^2[/math] instead of the 4/3 I had before.

are you retarded? you must be retarded.
>just fucking blast the ship forward to the point and then hardcode a full stop, it doesnt have to look real.
>this is equivalent to smoothly accelerating halfway towards the target, then reversing the acceleration so you come to a stop on target, which is what the OP wants and how it would work in real world physics.

>looks like overkill (and greek)
OP if you cant be bothered to model the actual math involved its not going to look real...and you wonder why you are having a problem?

besides, it's not like that is hard math to code, ffs pull your thumb out of your ass

Thiiiiiiis

OP have you really not ever taken wildlinalg?

Are you retarded OP?

No you don't understand that discontinuities in acceleration don't correspond to discontinuities in velocity. Take an intro physics course when you get out of HS.

How do I do that when A is moving, and B can (and will) move, though?

Figured it out. Thanks for nothing brainiacs.

Good luck with the eventual suicide once your research careers sputter out.

this is not how space ships work

Did you use PID control

>spaecshit magically just decelerates
THere's no fucking drag in space retard.

Good luck spending your life making gaymes you dumb cock monkey faggot.

If he didn't want to use basic kinematics equations, I doubt he was able to implement a PID loop.

>looks like overkill

>>not using trapezoidal acceleration profiles
I really hope you enjoy that jerk and higher order shocks

that does not look real at all.

Use a trapezoidal acceleration profile. Pic related. It's easy mode, it's just geometry.

This is so fucking retarded, why would you even bother posting this nonsense that doesn't even try to answer the question?

You need at minimum a third degree polynomial to describe the acceleration. All you have to do is find the constants that satisfy the following

a(0) = a_0
a(t_f) = 0
a_min =< a(0 to t_f) =< a_max
v(0) = v_0
v(t_f) = 0
d(0) = 0
d(t_f) = d_f

where a(t) = v'(t) = d''(t)

d(t) = At^5+Bt^4+Ct^3+(1/2)(a_0)t^2+(v_0)t

Basically plug and chug.