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
CameraSensor Class Referenceabstract

Class to connect a Camera as a sensor to a robot. More...

#include <camerasensor.h>

Inheritance diagram for CameraSensor:
Collaboration diagram for CameraSensor:

Public Member Functions

 CameraSensor ()
 Creates a camera sensor. More...
 
virtual ~CameraSensor ()
 
virtual void setInitData (Camera *camera, const OdeHandle &odeHandle, const OsgHandle &osgHandle, const osg::Matrix &pose)
 sets the initial data structures like the camera. More...
 
virtual void setPose (const osg::Matrix &pose)
 changes the relative pose of the camera More...
 
virtual osg::Matrix getPose ()
 relative pose of the camera More...
 
virtual void init (Primitive *own, Joint *joint=0)
 this function initialized the camera (no need to overload) (Sensor interface) More...
 
virtual bool sense (const GlobalData &globaldata)=0
 overload this function an process the image (use camera->getImage()) More...
 
virtual int getSensorNumber () const =0
 overload this function and return the number of sensor values More...
 
virtual int get (sensor *sensors, int length) const =0
 overload this function and return the sensor values More...
 
virtual void update ()
 we update the camera's visual appearance More...
 
virtual std::list< sensorgetList () const
 this is implemented based on get(sensor*,int) 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 Member Functions

virtual void intern_init ()=0
 overload this function to initialized you data structures. More...
 

Protected Attributes

Cameracamera
 
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 to connect a Camera as a sensor to a robot.

Essentially it implements the conversion from the 2D image to a list of double sensor values. The initialization is a bit confusing: use the contructor (of a inherited class) to provide custom parameter; setInitData sets the handles and the camera which has to be called before the normal initialization of the Sensor (via init()). A subclass has to overload intern_init() to initialize intern structures (e.g. number of channels), sense() and get().

Constructor & Destructor Documentation

Creates a camera sensor.

Use setInitData() to make it useable.

~CameraSensor ( )
virtual

Member Function Documentation

virtual int get ( sensor sensors,
int  length 
) const
pure virtual

overload this function and return the sensor values

Reimplemented from Sensor.

Implemented in PositionCameraSensor, OpticalFlow, and DirectCameraSensor.

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

this is implemented based on get(sensor*,int)

Implements Sensor.

osg::Matrix getPose ( )
virtual

relative pose of the camera

returns the relative pose of the camera

virtual int getSensorNumber ( ) const
pure virtual

overload this function and return the number of sensor values

Implements Sensor.

Implemented in PositionCameraSensor, OpticalFlow, and DirectCameraSensor.

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

this function initialized the camera (no need to overload) (Sensor interface)

Implements Sensor.

virtual void intern_init ( )
protectedpure virtual

overload this function to initialized you data structures.

Use camera->getImage() to get the image from the camera

Implemented in PositionCameraSensor, OpticalFlow, and DirectCameraSensor.

virtual bool sense ( const GlobalData globaldata)
pure virtual

overload this function an process the image (use camera->getImage())

Implements Sensor.

Implemented in MotionCameraSensor, PositionCameraSensor, OpticalFlow, and DirectCameraSensor.

void setInitData ( Camera camera,
const OdeHandle odeHandle,
const OsgHandle osgHandle,
const osg::Matrix pose 
)
virtual

sets the initial data structures like the camera.

The camera will be initialized in init() (don't initialize it before).

Parameters
poseposition and orientation of camera wrt. the primitive that is given at init()
void setPose ( const osg::Matrix pose)
virtual

changes the relative pose of the camera

void update ( )
virtual

we update the camera's visual appearance

Reimplemented from Sensor.

Member Data Documentation

Camera* camera
protected
bool isInitDataSet
protected
OdeHandle odeHandle
protected
OsgHandle osgHandle
protected
osg::Matrix pose
protected

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