Example

The best way to show how this log analysis tool works is using an example.
Lets pretend that we are developing a robot that will mow the lawn automatically.
(I will really love to have that robot at home)

Our robot as two motors mleft and mright.
It can advance by moving both motors in the same direction.
It can rotate by moving each motor in opposite direction.

Our robot has two sensors that detect what is in front of the robot.
sLimit detects the end of the yard and sBlock detects obstacles.

It also has one compass to read the current direction.

We are testing our robot and found a failure:
Our robot was supposed to mow the following yard:

E h h h h h h h h h
h h h h h h h h h h
h h h h h h h h h h
h h h h h o h h h h
h h h h h h h h h h
h h h o h h h h h h
h h h h h h h h h h
h h h h h h h o h h
h h h h h h h h h h
h h h h h h h h h h

h = high grass.
o = obstacle.
E = robot facing East.

And at the end the yard looked like:

m m m m m m m m m m
m m m m m m m m m m
m m m m m m m m m m
h h h m m o m m m m
m m m m m m m m m m
m m m o m m m m m m
m m m m m m m m m m
m m m m m m m o m m
m m m m m m m m m m
m m m m m m m m m S

m = mowed grass.
h = high grass.
o = obstacle.
S = robot facing South.

Bottom line: our robot “forgot” to mow a stripe of grass.
And as in the jokes we have two news:
-The good: we have the robot’s log. Log1.txt
-The bad: It is 1909 lines long.

So let’s use our log parser (or log analyzer)  to find out what went wrong.

One option is to create a rule that tracks how the robot moves through the yard:

- Name: advanceRobot()
- Example: SIM: advanceRobot from (8,0) to (9,0)
- Patterns: [SIM: advanceRobot from (], [) to (], [)]

Using this rule reduces the log from 1909 to 316. Advances.txt
But that is still too big.

A different option is to create a rule to track each time the robot changes direction.

- Name: rotateRobot()
- Example: SIM: rotateRobot(x=9, y=0, dir=S)
- Patterns: [SIM: rotateRobot(x=], [, y=], [, dir=], [)]

Using this rule reduces the log from 1909 to 49. Turns.txt

But since it seems like the problem happen close to an obstacle lets try creating
a rule that highlights each time the robot finds an obstacle.

- Name: obstacleFound()
- Example: SIM: obstacleAhead(x=5, y=2, dir= S)=1
- Patterns: [SIM: obstacleAhead(x=], [, y=], [, dir=], [)=1]

Using this rule reduces the log from 1909 to 6.  ObstacleFound.txt
And the first match corresponds to the obstacle at (5,3)

394 -> SIM: obstacleAhead(x=6, y=3, dir= W)=1

By double clicking on that match you can see the full log around it.
Then do a text search for the “RBT:” string and add each line as a comment to the index.
The final result is:

394 -> SIM: obstacleAhead(x=6, y=3, dir= W)=1
401 -> RBT: turnLeft()
407 -> RBT: advance()
411 -> RBT: turnRight()
417 -> RBT: advance()
421 -> RBT: turnLeft()
433 -> RBT: advance()
443 -> RBT: advance()

And you can see that as the robot was trying to go around the obstacle
it turned left, then right, and then left again.
The direction of the 3rd turn is wrong.
Feel free to download my rule set.  RoboMower.rls

You can learn more about it by: