MRPT  2.0.1
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
mrpt::hwdrivers::CDUO3DCamera Class Reference

Detailed Description

This "software driver" implements the communication protocol for interfacing a DUO3D Stereo Camera.

See also the example configuration file for rawlog-grabber in "share/mrpt/config_files/rawlog-grabber".

PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
-------------------------------------------------------
[supplied_section_name]
image_width = 640 // [int] x Resolution
image_height = 480 // [int] y Resolution
fps = 30 // [int] Frames per second (<=30)
exposure = 50 // [int] Exposure value (1..100)
led = 0 // [int] Led intensity (only for some device models) (1..100).
gain = 50 // [int] Camera gain (1..100)
capture_rectified = false // [bool] Rectify captured images
capture_imu = true // [bool] Capture IMU data from DUO3D device (if available)
calibration_from_file = true // [bool] Use YML calibration files provided by calibration application supplied with DUO3D device
intrinsic_filename = "" // [string] Intrinsic parameters file. This filename should contain a substring _RWWWxHHH_ with WWW being the image width and HHH the image height, as provided by the calibration application.
extrinsic_filename = "" // [string] Extrinsic parameters file. This filename should contain a substring _RWWWxHHH_ with WWW being the image width and HHH the image height, as provided by the calibration application.
rectify_map_filename = "" // [string] Rectification map file. This filename should contain a substring _RWWWxHHH_ with WWW being the image width and HHH the image height, as provided by the calibration application.
pose_x=0.21 // camera 3D position in the robot (meters)
pose_y=0
pose_z=0.34
pose_yaw=0 // Angles in degrees
pose_pitch=0
pose_roll=0

Definition at line 153 of file CDUO3DCamera.h.

#include <mrpt/hwdrivers/CDUO3DCamera.h>

Public Member Functions

 CDUO3DCamera ()
 Default Constructor (does not open the camera) More...
 
 CDUO3DCamera (const TCaptureOptions_DUO3D &options)
 Constructor: tries to open the camera with the given options. More...
 
 CDUO3DCamera (const CDUO3DCamera &)=delete
 
CDUO3DCameraoperator= (const CDUO3DCamera &)=delete
 
virtual ~CDUO3DCamera ()
 Destructor. More...
 
const TCaptureOptions_DUO3DgetCameraOptions () const
 Returns the current settings of the camera. More...
 
void open (const TCaptureOptions_DUO3D &options, const bool startCapture=true)
 Tries to open the camera with the given options, and starts capturing. More...
 
void startCapture ()
 Start the actual data capture of the camera. More...
 
void stopCapture ()
 Stop capture. More...
 
void close ()
 Stop capture and closes the opened camera, if any. More...
 
void getObservations (mrpt::obs::CObservationStereoImages &outObservation_img, mrpt::obs::CObservationIMU &outObservation_imu, bool &there_is_img, bool &there_is_imu)
 Specific laser scanner "software drivers" must process here new data from the I/O stream, and, if a whole scan has arrived, return it. More...
 
bool captureIMUIsSet ()
 Indicates if the camera is grabbing IMU data. More...
 
void * getEvent ()
 Returned pointer to be reinterpreted as DUO3D's "HANDLE". More...
 
void setDataFrame (void *frame)
 frame is a reinterpreted PDUOFrame More...
 

Protected Member Functions

bool queryVersion (std::string version, bool printOutVersion=false)
 Queries the DUO3D Camera firmware version. More...
 
void * m_get_duo_frame ()
 Gets a stereo frame from the DUO3D Camera (void* to be reinterpreted as PDUOFrame) More...
 
bool m_open_duo_camera (int width, int height, float fps)
 Opens DUO3D camera. More...
 
void m_close_duo_camera ()
 Closes DUO3D camera. More...
 
void m_set_exposure (float value)
 Sets DUO3D camera Exposure setting. More...
 
void m_set_gain (float value)
 Sets DUO3D camera Gain setting. More...
 
void m_set_led (float value)
 Sets DUO3D camera LED setting. More...
 

Protected Attributes

TCaptureOptions_DUO3D m_options
 
mrpt::vision::CStereoRectifyMap m_rectify_map
 
void * m_duo {nullptr}
 Opaque pointer to DUO's DUOInstance. More...
 
void * m_pframe_data
 Pointer, to be reinterpreted as "PDUOFrame". More...
 
void * m_evFrame
 DUO's HANDLE. More...
 

Constructor & Destructor Documentation

◆ CDUO3DCamera() [1/3]

CDUO3DCamera::CDUO3DCamera ( )

Default Constructor (does not open the camera)

Default constructor.

Definition at line 294 of file CDUO3DCamera.cpp.

References m_duo, M_DUO_VALUE, m_evFrame, m_pframe_data, and THROW_EXCEPTION.

◆ CDUO3DCamera() [2/3]

CDUO3DCamera::CDUO3DCamera ( const TCaptureOptions_DUO3D options)

Constructor: tries to open the camera with the given options.

