oTracker Object
An Object that tracks the position of a line.
Description:
 

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

Operation:
 

The oTracker Object monitors the 4 I/O lines specified by the IOGroup and Nibble properties.  It is expecting that the 4 I/O lines are connected to an array of 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 Value property. 

Before the URCP Value is stored in the Value 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 center property is set to 1, otherwise the Center property is set to 0.

If the line was not found by the sensor, then the OutOfRange property is set to 1 and the Value 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 Value property is set to 32 or -32 depending on the 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 Value property is set to 0 and the Center property is set to 1.

Storage size & Availability:
 

The following table lists the size and availability of the oTracker Object and its variations:

ObjectSizeVersion
oTracker 5 Bytes B.1.0
Properties:
 

The following table lists the Properties of the oTracker Object:

Property Description
Address

Returns a pointer to the address of the oTracker Object instance.

Data-Type: Address, Read-Only

Data-Range: 0 - 127

Center

A value that indicates if the line is centered.

Data-Type: Bit, Flag

Data-Range: 0 - 1

CenterDescription
0 The line is not in the center of the sensor array.
1 The line is in the center of the sensor array. 
(Line Sensor Status = -XX- or XXXX)
Direction

A value that indicates the direction of the last movement.

Data-Type: Bit, Flag

Data-Range: 0 - 1

DirectionDescription
0 The last movement of the line was towards the LSB sensor
1 The last movement of the line was towards the MSB sensor
InvertIn

A value that specifies if the inputs should be inverted.

Data-Type: Bit

Data-Range: 0 - 1

InvertInDescription
0 A high logic input (5 Volts) indicates the presents of the line under the sensor.
1 A low logic input (0 Volts) indicates the presents of the line under the sensor.
IOGroup

A value that specifies which physical I/O Group to use.

Data-Type: Nibble

Data-Range: 0 - 3

Mode A value that specifies what the Value is set to when the line is not under any of the sensors.

Data-Type: Bit

Data-Range: 0 - 1

ModeDescription
0 Value is set to 
1  
Moved

A value that indicates if the line's position has moved. (user must reset)

Data-Type: Bit

Data-Range: 0 - 1

MovedDescription
0 The line has not changed position since the last time Moved was set to 0.
1 The line has changed position since the last time Moved was set to 0.
Nibble

A value that specifies which side of the IOGroup to use.

Data-Type: Bit

Data-Range: 0 - 1

Operate

A value that specifies whether or not the data is updated.

Data-Type: Bit, Flag

Data-Range: 0 - 1

OutofRange

A value that indicates that the line is not under any of the sensors.

Data-Type: Bit Flag

Data-Range: 0 - 1

OutofRangeDescription
0 The line is under at least one of the sensors.
1 The line is not under any of the sensors.
Unsigned A value that specifies if the Value property is signed or unsigned.

Data-Type: Bit

Data-Range: 0 - 1

UnsignedDescription
0 The Value property is returned as a signed number in URCP Heading format.
1 The Value property is returned as an unsigned number.
Value

A value that indicates the position of the line.

Data-Type: Byte Default

Data-Range: 0 - 15  or  -32 to +32

Line Sensors StatusModeSigned
Value
Unsigned
Value
CenterOutOfRange
 ---->
1 -32 4 0 1
---X
0 or 1 -24 5 0 0
--XX
0 or 1 -16 6 0 0
--X-
0 or 1 -8 7 0 0
-XXX
0 or 1 -8 7 0 0
-XX-
0 or 1 0 8 1 0
XXXX
0 or 1 0 8 1 0
----
0 0 8 1 1
-X--
0 or 1 8 9 0 0
XXX-
0 or 1 8 9 0 0
XX--
0 or 1 16 10 0 0
X---
0 or 1 24 11 0 0
<---- 
1 32 12 0 1
All others0 or 1 No Change
Example:
  In the following example, the oTracker Object is used.
'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.IOGroup = 1
  L.Operate = cvtrue
  S.IOLine = 1
  S.Operate = cvTrue
  W.Input.Link(L)
  W.Output.Link(S)
  W.Operate = cvTrue
End Sub