Moving in a straight line with multiple constraints

Click For Summary
The discussion revolves around solving a motion problem where a body moves from Point A to Point B over 10 meters in 4 seconds, ending with a velocity of 20 m/s. The challenge lies in determining the initial velocity and acceleration, as the user initially assumed the body starts from rest, leading to incorrect calculations. It is clarified that if the initial velocity is not zero, the SUVAT equations can be applied effectively to find both initial velocity and acceleration. The conversation also explores the possibility of using non-linear acceleration to achieve the desired motion profile, emphasizing the need for a clear approach to define the acceleration function. Ultimately, the user seeks practical steps to implement these concepts in a computer program for animation.
  • #61
malawi_glenn said:
v(t) = 5t + sin(πt/2) does
View attachment 304865

All curves of the form v(t) = 5t + k*sin(m*πt/2) where k is a real number and m is an integer, will do as well (well not all, you have to make sure that the values of k and m does not make the graph have a zero between 0 and 4, but you get the idea)

D'oh! Of course! You are absolutely right, thank you for showing that as it makes it a lot easier to understand with a visual aid. I can see now why there is an infinite number of possible curves.
 
Physics news on Phys.org
  • #62
pbuk said:
Yes, the area is the distance traveled so must satisfy the constraint that S = 10 m.
...

Thanks pbuk for your comments. I am now at least confident that I understand what the equations are trying to do. As mentioned, seeing graphs helps a lot.

I appreciate your honest feedback regarding my poor maths, I fully accept that. I need to restudy calculus for sure :doh:.The equations of motion are not a problem for me, it is the calculus that I struggle with. I just need to better understand now how to construct the graph that gives me the required area.
 
  • #63
pbuk said:
Which is why I recommended the cubic easing.
To avoid any reverse movement, go to quartic.
 
  • #64
haruspex said:
To avoid any reverse movement, go to quartic.
Yes I started going down that path :wink: but the main problem is the constraints: if you want to take as long as 4 s to cover 10 m but end up at a speed of 20 m/s there is going to be a lot of acceleration at the end.
 
  • #65
Jack7 said:
I just need to better understand now how to construct the graph that gives me the required area.
... and that is where you really need the maths for the quantitive results to back up the qualitative understanding you can get from a graph. The key points to grasp are:
  • Speed is the derivative of distance with respect to time
    • This means that speed is the slope of a distance vs time graph
    • The converse of this is that position is the anti-derivative (or integral) of speed with respect to time
      • This means that distance is the area under a speed vs time graph
  • Acceleration is the derivative of speed with respect to time
    • This means that acceleration is the slope of a speed vs time graph
    • The converse of this is that speed is the anti-derivative (or integral) of acceleration with respect to time
      • This means that speed is the area under a acceleration vs time graph
 
  • Like
Likes Jack7
  • #66
It might help if you could explain what the context for this is: is it a high school project you are working on alone? or as part of a group project? a hobby project? And what is the end goal: an interesting graphic? A game? A simulation?

This would help us to point you towards approriate resources, e.g. whether you are better off with Kerbal Space Program, Howard Curtis' book or something else.
 
  • #67
pbuk said:
It might help if you could explain what the context for this is: is it a high school project you are working on alone? or as part of a group project? a hobby project? And what is the end goal: an interesting graphic? A game? A simulation?

This would help us to point you towards approriate resources, e.g. whether you are better off with Kerbal Space Program, Howard Curtis' book or something else.

Thanks pbuk, and everyone else who has been helping me in this thread. You guys are truly awesome for helping novices like me! I am sorry if I frustrate on occasion.

The context for this is that I am designing a video game as a hobby in my spare time. I have a need to shoot an object into a circular orbit within a specified 's', 'v' and 't'. I have already implemented objects moving in very nice circular paths with uniform motion, so generally I understand equations of motion. I struggle though when it comes to accelerating and decelerating things, since my calculus is lacking.

I want to do this very accurately and therefore I need to use a mathematically sound approach. So if you had any resources that would be really appreciated!
 
  • #68
Why can't you adjust the angular velocity so that you can use constant acceleration instead?
 
  • #69
malawi_glenn said:
Why can't you adjust the angular velocity so that you can use constant acceleration instead?

I can't do that for a very specific reason. In my actual game, there is already a body orbiting at an angular velocity. This new object that is shooting in needs to have half the angular velocity of that existing object, and it needs to shoot in at a very specific time, when the other body will be a certain number of degrees away.

This is why I need it to reach a very specific velocity, in a very specific time, over a very specific distance. The distance originates at the point lying just off-screen. Hopefully this clarifies why the three constraints exist.
 
  • #70
While playing with possible trajectory equations, it occurred to me that one could exploit the fact the factors of 2 are prominent. Ignoring units, the final speed is twice the distance and the time is 22. There is a single power of ##t## that will do the trick here:$$x(t)=\frac{5}{2^{15}}t^8~\implies v(t)=\frac{8\times 5}{2^{15}}t^7.$$With this,$$x(2^2)=\frac{5}{2^{15}}2^{16}=10~;~~v(2^2)=\frac{8\times5}{2^{15}}2^{14}=20.$$Note the effect of the many vanishing derivatives at small values of time.

