RoboidControl
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Attributes | Static Protected Attributes | List of all members
Passer::RoboidControl::DistanceSensor Class Reference

A Sensor which can measure the distance to the nearest object. More...

#include <DistanceSensor.h>

Inheritance diagram for Passer::RoboidControl::DistanceSensor:
Passer::RoboidControl::Sensor Passer::RoboidControl::Thing

Public Member Functions

 DistanceSensor ()
 Default constructor.
 
 DistanceSensor (float triggerDistance)
 Creates a DistanceSensor with the given trigger distance.
 
virtual float GetDistance ()
 Determine the distance to the nearest object.
 
bool ObjectNearby ()
 Indicate that an object is nearby.
 
virtual void Update ()
 
bool IsMotor ()
 Check if the Thing is a Motor.
 
bool IsSensor ()
 Check if the Thing is a Sensor.
 
void SetParent (Thing *parent)
 
ThingGetParent ()
 
void AddChild (Thing *child)
 
ThingGetChild (unsigned char childIx)
 

Public Attributes

float minRange = 0.01F
 The minimum range at which the sensor gives reliable measurements.
 
float maxRange = 10.0F
 The maximum range at which the sensor gives reliable measurements.
 
float triggerDistance = 1
 The distance at which ObjectNearby triggers.
 
unsigned int type
 The type of Thing.
 
Polar position
 

Static Public Attributes

static const unsigned int SwitchType = SensorType | (unsigned int)Type::Switch
 The type of a switch sensor.
 
static const unsigned int DistanceSensorType
 The type of a distance sensor.
 
static const unsigned int ControlledMotorType
 The type of a controlled motor.
 
static const unsigned int UncontrolledMotorType
 The type of an uncontrolled motor.
 
static const unsigned int ServoType = (unsigned int)Type::Servo
 The type of an object received from the network.
 
static const unsigned int ExternalType = (unsigned int)Type::ExternalSensor
 

Protected Types

enum class  Type {
  Undetermined , Switch , DistanceSensor , ControlledMotor ,
  UncontrolledMotor , Servo , ExternalSensor
}
 Basic Thing types. More...
 

Protected Attributes

float distance = 0
 Distance to the closest object.
 
Thingparent = nullptr
 
unsigned char childCount = 0
 
Thing ** children = nullptr
 

Static Protected Attributes

static const unsigned int MotorType = 0x8000
 Bitmask for Motor type.
 
static const unsigned int SensorType = 0x4000
 Bitmap for Sensor type.
 

Detailed Description

A Sensor which can measure the distance to the nearest object.

Member Enumeration Documentation

◆ Type

enum class Passer::RoboidControl::Thing::Type
strongprotectedinherited

Basic Thing types.

Enumerator
Undetermined 
Switch 
DistanceSensor 
ControlledMotor 
UncontrolledMotor 
Servo 
ExternalSensor 

Constructor & Destructor Documentation

◆ DistanceSensor() [1/2]

DistanceSensor::DistanceSensor ( )

Default constructor.

◆ DistanceSensor() [2/2]

DistanceSensor::DistanceSensor ( float  triggerDistance)

Creates a DistanceSensor with the given trigger distance.

Parameters
triggerDistanceThe distance at which the sensors indicates that a object is close by

Member Function Documentation

◆ GetDistance()

float DistanceSensor::GetDistance ( )
virtual

Determine the distance to the nearest object.

Returns
the measured distance in meters to the nearest object

◆ ObjectNearby()

bool DistanceSensor::ObjectNearby ( )

Indicate that an object is nearby.

Returns
True when an object is nearby

◆ Update()

virtual void Passer::RoboidControl::Sensor::Update ( )
inlinevirtualinherited

◆ IsMotor()

bool Thing::IsMotor ( )
inherited

Check if the Thing is a Motor.

Returns
True when the Thing is a Motor and False otherwise

◆ IsSensor()

bool Thing::IsSensor ( )
inherited

Check if the Thing is a Sensor.

Returns
True when the Thing is a Sensor and False otherwise

◆ SetParent()

void Thing::SetParent ( Thing parent)
inherited

◆ GetParent()

Thing * Thing::GetParent ( )
inherited

◆ AddChild()

void Thing::AddChild ( Thing child)
inherited

◆ GetChild()

Thing * Thing::GetChild ( unsigned char  childIx)
inherited

Member Data Documentation

◆ minRange

float Passer::RoboidControl::DistanceSensor::minRange = 0.01F

The minimum range at which the sensor gives reliable measurements.

◆ maxRange

float Passer::RoboidControl::DistanceSensor::maxRange = 10.0F

The maximum range at which the sensor gives reliable measurements.

◆ triggerDistance

float Passer::RoboidControl::DistanceSensor::triggerDistance = 1

The distance at which ObjectNearby triggers.

◆ distance

float Passer::RoboidControl::DistanceSensor::distance = 0
protected

Distance to the closest object.

◆ type

unsigned int Passer::RoboidControl::Thing::type
inherited

The type of Thing.

◆ SwitchType

const unsigned int Thing::SwitchType = SensorType | (unsigned int)Type::Switch
staticinherited

The type of a switch sensor.

◆ DistanceSensorType

const unsigned int Thing::DistanceSensorType
staticinherited
Initial value:
=
static const unsigned int SensorType
Bitmap for Sensor type.
Definition Thing.h:48

The type of a distance sensor.

◆ ControlledMotorType

const unsigned int Thing::ControlledMotorType
staticinherited
Initial value:
=
static const unsigned int MotorType
Bitmask for Motor type.
Definition Thing.h:46

The type of a controlled motor.

◆ UncontrolledMotorType

const unsigned int Thing::UncontrolledMotorType
staticinherited
Initial value:

The type of an uncontrolled motor.

◆ ServoType

const unsigned int Thing::ServoType = (unsigned int)Type::Servo
staticinherited

The type of an object received from the network.

◆ ExternalType

const unsigned int Thing::ExternalType = (unsigned int)Type::ExternalSensor
staticinherited

◆ position

Polar Passer::RoboidControl::Thing::position
inherited

◆ MotorType

const unsigned int Passer::RoboidControl::Thing::MotorType = 0x8000
staticprotectedinherited

Bitmask for Motor type.

◆ SensorType

const unsigned int Passer::RoboidControl::Thing::SensorType = 0x4000
staticprotectedinherited

Bitmap for Sensor type.

◆ parent

Thing* Passer::RoboidControl::Thing::parent = nullptr
protectedinherited

◆ childCount

unsigned char Passer::RoboidControl::Thing::childCount = 0
protectedinherited

◆ children

Thing** Passer::RoboidControl::Thing::children = nullptr
protectedinherited

The documentation for this class was generated from the following files: