# Drone targeting math

1. Apr 14, 2013

### guss

Here is a problem I've been trying to sort out and I can't get, I think it's kind of an interesting one.

Imagine a drone and a target point on a 2d plane. There are eight parameters:
P = my position
Q = target's position
V = my velocity
I = my moment of inertia
w = my angular velocity
s = my angular position
T = max thrust
U = max torque

(we'll just say the target is stationary)

The drone's job is to get to the target as fast as possible, obeying max torque and max thrust. Let's say the drone checks an equation at time interval t (maybe something like every .01 seconds) and adjusts its torque and thrust accordingly. What should the equations for thrust and torque be?

I'm guessing some programming-like if statements and stuff are required to check if max torque and thrust are obeyed, or something, so that stuff is allowed.

Last edited: Apr 14, 2013
2. Apr 14, 2013

### Staff: Mentor

Torque and moment of inertia around which axis? Do you have some additional parts in the setup?
Is thrust restricted to some direction (like "outwards"/"inwards")? Do we have to care about centrifugal force for that?

3. Apr 14, 2013

### DrZoidberg

If the initial velocity is not pointing directly at the target I'm guessing the path the drone will take will look like a parabola.
Maybe you could use a convergent iterative algorithm. Like Hero's method for example where you start with an initial guess and then refine that guess in every step. So you first make a guess for the position of the focus of the parabola, then calculate the trajectory you need to achieve that path. Then you refine the guess and keep iterating until the result doesn't improve much anymore.

4. Apr 14, 2013

### AlephZero

I'm not sure how realistic your problem is meant to be, but what you described would apply better to a spacecraft or a hovercraft than a drone. The difference is whether the vehicle can "fly sideways" or not.

If you apply torque and no thrust, what is supposed to happen? Does the drone travel in a straight line but rotate, or what?

Either way, it's not obvious to me the fastest path would be a parabola.

5. Apr 14, 2013

### jbriggs444

As I understand it, this drone has a variable thrust rocket motor with infinite fuel that produces acceleration purely on the forward axis with a fixed maximum thrust. And it has variable thrust attitude jets with infinite fuel that produce either clockwise or counterclockwise angular acceleration up to a fixed maximum torque. The mass of the craft is assumed constant regardless of fuel expenditure.

I would conjecture that the optimum strategy is characterized by:

1. Forward thrust is always either maximum or zero.
2. Angular thrust is always either maximum or zero.

It seems clear that a "hill climbing" strategy like Hero's method may fail because multiple local optima can exist. Consider, for instance, a drone with a very high initial rotation rate. Do we try to damp the rotation first and then go for the final parabolic trajectory after the rotation is damped? Or do we leave the rotation rate [mostly] alone and modulate the main thrusters to fire whenever the drone is pointed in the general direction of the target for an average thrust of approximately T/pi. Could we (perhaps) parameterize the problem in terms of the number of complete rotations that we will aim for and then try to use a hill climbing approach separately for each such number?

6. Apr 14, 2013

### jbriggs444

Thinking a bit more on this, one could model this as an n-dimensional optimization problem. The n dimensions are the turn-on time(s) and turn-off time(s) of the main thrusters and the attitude jets. There is a subset of this space that corresponds to those patterns of turn-on and turn-off times that result in an intercept. For each point in this subset there is a valuation function -- time to intercept. The subset is further constrained by simple rules such as:

1. First turn-on must be at time >= 0
2. First turn-off must be at time <= time to intercept.
3. Second turn-on must at time > first turn-off.
etc.

The whole exercise becomes something akin to a linear programming problem. Searching for a point on the surface of an n-dimensional shape that optimizes a valuation function.

As with linear programming, your first task is to find a point on the boundary of the shape -- a pattern of turn-ons/turn-offs that results in an intercept. Your second task is to modify that solution, finding a trade-off that can walk the solution along the boundaries of the shape to find a better solution. If the shape is convex, this part is guaranteed to succeed in finding an optimum.

7. Apr 14, 2013

### guss

Yeah, exactly. I think that is a central issue -- when do we let the craft rotate into position and when do we fire the main thruster. Also, when do we thrust directly at the target and when do we thrust away (when we are moving too quickly to turn and hit it).

You may have already been assuming this, but those "initial" conditions can just be given every time the function is called, and just be treated as current conditions. The craft then thrusts or torques for the time interval t given those conditions.

Last edited: Apr 14, 2013
8. Apr 14, 2013

### AlephZero

But if you let n be arbitrarily large, isn't that the same, in the limit, as having a continuously variable thrust?

9. Apr 14, 2013

### jbriggs444

Agreed.

The point I was trying to make was that just because you have continuously variable thrust does not mean that an optimal solution needs to actually use settings other than zero and full. If an optimal solution can be obtained with a bounded number of turn-on-to-max and turn-off operations then the solution space has been simplified -- instead of searching for a pair of real-valued functions in one variable one is searching for a [hopefully small] set of real-valued constants.

Now you used the phrase "in the limit"... I'll add a conjecture whose truth seems obvious.

3. The number of rotations required for an optimal intercept is bounded by a simple formula expressible terms of the known parameters.

[If the rotation rate is large, one can modulate the thrust in time with the rotation. An intercept is then certainly possible in time bounded in terms of starting distance, starting velocity and available [modulated] thrust. Within that bounded time, the possible number of rotations is bounded by a formula expressible in terms of starting rotation rate and maximum torque]

10. Apr 14, 2013

### guss

Ok, so here I am trying to figure out what angle the drone should aim at given the conditions. From there, we can work on the aiming and thrusting. So the time it takes to get to the target in the horizontal direction should be the same time in the vertical direction, and we can change the acceleration in each direction by adjusting the angle of thrust (and maybe the amount of thrust?).

So from calculus, d = (initial velocity)*t + .5*thrust*t^2. Solving for t in each dimension, then settings the ts equal, we get

(v + sqrt(v^2 + 2*d*T*cos(x)))/cos(x) = (w + sqrt(w^2 + 2*g*T*sin(x)))/sin(x)

Where x is angle, T is thrust, v is vx, w is vy, d is dx, g is dy.

Now how the hell do I solve this for x??? Even Mathematica, or any other tool I use, seems to be taking forever to solve for x. Is there even a solution?

11. Apr 15, 2013

### Staff: Mentor

We neglect time for a rotation now?
Okay. I think it is easier to solve this in a co-moving coordinate system - let the drone be at rest, so the target is moving. Its distance (to the original drone location) as function of time can be calculated, and the reachable distance of the drone in time t is just .5*thrust*t^2. Set both equal, and you get the minimal time and the position - this allows to find the direction as well.