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.