6. Some more ROBOLAB sub.vis

 

As the project became more complex, we decided to divide it into several sections where you don't loose survey. Here now the turnable beacon section and some tests.

 

First we add the cartesian-to-polar-function. Note that this functions uses the local variables12 ... 16. Note also that the angle is returned in degrees. Again you need to enter the function variables through their address. The angle is calculated as the arctan(x/y), the magnitude as sqrt(x^2+y^2).

 


This leads to the beacon-programs. Note that the magnitude isn't used in these programs. The beacon-x-coordinate for BEACON-B corresponds to the value c used in the whole project. All the coordinates are entered in units of 4.3904cm. The angles are expressed in degrees. The angle-limits define the liberty of motion of the beacons. Note also the use of the variables 0 ... 10.

 

 

The beacon-A program

(change the parameters as needed;

should be downloaded to RCX-A)

The beacon-B program

(change the parameters as needed;

should be downloaded to RCX-B)

 

Here the detail of the program. You distinguish 4 tasks:

 


Of course the robot-program has also to be adjusted. we added a sending-sub.vi. For best turning of the beacons towards the robot, the robot must communicate its position to the beacons. Note the use of variables 16 and 17. In order to make a clear distinction between the Pos_x and the Pos_y values, these values are somehow incoded:

  1. For the beacons, half of the accuracy is sufficient, so we divide the values by 200 (don't forget that the blue and the yellow container store 100times the real Pos_x and Pos_y values, thus in units of 0.04304cm!!)

  2. NOw the values to send don't exceed 127.

  3. We add 128 to the y-values. So, the beacons may easily distinguish on reception the origin of the message. This is necessary, in the case of bad communication. A number less than 127 indicates an x-coordinate, whereas a number above 127 must be an y-coordinate. The beacons must only substract 128 to the y-values and multiply bothe x and y-values by 2 to restore pos_x and pos_y.

  4. This procedure causes an additional loss of information, but this doesn't matter for the beacons.

 


Here now an example of robot-program. It operates a continuous datalogging of the pos_x and pos_y values as long as the button (sensor 2) is not pressed, or the program is stopped manually. Note that if you change the PILOT.vi the Datalog-program must be downloaded again.

 

 

 

 


 

This robot run the DATALOG-program with the following PILOT.vi:

 

 

 

 

Note again the short distances. If the robot moves around over more important distances, the errors appear less significant.

 


Variable-use Overview (Remember that you have only access to 20 variables in ROBOLAB.)

 

Robot-program

0 argument for RIGHT_addr, LEFT_addr
1 POS_X
2 POS_Y
3 PING and argument for beac_pos.vi
4 PING and argument for beac_pos.vi 
5 PING, local variable
6 unused
7 RIGHT_addr, LEFT_addr, local variable
8 RIGHT_addr, LEFT_addr, local variable
9 unused
10 beac_pos.vi, local variable
11 beac_pos.vi, local variable
12 beac_pos.vi, local variable
13 beac_pos.vi, local variable
14 beac_pos.vi, local variable
15 beac_pos.vi, local variable
16 send_position.vi, local variable
17 send_position.vi, local variable
18 sqrt-function, local variable
19 sqrt-function, local variable
20 sqrt-function, local variable

Beacon-Program

0 beacon-angle, argument of motor-task
1 POS_X
2 POS_Y
3 main program
4 main program
5 main program
6 main program
7 lower angle-limit, converted in rotation-pulses
8 upper angle-limit, converted in rotation-pulses
9 main program
10 main program
11 unused
12 cartesian_to_polar, local variable
13 cartesian_to_polar, local variable
14 cartesian_to_polar, local variable
15 cartesian_to_polar, local variable
16 cartesian_to_polar, local variable
17 unused
18 atan-function, local variable
19 atan-function, local variable
20 atan-function, local variable

 

Suggestions for the use of the device:

 

 


RetourMain Page