RobWorkProject  23.9.11-
Public Types | Public Member Functions | List of all members
SimulatedCamera Class Reference

The SimulatedCamera class makes it posible to use virtual camera sensors by using different framegrapper implementations. More...

#include <SimulatedCamera.hpp>

Inherits SimulatedSensor.

Public Types

typedef rw::core::Ptr< SimulatedCameraPtr
 Smart pointer type for a SimulatedCamera.
 
- Public Types inherited from SimulatedSensor
typedef rw::core::Ptr< SimulatedSensorPtr
 smart pointer type of this class
 
- Public Types inherited from Stateless
typedef rw::core::Ptr< StatelessPtr
 Smart pointer type for Stateless.
 

Public Member Functions

 SimulatedCamera (const std::string &name, double fov, rw::core::Ptr< rw::kinematics::Frame > frame, rw::core::Ptr< rwlibs::simulation::FrameGrabber > frameGrabber)
 creates a simulated pinhole camera, More...
 
 SimulatedCamera (rw::core::Ptr< rw::sensor::CameraModel > model, rw::core::Ptr< rwlibs::simulation::FrameGrabber > frameGrabber)
 constructor More...
 
virtual ~SimulatedCamera ()
 destructor
 
bool initialize ()
 initializes the camera to the current settings (CaptureMode,ColorMode,etc.) More...
 
bool start ()
 starts this camera, if the camera has not been initialized the initialize function will be called. More...
 
void stop ()
 stops this camera. When the camera is stopped it can be reinitialized using initialize() More...
 
void acquire ()
 aquires an image from the camera. This method is not blocking. Use isImageReady to poll for completion of acquire. More...
 
bool isImageReady ()
 tests whether a image has been acquired More...
 
const rw::sensor::ImagegetImage ()
 returns the last image acquired from the camera. This method is not blocking, if no image has been acquired yet an empty image is returned. The image returned can for some specific drivers be read only. More...
 
double getFrameRate ()
 returns the framerate that this camera is setup with More...
 
void setFrameRate (double framerate)
 sets the framerate of this camera. If the framerate is not supported the closest supported framerate is choosen. More...
 
virtual unsigned int getWidth () const
 get width of the captured images More...
 
virtual unsigned int getHeight () const
 get width of the captured images More...
 
void update (const rwlibs::simulation::Simulator::UpdateInfo &info, rw::kinematics::State &state)
 steps the the SimulatedSensor with time dt and saves any state changes in state. More...
 
void reset (const rw::kinematics::State &state)
 Resets the state of the SimulatedSensor to that of state. More...
 
rw::core::Ptr< rw::sensor::SensorgetSensor ()
 
rw::core::Ptr< rw::sensor::CameragetCameraSensor ()
 Get the camera sensor. More...
 
- Public Member Functions inherited from SimulatedSensor
virtual ~SimulatedSensor ()
 destructor
 
const std::string & getName () const
 get name of this simulated sensor
 
rw::kinematics::FramegetFrame () const
 get frame that this sensor is attached to. More...
 
rw::sensor::SensorModel::Ptr getSensorModel ()
 get the sensor model of this simulated sensor.
 
rw::sensor::Sensor::Ptr getSensorHandle (rwlibs::simulation::Simulator::Ptr sim)
 get a handle to controlling an instance of the simulated sensor in a specific simulator More...
 
- Public Member Functions inherited from Stateless
virtual ~Stateless ()
 destructor
 
virtual void registerIn (State &state)
 initialize this stateless data to a specific state More...
 
virtual void registerIn (StateStructure::Ptr state)
 register this stateless object in a statestructure.
 
virtual void unregister ()
 unregisters all state data of this stateless object
 
StateStructure::Ptr getStateStructure ()
 Get the state structure. More...
 
const StateStructure::Ptr getStateStructure () const
 Get the state structure. More...
 
bool isRegistered ()
 Check if object has registered its state. More...
 