Custom initialization and start grabbing constructor.

Raises an exception on error.

See also
open()

Definition at line 310 of file CDUO3DCamera.cpp.

References m_duo, M_DUO_VALUE, m_evFrame, m_pframe_data, open(), and THROW_EXCEPTION.

Here is the call graph for this function:

◆ CDUO3DCamera() [3/3]

mrpt::hwdrivers::CDUO3DCamera::CDUO3DCamera ( const CDUO3DCamera )
delete

◆ ~CDUO3DCamera()

CDUO3DCamera::~CDUO3DCamera ( )
virtual

Destructor.

Definition at line 328 of file CDUO3DCamera.cpp.

References close(), m_duo, and M_DUO_PTR.

Here is the call graph for this function:

Member Function Documentation

◆ captureIMUIsSet()

bool mrpt::hwdrivers::CDUO3DCamera::captureIMUIsSet ( )
inline

Indicates if the camera is grabbing IMU data.

Definition at line 219 of file CDUO3DCamera.h.

References mrpt::hwdrivers::TCaptureOptions_DUO3D::m_capture_imu, and m_options.

◆ close()

void CDUO3DCamera::close ( )

Stop capture and closes the opened camera, if any.

Closes DUO camera.

Called automatically on object destruction.

Definition at line 549 of file CDUO3DCamera.cpp.

References M_DUO_VALUE.

Referenced by open(), and ~CDUO3DCamera().

Here is the caller graph for this function:

◆ getCameraOptions()

const TCaptureOptions_DUO3D& mrpt::hwdrivers::CDUO3DCamera::getCameraOptions ( ) const
inline

Returns the current settings of the camera.

Definition at line 185 of file CDUO3DCamera.h.

References m_options.

◆ getEvent()

void* mrpt::hwdrivers::CDUO3DCamera::getEvent ( )
inline

Returned pointer to be reinterpreted as DUO3D's "HANDLE".

Definition at line 221 of file CDUO3DCamera.h.

References m_evFrame.

◆ getObservations()

void CDUO3DCamera::getObservations ( mrpt::obs::CObservationStereoImages outObservation_img,
mrpt::obs::CObservationIMU outObservation_imu,
bool &  there_is_img,
bool &  there_is_imu 
)

Specific laser scanner "software drivers" must process here new data from the I/O stream, and, if a whole scan has arrived, return it.

This method will be typically called in a different thread than other methods, and will be called in a timely fashion.

Definition at line 485 of file CDUO3DCamera.cpp.

References mrpt::obs::CObservationIMU::dataIsPresent, mrpt::obs::CObservationStereoImages::imageLeft, mrpt::obs::CObservationStereoImages::imageRight, mrpt::img::CImage::loadFromMemoryBuffer(), mrpt::hwdrivers::TCaptureOptions_DUO3D::m_capture_imu, mrpt::hwdrivers::TCaptureOptions_DUO3D::m_capture_rectified, m_get_duo_frame(), mrpt::hwdrivers::TCaptureOptions_DUO3D::m_img_height, mrpt::hwdrivers::TCaptureOptions_DUO3D::m_img_width, m_options, m_pframe_data, m_rectify_map, mrpt::hwdrivers::TCaptureOptions_DUO3D::m_stereo_camera, mrpt::system::now(), mrpt::obs::CObservationIMU::rawMeasurements, mrpt::vision::CStereoRectifyMap::rectify(), mrpt::obs::CObservationStereoImages::setStereoCameraParams(), and mrpt::obs::CObservation::timestamp.

Here is the call graph for this function:

◆ m_close_duo_camera()

void mrpt::hwdrivers::CDUO3DCamera::m_close_duo_camera ( )
protected

Closes DUO3D camera.

◆ m_get_duo_frame()

void * CDUO3DCamera::m_get_duo_frame ( )
protected

Gets a stereo frame from the DUO3D Camera (void* to be reinterpreted as PDUOFrame)

Definition at line 560 of file CDUO3DCamera.cpp.

References M_DUO_VALUE, m_evFrame, and m_pframe_data.

Referenced by getObservations().

Here is the caller graph for this function:

◆ m_open_duo_camera()

bool mrpt::hwdrivers::CDUO3DCamera::m_open_duo_camera ( int  width,
int  height,
float  fps 
)
protected

Opens DUO3D camera.

◆ m_set_exposure()

void CDUO3DCamera::m_set_exposure ( float  value)
protected

Sets DUO3D camera Exposure setting.

Definition at line 573 of file CDUO3DCamera.cpp.

References M_DUO_VALUE.

◆ m_set_gain()

void CDUO3DCamera::m_set_gain ( float  value)
protected

Sets DUO3D camera Gain setting.

Definition at line 581 of file CDUO3DCamera.cpp.

References M_DUO_VALUE.

◆ m_set_led()

void CDUO3DCamera::m_set_led ( float  value)
protected

Sets DUO3D camera LED setting.

Definition at line 589 of file CDUO3DCamera.cpp.

