Football Table Motion: Difference between revisions
(Created page with 'Here we explain MOTION.mdl') |
Rjmjanssen (talk | contribs) No edit summary |
||
(45 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
Here we explain MOTION.mdl | ==Introduction== | ||
<p>Here we explain <code>MOTION.mdl</code> (aliases/alternate versions: <code>MOTION_demo.mdl</code>, <code>MOTION_exp.mdl</code>, <code>MOTION_demo.mdl</code> and <code>MOTION_test.mdl</code>). <code>MOTION.mdl</code> is compiled as an external and hence you run in from a terminal (as a super user). Compilation is done by running <code>make.m</code>, which is located in the main folder.</p> | |||
<p>The three different version all serve different needs, '''to use one: save them as MOTION.MDL and compile''' | |||
;<code>MOTION_demo.mdl</code> | |||
:Demonstration ready, uses only old code (no Reinforcement learning and a simple policy). | |||
;<code>MOTION_frf.mdl</code> | |||
:Used for frf-measurements, this by-passes homing and safety, so make sure to '''center all rods''' before running. Secondly, check to see if there are actually weak controllers set in this file. The output of this file is the same as all of the variant, a log file called <code>MOTION.mat</code>. An m-file which processes the data can be found in the <code>../tools</code> folder(determines all transfer functions), you can use the output for loopshaping with i.e.: [http://cstwiki.wtb.tue.nl/index.php?title=Home_of_ShapeIt shape-it]. | |||
;<code>MOTION_exp.mdl</code> | |||
:Experimental version, this file is kept to test new systems e.g. new moves etc. | |||
;<code>MOTION_test.mdl</code> | |||
:Simulator version, use this file for generating experience. More on this can be found [http://cstwiki.wtb.tue.nl/index.php?title=Football_Table_Simulation_Visualization_Tool#Matlab_Simulink here]. | |||
</p> | |||
==Settings== | |||
[[File:MOTION_mdl.png|thumb|center|upright=2.0|<code>MOTION.mdl</code>]] | |||
===Enable/Disable Rods=== | |||
<p>In this subsystem one can disable rods from moving at all, or just allowing them to home. It is recommend to first attempt homing before running the system in its entirety. Do disable/enable rods all you have to do is double-click on them. | |||
</p> | |||
[[File:Enable_motion.png|thumb|center|upright=2.0|Enable and disable rods in this dialog.]] | |||
===Reference generation dialog=== | |||
<p>In the reference generation dialog we can alter/tweak the homing position and the reference saturation.</p> | |||
[[File:Reference_gen.png|center|thumb|upright=2.0|Reference generation dialog]] | |||
<p> | |||
;Rod number | |||
:Number index of the rod, starting with the goal-keeper being rod 1. | |||
;Rotational Homing position | |||
:Amount of degrees the puppet needs to rotate (for it to be upright) after detecting the homing sensor. | |||
;Rotational Homing Velocity | |||
:Speed at which to perform the rotational homing. | |||
;Translational Homing position. | |||
:This is the translation necessary to move to a central positron after hitting the end of its stroke(/side of the table). | |||
;Translational Homing Speed | |||
:Speed at which to perform the translational homing | |||
;Error in translation to determine homing point | |||
:This is a threshold, when the error becomes larger then this it assumes it has hit a wall. | |||
;Translational saturation | |||
:Absolute value at which to saturate the translational reference signal so not to hit the sides. | |||
</p> | |||
===Safety dialog=== | |||
<p>The safety has been put in to stop large voltages to be sent as the output for both the translational and rotational controller. Once it exceeds a certain threshold the output is set to zero.</p> | |||
[[File:Motion_safety.png|thumb|center|upright=2.0|Safety dialog]] | |||
;Rod number | |||
:Same as before | |||
;Maximum rotational voltage | |||
:Absolute maximum value of the control signal for rotational controller | |||
;Maximum translation voltage | |||
:Absolute maximum value of the control signal for translational controller | |||
;Maximum rotation | |||
:Maximum value of sensor read-outs, if this is exceeded it assumes failure and stops the executable (stop excessive spinning when stability is lost). | |||
;Maximum transalation | |||
:Maximum value of sensor read-outs, if this is exceeded it assumes failure and stops the executable (happens e.g. a cable snaps). | |||
==Building== | |||
<p>As said, building the file is really easy and is done using <code>make.m</code>. If this executes properly it will create an executable called <code>MOTION</code> in the main folder. This file currently requires Matlab R2011a (or below), as it makes use of a piece of code which is deprecated in later versions (see `Termination Block' in the simulink model). </p> | |||
<p>When building on a new system, be sure to run setup the compiler correctly by running <code>mex -setup</code> and choosing option 2. Now edit out all the <code>-ansi</code> flags, example: | |||
<blockquote><code> | |||
CFLAGS='-ansi -D_GNU_SOURCE' <br/></code> | |||
Should be:<br/> | |||
<code> | |||
CFLAGS='-D_GNU_SOURCE' <br/></code> | |||
</blockquote> | |||
</p> | |||
<p>Also, matlab uses a large set of its own libraries instead of using the system libraries. This can cause problems as we normally compile against system libraries. We fix this by creating some symbolic links to the system libaries (start a terminal): | |||
<blockquote> | |||
<code> | |||
sudo mv /path/to/matlab/sys/os/gl*/libstdc++.so.6 /path/to/matlab/sys/os/gl*/libstdc++.so.6.back <br/> | |||
sudo ln -s /path/to/system/library/libstdc++.so.6 /path/to/matlab/sys/os/gl*/libstdc++.so.6 <br/> | |||
</code> | |||
<code> | |||
sudo mv /path/to/matlab/sys/os/gl*/libgfortran.so.3 /path/to/matlab/sys/os/gl*/libgfortran.so.3.back <br/> | |||
sudo ln -s /path/to/system/library/libgfortran.so.3 /path/to/matlab/sys/os/gl*/libgfortran.so.3<br/> | |||
</code> | |||
<code> | |||
sudo mv /path/to/matlab/bin/gl*/libcurl.so.4 /path/to/matlab/bin/gl*/libcurl.so.4 back<br/> | |||
sudo ln -s /path/to/system/library/libcurl.so.4 /path/to/matlab/bin/gl*/libcurl.so.4</code></blockquote> | |||
</p> | |||
<p>The libraries used by RL/IPC have to be compiled seperately. These can be build by running the <code>src/shm_ipc/install.sh</code> and <code>/src/rl/install.sh</code>.</p> | |||
==Running== | |||
<p>You can run the motion executable by starting a terminal and typing the following code: | |||
<blockquote> | |||
<code>sudo su <br/> cd foosball <br/> ./MOTION</code> </blockquote></p> | |||
<p>When running the external, first homing will take place (apart from <code>MOTION_frf</code>). I recommend first attempting just to home it, by using the enable/disable options explained earlier. Once this is done, it will run until you stop it using <code>ctrl+c</code>, the final time is reached or when the emergency stop is used( not recommended as a default).''' If it crashes''' for some reason, or does not home see [http://cstwiki.wtb.tue.nl/index.php?title=Football_Table_Table#Common_causes_of_error this section] </p> | |||
==<code>libmotion_tools</code>== | |||
<p><code>libmotion_tools</code> is a small library created for common calculations performed on the table; puppet selection, intersection point calculation, et cetera. It functions using a class, this class has private variables that remembers what puppet is currently selected. The latter is really useful to avoid hectic switching of puppets in ''twilight'' zones.</p> | |||
<p>In this section we shortly describe how to use this library. | |||
;<code>motion_tools::get_y_ip(double x, double * q_b)</code> | |||
:Determines y-interception point, given a location (x-coordinate) and the ball vector <math>Q_b = [x~y~\dot x~\dot y]</math>. | |||
;<code>motion_tools::get_y_ip(double x, double * q_b, int rod_n)</code> | |||
:Overloaded method, with added information of the rod number. It determines y-interception point directly usable as reference (puppet selection already done), given a location (x-coordinate) and the ball vector <math>Q_b = [x~y~\dot x~\dot y]</math>. | |||
;<code>motion_tools::get_x_ip</code> | |||
:Determines x-interception point, given a location (y-coordinate) and the ball vector <math>Q_b = [x~y~\dot x~\dot y]</math>. | |||
;<code>motion_tools::get_y_p</code> | |||
:Apply puppet selection on a `raw' y-coordinate, yields the y-position usable as reference. This selection is made so that it will only switch puppets if the currently selected puppet cannot reach this position. | |||
;<code>motion_tools::get_y_np</code> | |||
:Get the position of the puppet that is currently `selected'. | |||
;<code>motion_tools::wall_reflect</code> | |||
:If an (raw, non-puppet selected) interception point lies outside of the playing field, it will bounce of the wall. This will calculate the new position, based on this reflection. | |||
;<code>motion_tools::getsign</code> | |||
:Returns the sign of the input. | |||
;<code>motion_tools::get_dt</code> | |||
:Calculates the time it will take for the ball to reach an interception coordinate (x). This will return a negative number if the interception will never take place. | |||
</p> | |||
==Actions and Action selection== | |||
===Selectable actions=== | |||
;Shoot | |||
:Variables: Shooting velocity | |||
;Tap | |||
:Variables: Tapping veloctiy (and direction) | |||
;Take | |||
:Invariant, to alter change the source file. | |||
;Avoid | |||
:Variables: duration | |||
===Action availability=== | |||
<p>Action availability is calculated alongside the constraint calculation for the particalur move.</p> | |||
===Action selection=== | |||
<p></p> | |||
===Constraints=== | |||
<p></p> | |||
===Attractor dynamics=== | |||
<p></p> | |||
<p></p> | |||
===Other=== | |||
<p></p> |
Latest revision as of 13:42, 17 March 2014
Introduction
Here we explain MOTION.mdl
(aliases/alternate versions: MOTION_demo.mdl
, MOTION_exp.mdl
, MOTION_demo.mdl
and MOTION_test.mdl
). MOTION.mdl
is compiled as an external and hence you run in from a terminal (as a super user). Compilation is done by running make.m
, which is located in the main folder.
The three different version all serve different needs, to use one: save them as MOTION.MDL and compile
MOTION_demo.mdl
- Demonstration ready, uses only old code (no Reinforcement learning and a simple policy).
MOTION_frf.mdl
- Used for frf-measurements, this by-passes homing and safety, so make sure to center all rods before running. Secondly, check to see if there are actually weak controllers set in this file. The output of this file is the same as all of the variant, a log file called
MOTION.mat
. An m-file which processes the data can be found in the../tools
folder(determines all transfer functions), you can use the output for loopshaping with i.e.: shape-it. MOTION_exp.mdl
- Experimental version, this file is kept to test new systems e.g. new moves etc.
MOTION_test.mdl
- Simulator version, use this file for generating experience. More on this can be found here.
Settings
Enable/Disable Rods
In this subsystem one can disable rods from moving at all, or just allowing them to home. It is recommend to first attempt homing before running the system in its entirety. Do disable/enable rods all you have to do is double-click on them.
Reference generation dialog
In the reference generation dialog we can alter/tweak the homing position and the reference saturation.
- Rod number
- Number index of the rod, starting with the goal-keeper being rod 1.
- Rotational Homing position
- Amount of degrees the puppet needs to rotate (for it to be upright) after detecting the homing sensor.
- Rotational Homing Velocity
- Speed at which to perform the rotational homing.
- Translational Homing position.
- This is the translation necessary to move to a central positron after hitting the end of its stroke(/side of the table).
- Translational Homing Speed
- Speed at which to perform the translational homing
- Error in translation to determine homing point
- This is a threshold, when the error becomes larger then this it assumes it has hit a wall.
- Translational saturation
- Absolute value at which to saturate the translational reference signal so not to hit the sides.
Safety dialog
The safety has been put in to stop large voltages to be sent as the output for both the translational and rotational controller. Once it exceeds a certain threshold the output is set to zero.
- Rod number
- Same as before
- Maximum rotational voltage
- Absolute maximum value of the control signal for rotational controller
- Maximum translation voltage
- Absolute maximum value of the control signal for translational controller
- Maximum rotation
- Maximum value of sensor read-outs, if this is exceeded it assumes failure and stops the executable (stop excessive spinning when stability is lost).
- Maximum transalation
- Maximum value of sensor read-outs, if this is exceeded it assumes failure and stops the executable (happens e.g. a cable snaps).
Building
As said, building the file is really easy and is done using make.m
. If this executes properly it will create an executable called MOTION
in the main folder. This file currently requires Matlab R2011a (or below), as it makes use of a piece of code which is deprecated in later versions (see `Termination Block' in the simulink model).
When building on a new system, be sure to run setup the compiler correctly by running mex -setup
and choosing option 2. Now edit out all the -ansi
flags, example:
CFLAGS='-ansi -D_GNU_SOURCE'
Should be:
CFLAGS='-D_GNU_SOURCE'
Also, matlab uses a large set of its own libraries instead of using the system libraries. This can cause problems as we normally compile against system libraries. We fix this by creating some symbolic links to the system libaries (start a terminal):
sudo mv /path/to/matlab/sys/os/gl*/libstdc++.so.6 /path/to/matlab/sys/os/gl*/libstdc++.so.6.back
sudo ln -s /path/to/system/library/libstdc++.so.6 /path/to/matlab/sys/os/gl*/libstdc++.so.6
sudo mv /path/to/matlab/sys/os/gl*/libgfortran.so.3 /path/to/matlab/sys/os/gl*/libgfortran.so.3.back
sudo ln -s /path/to/system/library/libgfortran.so.3 /path/to/matlab/sys/os/gl*/libgfortran.so.3
sudo mv /path/to/matlab/bin/gl*/libcurl.so.4 /path/to/matlab/bin/gl*/libcurl.so.4 back
sudo ln -s /path/to/system/library/libcurl.so.4 /path/to/matlab/bin/gl*/libcurl.so.4
The libraries used by RL/IPC have to be compiled seperately. These can be build by running the src/shm_ipc/install.sh
and /src/rl/install.sh
.
Running
You can run the motion executable by starting a terminal and typing the following code:
sudo su
cd foosball
./MOTION
When running the external, first homing will take place (apart from MOTION_frf
). I recommend first attempting just to home it, by using the enable/disable options explained earlier. Once this is done, it will run until you stop it using ctrl+c
, the final time is reached or when the emergency stop is used( not recommended as a default). If it crashes for some reason, or does not home see this section
libmotion_tools
libmotion_tools
is a small library created for common calculations performed on the table; puppet selection, intersection point calculation, et cetera. It functions using a class, this class has private variables that remembers what puppet is currently selected. The latter is really useful to avoid hectic switching of puppets in twilight zones.
In this section we shortly describe how to use this library.
motion_tools::get_y_ip(double x, double * q_b)
- Determines y-interception point, given a location (x-coordinate) and the ball vector [math]\displaystyle{ Q_b = [x~y~\dot x~\dot y] }[/math].
motion_tools::get_y_ip(double x, double * q_b, int rod_n)
- Overloaded method, with added information of the rod number. It determines y-interception point directly usable as reference (puppet selection already done), given a location (x-coordinate) and the ball vector [math]\displaystyle{ Q_b = [x~y~\dot x~\dot y] }[/math].
motion_tools::get_x_ip
- Determines x-interception point, given a location (y-coordinate) and the ball vector [math]\displaystyle{ Q_b = [x~y~\dot x~\dot y] }[/math].
motion_tools::get_y_p
- Apply puppet selection on a `raw' y-coordinate, yields the y-position usable as reference. This selection is made so that it will only switch puppets if the currently selected puppet cannot reach this position.
motion_tools::get_y_np
- Get the position of the puppet that is currently `selected'.
motion_tools::wall_reflect
- If an (raw, non-puppet selected) interception point lies outside of the playing field, it will bounce of the wall. This will calculate the new position, based on this reflection.
motion_tools::getsign
- Returns the sign of the input.
motion_tools::get_dt
- Calculates the time it will take for the ball to reach an interception coordinate (x). This will return a negative number if the interception will never take place.
Actions and Action selection
Selectable actions
- Shoot
- Variables: Shooting velocity
- Tap
- Variables: Tapping veloctiy (and direction)
- Take
- Invariant, to alter change the source file.
- Avoid
- Variables: duration
Action availability
Action availability is calculated alongside the constraint calculation for the particalur move.
Action selection
Constraints
Attractor dynamics