Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RaySensorBank Class Reference

Class for a bank (collection) of ray sensors. More...

#include <raysensorbank.h>

Inheritance diagram for RaySensorBank:
Collaboration diagram for RaySensorBank:

Public Member Functions

 RaySensorBank ()
 
virtual ~RaySensorBank ()
 
virtual void setInitData (const OdeHandle &odeHandle, const OsgHandle &osgHandle, const osg::Matrix &pose) override
 sets the initial data structures More...
 
virtual void init (Primitive *own, Joint *joint=0) override
 initialises sensor with a body of robot and optionally with a joint. More...
 
virtual int getSensorNumber () const override
 returns the number of sensors values produced by this sensor More...
 
virtual bool sense (const GlobalData &globaldata) override
 performs sense action More...
 
virtual int get (sensor *sensors, int length) const override
 writes the sensor values (usually in the range [-1,1] ) into the given sensor array and returns the number of sensors written. More...
 
virtual std::list< sensorgetList () const override
 returns a list of sensor values (usually in the range [-1,1] ) This function should be overloaded. More...
 
virtual void update () override
 to update any visual appearance More...
 
virtual unsigned int registerSensor (RaySensor *raysensor, Primitive *body, const osg::Matrix &pose, float range, RaySensor::rayDrawMode drawMode)
 registers a new sensor at the sensor bank. More...
 
virtual int size ()
 returns the number of sensors More...
 
virtual void setRange (unsigned int index, float range)
 set the range of the specified sensor (index) More...
 
virtual void setRange (float range)
 set the range of all sensors More...
 
virtual dSpaceID getSpaceID ()
 returns the spaceID of the sensor space More...
 
virtual void clear ()
 
virtual bool isInitialized ()
 
- Public Member Functions inherited from PhysicalSensor
 PhysicalSensor ()
 
virtual ~PhysicalSensor ()
 
virtual void setPose (const osg::Matrix &pose)
 changes the relative pose of the sensor More...
 
virtual osg::Matrix getPose ()
 relative pose of the sensor More...
 
- Public Member Functions inherited from Sensor
 Sensor ()
 
virtual ~Sensor ()
 
virtual std::list
< SensorMotorInfo
getSensorInfos () const
 returns a list of sensor infos ( More...
 
std::list< sensorgetListOfArray () const
 helper function for performance implementation of list<> get() based on array-get More...
 
- Public Member Functions inherited from SensorMotorInfoAble
 SensorMotorInfoAble ()
 
void setBaseName (const std::string &basename)
 
void setBaseInfo (const SensorMotorInfo &baseinfo)
 
SensorMotorInfo getBaseInfo ()
 
void setNamingFunc (const NamingFunction &func)
 
NamingFunction getNamingFunc () const
 
void setNames (const std::vector< std::string > &names)
 set names explicitly (basename is anyway suffixed) More...
 
std::string getName (int index) const
 returns the name of a single item. Typically called from within Sensor and Motor class. More...
 
std::list< SensorMotorInfogetInfos (int number) const
 get all infos. More...
 

Protected Attributes

std::vector< RaySensor * > bank
 
bool initialized
 
- Protected Attributes inherited from PhysicalSensor
OdeHandle odeHandle
 
OsgHandle osgHandle
 
osg::Matrix pose
 
bool isInitDataSet
 
- Protected Attributes inherited from SensorMotorInfoAble
NamingFunction func
 
SensorMotorInfo baseinfo
 

Additional Inherited Members

- Public Types inherited from Sensor
enum  Dimensions {
  X = 1, Y = 2, Z = 4, XY = X | Y,
  XZ = X | Z, YZ = Y | Z, XYZ = X | Y | Z
}
 defines which dimensions should be sensed. The meaning is sensor specific. More...
 
- Public Types inherited from SensorMotorInfoAble
typedef std::function
< std::string(int)> 
NamingFunction
 function that returns the name given the index More...
 
- Static Public Member Functions inherited from Sensor
static std::list< sensorselectrows (const matrix::Matrix &m, short dimensions)
 selects the rows specified by dimensions (X->0, Y->1, Z->2) More...
 
static int selectrows (sensor *sensors, int length, const matrix::Matrix &m, short dimensions)
 selects the rows specified by dimensions (X->0, Y->1, Z->2) More...
 
static Dimensions parseSensorDimension (char *str)
 
static std::string dimensions2String (short dimensions)
 
- Static Public Member Functions inherited from SensorMotorInfoAble
static std::string defaultNameing (int index)
 the default implementation is for index==0: basename, otherwise basename + (index+1) More...
 

Detailed Description

Class for a bank (collection) of ray sensors.

Ray sensors can be registered at the bank. Methods for sensing and reading the sensor values of all sensors are provided.

Constructor & Destructor Documentation

~RaySensorBank ( )
virtual

Member Function Documentation

void clear ( )
virtual
int get ( sensor sensors,
int  length 
) const
overridevirtual

writes the sensor values (usually in the range [-1,1] ) into the given sensor array and returns the number of sensors written.

A default implementation based on get() is provided. Only if performance matters overwrite this function.

Parameters
sensorscall by refernce array which received the values
lengthcapacity of sensors array
Returns
number of sensor values written

Reimplemented from Sensor.

std::list< sensor > getList ( ) const
overridevirtual

returns a list of sensor values (usually in the range [-1,1] ) This function should be overloaded.

If performance matters, implement get(double*, int) and use getListOfArray to implement this.

Implements Sensor.

int getSensorNumber ( ) const
overridevirtual

returns the number of sensors values produced by this sensor

Implements Sensor.

dSpaceID getSpaceID ( )
virtual

returns the spaceID of the sensor space

void init ( Primitive own,
Joint joint = 0 
)
overridevirtual

initialises sensor with a body of robot and optionally with a joint.

This is usually done by the robot itself (or using the Attachment())

Implements Sensor.

Reimplemented in RangeFinder.

virtual bool isInitialized ( )
inlinevirtual
unsigned int registerSensor ( RaySensor raysensor,
Primitive body,
const osg::Matrix pose,
float  range,
RaySensor::rayDrawMode  drawMode 
)
virtual

registers a new sensor at the sensor bank.

The body and the pose have to be provided.

Parameters
raysensorRaySensor to add
bodybody to which the sensor should be connected
poserelative position/orientation
rangemaximum sense range of the sensor
Returns
index of the sensor
bool sense ( const GlobalData globaldata)
overridevirtual

performs sense action

Implements Sensor.

void setInitData ( const OdeHandle odeHandle,
const OsgHandle osgHandle,
const osg::Matrix pose 
)
overridevirtual

sets the initial data structures

Parameters
poseposition and orientation of sensor (e.g. camera) wrt. the primitive that is given at init()

Reimplemented from PhysicalSensor.

void setRange ( unsigned int  index,
float  range 
)
virtual

set the range of the specified sensor (index)

Parameters
indexindex of sensor to modify
rangenew length of the sensor
void setRange ( float  range)
virtual

set the range of all sensors

Parameters
rangenew length of the sensors
virtual int size ( )
inlinevirtual

returns the number of sensors

void update ( )
overridevirtual

to update any visual appearance

Reimplemented from Sensor.

Member Data Documentation

std::vector<RaySensor*> bank
protected
bool initialized
protected

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