lego_rip_prog_simulink
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
lego_rip_prog_simulink [2016/04/18 00:18] – joaomatos | lego_rip_prog_simulink [2016/04/18 00:31] – joaomatos | ||
---|---|---|---|
Line 44: | Line 44: | ||
* **Input Calculation Logic:**Now that we have our “[x]” matrix with the states of our system , we can calculate the motor input as [K]*[u] , where [K] is our optimal gain matrix from LQR (Can be calculated using Matlab). We just need to do a matrix multiplication and its done. | * **Input Calculation Logic:**Now that we have our “[x]” matrix with the states of our system , we can calculate the motor input as [K]*[u] , where [K] is our optimal gain matrix from LQR (Can be calculated using Matlab). We just need to do a matrix multiplication and its done. | ||
+ | |||
+ | **1)Drag the following blocks to the work area: ** 1x Mux / 1x Gain / 1x Output(out1). | ||
+ | |||
+ | **2)Double click on the following blocks to modify its parameters: | ||
+ | * **Mux**: | ||
+ | * **Gain**: Change the gain value to the name of your Optimal Gain matrix stored on your workspace, and the multiplication to matrix. | ||
+ | * **Output**: Change the name to power input. | ||
+ | |||
+ | **3) Connections: | ||
+ | {{:: | ||
+ | |||
+ | **4)Organizing: | ||
+ | {{:: | ||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | **Part III) Sending the input to the motor ** | ||
+ | |||
+ | * **Motor Input Logic:**Now that we have our input calculated, we just need to send it to the motor. As the Lego motors only takes -100 to +100 values, we can use a saturation block to limit the input. For the convenience, | ||
+ | |||
+ | **1) Drag the following blocks to the work area:** 1x Switch / 2x Clock / 1x Constant / 1x Saturation /1x Motor/1x LCD | ||
+ | |||
+ | **2)Double click on the following blocks to modify its parameters: | ||
+ | * **Constant**: | ||
+ | * **Motor**: | ||
+ | * **Switch: | ||
+ | * **Saturation**: | ||
+ | * **LCD: | ||
+ | |||
+ | **3) Connections: | ||
+ | |||
+ | **4) Organizing: | ||
+ | |||
+ | {{:: |
lego_rip_prog_simulink.txt · Last modified: 2016/04/18 22:08 by joaomatos