Pick en Place Casus/Experiments manual: Difference between revisions

From Control Systems Technology Group
Jump to navigation Jump to search
 
(28 intermediate revisions by 2 users not shown)
Line 12: Line 12:
# Notebook with E/box image installed;
# Notebook with E/box image installed;
# Experimental Pick and Place setup (see below);
# Experimental Pick and Place setup (see below);
# Two E/boxes including ethernet cable
# Two E/boxes including ethernet cable;
# Three BNC cables (one included in each E/box kit)
# Three differential connected encoder cables. Note: These are NOT the ones included in the E/box kit.
# Three differential connected encoder cables. Note: These are NOT the ones included in the E/box kit.
''Table 1''
''Table 1''
Line 53: Line 54:
# Open a terminal (via the icon on the desktop)
# Open a terminal (via the icon on the desktop)
# Type ''svn_update''
# Type ''svn_update''
If you are experiencing any problems (bugs/errors) with the experiment software, then first make sure you have checked out and installed the latest software revision from the SVN by repeating steps 3.2 and 3.3. Since this update will also update the simulink templates used in the experiments, it is recommended to save any changes made to these files with a different filename and/or in a different location, preferably on your harddisk.


== Compiling and installation the software ==
== Compiling and installation the software ==
Line 77: Line 76:


These commands set the right ethernet index number, this needs to be done each time a new software revision is checked out.
These commands set the right ethernet index number, this needs to be done each time a new software revision is checked out.
== Choose a proper location and name ==
In the model Stateflow is used to implement a homing routine. In order to let Stateflow build the code well, the path name of the entire model should not exceed 260 characters. It is therefore sensible to choose a short model name and short path. A well chosen path could be /Home/Documents (in terminal from any location: ~/Documents). Be sure to copy the model (.mdl) as well as the S-Function (.c) to that location.
== Compiling S-Function ==
In order to reset the encoders while the robot is homing a S-Function is written. This function is named ec_EboxResetEnc.c and needs to be  compiled from matlab. Open Matlab and go to location you chose in the previous step. type: mex ec_EboxResetEnc.c. The compiled file ec_EboxResetEnc.mexa64 should appear after succesfull completion.


== Save data ==
== Save data ==
To be safe, you should save the data you obtain via experiments outside of Ubuntu. This means that it will not be deleted if Ubuntu is uninstalled. You can save it to your Windows hard disk or use a web service such as Dropbox or Box. The partition of your hard disk on which you have installed Ubuntu can be found under ''\host'', any other partitions can be found in ''\media'' or in the places menu from the taskbar.
To be safe, you should save the data you obtain via experiments outside of Ubuntu. This means that it will not be deleted if Ubuntu is uninstalled. You can save it to your Windows hard disk or use a web service such as Dropbox or Box. The partition of your hard disk on which you have installed Ubuntu can be found under ''\host'', any other partitions can be found in ''\media'' or in the places menu from the taskbar.
Be also sure to save your model!


= Performing Real-Time experiments =
= Performing Real-Time experiments =
The simulink template for the experiments can by typing ''printer01'' in the matlab consolue. Make sure you save any changes to the model with another file name and/or in another location or you might lose your work when updating the svn or reinstalling Ubuntu.