Plots.png
 
  • Like
Likes SammyS, Jack7, Delta2 and 1 other person
  • #71
kuruman said:
While playing with possible trajectory equations
That is what you would get as suggested in #21
 
  • #72
malawi_glenn said:
That is what you would get as suggested in #21
Perhaps. This is more specific than than the suggestions in #21 which include an exponential and a piecewise constant acceleration.
 
  • #73
kuruman said:
Perhaps. This is more specific than than the suggestions in #21
I thought
malawi_glenn said:
or power function a(t)=k⋅tα−2,
was pretty specific?

Anyway, in terms of distance traveled the last second, it is not that much of a difference compared to exponential acceleration (90% vs. 87%)
 
  • #74
If everyone is worried about the "sharpness" of the acceleration, why not use something like:

$$ \frac{dx}{dt} = \beta \ln \left( 1 + \gamma x\right) $$

It looks like it could produce a fairly "natural" acceleration.
 
  • #75
Integrating logarithm functions :bugeye:
But, such function will not work.
 
  • #76
malawi_glenn said:
Integrating logarithm functions :bugeye:
The program I use doesn't miss a beat!
malawi_glenn said:
But, such function will not work.
This I did not check, but I wonder how you recognize so quickly that it won't be able to produce a solution?
 
  • #77
Because of its convexity/concavity
1658934628751.png

we already know that linear velocity won't work
 
  • Like
Likes erobz
  • #78
malawi_glenn said:
Because of its convexity/concavity
View attachment 304871
we already know that linear velocity won't work

Ahh! Didn't have an inkling of an idea to think about it like that.
 
  • Like
Likes malawi_glenn
  • #79
Well, how about a simple quadratic model:

$$ \frac{dv}{dt} = k - \beta v^2 $$

Surely that has to have a chance and be more "natural" form of acceleration?

If it too doesn't work, I'll give up (joking)!

I think it gives (admittedly less than simple solution):

$$ \Large v(t) = \sqrt{ \frac{k}{\beta}} \frac{\left( e^{2 \beta \sqrt{ \frac{k}{\beta} } t } - 1 \right)}{\left( 1+ e^{2 \beta \sqrt{ \frac{k}{\beta} } t } \right) } $$

EDIT:
Math has to be checked yet, I feel I'm getting some funny results on a plot.

Fixed

Playing around with the graph, it appears that it is going to fail for the same reason @malawi_glenn has pointed out! SMH...
 
Last edited:
  • Like
Likes Jack7
  • #80
Okay so I have re-read this thread multiple times and I think the advice is finally starting to sink in! Talking it through with graphs has definitely aided my understanding.

The issue with the first GIF I posted (#31) was that I was forcing the particle to follow a curve that did not satisfy the constraints, i.e. the area under the velocity curve did not satisfy the total distance.

I have been experimenting with different curves, and tried adjusting the "u" values as you guys recommended, and I am much more closely able to approximate the area. As I mentioned before, I don't actually care much what "u" is, so long as it "s", "v", and "t" are satisfied and it only moves in one direction. In fact, a deceleration to "v" is fine too and this seems to work better.

You can see below that I am able to reach "v" in the required "t" and "s" and get a nice smooth transition!

Screen Recording 2022-07-27 at 21.08.40.gif


This is fantastic. The issue is, I achieved this with a lot of manual tweaking. I now need to achieve this programatically at run-time, as the "s", "v", "t" values will change. So that's my next challenge. I will continue reflecting on your advice and hopefully get there soon. Thank you guys so much!
 
  • Like
Likes erobz
  • #81
I don't know if I helped much (If I didn't confuse you more), but I don't believe you ever stated how the circular part of the animation works? What calculations does it use to generate the pixels that will light over time? This is basically, for my own curiosity (since you say it works fine)...but I'm assuming it is some method different from what I asked in post #52 ?
 
Last edited:
  • #82
erobz said:
I don't know if I helped much (If I didn't confuse you more), but I don't believe you ever stated how the circular part of the animation works? What calculations does it use to generate the pixels that will light over time? This is basically, for my own curiosity (since you say it works fine)...but I'm assuming it is some method different from what I asked in post #52 ?

Sorry erobz, I forgot to reply to #52. You have indeed helped me so thank you. Below is the answer:

It basically works as your first explanation described. The game world is three dimensional, but as this segment is top down, the positional co-ordinates of the square are treated two dimensional (z is fixed at 0). Since the radius is fixed, the co-ordinates are as you described (x , y) = (r.cosθ, r.sinθ).

Now, the angle is swept uniformly by multiplying the angular velocity by time. This is done in accordance with the timestep of the engine, so that it is independent of framerate. So it is a very simple calculation and it is very precise.

