: An interface for the phidget Interface kit board (1018).
An interface for the Phidgets Interface kit board (part number 1018) on wich it could be plugged either an Sharp IR adaptater board (phidget's part number : 1101),or a MaxBotix EZ-1 sonar (phidget's part number : 1118). The configuration file describe what is plugged to this board, and the geometry of the sensors on the robots. See the exemple below.
[PhidgetInterfaceKitProximitySensors] sensorLabel = FrontProximitySensors process_rate = 100 // Integer value in Hz (common to all sensors), default value is 50Hz. displayRecapitulativeInformations = true // default value = false. serialNumber = 12345 // The interface kit serial number (Integer value), default value is -1. sensor1 = SHARP-30cm // sharp InfraRed sensor 30cm range (string value). capital to convert raw data to range data (in meters). pose1_x = 0 // position on the robot (float value in meters) pose1_y = 0 pose1_z = 0.5 pose1_yaw = -45.0 // Angles in degrees (float value). pose1_pitch = 0 pose1_roll = 0 //... sensorn = EZ1 // Maxbotix Ultrasound sonar posen_x = 0 // ...
The maximum number of sensors on this board is 8. Sensor 1 is the first sensor. If you haven't plugged any sensor on an entry of the board, you haven't to specify anyithing about this sensor in the configuration file. The following table enumerate the different sensors supported by this class.
#include <mrpt/hwdrivers/CPhidgetInterfaceKitProximitySensors.h>