= External mode =  
= External mode =  
The following steps are have to be followed to execute the experiment:
The following steps are have to be followed to execute the experiment:
# Open the simulink file and press "Ctrl-B" to start building the real-time code
# Open the simulink file and press "Ctrl-B" to start building the real-time code
# Switch on the printer setup
# Switch on the pick and place setup
# Open a terminal
# Open a terminal
# type ''sudo su''
# type ''sudo su''
# Go to the folder where you just built the file (the file is built to the current directory of Matlab). Use ''cd'' to specify the path.
# Go to the folder where you just built the file (the file is built to the current directory of Matlab). Use ''cd'' to specify the path.
# Note: If there is a ref3 block present (yellow), you must first give it a path to follow and accept , otherwise it will throw an error.
# Type ''./RA -w'' in the terminal to execute your experiment (Assuming you saved your model as RA). The ''-w'' part means the realtime application will be run in external mode. If you have renamed the model, ''RA'' in the previous commands has to be replaced by the name of your Simulink model.
# Type ''./printer01 -w'' in the terminal to execute your experiment. The ''-w'' part means the realtime application will be run in external mode. If you have renamed the model, ''printer01'' in the previous commands has to be replaced by the name of your Simulink model.
# The external mode requires you to connect the Simulink model to the real-time application and start it manually from the Simulink. This has to be done by choosing "Connect to Target" and "Start Real-time Code" from the Simulation menu respectively.
# The external mode requires you to connect the Simulink model to the real-time application and start it manually from the Simulink. This has to be done by choosing "Connect to Target" and "Start Real-time Code" from the Simulation menu respectively.
# The standard simulation time is 30 seconds, to change this, in Simulink go to "Simulations", "Configuration Parameters" and change the "Stop time".
# The standard simulation time is 30 seconds, to change this, in Simulink go to "Simulations", "Configuration Parameters" and change the "Stop time".
# After the experiment has finished you can return to Matlab, load your data ("load printer01.mat") and perform the required actions to post-process the measurement data. Save all your commands in a Matlab m-file. Created variables have the prefix ''rt_''
# After the experiment has finished you can return to Matlab, load your data ("load RA.mat") and perform the required actions to post-process the measurement data. Save all your commands in a Matlab m-file. Created variables have the prefix ''rt_''
# The ''-w'' option can be omitted to let the real-time application run in stand alone mode.
# The ''-w'' option can be omitted to let the real-time application run in stand alone mode.


= Usefull tips =  
= Usefull tips =  
# The robot has physical limits; the range and velocity of all axis is limited. Take this into account when working with the robot. The range limits are considered in the Simulink model and the model will stand still in the axis that reached its limit. Restarting the model will re-home the robot.
# The robot has a singularities. Find out what they are and try to locate the singularities of this robot!
# For more information regarding system identification, the following book can be read: Feedback Control of Dynamic Systems, Franklin, Powell.
# Take an extra phaselag in the open-loop into account, which has the order of magnitude of <code>ωT</code>, where ''T'' is the sample time in <code>[s]</code>, equal to the ''Fixed step size'' from the simulation parameters. Futhermore, <code>ω</code>  is the frequency in <code>[rad/s]</code>. Increasing the open-loop gain will eventually always result in unstable behaviour.
# The positions of the axes of the robot are given in radians


To get an idea of the system behavior of the open-loop system. One of more suitable input signal for the motor can be chosen, while recording the resulting output of the system.
= Troubleshooting =
 
* By applying a sinusiodal input signal (and linear system behavior) it is possible to determine a point of the Bodediagram. With several of these experimenten, a complete Bodediagram can be constructed.
* With simple input signal, e.g. constant for a short period, then zero, gives relevant information about direction of motion, amount of friction, etc.
 
 
For more information regarding system identification, the following book can be read: Feedback Control of Dynamic Systems, Franklin, Powell.
 
 
Take an extra phaselag in the open-loop into account, which has the order of magnitude of <code>ωT</code>, where ''T'' is the sample time in <code>[s]</code>, equal to the ''Fixed step size'' from the simulation parameters. Futhermore, <code>ω</code>  is the frequency in <code>[rad/s]</code>. Increasing the open-loop gain will eventually always result in instable behevior.
 
