12-14-2010 08:29 PM
I'm a new mentor and looking to create a few sandboxes for students to learn a bit about control and programming on thier own so that they can make efficient use of time with the robots.
The initial goal is a one DoF simulation that runs on the LabView computer (soft real-time) where the students can configure various PID type controllers to run alongside and control it. A simple next step would be to add user speciffied disturbances from the GUI.
If I'm understanding everything correctly, I need the "simulation loop" VI which is not included in the FRC package. Looking at all of the tools provided in this package (optimization, spectral analysis, UDP and TCP sockets, etc.) what I need is so fundamental that I can't believe what I need is not in there somewhere. The simulation tutorial I am looking at is from version 8.0, so I probably just need to be setting something somewhere else to enable dynamic simulation.
Please point me in the right direction. Thanks!!!!
Solved! Go to Solution.
12-16-2010 12:31 PM
Hi critch,
You don't necessarily have to use the simulation loop to use PID. If you look in the Control Design & Simulation palette, you should see the PID palette and you can use these without the simulation loop. As well, if you look in the Example Finder under Toolkits and Modules»PID and Fuzzy Logic Control»PID you should be able to find some examples that use the PID VIs but don't need the simulation loop. What the simulation loop has that a regular while doesn't is an ODE solver. If you don't need this to evaluate your model/plant, then you don't have to use the simulation loop.
~Olivia
12-18-2010 02:22 PM
See if this helps. It's a PID demo I put together for the kickoff last year. It's supposed to simulate (in a very simplified way) a camera mounted to a motor, tracking an object. The code bounces a ball around the screen, and draws a triangular field of view. The PID loop tries to keep the ball in the center of the field of view. It's not very realistic but it's enough to demonstrate the effect of PID parameters. You'll see there's also an unused "Motor Speed" control. You can disconnect the output of the PID loop and connect the Motor Speed control, then have the students try to follow the ball around themselves by controlling the motor speed to demonstrate the advantage of automatic control.
As a bonus, there's a VI in this archive as well that reads from a joystick and uses the signal to move a circle around the screen. I gave this to students as starting point, then asked them to use the joystick buttons and throttle to make it do more - for example, toggle the color of the ball each time they press a button or change the ball speed. One student changed the circle to a rectangle and added code to rotate the "robot" as he drove it around the screen. He then expanded this to simulate use of the gyro to determine direction of travel.
12-18-2010 04:38 PM
Wow, thank you. This helps a lot! The joystick interface from LabView is a very welcome sight too!
As a plant model of a physical system, I most certainly have ODE's which need to be integrated. I can cover it with a Forward Euler for now and once I get the hang of it, it should be no problem to implement a fixed step third order Runge-Kutta (ode23 set to fixed step) environment as a for loop inside which you would drop your plant model. This provides increased stability at larger timesteps.
I'll keep looking as I learn more about LabView. Thank you!