Here by the result of parsing the complex footballrobot.rpp, which is part of the TXT-discovery set. It contains 37 subroutines.
The result gives an overview of the subroutines, including the comment and the relation of the subroutines (here only max. depth=2).
Not show: it can also produce a overview of for example: used variable including the starting value, const values, list including the initial values.
The program can be see as documentation generator.
Code: Alles auswählen
================================================================
Overview of subroutines
================================================================
1 subroutine= Main program
********documentation********
Enter a description for your function here.
*****************************
---> Is using the next subroutines:
, (0)Triangulation, (1)TriM2, (2)UpdateY, (2)UpdateX, (1)TriM1, (2)UpdateY, (2)UpdateX, (2)UpdateA, (1)TriLR, (2)UpdateY, (2)UpdateX, (2)UpdateA, (1)BarCode15
, (0)Test, (1)TakeBall, (2)MotOn, (2)MotOff, (1)MoveHome, (2)TurnTo, (2)MoveTo, (1)KickGoal, (2)MoveFwd, (2)KickBall, (2)ForwardTo, (2)atanXY, (1)InitPos, (2)TurnL, (2)Triangulation, (1)FindBall, (2)TurnR, (2)TurnL
, (0)Odometry, (1)NormAngle
, (0)InitPos, (1)TurnL, (2)MotOn, (2)MotOff, (1)Triangulation, (2)TriM2, (2)TriM1, (2)TriLR, (2)BarCode15
, (0)Collision, (1)TurnR, (2)MotOn, (2)MotOff, (1)TurnL, (2)MotOn, (2)MotOff, (1)Soccer, (2)TakeBall, (2)MoveHome, (2)KickGoal, (2)KickBack, (2)FindBall, (1)Rot, (1)Random, (1)PntColl, (2)MotOff, (2)KickBall, (1)MoveFwd, (2)MotOn, (2)MotOff, (1)MoveBckw, (2)MotOn, (2)MotOff
, (0)Adjust, (1)TurnTo, (2)TurnR, (2)TurnL, (2)NormAngle, (1)TurnR, (2)MotOn, (2)MotOff, (1)TurnL, (2)MotOn, (2)MotOff, (1)Triangulation, (2)TriM2, (2)TriM1, (2)TriLR, (2)BarCode15, (1)MoveTo, (2)TurnTo, (2)MoveFwd, (2)atanXY, (1)MoveFwd, (2)MotOn, (2)MotOff, (1)MoveBckw, (2)MotOn, (2)MotOff, (1)InitPos, (2)TurnL, (2)Triangulation, (1)ForwardR, (2)MotOn, (2)MotOff, (1)ForwardL, (2)MotOn, (2)MotOff
2 subroutine= Adjust
********documentation********
*****************************
---> Is using the next subroutines:
, (0)TurnTo, (1)TurnR, (2)MotOn, (2)MotOff, (1)TurnL, (2)MotOn, (2)MotOff, (1)NormAngle
, (0)TurnR, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)TurnL, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)Triangulation, (1)TriM2, (2)UpdateY, (2)UpdateX, (1)TriM1, (2)UpdateY, (2)UpdateX, (2)UpdateA, (1)TriLR, (2)UpdateY, (2)UpdateX, (2)UpdateA, (1)BarCode15
, (0)MoveTo, (1)TurnTo, (2)TurnR, (2)TurnL, (2)NormAngle, (1)MoveFwd, (2)MotOn, (2)MotOff, (1)atanXY
, (0)MoveFwd, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)MoveBckw, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)InitPos, (1)TurnL, (2)MotOn, (2)MotOff, (1)Triangulation, (2)TriM2, (2)TriM1, (2)TriLR, (2)BarCode15
, (0)ForwardR, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)ForwardL, (1)MotOn, (1)MotOff, (2)Triangulation
3 subroutine= Test
********documentation********
*****************************
---> Is using the next subroutines:
, (0)TakeBall, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)MoveHome, (1)TurnTo, (2)TurnR, (2)TurnL, (2)NormAngle, (1)MoveTo, (2)TurnTo, (2)MoveFwd, (2)atanXY
, (0)KickGoal, (1)MoveFwd, (2)MotOn, (2)MotOff, (1)KickBall, (2)KickBack, (1)ForwardTo, (2)NormAngle, (2)ForwardR, (2)ForwardL, (1)atanXY
, (0)InitPos, (1)TurnL, (2)MotOn, (2)MotOff, (1)Triangulation, (2)TriM2, (2)TriM1, (2)TriLR, (2)BarCode15
, (0)FindBall, (1)TurnR, (2)MotOn, (2)MotOff, (1)TurnL, (2)MotOn, (2)MotOff
4 subroutine= Soccer
********documentation********
*****************************
---> Is using the next subroutines:
, (0)TakeBall, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)MoveHome, (1)TurnTo, (2)TurnR, (2)TurnL, (2)NormAngle, (1)MoveTo, (2)TurnTo, (2)MoveFwd, (2)atanXY
, (0)KickGoal, (1)MoveFwd, (2)MotOn, (2)MotOff, (1)KickBall, (2)KickBack, (1)ForwardTo, (2)NormAngle, (2)ForwardR, (2)ForwardL, (1)atanXY
, (0)KickBack
, (0)FindBall, (1)TurnR, (2)MotOn, (2)MotOff, (1)TurnL, (2)MotOn, (2)MotOff
5 subroutine= Collision
********documentation********
*****************************
---> Is using the next subroutines:
, (0)TurnR, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)TurnL, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)Soccer, (1)TakeBall, (2)MotOn, (2)MotOff, (1)MoveHome, (2)TurnTo, (2)MoveTo, (1)KickGoal, (2)MoveFwd, (2)KickBall, (2)ForwardTo, (2)atanXY, (1)KickBack, (1)FindBall, (2)TurnR, (2)TurnL
, (0)Rot
, (0)Random
, (0)PntColl, (1)MotOff, (2)Triangulation, (1)KickBall, (2)KickBack
, (0)MoveFwd, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)MoveBckw, (1)MotOn, (1)MotOff, (2)Triangulation
6 subroutine= BarCode15
********documentation********
Detects a barcode with 3 black and 2 white stripes
One of the black or white stripes is 2 as thick as the other 4 stripes.
The total width of the bar code is thus 4+2 units.
The result codes ar as follows:
1 : black bar closest to the begin of the line detector is thick
2 : middle black bar is thick
3 : black bar closest to the end of the line detector is thick
4 : white bar closest to the begin of the line detector is thick
5 : white bar closest to the end of the line detector is thick
Note: The line detector should be adjusted to detect more than 3 lines in case there is a possibility that garbage is seen towards the end of the line.
*****************************
---> Is using the next subroutines:
7 subroutine= Triangulation
********documentation********
Calculate for each of the 3 line detectors a total barcode width and a code.
The wall code assignment is as follows:
1: thick black bar low = right side wall (looking towards the goal)
2: thick black bar middle = back wall
3: thick black bar high = left side wall (looking towards the goal)
4: thick white bar low = goal
5: thick white bar high = walls left and right of goal
-1: no code detected
In case the left and the right code are detected and equal (point to the same wall), TriangulateLR is called.
In case the middle line and one other line are detected and equal (point to the same wall), TriangulateM and TriangulateM2 is called.
Corrections:
[2019-09-25]
In the original Qr and Qm swap places
*****************************
---> Is using the next subroutines:
, (0)TriM2, (1)UpdateY, (1)UpdateX
, (0)TriM1, (1)UpdateY, (1)UpdateX, (1)UpdateA, (2)NormAngle
, (0)TriLR, (1)UpdateY, (1)UpdateX, (1)UpdateA, (2)NormAngle
, (0)BarCode15
8 subroutine= TriLR
********documentation********
Calculate the absolute angle from the sizes of two different barcodes.
This function is used if the outer left and outer right barcode have the same code (ar on the same border).
In this case the absolute angle and one of X and Y can be computed.
alpha/2 = atan 17/67 = 14.2373 deg is the angle between the middle and the left or teh middle and the right line detector.
This has been determined by scene measurement.
*****************************
---> Is using the next subroutines:
, (0)UpdateY
, (0)UpdateX
, (0)UpdateA, (1)NormAngle
9 subroutine= TriM1
********documentation********
Calculate the absolute angle from the sizes of two different barcodes.
This function is used if one of the outer and the middle barcode have the same code (are on the same border).
In this case the absolute angle and one of X and Y can be computed.
The other coordinate can be computed by TriangulateM2 when the other outer barcode points to a different border.
alpha/2 = atan 17/67 = 14.2373 deg is the angle between the middle and the left or the middle and the right line detector.
This has been determined by scene measurement.
*****************************
---> Is using the next subroutines:
, (0)UpdateY
, (0)UpdateX
, (0)UpdateA, (1)NormAngle
10 subroutine= TriM2
********documentation********
Calculate an additional coordinate in case the left and right line detector see a different border
*****************************
---> Is using the next subroutines:
, (0)UpdateY
, (0)UpdateX
11 subroutine= UpdateA
********documentation********
Store every result for login.
*****************************
---> Is using the next subroutines:
, (0)NormAngle
12 subroutine= UpdateX
********documentation********
*****************************
---> Is using the next subroutines:
13 subroutine= UpdateY
********documentation********
*****************************
---> Is using the next subroutines:
14 subroutine= TurnL
********documentation********
A turning test of the robot model results in 1310 steps for 4 turns.
This are 1310/1440 = 0.9097 steps per degree.
This value is for the new encoder motor
*****************************
---> Is using the next subroutines:
, (0)MotOn
, (0)MotOff, (1)Triangulation, (2)TriM2, (2)TriM1, (2)TriLR, (2)BarCode15
15 subroutine= TurnR
********documentation********
A turning test of the robot model results in 1310 steps for 4 turns.
This are 1310/1440 = 0.9097 steps per degree.
This value is for the new encoder motor
*****************************
---> Is using the next subroutines:
, (0)MotOn
, (0)MotOff, (1)Triangulation, (2)TriM2, (2)TriM1, (2)TriLR, (2)BarCode15
16 subroutine= Odometry
********documentation********
This subprogram looks for changing motor counter values.
The difference in counter values is turned into a rotation.
The sum of the counter values is turned into a straight movement.
Angle and movement are integrated to compute the current absolute angle and X/Y position.
For better precision, the X/Y position update is done with half of the angle.
The values calculated this way are corrected by camera measurements (subprogram triangulation).
*****************************
---> Is using the next subroutines:
, (0)NormAngle
17 subroutine= MotOn
********documentation********
*****************************
---> Is using the next subroutines:
18 subroutine= MotOff
********documentation********
*****************************
---> Is using the next subroutines:
, (0)Triangulation, (1)TriM2, (2)UpdateY, (2)UpdateX, (1)TriM1, (2)UpdateY, (2)UpdateX, (2)UpdateA, (1)TriLR, (2)UpdateY, (2)UpdateX, (2)UpdateA, (1)BarCode15
19 subroutine= InitPos
********documentation********
*****************************
---> Is using the next subroutines:
, (0)TurnL, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)Triangulation, (1)TriM2, (2)UpdateY, (2)UpdateX, (1)TriM1, (2)UpdateY, (2)UpdateX, (2)UpdateA, (1)TriLR, (2)UpdateY, (2)UpdateX, (2)UpdateA, (1)BarCode15
20 subroutine= MoveTo
********documentation********
*****************************
---> Is using the next subroutines:
, (0)TurnTo, (1)TurnR, (2)MotOn, (2)MotOff, (1)TurnL, (2)MotOn, (2)MotOff, (1)NormAngle
, (0)MoveFwd, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)atanXY
21 subroutine= atanXY
********documentation********
*****************************
---> Is using the next subroutines:
22 subroutine= TurnTo
********documentation********
*****************************
---> Is using the next subroutines:
, (0)TurnR, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)TurnL, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)NormAngle
23 subroutine= MoveFwd
********documentation********
The number of impulses per whell turn is 150
Wheel diameter = 59.5.mm
A 500 step straight drive tests result in a distance of 613mm.
This resuls in 0.81566 steps/mm
The theoretical result with a measured wheel diameter of 59.5 is 150 / (59.5mm*pi) = 0.80246/mm.
The measured distance results in a wheel diameter of 613mm/ (500/150) / pi = 58.5mm
*****************************
---> Is using the next subroutines:
, (0)MotOn
, (0)MotOff, (1)Triangulation, (2)TriM2, (2)TriM1, (2)TriLR, (2)BarCode15
24 subroutine= NormAngle
********documentation********
*****************************
---> Is using the next subroutines:
25 subroutine= FindBall
********documentation********
*****************************
---> Is using the next subroutines:
, (0)TurnR, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)TurnL, (1)MotOn, (1)MotOff, (2)Triangulation
26 subroutine= KickBack
********documentation********
*****************************
---> Is using the next subroutines:
27 subroutine= TakeBall
********documentation********
*****************************
---> Is using the next subroutines:
, (0)MotOn
, (0)MotOff, (1)Triangulation, (2)TriM2, (2)TriM1, (2)TriLR, (2)BarCode15
28 subroutine= ForwardL
********documentation********
A turning test of the robot model results in 390.75 steps per turn.
This are 390.75/360 = 1.0854 steps per degree
*****************************
---> Is using the next subroutines:
, (0)MotOn
, (0)MotOff, (1)Triangulation, (2)TriM2, (2)TriM1, (2)TriLR, (2)BarCode15
29 subroutine= ForwardR
********documentation********
A turning test of the robot model results in 390.75 steps per turn.
This are 390.75/360 = 1.0854 steps per degree
*****************************
---> Is using the next subroutines:
, (0)MotOn
, (0)MotOff, (1)Triangulation, (2)TriM2, (2)TriM1, (2)TriLR, (2)BarCode15
30 subroutine= ForwardTo
********documentation********
*****************************
---> Is using the next subroutines:
, (0)NormAngle
, (0)ForwardR, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)ForwardL, (1)MotOn, (1)MotOff, (2)Triangulation
31 subroutine= KickGoal
********documentation********
*****************************
---> Is using the next subroutines:
, (0)MoveFwd, (1)MotOn, (1)MotOff, (2)Triangulation
, (0)KickBall, (1)KickBack
, (0)ForwardTo, (1)NormAngle, (1)ForwardR, (2)MotOn, (2)MotOff, (1)ForwardL, (2)MotOn, (2)MotOff
, (0)atanXY
32 subroutine= MoveBckw
********documentation********
The number of impulses per whell turn is 150
Wheel diameter = 59.5.mm
A 500 step straight drive tests result in a distance of 613mm.
This resuls in 0.81566 steps/mm
The theoretical result with a measured wheel diameter of 59.5 is 150 / (59.5mm*pi) = 0.80246/mm.
The measured distance results in a wheel diameter of 613mm/ (500/150) / pi = 58.5mm
*****************************
---> Is using the next subroutines:
, (0)MotOn
, (0)MotOff, (1)Triangulation, (2)TriM2, (2)TriM1, (2)TriLR, (2)BarCode15
33 subroutine= MoveHome
********documentation********
*****************************
---> Is using the next subroutines:
, (0)TurnTo, (1)TurnR, (2)MotOn, (2)MotOff, (1)TurnL, (2)MotOn, (2)MotOff, (1)NormAngle
, (0)MoveTo, (1)TurnTo, (2)TurnR, (2)TurnL, (2)NormAngle, (1)MoveFwd, (2)MotOn, (2)MotOff, (1)atanXY
34 subroutine= PntColl
********documentation********
*****************************
---> Is using the next subroutines:
, (0)MotOff, (1)Triangulation, (2)TriM2, (2)TriM1, (2)TriLR, (2)BarCode15
, (0)KickBall, (1)KickBack
35 subroutine= Rot
********documentation********
*****************************
---> Is using the next subroutines:
36 subroutine= Random
********documentation********
DE: Erzeugt Zufallszahlen im Bereich -32768 bis 32767
EN: Generates random number in the range -32768 to 32767
Der Algorithmus ist in D.E.Knuth, "The Art Of Computer Programming", Abschnitt 3.2.2 beschrieben.
Der Algorithmus berechnet die folgende Folge:
Z(n) = ( Z(n-24) + Z(n-55) ) mod m
wobei m gerade und Z(0)..Z(54) beliebieg ganze Zahlen sind, von denen mindestens eine nicht gerade ist.
Als m wird die Maschinenauflösung ( 65536 in ROBOPro ) verwendet, so dass die Modulo-Operation entfällt.
Die 55 Anfangswerte stammen aus der Tabelle der RAND Corporation von 1947 (Start 0, Offset -32768, Werte >32767 wurden nicht verwendet).
*****************************
---> Is using the next subroutines:
37 subroutine= KickBall
********documentation********
*****************************
---> Is using the next subroutines:
, (0)KickBack