Look at [http://cstwiki.wtb.tue.nl/index.php?title=Printer_Casus_Ebox#Frequently_Asked_Questions Frequently Asked Questions] if there are any questions. This wiki will be updated during the casus on a regular basis.
 
= Troubleshooting =  
 
error:
 
  Invalid setting for fixed-step size (0.001) in model 'printer01'. All sample times in your model must be an integer multiple of the fixed-step size.
 
  The sample time period (0.00048828125) of 'printer01/Generated S-Function' is not an integer multiple of the fixed step size (0.001) specified for model.
 
solution:
 
* press Ctrl+e
 
* select: 'solver'
 
* change 'Fixed-step size (fundamental sample time):' under 'Solve options' to value "1/2048"
 
error:
 
  Error(s) encountered while building model "printer01"


solution: choose a different name for the model. Using "printer01.mdl" can cause problems because the file can be shadowed by the original "printer01.mdl" in a folder higher on the Matlab path.
If encountering any problems you can contact Jacco Hubregtse (j.hubregtse@student.tue.nl) or your group tutor.  
If you encountered any problem yourself and you solved it yourself, it is highly appreciated if you would inform Jacco about the problem. This way we can add these to FAQ, this will help your fellow students and further generations which is of course honourable!

Latest revision as of 14:24, 28 April 2014

Instructions for measuring and controlling the Pick and Place setup.

This manual describes the necessary hardware #Hardware and Software for measuring and controlling the Pick and Place setup. The section #Performing Real-Time experiments includes an introduction to the use of the preparation and the actual execution of experiments. To use a setup, you can subscribe at the appropriate registration lists in SEL3 (1 setup per half day per group).

Almost every day, for several hours assistance available in SEL3, where you can ask your questions. For questions during the experiments, please contact Jacco Hubregtse or your group tutor. The project coordinator is Rene van de Molengraft (Mail Rene.png , tel 2998, GEM-Z -1.141).

Hardware

The case is a special designed three degree of freedom robotarm with a solenoid as end effector, depicted below. The required hardware for the experimental set-up is included in Table 1. You have to take your own notebook to do experiments.

Required hardware

  1. Notebook with E/box image installed;
  2. Experimental Pick and Place setup (see below);
  3. Two E/boxes including ethernet cable;
  4. Three BNC cables (one included in each E/box kit)
  5. Three differential connected encoder cables. Note: These are NOT the ones included in the E/box kit.

Table 1

The three axes of the pick and place robot are driving using stepper motors (ST4118, NEMA17). The stepper motors are controlled in torque using specific controllers (iPOS360x BX-CAN). The radial position of the motors is measured using incremental encoders with differential output (WEDS5541). As visible, gears are used to couple the torque from the motor to the bodies of the robot. The gears are preloaded with springs to overcome the problem of backlash.

To control and measure the robot two E/boxes are needed. E/boxes can be connected in series by using a link ethernet cable. The connections that have to be made before starting the model are depicted in Figure 1. Once again, the encoder cables included in the E/box kit are not sufficient for this setup, use the differential connected cables. The differential connected cables have more connections; the PWM output of the E/box is used for controlling the solenoid and safety and the encoder are connected differential in order to reject noise.

Figure 1

Installation of Ubuntu with Wubi

WARNING: This installation will only work on a normal installation of the Windows Operating System as it depends on the Windows Boot loader. If you use another operating system or if you are unsure please contact one of the course supervisors.

Wubi is a linux installer for Windows which can install and uninstall Ubuntu in the same way as any other Windows application in a simple and safe way. Ubuntu will be installed within a file in the Windows system ebox_root.disk. This file is seen by Ubuntu as a real hard disk.

The installation of Ubuntu used for this course takes up 30 GB of free-space. Therefore, it is recommended to install Ubuntu by connecting to TU/e network via an ethernet cable. Using VPN or wireless is strongly discouraged!

The wubi-installer can be obtained from the TU/e network share: \\ai-stosrv02\EBox. Install by opening the executable "wubi_dd-mm-yy-time". Because the installation is quite large this will take some time, especially creating the virtual disk, so please be patient. Connected to gigabit network the installation will take approximately 15 minutes, on a 100 mbits network connection it will take about an hour.

When you have installed Ubuntu with Wubi, you can start ubuntu by rebooting your computer. A menu will appear during startup which allows you to choose whether to run Windows and Ubuntu. When you choose Ubuntu in this menu, you will go to a new bootloader called GRUB. Here you can choose which version of Ubuntu to run as well as alter the start-up commands for running Ubuntu. Unless you are having problems starting up, you should just select the default version by pressing enter. When prompted for account information use the following:

  1. Username: ebox
  2. Password: ebox123

You can change the password if desired.

Installing software for experiments

Activating Matlab

The version of Matlab installed on Ubuntu needs to be activated. To do so, start matlab from a terminal window with

  1. sudo su
  2. matlab

and follow the instructions and use the activation key linked on the campus software site. Matlab activatie

If the student activation key doesn't work, take the employee activation key

Update to the latest experiment software

The software to perform experiments is already present, but possibly outdated. To update the software and simulink models used, you have to checkout the latest stable revision from the SVN (subversion) server. This can easily be done using the svn_update script:

  1. Open a terminal (via the icon on the desktop)
  2. Type svn_update

Compiling and installation the software

First start matlab from a terminal (if not done already):

  1. Open a terminal
  2. Type sudo matlab

To obtain a fresh copy of the latest version:

  1. Run svn_update according to subsection #Update to the latest experiment software in a terminal window.
  2. Change the Matlab current directory to /home/ebox/svn/trunk/src/E-box
  3. Run make_all_clean in matlab
  4. Run make_all_install in matlab, answer yes to TU/e toolboxes installation question

Preparation prior to performing experiments

Connecting the E/BOX, changing ethernet index number

Connect the power supply to the E/BOX. Use a network cable to connect your laptop to the In-port of the E/BOX. Since the index number of the Ethernet port you are using can vary for different pc's, the right number has to be set:

  1. Open a terminal
  2. Type sudo geteth (returns the right port number, only when the E/box is connected)
  3. Start matlab (type sudo matlab)
  4. Type changeeth(x) in the matlab command window where x is the port number found with geteth.

These commands set the right ethernet index number, this needs to be done each time a new software revision is checked out.

Choose a proper location and name

In the model Stateflow is used to implement a homing routine. In order to let Stateflow build the code well, the path name of the entire model should not exceed 260 characters. It is therefore sensible to choose a short model name and short path. A well chosen path could be /Home/Documents (in terminal from any location: ~/Documents). Be sure to copy the model (.mdl) as well as the S-Function (.c) to that location.

Compiling S-Function

In order to reset the encoders while the robot is homing a S-Function is written. This function is named ec_EboxResetEnc.c and needs to be compiled from matlab. Open Matlab and go to location you chose in the previous step. type: mex ec_EboxResetEnc.c. The compiled file ec_EboxResetEnc.mexa64 should appear after succesfull completion.

Save data

To be safe, you should save the data you obtain via experiments outside of Ubuntu. This means that it will not be deleted if Ubuntu is uninstalled. You can save it to your Windows hard disk or use a web service such as Dropbox or Box. The partition of your hard disk on which you have installed Ubuntu can be found under \host, any other partitions can be found in \media or in the places menu from the taskbar. Be also sure to save your model!

Performing Real-Time experiments

External mode

The following steps are have to be followed to execute the experiment:

  1. Open the simulink file and press "Ctrl-B" to start building the real-time code
  2. Switch on the pick and place setup
  3. Open a terminal
  4. type sudo su
  5. Go to the folder where you just built the file (the file is built to the current directory of Matlab). Use cd to specify the path.
  6. Type ./RA -w in the terminal to execute your experiment (Assuming you saved your model as RA). The -w part means the realtime application will be run in external mode. If you have renamed the model, RA in the previous commands has to be replaced by the name of your Simulink model.
  7. The external mode requires you to connect the Simulink model to the real-time application and start it manually from the Simulink. This has to be done by choosing "Connect to Target" and "Start Real-time Code" from the Simulation menu respectively.
  8. The standard simulation time is 30 seconds, to change this, in Simulink go to "Simulations", "Configuration Parameters" and change the "Stop time".
  9. After the experiment has finished you can return to Matlab, load your data ("load RA.mat") and perform the required actions to post-process the measurement data. Save all your commands in a Matlab m-file. Created variables have the prefix rt_
  10. The -w option can be omitted to let the real-time application run in stand alone mode.

Usefull tips

  1. The robot has physical limits; the range and velocity of all axis is limited. Take this into account when working with the robot. The range limits are considered in the Simulink model and the model will stand still in the axis that reached its limit. Restarting the model will re-home the robot.
  2. The robot has a singularities. Find out what they are and try to locate the singularities of this robot!
  3. For more information regarding system identification, the following book can be read: Feedback Control of Dynamic Systems, Franklin, Powell.
  4. Take an extra phaselag in the open-loop into account, which has the order of magnitude of ωT, where T is the sample time in [s], equal to the Fixed step size from the simulation parameters. Futhermore, ω is the frequency in [rad/s]. Increasing the open-loop gain will eventually always result in unstable behaviour.
  5. The positions of the axes of the robot are given in radians

Troubleshooting

If encountering any problems you can contact Jacco Hubregtse (j.hubregtse@student.tue.nl) or your group tutor. If you encountered any problem yourself and you solved it yourself, it is highly appreciated if you would inform Jacco about the problem. This way we can add these to FAQ, this will help your fellow students and further generations which is of course honourable!