Class TBatterySensor

DescriptionHierarchyFieldsMethodsProperties

Unit

BatterySensor

Declaration

type TBatterySensor = class(TSensor)

Description

Class implementing a simple battery sensor. TBatterySensor implements a sensor that provides a way to monitor an energy source (see TEnergySource). The definition of the sensor should be placed in the robot definition file, within the definition of the body (see TRobot.Body). In Table 1 an example definition is shown where the sensor is connected to an energy source with the name "Battery".

Table 1: Example definition of a battery (energy source).

object MyBatterySensor: TBatterySensor
  CorrespondingBatteryName = 'Battery'
end

Hierarchy

TBatterySensor > TSensor > TTenaciousObject > TPersistent

Methods

Overview

Public constructor CreateAndSet(Sensor: TSensor); override;
Public function Copy: TSensor; override;
Public procedure LoadFromDefinition(ObjDef: TObjectDefinition); override;
Public procedure MapBattery(Battery: TEnergySource);
Public procedure Reset; override;
Public procedure UpdateReading(Arena: TArena); override;

Description

Public constructor CreateAndSet(Sensor: TSensor); override;

Copy constructor. The copy constructor copies everything except the reference to the monitored energy source which is set by calling MapBattery.

Public function Copy: TSensor; override;

Creates a copy by calling the copy constructor CreateAndSet.

Public procedure LoadFromDefinition(ObjDef: TObjectDefinition); override;

Loads the properties from the definition file.

Public procedure MapBattery(Battery: TEnergySource);

Sets the reference to the monitored energy source. This procedure is called automatically during the initialization of the robot's body (see TBody.Initialize). The user is not required to call this procedure explicitly.

Public procedure Reset; override;

This procedure is currently empty since there are no variables in this class that needs to be reset. It is called automatically in TBody.Reset.

Public procedure UpdateReading(Arena: TArena); override;

Updates the current reading by calling TEnergySource.Level.

Properties

Overview

Public property CorrespondingBattery: TEnergySource;
Public property CorrespondingBatteryName: string;

Description

Public property CorrespondingBattery: TEnergySource;

Reference to the energy source that is being monitored.

Public property CorrespondingBatteryName: string;

Name of the energy source that is being monitored.


Generated by PasDoc 0.8.8.3 on 2005-05-28 08:13:49