CameraUtils Class Reference

A custom gazebo plugin that provides an interface to programatically collect data from cameras at specific times. More...

#include <CameraUtils.hh>

Public Member Functions

 CameraUtils ()
 Constructs the object. More...
 
virtual ~CameraUtils ()
 Destroys the object. More...
 
virtual void Load (sensors::SensorPtr _sensor, sdf::ElementPtr _sdf)
 Loads the object. More...
 
void OnNewFrame (const unsigned char *_image, unsigned int _width, unsigned int _height, unsigned int _depth, const std::string &_format)
 Callback function for handling frame updates. More...
 

Protected Attributes

sensors::CameraSensorPtr parentSensor
 Pointer to camera sensor. More...
 
rendering::CameraPtr camera
 Pointer to camera object. More...
 
unsigned int width
 Image width. More...
 
unsigned int height
 Image height. More...
 
unsigned int depth
 Image depth. More...
 
std::string format
 Image format. More...
 
std::string extension
 Exported image extension. More...
 

Private Member Functions

void onRequest (CameraUtilsRequestPtr &_msg)
 Callback function for handling incoming requests. More...
 

Private Attributes

std::unique_ptr< CameraUtilsPrivatedataPtr
 Class with private attributes. More...
 
std::string output_dir
 Directory for saving output. More...
 
int saved_counter {0}
 Saved frames counter. More...
 
std::string next_file_name
 File name for next capture. More...
 
bool save_on_update {false}
 Internal flag for saving on next update. More...
 
event::ConnectionPtr newFrameConnection
 Connects to new frame rendered event. More...
 

Detailed Description

A custom gazebo plugin that provides an interface to programatically collect data from cameras at specific times.

See the example usage below:

1 <plugin name="camera_utils" filename="libCameraUtils.so">
2 
3  <!-- Output image directory -->
4  <output_dir>/tmp/camera_world</output_dir>
5 
6  <!-- Output image extension -->
7  <extension>.png</extension>
8 
9 </plugin>

See worlds/camera.world for a complete example.

Constructor & Destructor Documentation

Constructs the object.

~CameraUtils ( )
virtual

Destroys the object.

Member Function Documentation

void Load ( sensors::SensorPtr  _sensor,
sdf::ElementPtr  _sdf 
)
virtual

Loads the object.

Parameters
_sensorThe camera sensor to which the plugin is attached
_sdfThe SDF element with plugin parameters
void OnNewFrame ( const unsigned char *  _image,
unsigned int  _width,
unsigned int  _height,
unsigned int  _depth,
const std::string &  _format 
)

Callback function for handling frame updates.

Parameters
_imageImage data
_widthImage width
_heightImage height
_depthImage depth
_formatImage format
void onRequest ( CameraUtilsRequestPtr _msg)
private

Callback function for handling incoming requests.

Parameters
_msgThe message

Member Data Documentation

rendering::CameraPtr camera
protected

Pointer to camera object.

std::unique_ptr<CameraUtilsPrivate> dataPtr
private

Class with private attributes.

unsigned int depth
protected

Image depth.

std::string extension
protected

Exported image extension.

std::string format
protected

Image format.

unsigned int height
protected

Image height.

event::ConnectionPtr newFrameConnection
private

Connects to new frame rendered event.

std::string next_file_name
private

File name for next capture.

std::string output_dir
private

Directory for saving output.

sensors::CameraSensorPtr parentSensor
protected

Pointer to camera sensor.

bool save_on_update {false}
private

Internal flag for saving on next update.

int saved_counter {0}
private

Saved frames counter.

unsigned int width
protected

Image width.


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