understand the football simulation source code. understand the football simulation source code....

21

Post on 19-Dec-2015

246 views

Category:

Documents


2 download

TRANSCRIPT

Understand the football simulation source code.Understand the football simulation source code. Learn all the technical specifications of the system Learn all the technical specifications of the system

components.components. Study the control loops in the controller. Study the control loops in the controller. Learn all the C library of the controller from ACSLIB guide.Learn all the C library of the controller from ACSLIB guide. Create a motion path which will reach a specified state in Create a motion path which will reach a specified state in

specified time.specified time. The profile will be created according to a vector which The profile will be created according to a vector which

includes:includes:

After the user inserts these values, the football player should After the user inserts these values, the football player should reach to:reach to:

Create a graphic user interface in order to view the real time Create a graphic user interface in order to view the real time results on a graph.results on a graph.

The time for to football The time for to football player to reach to the player to reach to the

cross point with the ball cross point with the ball on both axeson both axesThe horizontal The horizontal

position ,the player position ,the player should reach in delta should reach in delta

time.time.The horizontal velocity, The horizontal velocity,

the player should reach in the player should reach in delta timedelta time

The circular position, The circular position, the player should the player should

reach in delta timereach in delta time

The circular velocity, The circular velocity, the player should the player should

reach in delta timereach in delta time

The The software simulationsoftware simulation is a flexible system, which serves as the lab is a flexible system, which serves as the lab for the development of the agent. It is an idealized copy of the real for the development of the agent. It is an idealized copy of the real foosball table. It simulates the physical behavior of the foosball:foosball table. It simulates the physical behavior of the foosball:

The motion of the ball and the players.The motion of the ball and the players. The collisions between the ball and the players or the table borders.The collisions between the ball and the players or the table borders. Counts the goalsCounts the goals..

The SB line of controllers supports the following modes of motion:

Mode 0 . Linear point to point

Mode 1 . Linear point to point, repetitive

Mode 3 . Move by sequence

Mode 4 . Circular interpolation

Mode 8 . Multiple velocities - point to point

Mode 9 . Search for contact

Mode 10 Constant Velocity (jogging).

Mode 12 . Master-Slave

Mode 15 . Continuous path following

Mode 16 . Arbitrary path generation and cam

Mode 21 . Manual control by Joystick

Mode 22 . Position tracking

Delay checking with MFC Timer

With MFC timer we could perform a sampling on the motor encoder in a very accurate time.

We used this feature in order to measure the time delay from the moment we called the controller to start the motion until the moment the motors actually began to move.

We set a timer in the code before calling the function to move the motor and we started sampling the encoder every 5ms.

We couldn’t get more accurate checking with this method , because the minimum time between each sample can’t be lower then 5 ms.

This fact we discovered by our self , by few experiments.

So we did a linear interpolation between the points in order to get the delay time.

Delay checking with ACS Tools

Using ACSPL you can create a data collection of the motor motion, the data collection does as we did above it sample the encoder every specified time, but using data collection feature you can get sampling every 1 ms, so implement a data collection code within our program, and the results showed the 2 ms was correct, and we also discovered there is a 2.5ms delay between the sampling time until the computer gets the sampling results.

For better view of the project results, we For better view of the project results, we created a graph output program that gives in created a graph output program that gives in real time the graph of the football player real time the graph of the football player motion.motion.

The main window is divided to 3 parts:The main window is divided to 3 parts:

Menu Bar Menu Bar

The menu bar contains all the functions that The menu bar contains all the functions that we we

need to control the player from the pc.need to control the player from the pc.

Graph windowGraph window

here you can see the graph of the motion built on here you can see the graph of the motion built on real time, There are two graphs, the first one is real time, There are two graphs, the first one is describing the motion that the motor should have describing the motion that the motor should have done, and the second one, describes the real done, and the second one, describes the real motion. motion.

Side barSide bar

the side bar shows all the samples any 10 the side bar shows all the samples any 10 millisecond,millisecond,

it was made to help for the debug and for more it was made to help for the debug and for more details ofdetails of

the motion profile.the motion profile.

The path is defined by an array of up to 32 mixed straight line segmentsThe motion starts at the present position, accelerates to the specifiedvector velocity, keeps that velocity until the last segment, and thendecelerates toward the end point of the path.

This motion gave us the best solution for creating ourmotion profile ,this motion is very flexible and can serve many type’s of motion.

We decided to set 3 points in a linear line, the middle point is specified point which the motor had to go through in specified time, while the other two points on the sides, helps us to gain control on the velocity.The motor will achieve in the middle point.This idea was based on the assumption that the ACS interpolation was good enoughAnd will make the motor to move through these points accurately.

The idea of the numerical interpolation came to , after having problems to achieve good results using the ACS interpolation.

We used the popular Divided Distances Interpolation.

This interpolation creates a polynomial function of forth levels:

The inputs we used were:

f(0) = 0 the starting point position.

F’(0) = 0 the starting point Velocity.

F”(0) = 0 the starting point acceleration.

f(delta_t)) = X the specified position point in the specified time.

F’(delta_t)) = V the specified velocity point in the specified time.

In order to achieve more accurate velocity in specified time , we used the technique of the 3 points, combined with our interpolation.

Whit the combination of both techniques , we achieved good results in position and velocity.The results were showed errors around 300 to 0 counts in the position, and around 10 counts/msec in the velocity.Those results were taken in hard paths as the tests before.

We have fully implemented the project goals, and also added some additional features.

Created a motion profile for the football player

Overcome of the delay of the controller.

Succeed to get reasonable results on both axes.

Gained knowledge of working with Real-Time systems.

Provided an easy class to control the motors in future development

Created a graph viewer in order to see the last path of the motor.

Gui designed especially to be attractive ,intuitive and easy to use.

There are few enhancements that can be done in the future and they are:

1) Improve the interpolation by considering the acceleration limits and the response to steps.

2) Replace the controller with a new one, for two reasons:

a. The existing controller can handle up to two player’s rows.

b. The controller can’t change movements on the fly.