Description: |
| | The oDistance Object manages a signed 8-Bit variable intended to be used as a URCP Distance value and that can be used in a virtual circuit. As well as the value of the variable, status properties are also provided that can be used in a virtual circuit. The oDistance Object has properties and methods that support the URCP Distance value. URCP Distance values deal with Distances, Lengths, Proximities. The common numbering system chosen for this is 64 steps per foot. 256 steps over a 4 foot range is used so that a single byte can represent a "Personal space" of 4 feet for a robot. This gives a resolution down to better than one fifth of an inch or about one half of a centimeter.The oDistance2 Object is composed of two bytes. The second byte represents an extension to the first and can indicated distances of up to 512 feet. Objects such as the oSonarDV and the oIRRange use URCP Distance values. There are three main differences between this object and a standard Char variable.
- This Object's Value property is an instance of the oValue Object which can be pointed to by a Virtual Circuit.
- This Object maintains status bits which can be pointed to by Virtual Circuits.
- This Object is 1 byte larger in order to store the status information.
|
| | The following table lists the size and availability of the oDistance Object.
| | Object | Size | Description | A1 | A2 | B1 | B2 | C1 |
 | oDistance | 2 Bytes | An Object that manages a URCP distance value. | x | x | x |
 | oDistance2 | 3 Bytes | An Object that manages a URCP distance value. | x | x | x |
|
Operation: |
| | An oDistance Object variable stores a signed 8 or 16 Bit value in its Value property and maintains other values that represent the status of those 8 bits. The Negative property indicates the Most-Significant-Bit of the value which is used to indicate when the value is a negative number. The NonZero Property indicates if the value is not zero. |
Properties: |
| The following table lists the properties of the oDistance Object:
Property | Description |
| Value |
| The distance value. |
 | Object Class: | oValue | | Value Range: | -32,768 to +32,767 or -128 to -127 |
| Data Type: | Numeric | | Default Value: | 0 |
|
| Value | Description |
| 0 | No distance |
| 32 | |
| 64 | 1 foot forward |
| 96 | |
| 127 | 2 feet forward |
|
|
| Negative |
| A value that indicates the Value property is less than zero. |
 | Object Class: | oLogic | | Value Range: | 0 - 1 |
| Data Type: | Numeric | | Default Value: | 0 |
|
| Notes on virtual circuit usage: Not all implementations of the oDistance Object have a linkable Negative property. While all instance of the oDistance Object that you create in your programs will have a linkable Negative property, some of the ooPIC Objects create a custom oDistance Object instance that cannot. |
| Negative | Description |
| 0 | The Value property is a Positive value. |
| 1 | The Value property is Negative Value. |
|
|
| NonZero |
| A value that indicates the Value property is more than or less than zero. |
 | Object Class: | oLogic | | Value Range: | 0 - 1 |
| Data Type: | Numeric | | Default Value: | 0 |
|
| Notes on virtual circuit usage: Not all implementations of the oDistance Object have a linkable NonZero property. While all instance of the oDistance Object that you create in your programs will have a linkable NonZero property, some of the ooPIC Objects create a custom oDistance Object instance that cannot. |
| NonZero | Constant | Description |
| 0 | cvFalse | The Value property is zero. |
| 1 | cvTrue | The Value property is not zero. |
|
|
| Data |
| The data for the Value property. |
 | Object Class: | oVar1 | | 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 |
|
|
|
Example:
|
| The following examples use the oDistance Object as implemented in the oSonarDV object.
| Visual Basic Syntax | C and Java Syntax |
'This program reads an oSonarDV
'Object and outputs the distance
'on Scott Edwards LCD.
Dim A As New oSonarDV
Dim D As New oLCDSE
Sub Main()
A.IOLineE = 31
A.IOLineP = 30
A.Operate = 1
D.IOLine = 16
Do
A.Operate.Pulse(1,1,250)
D.Clear
D.VString = Str$(A.Distance/64)
Loop
End Sub | // This program reads an oSonarDV
// Object and outputs the distance
// on Scott Edwards LCD.
oSonarDV A = New oSonarDV;
oLCDSE D = New oLCDSE;
Void Main(Void){
A.IOLineE = 31;
A.IOLineP = 30;
A.Operate = 1;
D.IOLine = 16;
Do{
A.Operate.Pulse(1,1,250);
D.Clear;
D.VString = Str$(A.Distance/64)
} While (1);
} |
| Basic Syntax | |
'This program reads an oSonarDV
'Object and outputs the distance
'on Scott Edwards LCD.
A As oSonarDV(31,30,cvOn)
D As oLCDSE(16)
Do
A.Operate.Pulse(1,1,250)
D.Clear
D.VString = Str$(A.Distance/64)
Loop | |
|
Related Items:
|
| | The following table lists objects that use the oDistance Object.
| | Object | Description | A1 | A2 | B1 | B2 | C1 |
 | oIRRange | Reads a Sharp GP2D12 IR ranging module. | x | x | x |
 | oSonarDV | Reads a Devantech SRF04 Ultrasonic Range Finder. | x | x | x |
 | oSonarPL | Reads a Polaroid 6500 sonar ranging module. | x | x | x |
|
| | The following table lists objects with related functions
| | Object | Description | A1 | A2 | B1 | B2 | C1 |
 | oHeading | Manages a URCP Heading value. | x | x | x |
 | oPower | Manages a URCP Power value. | x | x | x |
|
Version History and Bug List: |
| | Firmware Ver B1: Introduced. Bugs: No known bugs. |