Regilo
A simple C++ library for controlling the Neato XV robot and the Hokuyo scanner.
regilo::HokuyoController< ProtocolController > Class Template Reference

The HokuyoController class is used to communicate with the Hokuyo scanner. More...

#include <hokuyocontroller.hpp>

Inheritance diagram for regilo::HokuyoController< ProtocolController >:
regilo::IHokuyoController regilo::ScanController< ProtocolController > regilo::IScanController regilo::IScanController regilo::IController regilo::IController

Public Member Functions

 HokuyoController ()
 Default constructor.
 
 HokuyoController (const std::string &logPath)
 Constructor with a log file specified by a path. More...
 
 HokuyoController (std::iostream &logStream)
 Constructor with a log specified by a stream. More...
 
virtual ~HokuyoController ()=default
 Default destructor.
 
virtual std::map< std::string, std::string > getVersionInfo () override
 Return information about the scanner version. More...
 
void setScanParameters (std::size_t fromStep, std::size_t toStep, std::size_t clusterCount)
 Set parameters for the scan command. More...
 
- Public Member Functions inherited from regilo::IHokuyoController
virtual ~IHokuyoController ()=default
 Default destructor.
 
- Public Member Functions inherited from regilo::IScanController
virtual ~IScanController ()=default
 Default destructor.
 
- Public Member Functions inherited from regilo::IController
virtual ~IController ()=default
 Default destructor.
 
virtual void connect (const std::string &endpoint)=0
 Connect the controller to a device. More...
 
virtual bool isConnected () const =0
 Test if the controller is connected. More...
 
virtual std::string getEndpoint () const =0
 Get the endpoint of device. More...
 
virtual std::shared_ptr< ILoggetLog ()=0
 Get the current Log. More...
 
virtual std::shared_ptr< const ILoggetLog () const =0
 Get the current Log (a const variant). More...
 
virtual void setLog (std::shared_ptr< ILog > log)=0
 Set a Log (it can be shared between more controllers). More...
 
virtual std::string sendCommand (const std::string &command)=0
 Send a command to the device. More...
 
- Public Member Functions inherited from regilo::ScanController< ProtocolController >
virtual ~ScanController ()=default
 Default destructor.
 
virtual ScanData getScan (bool fromDevice=true) override final
 Get a scan from the device. More...
 

Static Public Attributes

static std::string CMD_GET_VERSION = "V"
 A command for getting the scanner version.
 
static std::string CMD_GET_SCAN = "G%03d%03d%02d"
 A command for getting a scan.
 

Protected Member Functions

virtual std::string getScanCommand () const override
 Get a string that can be used for getting a scan. More...
 
virtual bool parseScanData (std::istream &in, ScanData &data) override
 Parse the raw scan data. More...
 

Additional Inherited Members

- Protected Attributes inherited from regilo::ScanController< ProtocolController >
std::size_t lastScanId = 0
 A scan id (starting from zero) that is used for new scans.
 

Detailed Description

template<typename ProtocolController>
class regilo::HokuyoController< ProtocolController >

The HokuyoController class is used to communicate with the Hokuyo scanner.

Constructor & Destructor Documentation

template<typename ProtocolController >
regilo::HokuyoController< ProtocolController >::HokuyoController ( const std::string &  logPath)

Constructor with a log file specified by a path.

Parameters
logPathPath to the log file.
template<typename ProtocolController >
regilo::HokuyoController< ProtocolController >::HokuyoController ( std::iostream &  logStream)

Constructor with a log specified by a stream.

Parameters
logStreamThe log stream.

Member Function Documentation

template<typename ProtocolController >
virtual std::string regilo::HokuyoController< ProtocolController >::getScanCommand ( ) const
inlineoverrideprotectedvirtual

Get a string that can be used for getting a scan.

Returns
A command for getting a scan.

Implements regilo::ScanController< ProtocolController >.

template<typename ProtocolController >
std::map< std::string, std::string > regilo::HokuyoController< ProtocolController >::getVersionInfo ( )
overridevirtual

Return information about the scanner version.

Returns
Key-value pairs with the information.

Implements regilo::IHokuyoController.

template<typename ProtocolController >
bool regilo::HokuyoController< ProtocolController >::parseScanData ( std::istream &  in,
ScanData data 
)
overrideprotectedvirtual

Parse the raw scan data.

Parameters
inThe input stream that stores the raw scan data.
dataOutput for the scanned data.
Returns
True if the parsing ends without an error.

Implements regilo::ScanController< ProtocolController >.

template<typename ProtocolController >
void regilo::HokuyoController< ProtocolController >::setScanParameters ( std::size_t  fromStep,
std::size_t  toStep,
std::size_t  clusterCount 
)

Set parameters for the scan command.

Parameters
fromStepThe starting step [0; maxStep].
toStepThe ending steop [0; maxStep].
clusterCountThe cluster count [0; 99].

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