Search code examples
drake

Adding Thurster/External Forces to Extract Gradients for Equation of Motion for Linearizing


I have a simple robot with a floating base and a 2-DoF arm attached to it with a thruster at the end (similar to a 3-D perching glider underwater, if that helps with an image of the system).

For this, I planned to use Time-Varying LQR for its control for trajectory tracking. During the trajectory optimization, I used the term J^T F_thurster to account for the thruster forces. Now I'm trying to linearize the equations of motion (M(q)q_ddot + C(q, q_dot) = B[tau_1, tau_2] + J^T F_thruster) with the thruster force so that I can create a TVLQR controller. Previously I had used plant.EvalTimeDerivatives and ExtractGradient to create the linear A and B matrices for other systems without thrusters/external forces.

Is it possible to add the J^T F_thruster term to this process? I was considering writing the equations of motion partially manually by using AutoDiff and functions such as CalcMassMatrix, CalcBiasTerm, and CalcJacobianSpatialVelocity and then using ExtractGradient but I am not sure this is supported?


Solution

  • I would recommend implementing the thrust as a System, and then taking the derivatives of the Diagram (eg using AutoDiff). The Propeller system might be very close to what you want.