WEEK 1

ITENS ORDERED Glide Wheel

OPTIONAL ITENS (I WILL NOT ORDER YET) XL Motor Battery Box for XL Motor

WEEK 2

WEEK 4

I'm trying to tune the gains. I will have to modify a few things from the original project:

Control Method: I'm programming only on the Bricx program ( that we used on class ) . I'm using the classical PID on the Angular sensor attached to the pendulum , measuring the angle , calculating the velocity and the errors. To run the motor i'm using foward command or Rev command using the power as a function of the PID gains and its respective errors. I tried to use PID on the motor also , ( by hand and using the RotateMotorExPID - which allow to control the motor rotation using PID gains ) but the performance got worse, so i got back to only the OnFWD and OnREV commands.

Videos of progress: Analyzing the videos my guess is the derivative gain need to be adjusted , but i'm working on it a few days and the performance is not getting better. The pendulum is travelling a long circular distance in order to keep balancing ( first video ). The second and third videos shows a little bit of the derivative gain adjusting , i tried small and big values , but i could not find the perfect value. Testing 1:

Testing 2:

Testing 3:


WEEK 5

LQR Approach → I'm following two different papers to find the LQR derivation for a rotary inverted pendulum. The state space model from the two papers are different , and i found two different [K] matrix for my model . ( changing the model parameters to my parameters and using Matlab to solve the ARE and get the [K] matrix ( I'm using Q as diag(100,1,100,1) and R=1 - plausible values and the pole placement is OK on both). However , the two [K] matrix were not good ( we always need some kind of hand tuning after finding these gains ). Since then i'm trying to tune the gains from the model that gave me the best balance.I tried to use the LQR gains from the MathWork program but the response was not very good.

I'm now using a full state feedback ,using the gains from LQR. I found a bug on the AngularSensor with motor controler - if you start the MotorRotationCount and rotate the motor to the negative direction , it will give sometimes a very wrong reading . So i had to insert on the code a 360 degree rotation on the motor before the system start working to use the Motor position as the (Actual counter - 360) to avoid these kind of wrong readings.

I found that limiting the motor maximum power to around 40~~50 of maximum power the system balance better. ( using saturation -100 x 100 the motor vibrates a lot when changing the turning direction). I tried to apply a filter on the velocity calculation (using average from 4 measures) but the system performance does not improved. Other strange thing happening is that sometimes in the middle of the balancing i got a “BlackOut” and the system loose the balance ( see video) . I don't know yet what can be causing this.

MATLAB CALCULATION


FIRST PAPER


SECOND PAPER wjet_2015052217370851.pdf


BALANCE SITUATION: Here is shown the “BlackOut”. I have been trying to tune the gains since Thursday, i don't know if i'm already at the better performance or not , i need to get the New Angle Sensor and run this setup on the simulink and see if the motor is limiting the performance or what is wrong with the code.

Difference between my model and the available on the internet → The control method is pretty similar to the majority of papers that i found on the internet - Full state feedback using LQR to find the gains. One thing that the guy from MathWork ( and Prof Kawata) did different is the method to derive the velocity. The guy from MathWork uses transfer functions blocks to find the velocity (input angle , output velocity). Prof Kawata is using the StateSpace block model to derive the velocity (input angle , output velocity ). And i'm using the manual method (Angle-PreviousAngle)/dt , dt= interval between the control loop. The Motor Input we are all using the same ( [K]*[x] ) (x as the matrix with the two angles and two velocities).

Next steps

WEEK 6

Voltage Calculation. ( the standard [K] from LQR times the Matrix with the states )

factor:

USING SIMULINK

Day 7:



WEEK 7 Now that the NQC is running smoothly the next steps are:

  1. Finish the swing up control.
  2. Fill up the spreadsheet with the necessary parts for the RIP Box.
  3. Do the a detailed version of the building instructions
  4. Do the step - by - step coding in the Bricx Command Center
  5. Explain the theory behind the NQC code
  6. LQR Theory - how to find the gains