0

I'm trying to create a trajectory optimization algorithm for a rigid body that can have torques applied to it to rotate it in 3D space, as well as a thuster that is fixed to the bodies X-axis which can be used to accelerate the object with a fixed acceleration (in this case either 0, or 1000 units/s^2). For now I am removing the rotational equations of motion for my optimization problem for simplicity until I understand how to use the scipy.optimize.minimize function well enough to include these other dynamic constraints. I am also considering that the acceleration can be a value anywhere inbetween 0 and 1000, and apply a pulse width modulation to the thrust control to emulate an acceleration between 0 and 1000

So I've been looking around for a good example that uses a typical cost functional like the following:

J = t_f, where t_f is the final time, J is my cost functional that I would like to minimize

Let's say I have some boundary conditions (or constraints): x(t_f) = [s_f, v_f]

and initial conditions x(0) = [s_0, v_0]

where x is the state of the object: x = [position, velocity]

I would like to optimize the control input u(t) (which is my ideal acceleration vector, u = [ax, ay, az]) such that I reach the final state in minimal time. (and of course my acceleration values here are in the world_frame)

u has the constraint |u| <= 1000. Again for simplicity I'm considering that the rocket's rotational dynamics are not at play here, and I can instantly apply this acceleration to the rocket without having to orient the rocket in the acceleration vectors direction.

The dynamic constraints are Newtons equations of motion which I was going to consider being in discrete time.

x0 = ((u(t) + gravity)*(delta_t^2) / 2) + (x1*delta_t) + x0

x1 = (u(t) + g)*(delta_t) + x1

Is there a similar question out there that I have missed? Or is there an example I missed that would lead me to finding the control vector u(t)?

I've been reading about the 'SLSQP' method a bunch, and that seems to be the way to go, but I'm still not sure how to apply my objective function and constraints properly such that I will receive my control input over the entire time span.

To simplify: I'd like to minimize some function J=t_f using scipy.optimize.minize(method='SLSQP')

Constrained by some dynamics and boundary conditions,

x(t_f) = [s_f, v_f]

x(t_0) = [s_0, v_0]

x0 = ((u(t) + gravity)*(delta_t^2) / 2) + (x1*delta_t) + x0

x1 = (u(t) + g)*(delta_t) + x1

|u| < 1000

And my variable that can be controlled in order to minimize the function is u.

Once the function terminates I'd like to have all of the u's over the entire time span from t_0 to t_f.

gigs
  • 105
  • 4
  • 1
    At least 50% of this question has nothing to do with coding, it's just mathematical theory. This doesn't really fit the site because we deal with _specific_ issues with code. That said, I'm not sure where this is better asked. If you can pull the content down to literally just `scipy.optimize.minimize` then it might be on-topic – roganjosh Mar 09 '19 at 16:43
  • I feel like it's pretty on topic. I'm asking for similar examples that the community has seen that could lead me to a solution, or possibly someone who has done a similar problem like this that has some insight. The function in question is an optimization/minimization function anyway, how could it not include mathematical theory. Also, I am not asking for clarification about the theory, I understand the theory, the implementation numerically using the scipy.optimize.minimize function is the question at hand here. What would be your recommendation on wording to become "on-topic"? – gigs Mar 09 '19 at 16:55
  • To be on-topic would be to drop all the background and ask about how the code you've implemented doesn't work the way you expected. In a technical sense, not in terms of mathematics. Like, spurious results or errors. You're asking something context-specific – roganjosh Mar 09 '19 at 17:03
  • see https://stackoverflow.com/help/on-topic – mb21 Mar 12 '19 at 16:17

0 Answers0