Additional Inherited Members

- Protected Member Functions inherited from SimulatedSensor
 SimulatedSensor (rw::sensor::SensorModel::Ptr model)
 constructor
 
- Protected Member Functions inherited from Stateless
 Stateless ()
 constructor
 
template<class T >
void add (StatelessData< T > &data)
 implementations of sensor should add all their stateless data on initialization
 
void add (StateData *data)
 Add data. More...
 
void add (rw::core::Ptr< StateData > data)
 implementations of sensor should add all their state data on initialization
 
- Protected Attributes inherited from Stateless
bool _registered
 True if object has registered its state.
 
std::vector< rw::core::Ptr< StateData > > _datas
 Data.
 
StateStructure::Ptr _stateStruct
 The state structure.
 

Detailed Description

The SimulatedCamera class makes it posible to use virtual camera sensors by using different framegrapper implementations.

The SimulatedCamera implements the camera interface though the setting of framerate has no meaning to the virtual camera since no timing is done in this implementation.

Constructor & Destructor Documentation

◆ SimulatedCamera() [1/2]

SimulatedCamera ( const std::string &  name,
double  fov,
rw::core::Ptr< rw::kinematics::Frame frame,
rw::core::Ptr< rwlibs::simulation::FrameGrabber frameGrabber 
)

creates a simulated pinhole camera,

Parameters
name[in] name of sensor
fov[in] field of view for the camera.
frame[in] frame to which the camera is attached
frameGrabber[in] the frameGrabber from which this Camera should grab images

◆ SimulatedCamera() [2/2]

constructor

Parameters
model[in] the model and info of the camera
frameGrabber[in] the frameGrabber from which this Camera should grab images.

Member Function Documentation

◆ acquire()

void acquire ( )

aquires an image from the camera. This method is not blocking. Use isImageReady to poll for completion of acquire.

◆ getCameraSensor()

rw::core::Ptr<rw::sensor::Camera> getCameraSensor ( )
inline

Get the camera sensor.

Returns
the sensor.

◆ getFrameRate()

double getFrameRate ( )

returns the framerate that this camera is setup with

Returns
the framerate in frames per second

◆ getHeight()

virtual unsigned int getHeight ( ) const
virtual

get width of the captured images

Returns
width

◆ getImage()

const rw::sensor::Image* getImage ( )

returns the last image acquired from the camera. This method is not blocking, if no image has been acquired yet an empty image is returned. The image returned can for some specific drivers be read only.

Returns
last image captured from camera.

◆ getWidth()

virtual unsigned int getWidth ( ) const
virtual

get width of the captured images

Returns
width

◆ initialize()

bool initialize ( )

initializes the camera to the current settings (CaptureMode,ColorMode,etc.)

Returns
true if initialization is succesfully, false otherwise.

◆ isImageReady()

bool isImageReady ( )

tests whether a image has been acquired

Returns
true if an image has been acquired, false otherwise.

◆ reset()

void reset ( const rw::kinematics::State state)
inlinevirtual

Resets the state of the SimulatedSensor to that of state.

Parameters
state[in] the state that the sensor is reset too.

Implements SimulatedSensor.

◆ setFrameRate()

void setFrameRate ( double  framerate)

sets the framerate of this camera. If the framerate is not supported the closest supported framerate is choosen.

Parameters
framerate[in] the framerate

◆ start()

bool start ( )

starts this camera, if the camera has not been initialized the initialize function will be called.

Returns
true if camera was successfully started, false otherwise

◆ stop()

void stop ( )

stops this camera. When the camera is stopped it can be reinitialized using initialize()

◆ update()

void update ( const rwlibs::simulation::Simulator::UpdateInfo info,
rw::kinematics::State state 
)
virtual

steps the the SimulatedSensor with time dt and saves any state changes in state.

Parameters
info[in] update information related to the time step.
state[out] changes of the SimulatedSensor is saved in state.

Implements SimulatedSensor.


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