Mech-Eye API 2.3.3
API reference documentation for Mech-Eye 3D Laser Profiler
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Friends | List of all members
mmind::eye::Profiler Class Reference

Operates the laser profiler. Use Profiler::connect to connect an available laser profiler, retrieve profile data, configure parameters and so on. More...

#include <Profiler.h>

Public Types

using AcquisitionCallback = std::function<void(const ProfileBatch& batch, void* pUser)>
 The type of callback function.
 

Public Member Functions

 Profiler ()
 Constructor.
 
 ~Profiler ()
 Destructor.
 
 Profiler (const Profiler &other) noexcept
 Copy constructor.
 
Profileroperator= (const Profiler &other) noexcept
 Copy assignment.
 
ErrorStatus connect (const ProfilerInfo &info, unsigned int timeoutMs=5000)
 Connects to a laser profiler via ProfilerInfo.
 
ErrorStatus saveVirtualDeviceFile (const ProfileBatch &data, const std::string &filePath)
 Saves the acquired ProfileBatch data collected, Parameter s, and ProfilerInfo in an MRAW format file that can be loaded as a VirtualProfiler.
 
ErrorStatus connect (const std::string &ipAddress, unsigned int timeoutMs=5000)
 Connects to a laser profiler via IP address.
 
ErrorStatus disconnect ()
 Disconnects from the current laser profiler and releases the associated resources.
 
ErrorStatus setHeartbeatInterval (unsigned int intervalMs)
 Sets the time interval at which the client sends periodic heartbeat messages to the profiler side. The default time interval is 10s.
 
ErrorStatus getProfilerInfo (ProfilerInfo &info) const
 Gets the basic information of the laser profiler, such as model, serial number, firmware version, and IP setting, etc.
 
UserSetManageruserSetManager ()
 Gets the UserSetManager of the laser profiler. UserSetManager provides various operations to manage all user set saved in the laser profiler, including adding and deleting the user set and selecting the user set currently in effect. It is also available to save all user set details to a json file and read a json file to load user set details.
 
UserSetcurrentUserSet ()
 Gets the UserSet currently in effect of the laser profiler. UserSet can access all available parameters of the laser profiler related to profile data acquisition. UserSet can also directly set and get parameters instead of using Parameter interface.
 
ErrorStatus retrieveBatchData (ProfileBatch &batch, int timeoutMs=4000) const
 Retrieves a batch of the profiles. There are two ways to retrieve profile data, by polling or callback. This method is only used with the polling method. The number of profiles contained in a batch varies depending on the scan rate and the rate at which this method is called.
 
ErrorStatus triggerSoftware ()
 Sends a software signal to trigger data acquisition. This method is used when no external signals are input to trigger data acquisition and must be called after startAcquisition.
 
ErrorStatus registerAcquisitionCallback (const Profiler::AcquisitionCallback &func, void *pUser)
 Registers the callback function for data acquisition. There are two ways to retrieve profile data, by polling or callback. This method is only used with the callback method. This method must be called after connect and before startAcquisition. If the laser profiler is in acquisition ready status, stopAcquisition should be called before registering a different callback function.
 
ErrorStatus startAcquisition ()
 Enters the laser profiler into the acquisition ready status, where it can accept trigger signals for scanning.
 
ErrorStatus stopAcquisition ()
 Exits the laser profiler from the acquisition ready status to avoid accidental triggering of scanning. If a callback function is being executed when this method is called, this method is not executed until the execution of the callback function is finished.
 
ErrorStatus setOutputForGPIO (OutputLineGPIO outputLine, OutputLevel value)
 Sets controller GPIO output value.
 
ErrorStatus getAcquisitionStatus (AcquisitionStatus &status)
 Gets the acquisition status.
 

Static Public Member Functions

static std::vector< ProfilerInfodiscoverProfilers ()
 Discovers all available laser profilers, and returns the laser profiler information list. If a laser profiler is not successfully discovered, check the running status and network connection of the laser profiler.
 

Friends

class ProfilerEvent
 
class InternalInterfaces
 

Detailed Description

Operates the laser profiler. Use Profiler::connect to connect an available laser profiler, retrieve profile data, configure parameters and so on.

Definition at line 50 of file Profiler.h.

Member Typedef Documentation

◆ AcquisitionCallback

using mmind::eye::Profiler::AcquisitionCallback = std::function<void(const ProfileBatch& batch, void* pUser)>

The type of callback function.

