Notebook 09


Lab Notebook

Date: 19/04 2012
Group members participating: Falk, Jeppe and Jakob
Duration of activity: 3 hours


Investigate how a robot can move around in a cartesian coordinate system, keeping track of its position and direction.


  • Build a robot.
  • Implement a program that makes the robot move according to a cartesian coordinate system, like Bagnall's 'Blightbot [1].
  • Test the influence of rotation speed, wheel diameter and track width.
  • Describe how to navigate while avoiding objects.
  • Compare and consider the improved navigation.


The robot

The robot was build accordingly to the manual 9797 page 8-22.

The program

Before starting programming the following ideas were considered:

  • The DifferentialPilot should be used.
    • Wheel diameter: 5.6 cm
    • Track width: 11.1 cm (middle of the wheels)
  • The program uses the DifferentialPilot with the OdometryPostProvider attached to keep track of the pose of the robot.
private static DifferentialPilot pilot = new DifferentialPilot(5.6, 11.1, Motor.C, Motor.B);
private static OdometryPoseProvider poseProvider = new OdometryPoseProvider(pilot);
  • The main structure of the program is similar to the main structure of Bagnall's program, at least with the goTo method.

The first implementation used the method angleTo which caused the robot to turn wrong at certain points, even though the position of the robot was correct the calculations of the heading was incorrect.
The reason for this is that angleTo returns the angle relative to the x-axis, and not to the pose. Instead using the relativeBearing solved the problem.

public static void goTo(float x, float y) {
    Pose currentPose = poseProvider.getPose();
    float heading = currentPose.relativeBearing(new Point(x, y));
    float distance = currentPose.distanceTo(new Point(x, y));

A whiteboard marker was attached at the front of the robot, and it made the following pattern:


As can be seen this is a bit off compared to [1], but another run mad this a lot better:


The second picture shows the robot path is close to completely on the desired track.


To test if the rotation speed has an impact on the accuracy the robot was run with the following rotation speeds. (only one run for each value)
Wheel diameter: 5.6cm

Rotation speed Distance from the goal (cm)
40 54
80 49
160 48
320 44

Surprisingly enough the robot gets closer to the goal as the rotation speed increases, but this is based on very few readings.
The (insecure) conclusion is however that the higher rotation speed the lower the drift.

The robot was also tested with different wheel diameter.
Rotation speed: 320

Wheel diameter (cm) Distance from the goal (cm)
5.7 29
5.4 140
5.0 88

The wheel diameter obviously has a huge impact on the accuracy of the robot.

The best run was with the rotation speed at 320 and with a wheel diameter of 5.7 and not 5.6 as the original measurement.

There was not enough time at the lab session to test the influence of the track width.


To avoid objects while navigating the non-blocking travel-method is needed, to be able to detect objects and possible act on this while driving. To avoid something the robot must be stopped. The pilot remembers where it is at, and if the avoiding move is done also using the pilot, it will still remember the pose.

There was not enough time at the lab session to consider the improved navigation.


With a relative simple implementation using the DifferentialPilot with the OdometryPostProvider it was possible to have the robot drive around in a coordinate system and with good results. To improve the accuracy P-regulated motors with the tacho-counter could have been used.

If this approach is used for driving more than a few meters, it could easily pay off to investigate further into the optimal values for rotation speed, wheel diameter and track width. The other options the DifferentialPilot offers should also be considered such as travel speed and acceleration.


1. Brian Bagnall, Maximum Lego NXTBuilding Robots with Java Brains, Chapter 12, Localization, p.297 - p.298.
2. Java Robotics Tutorials, Enabling Your Robot to Keep Track of its Position. You could also look into Programming Your Robot to Navigate to see how an alternative to the leJOS classes could be implemented.
3. Maja J Mataric, Integration of Representation Into Goal-Driven Behavior-Based Robots, in IEEE Transactions on Robotics and Automation, 8(3), Jun 1992, 304-312.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License