It's also worth noting that the pink square is not treated as pixels per se, it is a rigidbody inside the game world, which let's one move it around easily with physics. The world space co-ordinates are then converted to pixel space (aka screen space) by the engine as part of its rendering process. This part is a very involved process, more details here if you are interested.
 
  • Like
Likes erobz
  • #83
malawi_glenn said:
View attachment 304860
now the only way to get that area to become 10 is if v0 is negative, because the picture you posted shows the minimal area with v0≥0

You can come up with any kind of v(t) for your problem as long as the graph is above the horisontal axis between 0 < t < 4, it has v(4) = 20, and the area is equal to 10.
Is there an easy way of determining what the v0 should be for a particular curve, such that the area actually is 10? In your case above it's not actually possible given the shape.

I am trying to solve this problem programmatically so I see there being two challenges:
  1. Constructing a curve in which area underneath can actually equal 10.
  2. Setting the v0 that actually satisfies the area.
How do I decide which one to do first? As mentioned, I cannot do this manually as the "s", "v", "t" values will be different for different orbits, so manually defining a velocity profile that works is not viable. I need a programmatic way to shape the curve with the correct v0, which works for any number of "s", "v", "t" automatically.

I'm sure you guys have probably already given the answer to this but I just haven't recognised it yet. Have I missed something?
 
  • #84
Jack7 said:
Is there an easy way of determining what the v0 should be for a particular curve, such that the area actually is 10? In your case above it's not actually possible given the shape.
Depends on the shape of the curve. But you can see that for a v0>0 you must have an even larger acceleration (slope) in the v-t diagram to make sure the final speed is 20 m/s and only covers 10 m (area)
 
  • #85
malawi_glenn said:
Depends on the shape of the curve. But you can see that for a v0>0 you must have an even larger acceleration (slope) in the v-t diagram to make sure the final speed is 20 m/s and only covers 10 m (area)
This seems a bit like a chicken and egg situation. If we want v0 to always be positive (one direction of travel), then don't the curve and v0 need to be defined together through manual iteration?

Or, here is another question:

Can I define one curve, that will satisfy any "s", "v", "t" constraints and then use it find the appropriate v0 that is always positive, given the "s", "v", "t" of a particular case.

It seems like this is what I need to do, if I am not mistaken. But I am not sure if this is possible.
 
  • #86
This should illustrate the problem with having a non-zero v0
1658995835415.png

These velocity profiles have the same final speed and the particle will cover the same distance (well, the picture here should be taken with a grain of salt, I have not actually measured their areas but it is just for illustrational purposes)
The particle with higher v0 has to experience a much larger acceleration at the end of its trajectory.
 
Last edited:
  • Like
Likes Jack7
  • #87
malawi_glenn said:
This should illustrate the problem with having a non-zero v0
View attachment 304914
These velocity profiles have the same final speed and the particle will cover the same distance.
But the particle with higher v0 has to experience a much larger acceleration at the end of its trajectory.

Thanks malawi_glenn, I understand fully what you are saying and I completely agree. The red one is preferable as it will show a smoother acceleration.

So then, let's say we do this:
  • We always set v0 = 0
  • We always set v = our linear velocity target when it joins the circle (varies case by case)
  • We always set t = our time span (varies case by case)
  • We know the area the curve must satisfy = our distance that must be covered (varies case by case)
How then can I create the correct curve that satisfies the above in an automated fashion?

I cannot do it manually as the context is a game, so the constraints change dynamically during gameplay, i.e. other squares fly in that need to satisfy other orbit speeds, which are different distances from a fixed starting point. Hence "s", "v", "t" vary in real-time. So I need to be able to construct the correct curve in an automated fashion.
 
  • #88
You could define piece-wise constant accelerations over several time-intervals.
Here is an example I made in Geogebra, by inserting 6 points and varying their position (keepin the origin and (4,20) fixed). Then use the polygon tool and displaying its area
1658997122229.png

You can adjust until you get something that looks reasonable for you. Also you can use more points to determine the shape.
In this, crude, example - we see that in the last 0.5 seconds the speed will increase from 4 to 20.
And the ratio of distance traveled is ~54%
1658997285328.png


In the last second, the speed will increase from ~2.5 to 20 m/s and the ratio of distance traveled is ~70%
1658997412519.png
 
  • Like
Likes Jack7
  • #89
I haven't read all the posts, so perhaps this has been pointed out already. If you have a displacement of ##10m## in ##4s##, then your average velocity is ##2.5m/s##. If your final velocity is ##20m/s## then, assuming constant acceleration, your initial velocity must have been negative.

That much should be clear without any equations.
 
  • #90
If it was up to me, I would sit around at A for ##3s##, then accelerate at ##20m/s^2## for the last second.
 
  • Like
Likes SammyS

Similar threads

Replies
24
Views
2K
Replies
7
Views
2K
  • · Replies 6 ·
Replies
6
Views
263
Replies
8
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
Replies
7
Views
2K
  • · Replies 6 ·
Replies
6
Views
1K
  • · Replies 1 ·
Replies
1
Views
7K