Parameters
[out]batchThe retrieved data of multiple profiles. See ProfileBatch for details.
[out]pUserThe user data pointer.

Definition at line 59 of file Profiler.h.

Member Function Documentation

◆ connect() [1/2]

ErrorStatus mmind::eye::Profiler::connect ( const ProfilerInfo & info,
unsigned int timeoutMs = 5000 )

Connects to a laser profiler via ProfilerInfo.

Parameters
[in]infoLaser profiler information. Use Profiler::discoverProfilers to find all available laser profilers.
[in]timeoutMsThe timeout for connecting a laser profiler(ms). If the execution time of the connecting process is greater than the timeout, the function will immediately return ErrorStatus::MMIND_STATUS_TIMEOUT_ERROR.
Returns
ErrorStatus::MMIND_STATUS_SUCCESS Success.
ErrorStatus::MMIND_STATUS_INVALID_INPUT_ERROR IP address format error.
ErrorStatus::MMIND_STATUS_INVALID_DEVICE IP address not corresponding to an available device.
ErrorStatus::MMIND_STATUS_NO_SUPPORT_ERROR Laser profiler model or firmware version not supported.
ErrorStatus::MMIND_STATUS_TIMEOUT_ERROR Timeout error.

◆ connect() [2/2]

ErrorStatus mmind::eye::Profiler::connect ( const std::string & ipAddress,
unsigned int timeoutMs = 5000 )

Connects to a laser profiler via IP address.

Parameters
[in]ipAddressValid IP address of the laser profiler, e.g. in "100.100.1.1" format.
[in]timeoutMsThe timeout for connecting a laser profiler (ms). If the execution time of the connecting process is greater than the timeout, the function will immediately return ErrorStatus::MMIND_STATUS_TIMEOUT_ERROR.
Returns
ErrorStatus::MMIND_STATUS_SUCCESS Success.
ErrorStatus::MMIND_STATUS_INVALID_INPUT_ERROR IP address format error.
ErrorStatus::MMIND_STATUS_INVALID_DEVICE IP address not corresponding to an available device.
ErrorStatus::MMIND_STATUS_NO_SUPPORT_ERROR Laser profiler model or firmware version not supported.
ErrorStatus::MMIND_STATUS_TIMEOUT_ERROR Timeout error.

◆ currentUserSet()

UserSet & mmind::eye::Profiler::currentUserSet ( )

Gets the UserSet currently in effect of the laser profiler. UserSet can access all available parameters of the laser profiler related to profile data acquisition. UserSet can also directly set and get parameters instead of using Parameter interface.

Returns
See UserSet for details.

◆ disconnect()

ErrorStatus mmind::eye::Profiler::disconnect ( )

Disconnects from the current laser profiler and releases the associated resources.

Returns
ErrorStatus::MMIND_STATUS_SUCCESS Success.
ErrorStatus::MMIND_STATUS_INVALID_DEVICE Invalid laser profiler handle.
ErrorStatus::MMIND_STATUS_RESPONSE_PARSE_ERROR Parse Response error.
ErrorStatus::MMIND_STATUS_REPLY_WITH_ERROR There are errors in reply.
ErrorStatus::MMIND_STATUS_DEVICE_OFFLINE Laser profiler disconnected.
ErrorStatus::MMIND_STATUS_TIMEOUT_ERROR Timeout error.

◆ discoverProfilers()

static std::vector< ProfilerInfo > mmind::eye::Profiler::discoverProfilers ( )
static

Discovers all available laser profilers, and returns the laser profiler information list. If a laser profiler is not successfully discovered, check the running status and network connection of the laser profiler.

Returns
The available laser profiler information list.

◆ getAcquisitionStatus()

ErrorStatus mmind::eye::Profiler::getAcquisitionStatus ( AcquisitionStatus & status)

Gets the acquisition status.

Returns
ErrorStatus::MMIND_STATUS_SUCCESS Success.
ErrorStatus::MMIND_STATUS_INVALID_DEVICE Invalid laser profiler handle.
ErrorStatus::MMIND_STATUS_DEVICE_OFFLINE Laser profiler disconnected.
ErrorStatus::MMIND_STATUS_TIMEOUT_ERROR Timeout error.
ErrorStatus::MMIND_STATUS_RESPONSE_PARSE_ERROR Parse response error.
ErrorStatus.MMIND_STATUS_REPLY_WITH_ERROR: There are errors in reply.

◆ getProfilerInfo()

