Lab 4: Trajectory Following 1
Prelab Familiarize yourself with how the LabVIEW program works It is XYposition_control1.4.vi Located in Lab4_LabVIEW.zip on the Stellar page 2
Optional prelab: create your own trajectory It is possible (and optional) to create your own trajectory using Matlab Download and unzip Lab4_Matlab_optional.zip Open up SmoothSplineCurve.m This program allows you to open up an image and click points on the image. Then, it interpolates and smoothes the trajectory of points. Next, create an image file with the curve you d like to follow. Skoltech.png is provided as an example Enter the image file name in the Matlab program an run it Click the trajectory of points you d like to follow Save the X and Y vectors to a *.txt file An example trajectory file is TrajectoryS6.txt in Lab4_LabVIEW.zip Load it onto your myrio s tmp folder by following the instructions provided later in this lab Note: you will need to scale your trajectory so that it fits within the XY stage s ~2cm x 2cm workspace 3
In lab: Step 1: assemble two kits into a twoaxis stage 4
Combine the parts from your team s two kits Disassemble two kits to the level shown in the photo NOTE: keep your aluminum plate attached to the bottom of kit 1 (The plate is omitted from these photos for clarity) Kit 2 Kit 1 Aluminum plate should remain attached, but is omitted in these photos for clarity
Attach Base 2 to Carriage 1 with two M2.5x8 screws Insert hex driver through holes to access screws 6
Attach Coil 1 to Base 2 using two #8 screws You may have to rotate Coil 2 so that the holes line up. Make sure VCA wires are sticking out to the right as viewed in this picture 7
Place Voice Coil 2 in position on Base 2 and attach magnet using two #8 screws 8
Attach Coil Support 2 to Carriage 2 using two M2.5x6 screws 9
Attach the coil to the coil support with two #8 screws 10
Orient one encoder so that the pins are towards the base, as shown in the left photo (from Lab 1) Line up the encoder with the forward two mounting holes Attach encoder to base using two M2.5x14 screws Three holes Pins are towards base Two forward holes 11
Carefully place code strip in between the code strip support and the coil support bracket with the concave side facing towards the voice coil Tighten in place 12
Using two M2.5 screws, attach the two halves of the code strip support as shown in the photo 13
Affix the code strip support assembly to the back of Base 2, as shown 14
Place the other encoder against Base 1 with the pins away from the base Line up the holes with the rear two holes Secure in place with two M2.5x14 screws Pins away from base Three holes 15
Carefully place the code strip in the clamp assembly with the concave side facing towards Base 1 Line it up as shown in the left photo Tighten in place ~8mm 16
Now you re done assembling the 2-axis stage! 17
Attaching the pen writing assembly Fully insert your pen into the hole and tighten the four screws Attach the assembly to your 2-axis stage using four M2.5x8 screws 18
Find a flat, rigid object whose height is a few millimeters above the bottom of the pen, as shown. Tape a clean piece of paper to the object ~1-3mm Now you re done with assembly! 19
Step 2: wire up the second voice coil and motor driver Follow the same process as in Lab 1, but connect the five signals (PWM, INA, INB, ENC.A, and ENC.B) to myrio s Channel B 20
21
Step 3: control with LabVIEW Plug in the AC adapters for the myrio and motor driver carriers Connect the myrio to your computer with the USB cable and open up your myrio project Download Lab4_LabVIEW.zip from the Stellar page Drag XYposition_control1.4.vi into your myrio project Double-click it to open it up 22
Load the trajectory file onto your myrio using WebDAV Follow Steps 1-9 here: http://digital.ni.com/public.nsf/allkb/4ebe45e8a816b193862 57B6C0071D025#windows7 Note: you may need to temporarily turn off windows firewall Hostname: (see next page) Username = admin, pw = (blank) Drag the text file TrajectoryS6.txt into the tmp folder Takes 1 or 2 minutes If a window pops up that says Are you sure you want to copy this file without its properties?, click Yes 23
Hostname In my case, this is the folder address that I ll need to use when I Map Network Drive: http://172.22.11.2/files/ 24
If you see a window that says Windows cannot access http://172.22.11.2/files/, click Cancel. You probably need to power cycle the myrio. To do so, Unplug the myrio s USB connector from your computer Unplug power to the myrio Reconnect power to the myrio Wait for the myrio s Status LED to go from purple to off Plug the myrio s USB into your computer Try to reconnect using Map Network Drive 25
Zeroing the encoders We want the encoders to read zero at the center of their range of motion. To do this, Go back to your LabVIEW program and press run Push the actuators so that they are both fully compressed, as shown 26
With the actuators fully compressed, zero the encoders in your LabVIEW program Be sure to unpress each Zero Encoder button so that it does not continuously reset the encoder 27
Now, move both actuators by hand so that they are both at a position of about 14,000μm (the center of their range of travel). Position is displayed in LabVIEW, as highlighted in the photo on the following page Zero both encoders again Now your encoders will read zero when the device it at the center of its range of motion 28
29
Enabling the motors Now your stage is ready to start writing, but first we need to enable the motors The trajectory is being continuously read and loaded, but at this point, the motors are disabled When we enable one of the motors, it will rapidly move to follow the trajectory To prevent the recoil from potentially knocking the stage off of its stand, first firmly grasp voice coil 1, as shown on the next page (Alternatively, you can place your voice coil stage on a rigid object ~5cm tall, then clamp it in place using a C-clamp to sandwich the aluminum plate, 5cm object, and table.) 30
Hold this magnet when you enable position control. This will prevent the device from falling over. Do the same when you enable axis 2. 31
While grasping the magnet of voice coil 1 with one hand, use the other hand to toggle the VCA 1 control on/off switch to ON VCA 1 enable switch 32
Do the same for voice coil 2 VCA 2 enable switch 33
Now the motors should be following the trajectory and you re ready to start writing Lift up the tip of the pen and slide the writing surface underneath it. (Or, carefully tip the entire assembly up and slide the writing surface underneath) Release pen so that it makes good contact with the paper 34
Sit back and enjoy the show! 35
Press the Pause button to pause/unpause motion 36
Press the STOP button to stop motion 37
Potentially necessary: change the PID gains to improve performance Because following a trajectory is the same as following a series of sequential steps, having a good step response leads to good trajectory following. The default PID gains have been chosen to provide reasonably good trajectory following. You ll notice that they re close to the PID gains we used in Lab 3 Feel free to try different PID gains if you would like to improve the quality of the trajectory following 38
Potentially necessary: inverting the axis directions Potentially, you might find that the writing is mirrored. If that happens, try inverting the VCA1gain or VCA2gain above the Stop button 39
Optional: speed up or slow down You can speed up or slow down the writing speed by changing the parameter labeled C, which is below the Stop button You can see what C does by studying the LabVIEW block diagram 40
Checkoffs Demonstrate the assembled two-axis stage Demonstrate closed loop position control with both axes Demonstrate trajectory following Be ready to explain how the LabVIEW program works 41