Hi,
The line leader class can be seen here:
...
If you want to use the new classes there really is no need to wait for 0.9 you can use the developer snapshot, not that much will change before 0.9 and any testing you do will be very useful.
So I loaded the referenced NXTLineLeader class into Eclipse and did some testing. Results are below.
Both of the constructors generated errors:
- Code: Select all
public NXTLineLeader(I2CPort port, int address) {
super(port, address, I2CPort.LEGO_MODE, TYPE_LOWSPEED_9V);
}

- Code: Select all
public NXTLineLeader(I2CPort port) {
this(port, DEFAULT_I2C_ADDRESS);
}

I followed a suggestion provided by Eclipse and used:
- Code: Select all
public NXTLineLeader(I2CPort port) {
super(port);
}
It's possible that when using a "complete" 0.9 package the problems described above may be solved, and may solve some of the things described below.
A seemingly obligatory task is to figure out how to generate the real time display of each of the eight sensors shown as a rectangle. To do that I used getCalibratedSensorReading() and noted that the documentation says it returns values in the range [0..255] while I found that the range was [0..100].
A worse problem is the methods to set many of the parameters did not work as I expected. It took awhile to discover that this was the cause of my robot's unexpected behavior. The simplest way to duplicate the problem is to just use the set methods followed by displaying the results of their respective get methods in the LCD.
I did two tests of setting values to something easy to see such as [42..48] and then [12..18] and found:
- Code: Select all
parameter| default | set | get | set | get |
---------|---------|-----|-----|-----|-----|
SetPoint | 45 | 42 | 42 | 12 | 12 |
---------|---------|-----|-----|-----|-----|
KP | 25 | 43 | 45 | 13 | 15 |
---------|---------|-----|-----|-----|-----|
KPDiv | 32 | 44 | 46 | 14 | 16 |
---------|---------|-----|-----|-----|-----|
KI | 0 | 45 | 0 | 15 | 0 |
---------|---------|-----|-----|-----|-----|
KIDiv | 32 | 46 | 32 | 16 | 32 |
---------|---------|-----|-----|-----|-----|
KD | 10 | 47 | 47 | 17 | 17 |
---------|---------|-----|-----|-----|-----|
KDDiv | 32 | 48 | 32 | 18 | 32 |
--------------------------------------------
SetPoint and KD both work as expected.
KP and KPDiv both have a descrepancy of 2.
KDDiv, KI, and KIDiv always return their default values.
If anyone is interested, I can post the code the calibrating the WHITE and BLACK values and for generating the rectangles for a graphic display of each sensor. Those took a bit of experimentation and may save someone else that time.
Walt