ErrorStatus mmind::eye::Profiler::getProfilerInfo ( ProfilerInfo & info) const

Gets the basic information of the laser profiler, such as model, serial number, firmware version, and IP setting, etc.

Parameters
[out]SeeProfilerInfo for details.
Returns
ErrorStatus::MMIND_STATUS_SUCCESS Success.
ErrorStatus::MMIND_STATUS_INVALID_DEVICE Invalid laser profiler handle.
ErrorStatus::MMIND_STATUS_DEVICE_OFFLINE Laser profiler disconnected.
ErrorStatus::MMIND_STATUS_TIMEOUT_ERROR Timeout error.

◆ registerAcquisitionCallback()

ErrorStatus mmind::eye::Profiler::registerAcquisitionCallback ( const Profiler::AcquisitionCallback & func,
void * pUser )

Registers the callback function for data acquisition. There are two ways to retrieve profile data, by polling or callback. This method is only used with the callback method. This method must be called after connect and before startAcquisition. If the laser profiler is in acquisition ready status, stopAcquisition should be called before registering a different callback function.

Parameters
[in]funcThe callback function to be registered. When the number of retrieved profiles equals to the set value of ScanLineCount, the callback function will be executed. See AcquisitionCallback for details.
[out]pUserThe user data pointer.
Returns
ErrorStatus::MMIND_STATUS_SUCCESS Success.
ErrorStatus::MMIND_STATUS_INVALID_DEVICE Invalid laser profiler handle.
ErrorStatus::MMIND_STATUS_INVALID_CALLBACKFUNC Invalid callback function.
ErrorStatus::MMIND_STATUS_DEVICE_BUSY The callback function registration is executed again before data acquisition is stopped.

◆ retrieveBatchData()

ErrorStatus mmind::eye::Profiler::retrieveBatchData ( ProfileBatch & batch,
int timeoutMs = 4000 ) const

Retrieves a batch of the profiles. There are two ways to retrieve profile data, by polling or callback. This method is only used with the polling method. The number of profiles contained in a batch varies depending on the scan rate and the rate at which this method is called.

Parameters
[out]batchThe retrieving result, it contains information including profile index, encoder value intensity image, and depth data. See ProfileBatch for details.
[in]timeoutMsThe timeout for capturing in milliseconds. If the execution time of the capturing process is greater than the timeout, the function will immediately return ErrorStatus::MMIND_STATUS_TIMEOUT_ERROR.
Returns
ErrorStatus::MMIND_STATUS_SUCCESS Success.
ErrorStatus::MMIND_STATUS_INVALID_DEVICE Invalid laser profiler handle.
ErrorStatus::MMIND_STATUS_DEVICE_OFFLINE Laser profiler disconnected.
ErrorStatus::MMIND_STATUS_NO_DATA_ERROR No profile data obtained. Some error may have occurred on the laser profiler.
ErrorStatus::MMIND_STATUS_TIMEOUT_ERROR Timeout error.
ErrorStatus::MMIND_STATUS_ACQUISITION_TRIGGER_WAIT Acquisition not started or stopped.

◆ saveVirtualDeviceFile()

ErrorStatus mmind::eye::Profiler::saveVirtualDeviceFile ( const ProfileBatch & data,
const std::string & filePath )

Saves the acquired ProfileBatch data collected, Parameter s, and ProfilerInfo in an MRAW format file that can be loaded as a VirtualProfiler.

Parameters
dataThe acquired ProfileBatch data to be saved.
filePathThe path where the MRAW file will be saved.
Returns
ErrorStatus::MMIND_STATUS_SUCCESS Success.
ErrorStatus::MMIND_STATUS_INVALID_DEVICE Invalid laser profiler handle.
ErrorStatus::MMIND_STATUS_DEVICE_OFFLINE Laser profiler disconnected.
ErrorStatus::MMIND_STATUS_TIMEOUT_ERROR Timeout error.
ErrorStatus::MMIND_STATUS_RESPONSE_PARSE_ERROR Parse response error.
ErrorStatus::MMIND_STATUS_REPLY_WITH_ERROR There are errors in reply.
ErrorStatus::MMIND_STATUS_FILE_IO_ERROR Fails to save the virtual data.

◆ setHeartbeatInterval()

ErrorStatus mmind::eye::Profiler::setHeartbeatInterval ( unsigned int intervalMs)

Sets the time interval at which the client sends periodic heartbeat messages to the profiler side. The default time interval is 10s.

