Mech-Eye API 2.2.1
API reference documentation for Mech-Eye 3D Laser Profiler
All Classes Functions Variables Typedefs Enumerations Enumerator Pages
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 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 in scan mode. There are two ways to retrieve profile data, by polling or callback. This function is only used for polling. The profile count in batch is not fixed, it is related to the scan rate and the rate of this function 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. The function only needs to be called when profile data needs to be retrieved through callback. This function must be called after connect but not after startAcquisition. If the laser profiler is in data acquisition status, stopAcquisition should be called before registering a different callback function.
 
ErrorStatus startAcquisition ()
 Enters the laser profiler into the data acquisition status, where it can accept trigger signals. This method must be called before triggerSoftware.
 
ErrorStatus stopAcquisition ()
 Exits the laser profiler from the data acquisition status, and then it can not accept trigger signals. If callback function is being executed when this function is called, this function will block until 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
 

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 retrieving result that contains information such as profile index, encoder value intensity image, and depth data. 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. The function only needs to be called when profile data needs to be retrieved through callback. This function must be called after connect but not after startAcquisition. If the laser profiler is in data acquisition status, stopAcquisition should be called before registering a different callback function.

Parameters
[in]funcThe function to be registered. When the count of the profile data that has been retrieved is equal to the scan line count set, the func 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 in scan mode. There are two ways to retrieve profile data, by polling or callback. This function is only used for polling. The profile count in batch is not fixed, it is related to the scan rate and the rate of this function 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.

◆ 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 data acquisition status, where it can accept trigger signals. This method must be called before triggerSoftware.

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 data acquisition status, and then it can not accept trigger signals. If callback function is being executed when this function is called, this function will block until 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

◆ ProfilerEvent

friend class ProfilerEvent
friend

Definition at line 284 of file Profiler.h.


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