Find acceleration to stop at target in frictionless 2D space

In summary: An alternative I may test could be finding a way of determining the number of steps required to reach the target in the 1D case as a function of the maximum acceleration, and then balancing what ratio of the acceleration is allocated to solving the 1D case on both the X and Y axis such that they both reach the target at the same time.Can you brute force it? Just estimate based on two 1D problems, and try some iterative solution? Granted, I haven't really thought it through.
  • #1
Ziks
6
0
This is a problem that's appeared in a game I am writing, and is a bit beyond the mechanics I can sort-of remember from high school.

The context is I have an object in 2D space which has a position [itex]p[/itex] and a velocity [itex]u[/itex], and a goal position [itex]G[/itex] I want that object to be in as soon as possible. At each time step, I can add an acceleration [itex]a = xA[/itex], where [itex]A[/itex] is the maximum acceleration and [itex]-1 \leq x \leq 1[/itex]. When the object reaches the goal position, its velocity should be 0.

I need to define a function [itex]f[/itex] with produces an acceleration [itex]a = f(G, A, p, u)[/itex]. This function should yield a sequence of states [itex]s_0, s_1, s_2 \ldots s_n[/itex] with the smallest possible length [itex]n[/itex], where each state [itex]s_i[/itex] is of the form [itex]s_i = (\mbox{position}, \mbox{velocity})[/itex].

The sequence of states must meet the criteria:

[itex]s_0 = (p, u) \\

s_n = (G, 0) \\

s_{i+1} = (\mbox{position}(s_i) + \mbox{velocity}(s_i), \mbox{velocity}(s_i) + f(G, A, \mbox{position}(s_{i+1}), \mbox{velocity}(s_i)))[/itex]

Also, [itex]-A \leq f(G, A, p, u) \leq A[/itex]

It's pretty trivial in one dimension, but extrapolating it to two dimensions is difficult because of the constraint on maximum acceleration.

My one dimensional solution:

[itex]f(G, A, p, u) = \begin{cases}
\mbox{min}(u + A, v) & u < v \\
\mbox{max}(u - A, v) & u > v \\
u & \mbox{otherwise}\end{cases}[/itex], where [itex]v=\sqrt{2A(G - p)}[/itex]

My reasoning here is that it should find out the largest possible velocity the object can travel at while still being able to slow and stop at the target, and then depending on whether that velocity has been exceeded or not the object will either accelerate or decelerate by the acceleration limit.

I'm at a loss as to how to extrapolate this into two dimensions, any help is appreciated.
 
Physics news on Phys.org
  • #2
I think we had a similar question here one year ago (?), I don't remember if there was some reasonable solution.

In the continuous case, the best trajectory always uses the maximal acceleration. I would expect that the stepwise version will do the same, maybe with 1-2 steps as exception.

To restrict the search space: I would expect that three periods of constant acceleration direction will give a reasonable approximation to the ideal path. This leaves 5 degrees of freedom (three directions and two times), with 4 constraints (final position and velocity), so 1 parameter can be optimized.
 
  • #3
It would make sense that a decent method would be to eliminate tangential velocity first, and then solve it as the one dimensional case along the radial line (treating the goal as the centre). So the three stages you describe would be to:

  1. Eliminate tangential velocity by accelerating in the opposite direction
  2. Accelerate directly towards goal until the critical point is reached where deceleration is required
  3. Acelerate in the opposite direction of motion to stop on the goal

This will certainly solve the problem of reaching the target with a final velocity of zero, but is it optimal? It will probably be good enough for my application, although I am interested in knowing if an optimal general solution exists (assuming this is not it).

An alternative I may test could be finding a way of determining the number of steps required to reach the target in the 1D case as a function of the maximum acceleration, and then balancing what ratio of the acceleration is allocated to solving the 1D case on both the X and Y axis such that they both reach the target at the same time.
 
  • #4
Can you brute force it? Just estimate based on two 1D problems, and try some iterative solution? Granted, I haven't really thought it through.

edit:
I think this is an inverse kinematics problem. They can get a lot more complicated in general.
https://en.wikipedia.org/wiki/Inverse_kinematics
 
  • #5
Ziks said:
  1. Eliminate tangential velocity by accelerating in the opposite direction
  2. Accelerate directly towards goal until the critical point is reached where deceleration is required
  3. Acelerate in the opposite direction of motion to stop on the goal

This will certainly solve the problem of reaching the target with a final velocity of zero, but is it optimal?
I am sure it is not, and it gives other issues, too - the tangential direction changes as the object moves. You could try to get rid of angular momentum first (this gives constant acceleration in one direction as first step), but I think my proposed method is more general and will find a better solution in most cases.

It will probably be good enough for my application, although I am interested in knowing if an optimal general solution exists (assuming this is not it).
There is an optimal solution, the problem is just to find it without excessive numerical simulations for every set of parameters.

An alternative I may test could be finding a way of determining the number of steps required to reach the target in the 1D case as a function of the maximum acceleration, and then balancing what ratio of the acceleration is allocated to solving the 1D case on both the X and Y axis such that they both reach the target at the same time.
Hmmhmm... could lead to interesting results.
 

FAQ: Find acceleration to stop at target in frictionless 2D space

What is meant by "acceleration" in this context?

Acceleration refers to the rate of change of an object's velocity over time. In this context, it refers to the force required to slow down and ultimately stop at a specific target in a frictionless 2D space.

How is acceleration calculated in a frictionless 2D space?

In a frictionless 2D space, the only force acting on an object is its initial velocity and the force required to stop at the target. Therefore, acceleration can be calculated using the formula a = (vf - vi) / t, where vf is the final velocity (0 m/s in this case), vi is the initial velocity, and t is the time taken to stop at the target.

Can the acceleration be negative in this scenario?

No, the acceleration in a frictionless 2D space can only be positive or zero. This is because the force required to stop at the target is always in the opposite direction of the initial velocity, and therefore cannot be negative.

How does the mass of the object affect the acceleration?

In a frictionless 2D space, the mass of the object does not affect the acceleration. This is because the force required to stop at the target is dependent on the initial velocity and distance, not the mass of the object.

Is the acceleration to stop at a target always the same in a frictionless 2D space?

No, the acceleration to stop at a target can vary depending on the initial velocity and distance to the target. A higher initial velocity or longer distance will require a greater acceleration to stop at the target in a frictionless 2D space.

Back
Top