Parameters
[in]timeIntervalMsThe time interval for periodic sending heartbeat messages in milliseconds. The valid setting range is from 1s to 3600s.
Returns
ErrorStatus::MMIND_STATUS_SUCCESS Success.
ErrorStatus::MMIND_STATUS_INVALID_DEVICE Invalid profiler handle.
ErrorStatus::MMIND_STATUS_DEVICE_OFFLINE Profiler disconnected.
ErrorStatus::MMIND_STATUS_OUT_OF_RANGE_ERROR Invalid parameter input.

◆ setOutputForGPIO()

ErrorStatus mmind::eye::Profiler::setOutputForGPIO ( OutputLineGPIO outputLine,
OutputLevel value )

Sets controller GPIO output value.

Returns
ErrorStatus::MMIND_STATUS_SUCCESS Success.
ErrorStatus::MMIND_STATUS_INVALID_DEVICE Invalid laser profiler handle.
ErrorStatus::MMIND_STATUS_DEVICE_OFFLINE Laser profiler disconnected.
ErrorStatus::MMIND_STATUS_TIMEOUT_ERROR Timeout error.
ErrorStatus::MMIND_STATUS_RESPONSE_PARSE_ERROR Parse response error.
ErrorStatus::MMIND_STATUS_REPLY_WITH_ERROR There are errors in reply.

◆ startAcquisition()

ErrorStatus mmind::eye::Profiler::startAcquisition ( )

Enters the laser profiler into the acquisition ready status, where it can accept trigger signals for scanning.

Returns
ErrorStatus::MMIND_STATUS_SUCCESS Success.
ErrorStatus::MMIND_STATUS_INVALID_DEVICE Invalid laser profiler handle.
ErrorStatus::MMIND_STATUS_DEVICE_OFFLINE Laser profiler disconnected.
ErrorStatus::MMIND_STATUS_TIMEOUT_ERROR Timeout error.
ErrorStatus::MMIND_STATUS_RESPONSE_PARSE_ERROR Parse response error.
ErrorStatus::MMIND_STATUS_REPLY_WITH_ERROR There are errors in reply.

◆ stopAcquisition()

ErrorStatus mmind::eye::Profiler::stopAcquisition ( )

Exits the laser profiler from the acquisition ready status to avoid accidental triggering of scanning. If a callback function is being executed when this method is called, this method is not executed until the execution of the callback function is finished.

Returns
ErrorStatus::MMIND_STATUS_SUCCESS Success.
ErrorStatus::MMIND_STATUS_INVALID_DEVICE Invalid laser profiler handle.
ErrorStatus::MMIND_STATUS_DEVICE_OFFLINE Laser profiler disconnected.
ErrorStatus::MMIND_STATUS_TIMEOUT_ERROR Timeout error.
ErrorStatus::MMIND_STATUS_RESPONSE_PARSE_ERROR Parse response error.
ErrorStatus::MMIND_STATUS_REPLY_WITH_ERROR There are errors in reply.

◆ triggerSoftware()

ErrorStatus mmind::eye::Profiler::triggerSoftware ( )

Sends a software signal to trigger data acquisition. This method is used when no external signals are input to trigger data acquisition and must be called after startAcquisition.

Returns
ErrorStatus::MMIND_STATUS_SUCCESS Success.
ErrorStatus::MMIND_STATUS_INVALID_DEVICE Invalid laser profiler handle.
ErrorStatus::MMIND_STATUS_DEVICE_OFFLINE Laser profiler disconnected.
ErrorStatus::MMIND_STATUS_TIMEOUT_ERROR Timeout error.
ErrorStatus::MMIND_STATUS_RESPONSE_PARSE_ERROR Parse response error.
ErrorStatus::MMIND_STATUS_REPLY_WITH_ERROR There are errors in reply.

◆ userSetManager()

UserSetManager & mmind::eye::Profiler::userSetManager ( )

Gets the UserSetManager of the laser profiler. UserSetManager provides various operations to manage all user set saved in the laser profiler, including adding and deleting the user set and selecting the user set currently in effect. It is also available to save all user set details to a json file and read a json file to load user set details.

Returns
See UserSetManager for details.

Friends And Related Symbol Documentation

◆ InternalInterfaces

friend class InternalInterfaces
friend

Definition at line 303 of file Profiler.h.

◆ ProfilerEvent

friend class ProfilerEvent
friend

Definition at line 302 of file Profiler.h.


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