Robot Simulator of the Robotics Group for Self-Organization of Control: CameraSensor Class Reference

# CameraSensor Class Reference

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

`#include <camerasensor.h>`

Inherits lpzrobots::Sensor.

Inherited by DirectCameraSensor, OpticalFlow, and PositionCameraSensor.

Collaboration diagram for CameraSensor:
[legend]

List of all members.

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

## 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

CameraSensor | ( |  | ) |

Creates a camera sensor.

Use setInitData() to make it useable.

~CameraSensor | ( |  | ) | `[virtual]`

## Member Function Documentation

virtual std::list<sensor> get | ( |  | ) | const`[virtual]`

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

Implements Sensor.

virtual int get | ( | sensor * | sensors,
|  | int | length |
| ) |  |  | const`[pure virtual]`

overload this function and return the sensor values

Reimplemented from Sensor.

Implemented in DirectCameraSensor, PositionCameraSensor, and OpticalFlow.

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 DirectCameraSensor, PositionCameraSensor, and OpticalFlow.

void init | ( | Primitive * | own | ) | `[virtual]`

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

Implements Sensor.

virtual void intern_init | ( |  | ) | `[protected, pure virtual]`

overload this function to initialized you data structures.

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

Implemented in DirectCameraSensor, PositionCameraSensor, and OpticalFlow.

virtual bool sense | ( | const GlobalData & | globaldata | ) | `[pure virtual]`

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

Implements Sensor.

Implemented in DirectCameraSensor, PositionCameraSensor, MotionCameraSensor, and OpticalFlow.

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:

  | pose | position 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:

- camerasensor.h
- camerasensor.cpp