Public Types | |||
| enum | TSensorState { ssInitializing = 0, ssWorking, ssError } | ||
| The current state of the sensor. More... | |||
| typedef std::multimap < mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > | TListObservations | ||
| typedef std::pair < mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > | TListObsPair | ||
Public Member Functions | |||
| CPhidgetInterfaceKitProximitySensors () | |||
| Constructor. | |||
| virtual | ~CPhidgetInterfaceKitProximitySensors () | ||
| Destructor. | |||
| void | getObservation (mrpt::slam::CObservationRange &outObservation) | ||
| This method tries to get a set of range measurements from the IR sensors. | |||
| void | initialize () | ||
| Initialize the sensor according to the parameters previously read in the configuration file. | |||
| void | doProcess () | ||
| This method should be called periodically. | |||
| virtual const mrpt::hwdrivers::TSensorClassId * | GetRuntimeClass () const =0 | ||
| TSensorState | getState () const | ||
| The current state of the sensor. | |||
| double | getProcessRate () const | ||
| std::string | getSensorLabel () const | ||
| void | setSensorLabel (const std::string &sensorLabel) | ||
| void | loadConfig (const mrpt::utils::CConfigFileBase &configSource, const std::string §ion) | ||
Loads the generic settings common to any sensor (See CGenericSensor), then call to "loadConfig_sensorSpecific"
| |||
| void | getObservations (TListObservations &lstObjects) | ||
| Returns a list of enqueued objects, emptying it (thread-safe). | |||
| virtual void | setPathForExternalImages (const std::string &directory) | ||
| Set the path where to save off-rawlog image files (will be ignored in those sensors where this is not applicable). | |||
| void | setExternalImageFormat (const std::string &ext) | ||
| Set the extension ("jpg","gif","png",...) that determines the format of images saved externally The default is "jpg". | |||
| void | setExternalImageJPEGQuality (const unsigned int quality) | ||
| The quality of JPEG compression, when external images is enabled and the format is "jpg". | |||
| unsigned int | getExternalImageJPEGQuality () const | ||
Static Public Member Functions | |||
| static void | printf_debug (const char *frmt,...) | ||
| Sends a formated text to "debugOut" if not NULL, or to cout otherwise. | |||
| static void | registerClass (const TSensorClassId *pNewClass) | ||
| Register a class into the internal list of "CGenericSensor" descendents. | |||
| static CGenericSensor * | createSensor (const std::string &className) | ||
| Creates a sensor by a name of the class. | |||
| static CGenericSensorPtr | createSensorPtr (const std::string &className) | ||
| Just like createSensor, but returning a smart pointer to the newly created sensor object. | |||
Protected Member Functions | |||
| void | appendObservations (const std::vector< mrpt::utils::CSerializablePtr > &obj) | ||
| This method must be called by derived classes to enqueue a new observation in the list to be returned by getObservations. | |||
| void | appendObservation (const mrpt::utils::CSerializablePtr &obj) | ||
| Like appendObservations() but for just one observation. | |||
Protected Attributes | |||
| size_t | m_grab_decimation_counter | ||
| Used when "m_grab_decimation" is enabled. | |||
| TSensorState | m_state | ||
| std::string | m_path_for_external_images | ||
| The path where to save off-rawlog images: empty means save images embedded in the rawlog. | |||
| std::string | m_external_images_format | ||
| The extension ("jpg","gif","png",...) that determines the format of images saved externally. | |||
| unsigned int | m_external_images_jpeg_quality | ||
| For JPEG images, the quality (default=95%). | |||
Common settings to any sensor, loaded in "loadConfig" | |||
| double | m_process_rate | ||
| See CGenericSensor. | |||
| size_t | m_max_queue_len | ||
| See CGenericSensor. | |||
| size_t | m_grab_decimation | ||
| If set to N>=2, only 1 out of N observations will be saved to m_objList. | |||
| std::string | m_sensorLabel | ||
| See CGenericSensor. | |||
Private Member Functions | |||
| void | loadConfig_sensorSpecific (const mrpt::utils::CConfigFileBase &configSource, const std::string &iniSection) | ||
| Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes) See hwdrivers::CGPSInterface for the possible parameters. | |||
Private Attributes | |||
| std::vector< bool > | m_sensorIsPlugged | ||
| An 8 dimension vector of boolean value wich store the presence or abscence of a sensor on the phidget interface kit board. | |||
| std::vector< float > | m_minRange | ||
| The minimum range in meters, this field is automaticaly filled according to the sensor part number read in the configuration file. | |||
| std::vector< float > | m_maxRange | ||
| The maximum range in meters, this field is automaticaly filled according to the sensor part number read in the configuration file. | |||
| std::vector< SensorType > | m_sensorType | ||
| The sensor type. | |||
| std::vector< mrpt::math::CPose3D > | m_sensorPoses | ||
| The poses of the 8 sensors x[m] y[m] z[m] yaw[deg] pitch[deg] roll[deg]. | |||
| int | m_serialNumber | ||
| The board serial number read in the configuration file. | |||
| float | m_minOfMinRanges | ||
| float | m_maxOfMaxRanges | ||
| void * | m_carteInterfaceKit | ||
typedef std::multimap< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > mrpt::hwdrivers::CGenericSensor::TListObservations [inherited] |
Definition at line 84 of file CGenericSensor.h.
typedef std::pair< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > mrpt::hwdrivers::CGenericSensor::TListObsPair [inherited] |
Definition at line 85 of file CGenericSensor.h.
enum mrpt::hwdrivers::CGenericSensor::TSensorState [inherited] |
The current state of the sensor.
Definition at line 90 of file CGenericSensor.h.
| mrpt::hwdrivers::CPhidgetInterfaceKitProximitySensors::CPhidgetInterfaceKitProximitySensors | ( | ) |
Constructor.
| serialNumber | The board's serial number. Set -1 to choose the first available board |
| virtual mrpt::hwdrivers::CPhidgetInterfaceKitProximitySensors::~CPhidgetInterfaceKitProximitySensors | ( | ) | [virtual] |
Destructor.
| void mrpt::hwdrivers::CGenericSensor::appendObservation | ( | const mrpt::utils::CSerializablePtr & | obj | ) | [inline, protected, inherited] |
Like appendObservations() but for just one observation.
Definition at line 155 of file CGenericSensor.h.
| void mrpt::hwdrivers::CGenericSensor::appendObservations | ( | const std::vector< mrpt::utils::CSerializablePtr > & | obj | ) | [protected, inherited] |
This method must be called by derived classes to enqueue a new observation in the list to be returned by getObservations.
Passed objects must be created in dynamic memory and a smart pointer passed. Example of creation:
CObservationGPSPtr o = CObservationGPSPtr( new CObservationGPS() ); o-> .... // Set data appendObservation(o);
If several observations are passed at once in the vector, they'll be considered as a block regarding the grabbing decimation factor.
| static CGenericSensor* mrpt::hwdrivers::CGenericSensor::createSensor | ( | const std::string & | className | ) | [static, inherited] |
Creates a sensor by a name of the class.
Typically the user may want to create a smart pointer around the returned pointer, whis is made with:
CGenericSensorPtr sensor = CGenericSensorPtr( CGenericSensor::createSensor("XXX") );
| static CGenericSensorPtr mrpt::hwdrivers::CGenericSensor::createSensorPtr | ( | const std::string & | className | ) | [inline, static, inherited] |
Just like createSensor, but returning a smart pointer to the newly created sensor object.
Definition at line 188 of file CGenericSensor.h.
| void mrpt::hwdrivers::CPhidgetInterfaceKitProximitySensors::doProcess | ( | ) | [virtual] |
This method should be called periodically.
Period depend on the process_rate in the configuration file.
Implements mrpt::hwdrivers::CGenericSensor.
| unsigned int mrpt::hwdrivers::CGenericSensor::getExternalImageJPEGQuality | ( | ) | const [inline, inherited] |
Definition at line 241 of file CGenericSensor.h.
| void mrpt::hwdrivers::CPhidgetInterfaceKitProximitySensors::getObservation | ( | mrpt::slam::CObservationRange & | outObservation | ) |
This method tries to get a set of range measurements from the IR sensors.
| outThereIsObservation | Will be true if an observation was sucessfully received. |
| void mrpt::hwdrivers::CGenericSensor::getObservations | ( | TListObservations & | lstObjects | ) | [inherited] |
Returns a list of enqueued objects, emptying it (thread-safe).
The objects must be freed by the invoker.
| double mrpt::hwdrivers::CGenericSensor::getProcessRate | ( | ) | const [inline, inherited] |
Definition at line 100 of file CGenericSensor.h.
| virtual const mrpt::hwdrivers::TSensorClassId* mrpt::hwdrivers::CGenericSensor::GetRuntimeClass | ( | ) | const [pure virtual, inherited] |
| std::string mrpt::hwdrivers::CGenericSensor::getSensorLabel | ( | ) | const [inline, inherited] |
Definition at line 102 of file CGenericSensor.h.
| TSensorState mrpt::hwdrivers::CGenericSensor::getState | ( | ) | const [inline, inherited] |
The current state of the sensor.
Definition at line 98 of file CGenericSensor.h.
| void mrpt::hwdrivers::CPhidgetInterfaceKitProximitySensors::initialize | ( | ) | [virtual] |
Initialize the sensor according to the parameters previously read in the configuration file.
| throw | an exception if the board could not be found. |
| throw | an exception if the process rate can't be set on one of the board channel. |
Reimplemented from mrpt::hwdrivers::CGenericSensor.
| void mrpt::hwdrivers::CGenericSensor::loadConfig | ( | const mrpt::utils::CConfigFileBase & | configSource, |
| const std::string & | section | ||
| ) | [inherited] |
Loads the generic settings common to any sensor (See CGenericSensor), then call to "loadConfig_sensorSpecific"
| This | method throws an exception with a descriptive message if some critical parameter is missing or has an invalid value. |
| void mrpt::hwdrivers::CPhidgetInterfaceKitProximitySensors::loadConfig_sensorSpecific | ( | const mrpt::utils::CConfigFileBase & | configSource, |
| const std::string & | iniSection | ||
| ) | [private, virtual] |
Loads specific configuration for the device from a given source of configuration parameters, for example, an ".ini" file, loading from the section "[iniSection]" (see utils::CConfigFileBase and derived classes) See hwdrivers::CGPSInterface for the possible parameters.
Implements mrpt::hwdrivers::CGenericSensor.
| static void mrpt::utils::CDebugOutputCapable::printf_debug | ( | const char * | frmt, |
| ... | |||
| ) | [static, inherited] |
Sends a formated text to "debugOut" if not NULL, or to cout otherwise.
Referenced by mrpt::math::CLevenbergMarquardtTempl::execute().
| static void mrpt::hwdrivers::CGenericSensor::registerClass | ( | const TSensorClassId * | pNewClass | ) | [static, inherited] |
Register a class into the internal list of "CGenericSensor" descendents.
Used internally in the macros DEFINE_GENERIC_SENSOR, etc...
Can be used as "CGenericSensor::registerClass( SENSOR_CLASS_ID(CMySensor) );" if building custom sensors outside mrpt libraries in user code.
| void mrpt::hwdrivers::CGenericSensor::setExternalImageFormat | ( | const std::string & | ext | ) | [inline, inherited] |
Set the extension ("jpg","gif","png",...) that determines the format of images saved externally The default is "jpg".
Definition at line 233 of file CGenericSensor.h.
| void mrpt::hwdrivers::CGenericSensor::setExternalImageJPEGQuality | ( | const unsigned int | quality | ) | [inline, inherited] |
The quality of JPEG compression, when external images is enabled and the format is "jpg".
Definition at line 238 of file CGenericSensor.h.
| virtual void mrpt::hwdrivers::CGenericSensor::setPathForExternalImages | ( | const std::string & | directory | ) | [inline, virtual, inherited] |
Set the path where to save off-rawlog image files (will be ignored in those sensors where this is not applicable).
An empty string (the default value at construction) means to save images embedded in the rawlog, instead of on separate files.
| std::exception | If the directory doesn't exists and cannot be created. |
Reimplemented in mrpt::hwdrivers::CKinect, mrpt::hwdrivers::CCameraSensor, and mrpt::hwdrivers::CSwissRanger3DCamera.
Definition at line 225 of file CGenericSensor.h.
| void mrpt::hwdrivers::CGenericSensor::setSensorLabel | ( | const std::string & | sensorLabel | ) | [inline, inherited] |
Definition at line 103 of file CGenericSensor.h.
Definition at line 147 of file CPhidgetInterfaceKitProximitySensors.h.
std::string mrpt::hwdrivers::CGenericSensor::m_external_images_format [protected, inherited] |
The extension ("jpg","gif","png",...) that determines the format of images saved externally.
Definition at line 139 of file CGenericSensor.h.
unsigned int mrpt::hwdrivers::CGenericSensor::m_external_images_jpeg_quality [protected, inherited] |
For JPEG images, the quality (default=95%).
Definition at line 140 of file CGenericSensor.h.
size_t mrpt::hwdrivers::CGenericSensor::m_grab_decimation [protected, inherited] |
If set to N>=2, only 1 out of N observations will be saved to m_objList.
Definition at line 127 of file CGenericSensor.h.
size_t mrpt::hwdrivers::CGenericSensor::m_grab_decimation_counter [protected, inherited] |
Used when "m_grab_decimation" is enabled.
Definition at line 132 of file CGenericSensor.h.
size_t mrpt::hwdrivers::CGenericSensor::m_max_queue_len [protected, inherited] |
See CGenericSensor.
Definition at line 126 of file CGenericSensor.h.
Definition at line 145 of file CPhidgetInterfaceKitProximitySensors.h.
The maximum range in meters, this field is automaticaly filled according to the sensor part number read in the configuration file.
Size of this vector depend on the number of sensors described in the configuration file.
Definition at line 131 of file CPhidgetInterfaceKitProximitySensors.h.
Definition at line 144 of file CPhidgetInterfaceKitProximitySensors.h.
The minimum range in meters, this field is automaticaly filled according to the sensor part number read in the configuration file.
Size of this vector depend on the number of sensors described in the configuration file.
Definition at line 126 of file CPhidgetInterfaceKitProximitySensors.h.
std::string mrpt::hwdrivers::CGenericSensor::m_path_for_external_images [protected, inherited] |
The path where to save off-rawlog images: empty means save images embedded in the rawlog.
Definition at line 138 of file CGenericSensor.h.
double mrpt::hwdrivers::CGenericSensor::m_process_rate [protected, inherited] |
See CGenericSensor.
Definition at line 125 of file CGenericSensor.h.
std::vector<bool> mrpt::hwdrivers::CPhidgetInterfaceKitProximitySensors::m_sensorIsPlugged [private] |
An 8 dimension vector of boolean value wich store the presence or abscence of a sensor on the phidget interface kit board.
Definition at line 122 of file CPhidgetInterfaceKitProximitySensors.h.
std::string mrpt::hwdrivers::CGenericSensor::m_sensorLabel [protected, inherited] |
See CGenericSensor.
Definition at line 128 of file CGenericSensor.h.
std::vector<mrpt::math::CPose3D> mrpt::hwdrivers::CPhidgetInterfaceKitProximitySensors::m_sensorPoses [private] |
The poses of the 8 sensors x[m] y[m] z[m] yaw[deg] pitch[deg] roll[deg].
This field is automaticaly filled according to the sensor described in the configuration file.
Definition at line 139 of file CPhidgetInterfaceKitProximitySensors.h.
std::vector<SensorType> mrpt::hwdrivers::CPhidgetInterfaceKitProximitySensors::m_sensorType [private] |
The sensor type.
Definition at line 135 of file CPhidgetInterfaceKitProximitySensors.h.
The board serial number read in the configuration file.
-1 for any board.
Definition at line 143 of file CPhidgetInterfaceKitProximitySensors.h.
TSensorState mrpt::hwdrivers::CGenericSensor::m_state [protected, inherited] |
Definition at line 134 of file CGenericSensor.h.
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |