Things I did:
For the past two weeks, I helped our team create the abstract and presentation. Additionally, I worked on the symbolic modeling and simulation of the double pendulum system with Thomas, towards prototype 2. Specifically, I was able to use the Lagrangian equations of the system to derive the equations of motion, and encoded them into symbolic objects in Casadi. The main challenge I faced during this step is figuring out how to represent dynamical systems in Casadi. This is largely due to the fact that Casadi’s documentation is very sparse. This caused issues when I tried to represent the derivatives of variables, as I had to work around to find a correct representation.
Additionally, after obtaining the dynamical equations, I was able to implement a Second Order Implicit Runge-Kutta solver(IRK2). By using this solver, I can solve the dynamical ODE’s, giving me the evolution of the state with respect to time. The reason we used IRK2 is three fold:
- IRK2 guarentees stability if the ODE system is stable.
- It gives O(dt^3) local error(where dt is the time step) even though it’s a second order method due to some its properties.
- It only requires the current state and next state values when solving the system, which is already given by the NMPC formulation. This means there is no need to add additional variables to the equality constraint for optimization, which means we don’t need to add additional components to the PCB board.
After creating the solver, I implemented a basic visualizer using matplotlib, which visualizes the double pendulum and displays how it’s state evolves as time progresses.
Finally, I added a control input, a torque on the joint, to the system.
The resulting simulation with a constant torque applied is shown below.
Things I will do:
For the upcoming week, I will continue working on the simulation, starting with looking into how to integrate a NMPC solver into the system. This will involve a review of existing solvers, and looking at ways of integrating them with Casadi.
Current standing:
Currently, I am on schedule working towards prototype 1. I will be continually working on this for the next week.