libnifalcon  1.0.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
libnifalcon::FalconDeviceThread Class Reference

#include <FalconDeviceThread.h>

+ Inheritance diagram for libnifalcon::FalconDeviceThread:
+ Collaboration diagram for libnifalcon::FalconDeviceThread:

Public Member Functions

 FalconDeviceThread ()
 
virtual ~FalconDeviceThread ()
 
void startThread ()
 
virtual void runThreadLoop ()
 
void stopThread ()
 
bool isThreadRunning ()
 
void getPosition (std::array< double, 3 > &pos)
 
- Public Member Functions inherited from libnifalcon::FalconDevice
 FalconDevice ()
 
 ~FalconDevice ()
 
bool isFirmwareLoaded ()
 
bool setFirmwareFile (const std::string &filename)
 
bool loadFirmware (unsigned int retries, bool skip_checksum=false)
 
bool loadFirmware (bool skip_checksum)
 
bool getDeviceCount (unsigned int &count)
 
bool open (unsigned int index)
 
void close ()
 
bool runIOLoop (unsigned int exe_flags=(FALCON_LOOP_FIRMWARE|FALCON_LOOP_KINEMATIC|FALCON_LOOP_GRIP))
 
template<class T >
void setFalconComm ()
 
template<class T >
void setFalconFirmware ()
 
template<class T >
void setFalconGrip ()
 
template<class T >
void setFalconKinematic ()
 
std::array< double, 3 > getPosition ()
 
void setForce (std::array< double, 3 > force)
 
std::shared_ptr< FalconCommgetFalconComm ()
 
std::shared_ptr< FalconFirmwaregetFalconFirmware ()
 
std::shared_ptr< FalconGripgetFalconGrip ()
 
std::shared_ptr< FalconKinematicgetFalconKinematic ()
 
bool isOpen ()
 
unsigned int getErrorCount ()
 
- Public Member Functions inherited from libnifalcon::FalconCore
 FalconCore ()
 
virtual ~FalconCore ()
 
int getErrorCode ()
 

Protected Member Functions

void runDeviceComm ()
 

Protected Attributes

std::unique_ptr< std::thread > m_ioThread
 
std::array< double, 3 > m_localPosition
 
bool m_runThreadLoop
 
- Protected Attributes inherited from libnifalcon::FalconDevice
unsigned int m_errorCount
 
std::shared_ptr< FalconCommm_falconComm
 
std::shared_ptr< FalconKinematicm_falconKinematic
 
std::shared_ptr< FalconFirmwarem_falconFirmware
 
std::shared_ptr< FalconGripm_falconGrip
 
std::array< double, 3 > m_position
 
std::array< double, 3 > m_forceVec
 
- Protected Attributes inherited from libnifalcon::FalconCore
int m_errorCode
 

Additional Inherited Members

- Public Types inherited from libnifalcon::FalconDevice
enum  {
  FALCON_DEVICE_NO_COMM_SET = 1000, FALCON_DEVICE_NO_FIRMWARE_SET, FALCON_DEVICE_NO_KINEMATIC_SET, FALCON_DEVICE_NO_GRIP_SET,
  FALCON_DEVICE_NO_FIRMWARE_LOADED, FALCON_DEVICE_FIRMWARE_NOT_VALID, FALCON_DEVICE_FIRMWARE_CHECKSUM_MISMATCH
}
 
enum  { FALCON_LOOP_FIRMWARE = 0x1, FALCON_LOOP_KINEMATIC = 0x2, FALCON_LOOP_GRIP = 0x4 }
 

Detailed Description

The FalconDeviceThread class is a sample device that uses the std::thread class to run the communications loop to the falcon.

The FalconDeviceThread class is only available if the std::thread library is available on the system.

Constructor & Destructor Documentation

libnifalcon::FalconDeviceThread::FalconDeviceThread ( )

Constructor

libnifalcon::FalconDeviceThread::~FalconDeviceThread ( )
virtual

Destructor

Member Function Documentation

void libnifalcon::FalconDeviceThread::getPosition ( std::array< double, 3 > &  pos)

Thread safe position return

bool libnifalcon::FalconDeviceThread::isThreadRunning ( )
inline

Thread run status

Returns
True if running, false otherwise
void libnifalcon::FalconDeviceThread::runDeviceComm ( )
protected

Wrapper function for dealing with device communication

void libnifalcon::FalconDeviceThread::runThreadLoop ( )
virtual

Runs IO loop. Overridden to implement application specific functionality

void libnifalcon::FalconDeviceThread::startThread ( )

Starts a thread that runs FalconDevice::runIOLoop constantly

void libnifalcon::FalconDeviceThread::stopThread ( )

Stops thread if running

Member Data Documentation

std::unique_ptr<std::thread> libnifalcon::FalconDeviceThread::m_ioThread
protected

Internal thread object

std::array<double, 3> libnifalcon::FalconDeviceThread::m_localPosition
protected

Internal position storage

bool libnifalcon::FalconDeviceThread::m_runThreadLoop
protected

Internal thread execution state. Thread loop exits if this is false.


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