References M_DUO_VALUE.

◆ open()

void CDUO3DCamera::open ( const TCaptureOptions_DUO3D options,
const bool  startCapture = true 
)

Tries to open the camera with the given options, and starts capturing.

Tries to open the camera with the given options.

Raises an exception on error.

Parameters
[in]startCaptureIf set to false, the camera is only opened and configured, but a posterior call to startCapture() is required to start grabbing data.
See also
close(), startCapture()

Raises an exception on error.

See also
close()

Definition at line 342 of file CDUO3DCamera.cpp.

References close(), duo_params, mrpt::hwdrivers::TCaptureOptions_DUO3D::m_calibration_from_file, mrpt::hwdrivers::TCaptureOptions_DUO3D::m_camera_ext_params_from_yml(), mrpt::hwdrivers::TCaptureOptions_DUO3D::m_camera_int_params_from_yml(), mrpt::hwdrivers::TCaptureOptions_DUO3D::m_capture_rectified, M_DUO_VALUE, mrpt::hwdrivers::TCaptureOptions_DUO3D::m_exposure, mrpt::hwdrivers::TCaptureOptions_DUO3D::m_gain, mrpt::hwdrivers::TCaptureOptions_DUO3D::m_img_height, mrpt::hwdrivers::TCaptureOptions_DUO3D::m_img_width, mrpt::hwdrivers::TCaptureOptions_DUO3D::m_led, m_options, m_rectify_map, mrpt::hwdrivers::TCaptureOptions_DUO3D::m_rectify_map_filename, mrpt::hwdrivers::TCaptureOptions_DUO3D::m_rectify_map_from_yml(), TDUOParams::m_rectify_map_left_x, TDUOParams::m_rectify_map_left_y, TDUOParams::m_rectify_map_right_x, TDUOParams::m_rectify_map_right_y, mrpt::hwdrivers::TCaptureOptions_DUO3D::m_stereo_camera, mrpt::vision::CStereoRectifyMap::setFromCamParams(), startCapture(), THROW_EXCEPTION, mrpt::hwdrivers::TCaptureOptions_DUO3D::yrr_EMPTY, mrpt::hwdrivers::TCaptureOptions_DUO3D::yrr_NAME_NON_CONSISTENT, and mrpt::hwdrivers::TCaptureOptions_DUO3D::yrr_OK.

Referenced by CDUO3DCamera().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

CDUO3DCamera& mrpt::hwdrivers::CDUO3DCamera::operator= ( const CDUO3DCamera )
delete

◆ queryVersion()

bool CDUO3DCamera::queryVersion ( std::string  version,
bool  printOutVersion = false 
)
protected

Queries the DUO3D Camera firmware version.

Definition at line 598 of file CDUO3DCamera.cpp.

◆ setDataFrame()

void mrpt::hwdrivers::CDUO3DCamera::setDataFrame ( void *  frame)
inline

frame is a reinterpreted PDUOFrame

Definition at line 223 of file CDUO3DCamera.h.

◆ startCapture()

void mrpt::hwdrivers::CDUO3DCamera::startCapture ( )

Start the actual data capture of the camera.

Must be called after open(), only when "startCapture" was set to false.

Referenced by open().

Here is the caller graph for this function:

◆ stopCapture()

void mrpt::hwdrivers::CDUO3DCamera::stopCapture ( )

Stop capture.

Member Data Documentation

◆ m_duo

void* mrpt::hwdrivers::CDUO3DCamera::m_duo {nullptr}
protected

Opaque pointer to DUO's DUOInstance.

Definition at line 164 of file CDUO3DCamera.h.

Referenced by CDUO3DCamera(), and ~CDUO3DCamera().

◆ m_evFrame

void* mrpt::hwdrivers::CDUO3DCamera::m_evFrame
protected

DUO's HANDLE.

Definition at line 168 of file CDUO3DCamera.h.

Referenced by CDUO3DCamera(), getEvent(), and m_get_duo_frame().

◆ m_options

TCaptureOptions_DUO3D mrpt::hwdrivers::CDUO3DCamera::m_options
protected

Definition at line 158 of file CDUO3DCamera.h.

Referenced by captureIMUIsSet(), getCameraOptions(), getObservations(), and open().

◆ m_pframe_data

void* mrpt::hwdrivers::CDUO3DCamera::m_pframe_data
protected

Pointer, to be reinterpreted as "PDUOFrame".

Definition at line 166 of file CDUO3DCamera.h.

Referenced by CDUO3DCamera(), getObservations(), and m_get_duo_frame().

◆ m_rectify_map

mrpt::vision::CStereoRectifyMap mrpt::hwdrivers::CDUO3DCamera::m_rectify_map
protected

Definition at line 161 of file CDUO3DCamera.h.

Referenced by getObservations(), and open().




Page generated by Doxygen 1.8.14 for MRPT 2.0.1 Git: 0fef1a6d7 Fri Apr 3 23:00:21 2020 +0200 at vie abr 3 23:20:28 CEST 2020