User Tools

Site Tools


lego_rip_simulation_cad

This is an old revision of the document!


Step by Step instructions

You can get all the necessary .STL parts to build the RIP project on this file bellow. If you want the assembly already done, you can find inside the folder “only sensors building” named as “PendulumAssembly”

Kit for the RIP project

Follow the following steps to export your Assembly from Solidworks to Simulink:

Download the latest Simscape Multibody Link Plug-in in the following link: Link

Follow these simple instructions on how to install a Plug-in if you don’t know how to. Instructions

1→ If you did not make your assembly , Open the “RIP only Sensors building “ and open the “PendulumAssembly” file at SolidWorks. Enable the SimMechanics Link add-in in SolidWorks: (on the top toolbar , click on the gear (add-ins) , scroll down and check the SimMechanics Link box)


2→ When you are done with your assembly, you can export it in the format to be used by Simulink following : (Tools > SimMechanics Link > Export > SimMechanics Second Generation ). Save the xml file with the SAME name as the assembly name!


3→ Now open your Matlab , make sure that you are in the correct folder on the matlab path , and in the command window type: smimport (‘YourAssemblyName’) and hit enter. (change the argument to the name of your assembly). A simulink window should open and you can see the model of your system .


4→ Hit the play button and see if the dynamics and the parts of your system are all correct.


5→ If your model seems to be running with some lag, try to change the model parameters to the following : (decreasing the step size – set max step size to 0.001- make the simulation to run smoother , but it will take more time to compile it. Also changing the Solver to ode23t will make it to compile faster)


6→ The basics that you should know to start developing your control strategy is in the joints blocks. Double click any joint block (If you did everything correctly you should see only two revolute joints , one for the “motor” and one for the pendulum ).

Under State Targets, you can set the intitial position and the velocity that this joint will be at the beginning of the simulation. PS* try to save your assembly before you export to Simulink with the pendulum in the correct position – on the top or on the bottom position - , otherwise 0/180 degrees will not correspond to the top and bottom position correctly .

Under Internal Mechanics , you can set some parameters to the joints like stiffness and damping, it will make it to be more realistic - if you set everything to 0 you will have the ideal conditional of no friction.

Under Actuation ,you can enable/disable the input of some torque on this joint. Latter on the controlled version , we will enable torque input on the “motor” joint , to simulate the torque that the motor give to the system (provided by the LQR calculation). Under Sensing , is where you can enable the option to get the “real time” data from this joint . For our controlled version , we will enable position and velocity data.

To get data from the sensing , connect a simulink “PS-SIMULINK” block to the output port on the right side of the joint block. On the “PS-SIMULINK” block you can set the unit of the variable that you are measuring ( for example , radians for angles , and radians/seconds for velocity ). To send data (for example send the torque input to the motor joint) you use the “SIMULINK-PS” block. On this block you can set the unit for the input that you are sending, for example N*m for Torque.

With this briefly explanation you should be able to wire some blocks and make your control scheme and see if it works. I will provide my block diagram with the controller using PD provided by the LQR calculation. There is a lot of ways to construct your block diagram , use your creativity!

lego_rip_simulation_cad.1488224395.txt.gz · Last modified: 2017/02/27 11:39 by joaomatos