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
RelativePositionSensor Class Reference

Class for relative (or absolute) position sensing. More...

#include <relativepositionsensor.h>

Inheritance diagram for RelativePositionSensor:
Collaboration diagram for RelativePositionSensor:

Public Member Functions

 RelativePositionSensor (double maxDistance, double exponent, short dimensions=X|Y|Z, bool local_coordinates=false)
 
virtual ~RelativePositionSensor ()
 
virtual void init (Primitive *own, Joint *joint=0)
 initialises sensor with a body of robot and optionally with a joint. More...
 
virtual int getSensorNumber () const
 returns the number of sensors values produced by this sensor More...
 
virtual bool sense (const GlobalData &globaldata)
 performs sense action More...
 
virtual std::list< sensorgetList () const
 returns a list of sensor values (usually in the range [-1,1] ) This function should be overloaded. More...
 
virtual void setReference (Primitive *ref)
 Sets the reference object we use for relative position measureing. More...
 
- Public Member Functions inherited from Sensor
 Sensor ()
 
virtual ~Sensor ()
 
virtual std::list
< SensorMotorInfo
getSensorInfos () const
 returns a list of sensor infos ( More...
 
virtual void update ()
 to update any visual appearance More...
 
virtual int get (sensor *sensors, int length) const
 writes the sensor values (usually in the range [-1,1] ) into the given sensor array and returns the number of sensors written. 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...
 

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...
 
- Protected Attributes inherited from SensorMotorInfoAble
NamingFunction func
 
SensorMotorInfo baseinfo
 

Detailed Description

Class for relative (or absolute) position sensing.

The sensor values are the normalised relative position to some given object ( setReference() ) or the origin.

Constructor & Destructor Documentation

RelativePositionSensor ( double  maxDistance,
double  exponent,
short  dimensions = X | Y | Z,
bool  local_coordinates = false 
)
Parameters
maxDistancemaximal distance that is expected used for normalisation of sensor value
exponentexponent of the sensor characteritic (default: 1 (linear))
dimensionsbit mask for the dimensions to sense. Default: X | Y | Z (all dimensions)
See Also
Dimensions If exact (relative) positions should be produced, use maxDistance=1 and exponent=1
virtual ~RelativePositionSensor ( )
inlinevirtual

Member Function Documentation

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

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
virtual

returns the number of sensors values produced by this sensor

Implements Sensor.

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

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.

bool sense ( const GlobalData globaldata)
virtual

performs sense action

Implements Sensor.

void setReference ( Primitive ref)
virtual

Sets the reference object we use for relative position measureing.

If not set or 0 then the origin is used. This can be another robot an obstacle (light source) and such like This must be called before first sense() or get() call.


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