oTracker Object

Back to top of page Description:
 

The oTracker Object is a Hardware Object that tracks the position of a line and calculates a URCP Heading based on that position.

The oTracker Object can be configured with either 3 or 4 line sensors.   It can report the position of the line, if it sees a line, which direction the line moved and if the line has moved out from under it, which side the line is now on.

The lynxmotion Tracker Sensor (as shown at right) uses 3 sensors.

 The following table lists the size and availability of the oTracker Object.
 ObjectSizeDescriptionA1A2B1B2C1
oTracker5 BytesAn Object that tracks the position of a line.xxx
Back to top of page Operation:
 

The oTracker Object monitors the 4 I/O lines specified by the IOPack property.  It is expecting that the 4 I/O lines are connected to an array of 3 or 4 optical sensors that are placed on the bottom of a robot to detect when a line is under them.  It then takes the data read from these I/O lines and calculates a URCP Heading based on that position and stores it in the Position property. 

Before the URCP Value is stored in the Position property, it is compared to the previous value and the Direction property is set based on the direction that the line moved. 

If the line was in the middle of the sensor array, then the Centered property is set to 1, otherwise the Centered property is set to 0.

If the line was not found by the sensor, then the OutOfRange property is set to 1 and the Position property is set based on the value of the Mode property.  If the Mode property is 0, then the oTracker Object assumes that the line has moved to the right or left of the sensor array and the Position property is set to 32 or -32 depending on the current value of the Direction property.    If the Mode property is 1, then the oTracker assumes that the line is between the two middle sensors and the Position property is set to 0 and the Centered property is set to 1.

The DIO property is an instance of the oCenterSwitch4 object which is created when the oTracker Object is.  The oTracker Object uses this object to do that actual evaluation of the sensors.  Most properties of the oCenterSwitch4 instance can be adjusted and will affect the oTracker object's operation.  See oCenterSwitch4 for more detail on how oCenterSwitch4 determines the lines position.

Back to top of page Properties:

The following table lists the properties of the oTracker Object:

Property

Description

Position
A value that indicates the position of the line.
Object Class: oHeading Value Range: -32 to +32
Data Type: Numeric Default Value: 0
Line SensorsModePositionCenteredOutOfRange


URCP Heading

 ---->
1-3201
 ---X 
0 or 1-2400
 --XX 
0 or 1-1600
 --X- 
0 or 1-800
 -XXX 
0 or 1-800
 -XX- 
0 or 1010
 XXXX 
0 or 1010
 ---- 
0011
 -X-- 
0 or 1800
 XXX- 
0 or 1800
 XX-- 
0 or 11600
 X--- 
0 or 12400
<---- 
13201
All others0 or 1No Change
Centered
A value that indicates if the line is centered.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
CenteredDescription
0The line is not in the center of the sensor array.
1The line is in the center of the sensor array. 
(Line Sensor Status = -XX- or XXXX)
Moved
A value that indicates if the line's position has moved.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
MovedDescription
0The line has not changed position since the last time Moved was set to 0.
1The line has changed position since the last time Moved was set to 0.
Direction
A value that indicates the direction of the last movement.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
DirectionDescription
0The last movement of the line was towards the LSB sensor
1The last movement of the line was towards the MSB sensor
OutofRange
A value that indicates that the line is not under any of the sensors.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OutofRangeDescription
0The line is under at least one of the sensors.
1The line is not under any of the sensors.
IOPack
A value that specifies which pack of 4 I/O lines is connected to the line sensor.
Object Class: oIOPack Value Range: 0 - 7
Data Type: Numeric Default Value: 0
Some I/O Lines have special purposes.  Be sure to see oIOPack help file for details.
InvertIn
A value that selects if the inputs from line sensor are inverted.
Object Class: oSelect0to1 Value Range: 0 - 1
Data Type: Numeric Default Value: 0
InvertInDescription
0A high logic input (5 Volts) indicates the presents of the line under the sensor.
1A low logic input (0 Volts) indicates the presents of the line under the sensor.
Width
A value that selects how many sensors the lines sensor has.
Object Class: oSelect0to1 Value Range: 0 - 1
Data Type: Numeric Default Value: 0
 The following table show the value of the Width property
WidthEffect
0Use four sensors for line detection.
1

Use only three sensors for line detection. Setting this property has the following effects:

  • Bit 0 is left alone
  • Bit 2 is shifted over to bit 3's position
  • Bit 1 is copied into bit 2's position
  • Bit 3's input is ignored.

This means that basically the middle two bits are the same and the values are applied to the Value table above.

Mode
A value that selects how to set the Position property when the line is not under any of the sensors.
Object Class: oSelect0to1 Value Range: 0 - 1
Data Type: Numeric Default Value: 0
ModeDescription
0If no line is detected, assume the line is far outside either the left or right sides, depending upon the last direction seen. The Value is set to either -32 or 32 depending upon the Direction property.
1If no line is detected, assume the line is between the center two sensors. The Position property is set to 0 and the Centered property is set to 1.
Operate
A value that selects whether or not the line sensor is read or not.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOff

The sensor is not being read.

1cvOn

The sensor is being read.

DIO
The I/O function object used to read the line sensor.
Object Class: oCenterSwitch4 Value Range: 0 - 255
Data Type: Numeric Default Value: 0
Address
Returns a pointer to the address of the oCounter Object instance.
Object Class: oAddress Value Range: 0 - 127
Data Type:Pointer (Read Only) Default Value: Address of Object

Back to top of page Examples:
 In the following example, the oTracker Object is used.
Visual Basic SyntaxC and Java Syntax
' This program creates a Virtual 
' Circuit that uses an oTracker
' object to track a line and 
' position a servo via an oServo
' object for a line following robot.

Dim l As New oTracker
Dim S As New oServoX
Dim W As New oBus

Sub Main()
  ooPIC.PullUp = cvTrue
  l.IOPack = 1
  l.Operate = cvTrue
  S.IOLine = 1
  S.Operate = cvTrue
  W.Input.Link(l.Position)
  W.Output.Link(S)
  W.Operate = cvTrue
End Sub
// This program creates a Virtual 
// Circuit that uses an oTracker
// object to track a line and 
// position a servo via an oServo
// object for a line following robot.

oTracker l = New oTracker;
oServoX S = New oServoX;
oBus W = New oBus;

Void Main(Void){
  ooPIC.PullUp = cvTrue;
  l.IOPack = 1;
  l.Operate = cvTrue;
  S.IOLine = 1;
  S.Operate = cvTrue;
  W.Input.Link(l.Position);
  W.Output.Link(S);
  W.Operate = cvTrue;
}
Basic Syntax
' This program creates a Virtual 
' Circuit that uses an oTracker
' object to track a line and 
' position a servo via an oServo
' object for a line following robot.

l Var oTracker(1,,,,cvOn)
S Var oServoX(7,,,,,,,cvOn)
W Var oBus(l.Position,,S.Position,cvTrue)
Back to top of page Connections:
The Lynxmotion Tracker uses 3 I/O lines. 
Lynxmotion IRPD

Back to top of page Related Items:

 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oBumper4Reads a 4-contact bumper.xxx
oBumper8Reads an 8-contact bumper.xx
Back to top of page Version History and Bug List:
 Firmware Ver B1: Introduced.

Bugs: No known bugs.


ooPIC Compiler Ver 6.0 (c) Copyright 1997 - 2007 Savage Innovations, LLC.