#include <FalconDevice.h>
Inherits libnifalcon::FalconCore.
Inherited by libnifalcon::FalconDeviceBoostThread.

Public Types | |
| 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 } |
Public Member Functions | |
| 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 () |
| boost::array< double, 3 > | getPosition () |
| void | setForce (boost::array< double, 3 > force) |
| boost::shared_ptr< FalconComm > | getFalconComm () |
| boost::shared_ptr< FalconFirmware > | getFalconFirmware () |
| boost::shared_ptr< FalconGrip > | getFalconGrip () |
| boost::shared_ptr < FalconKinematic > | getFalconKinematic () |
| bool | isOpen () |
| unsigned int | getErrorCount () |
Protected Attributes | |
| unsigned int | m_errorCount |
| boost::shared_ptr< FalconComm > | m_falconComm |
| boost::shared_ptr < FalconKinematic > | m_falconKinematic |
| boost::shared_ptr< FalconFirmware > | m_falconFirmware |
| boost::shared_ptr< FalconGrip > | m_falconGrip |
| boost::array< double, 3 > | m_position |
| boost::array< double, 3 > | m_forceVec |
Private Member Functions | |
| DECLARE_LOGGER () | |
Once these behaviors are established, FalconDevice can be used to get/set common parameters (end effector position, force generation, LED status, button/grip status, etc...) without have to refer to the specific behavior class.
The most common use of libnifalcon will look something like
All of the above functions can be achieved through using the FalconDevice object.
| anonymous enum |
| anonymous enum |
| libnifalcon::FalconDevice::FalconDevice | ( | ) |
Constructor
Sets the falcon communications device to the default for the system (FTD2XX for windows, libusb-1.0 for anything else)
| libnifalcon::FalconDevice::~FalconDevice | ( | ) |
Destructor
| void libnifalcon::FalconDevice::close | ( | ) |
Closes the falcon, if open
| libnifalcon::FalconDevice::DECLARE_LOGGER | ( | ) | [private] |
| bool libnifalcon::FalconDevice::getDeviceCount | ( | unsigned int & | count | ) |
Returns the number of falcons currectly connected to the system
| count | Reference to return to |
| unsigned int libnifalcon::FalconDevice::getErrorCount | ( | ) | [inline] |
Get the number of total errors generated by the I/O loop
| boost::shared_ptr<FalconComm> libnifalcon::FalconDevice::getFalconComm | ( | ) | [inline] |
Get communication behavior object pointer
| boost::shared_ptr<FalconFirmware> libnifalcon::FalconDevice::getFalconFirmware | ( | ) | [inline] |
Get firmware behavior object pointer
| boost::shared_ptr<FalconGrip> libnifalcon::FalconDevice::getFalconGrip | ( | ) | [inline] |
Get grip behavior object pointer
| boost::shared_ptr<FalconKinematic> libnifalcon::FalconDevice::getFalconKinematic | ( | ) | [inline] |
Get kinematic behavior object pointer
| boost::array<double, 3> libnifalcon::FalconDevice::getPosition | ( | ) | [inline] |
Return the position given by the kinematic behavior.
| bool libnifalcon::FalconDevice::isFirmwareLoaded | ( | ) |
Checks to see if firmware is loaded by running IO loop 10 times, returning true on first success Will automatically return false is setFalconFirmware() has not been called.
| bool libnifalcon::FalconDevice::isOpen | ( | ) | [inline] |
Checks whether the falcon communications are open
| bool libnifalcon::FalconDevice::loadFirmware | ( | bool | skip_checksum | ) |
Tries to load the firmware that was specified by the setFirmwareFile function. For the moment, skip_checksum should be used on non-windows platforms when using the ftd2xx communications core, as there is a bug that causes bad checksum returns on otherwise proper firmware loading events
| skip_checksum | Whether or not to skip checksum tests when loading firmware (useful with ftd2xx on non-windows platforms) |
| bool libnifalcon::FalconDevice::loadFirmware | ( | unsigned int | retries, | |
| bool | skip_checksum = false | |||
| ) |
Conveinence function, calls loadFirmware with a certain number of retries
| retries | Number of times to retry loading firmware before quitting | |
| skip_checksum | Whether or not to skip checksum tests when loading firmware (useful with ftd2xx on non-windows platforms) |
| bool libnifalcon::FalconDevice::open | ( | unsigned int | index | ) |
Opens the falcon at the specified index
| index | Index of falcon to open (starts at 0) |
| bool libnifalcon::FalconDevice::runIOLoop | ( | unsigned int | exe_flags = (FALCON_LOOP_FIRMWARE | FALCON_LOOP_KINEMATIC | FALCON_LOOP_GRIP) |
) |
Runs one iteration of the IO Loop, with the following logic
| void libnifalcon::FalconDevice::setFalconComm | ( | ) | [inline] |
Set communications behavior type, and create a new internal object from it. Also passes new comm object to firmware behavior, if it exists.
Template should be a subclass of FalconComm
| void libnifalcon::FalconDevice::setFalconFirmware | ( | ) | [inline] |
Set firmware behavior type, and create a new internal object from it. Also passes communications behavior to firmware, if it exists.
Template should be a subclass of FalconFirmware
| void libnifalcon::FalconDevice::setFalconGrip | ( | ) | [inline] |
Set grip behavior, and create a new internal object from it.
Template should be a subclass of FalconGrip
| void libnifalcon::FalconDevice::setFalconKinematic | ( | ) | [inline] |
Set communications behavior, and create a new internal object from it.
Template should be a subclass of FalconKinematic
| bool libnifalcon::FalconDevice::setFirmwareFile | ( | const std::string & | filename | ) |
Sets the firmware file to load to the falcon
| filename | Name of the file to use for firmware |
| void libnifalcon::FalconDevice::setForce | ( | boost::array< double, 3 > | force | ) | [inline] |
Set the instantanious force for the next I/O loop
| force | Force vector, in cartesian coordinates (x,y,z) |
unsigned int libnifalcon::FalconDevice::m_errorCount [protected] |
Number of errors in I/O loops
boost::shared_ptr<FalconComm> libnifalcon::FalconDevice::m_falconComm [protected] |
Falcon communication object
boost::shared_ptr<FalconFirmware> libnifalcon::FalconDevice::m_falconFirmware [protected] |
Falcon firmware object
boost::shared_ptr<FalconGrip> libnifalcon::FalconDevice::m_falconGrip [protected] |
Falcon grip object
boost::shared_ptr<FalconKinematic> libnifalcon::FalconDevice::m_falconKinematic [protected] |
Falcon kinematics object
boost::array<double, 3> libnifalcon::FalconDevice::m_forceVec [protected] |
Current force in 3D cartesian coordinates
boost::array<double, 3> libnifalcon::FalconDevice::m_position [protected] |
Current position in 3D cartesian coordinates
1.5.9