#include <FalconFirmware.h>
Inherits libnifalcon::FalconCore.
Inherited by libnifalcon::FalconFirmwareNovintSDK.
Public Types | |
enum | { GREEN_LED = 0x2, BLUE_LED = 0x4, RED_LED = 0x8 } |
enum | { ENCODER_1_HOMED = 0x1, ENCODER_2_HOMED = 0x2, ENCODER_3_HOMED = 0x4 } |
enum | { FALCON_FIRMWARE_NO_COMM_SET = 3000, FALCON_FIRMWARE_NO_FIRMWARE_SET, FALCON_FIRMWARE_NO_FIRMWARE_LOADED, FALCON_FIRMWARE_FILE_NOT_VALID, FALCON_FIRMWARE_CHECKSUM_MISMATCH } |
Public Member Functions | |
FalconFirmware () | |
virtual | ~FalconFirmware () |
virtual bool | runIOLoop ()=0 |
virtual int | getGripInfoSize ()=0 |
virtual const uint8_t * | getGripInfo ()=0 |
void | setForces (const boost::array< int, 3 >(&force)) |
boost::array< int, 3 > | getEncoderValues () |
void | setLEDStatus (unsigned int leds) |
uint8_t | getLEDStatus () |
void | setHomingMode (bool value) |
unsigned int | getHomingModeStatus () |
bool | isHomed () |
void | setFalconComm (boost::shared_ptr< FalconComm > f) |
bool | isFirmwareLoaded () |
bool | setFirmwareFile (const std::string &filename) |
bool | loadFirmware (unsigned int retries, bool skip_checksum=false) |
bool | loadFirmware (bool skip_checksum=false) |
bool | loadFirmware (bool skip_checksum, const unsigned int &firmware_size, uint8_t *buffer) |
virtual void | resetFirmwareState () |
virtual std::string | getRawReturn () |
uint64_t | getLoopCount () |
Public Attributes | |
enum libnifalcon::FalconFirmware:: { ... } | FalconFirmwareLEDValues |
enum libnifalcon::FalconFirmware:: { ... } | FalconFirmwareHomingValues |
enum libnifalcon::FalconFirmware:: { ... } | FalconFirmwareErrorValues |
Protected Attributes | |
boost::shared_ptr< FalconComm > | m_falconComm |
std::string | m_firmwareFilename |
bool | m_isFirmwareLoaded |
bool | m_homingMode |
unsigned int | m_ledStatus |
boost::array< int, 3 > | m_forceValues |
boost::array< int, 3 > | m_encoderValues |
unsigned int | m_homingStatus |
uint64_t | m_loopCount |
uint64_t | m_outputCount |
bool | m_hasWritten |
Private Member Functions | |
DECLARE_LOGGER () |
This class provides the pure virtual functions that need to be filled in by specific firmware implementations.
It is recommended that any program using the falcon require the falcon to be homed before enacting any torques calculated from positions, as the transfer from non-homed to homed completely resets the coordinate system, and will cause large errors in calculations. Since each motor is decently powerful, these errors can lead to violence.
To home the falcon:
anonymous enum |
anonymous enum |
anonymous enum |
libnifalcon::FalconFirmware::FalconFirmware | ( | ) |
Constructor
virtual libnifalcon::FalconFirmware::~FalconFirmware | ( | ) | [inline, virtual] |
Destructor
libnifalcon::FalconFirmware::DECLARE_LOGGER | ( | ) | [private] |
Reimplemented in libnifalcon::FalconFirmwareNovintSDK.
boost::array<int, 3> libnifalcon::FalconFirmware::getEncoderValues | ( | ) | [inline] |
Returns an array of current motor encoder values from the last I/O loop
virtual const uint8_t* libnifalcon::FalconFirmware::getGripInfo | ( | ) | [pure virtual] |
Retrieves the buffer containing grip data
Implemented in libnifalcon::FalconFirmwareNovintSDK.
virtual int libnifalcon::FalconFirmware::getGripInfoSize | ( | ) | [pure virtual] |
Returns the size of grip information for this firmware.
This may or may not work. However, there's currently only one grip type, so I'm guessing.
Implemented in libnifalcon::FalconFirmwareNovintSDK.
unsigned int libnifalcon::FalconFirmware::getHomingModeStatus | ( | ) | [inline] |
Return the homing status of each encoder
uint8_t libnifalcon::FalconFirmware::getLEDStatus | ( | ) | [inline] |
Returns the current LED status bitfield
uint64_t libnifalcon::FalconFirmware::getLoopCount | ( | ) | [inline] |
Get the number of successful I/O loops run
virtual std::string libnifalcon::FalconFirmware::getRawReturn | ( | ) | [inline, virtual] |
Get the raw data string returned from the falcon
Reimplemented in libnifalcon::FalconFirmwareNovintSDK.
bool libnifalcon::FalconFirmware::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::FalconFirmware::isHomed | ( | ) | [inline] |
Returns the overall homing status
Basically, if only one encoder is homed, it doesn't do you a lot of good. This is a conveinence function to signify whether all motors are homed
bool libnifalcon::FalconFirmware::loadFirmware | ( | bool | skip_checksum, | |
const unsigned int & | firmware_size, | |||
uint8_t * | buffer | |||
) |
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) | |
firmware_size | Size of the raw buffer we're passing to the firmware | |
buffer | Raw buffer loaded with binary falcon firmware |
bool libnifalcon::FalconFirmware::loadFirmware | ( | bool | skip_checksum = false |
) |
Conveinence function, runs one try of loading firmware with set filename
skip_checksum | Whether or not to skip checksum tests when loading firmware (useful with ftd2xx on non-windows platforms) |
bool libnifalcon::FalconFirmware::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) |
virtual void libnifalcon::FalconFirmware::resetFirmwareState | ( | ) | [inline, virtual] |
Used to reset the state of the communications if reloading firmware more than once in the same session
virtual bool libnifalcon::FalconFirmware::runIOLoop | ( | ) | [pure virtual] |
Run one read/write loop
Implemented in libnifalcon::FalconFirmwareNovintSDK.
void libnifalcon::FalconFirmware::setFalconComm | ( | boost::shared_ptr< FalconComm > | f | ) | [inline] |
Sets the communication object for the firmware to run I/O through
f | Pointer to the communications object |
bool libnifalcon::FalconFirmware::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::FalconFirmware::setForces | ( | const boost::array< int, 3 > & | force | ) | [inline] |
Sets the instantious force (in whatever units the falcon takes) for the next I/O loop
force | Array of signed 16-bit integers to set force |
void libnifalcon::FalconFirmware::setHomingMode | ( | bool | value | ) | [inline] |
Sets the homing mode for the next I/O loop
value | True to turn homing mode on, false for off |
void libnifalcon::FalconFirmware::setLEDStatus | ( | unsigned int | leds | ) | [inline] |
Sets the LEDs to turn on or off at the next I/O loop
leds | Bitfield of the LED flags |
enum { ... } libnifalcon::FalconFirmware::FalconFirmwareLEDValues |
boost::array<int, 3> libnifalcon::FalconFirmware::m_encoderValues [protected] |
Encoder values from the last I/O loop
boost::shared_ptr<FalconComm> libnifalcon::FalconFirmware::m_falconComm [protected] |
Communications object for I/O
std::string libnifalcon::FalconFirmware::m_firmwareFilename [protected] |
Filename of the firmware to load
boost::array<int, 3> libnifalcon::FalconFirmware::m_forceValues [protected] |
Force values for the next I/O loop
bool libnifalcon::FalconFirmware::m_hasWritten [protected] |
True if we're waiting for a read return
bool libnifalcon::FalconFirmware::m_homingMode [protected] |
True if homing mode is on, false for homing mode off
unsigned int libnifalcon::FalconFirmware::m_homingStatus [protected] |
Current homing status from the last I/O loop
bool libnifalcon::FalconFirmware::m_isFirmwareLoaded [protected] |
True if firmware has been loaded, false otherwise
unsigned int libnifalcon::FalconFirmware::m_ledStatus [protected] |
Bitfield for LED Status
uint64_t libnifalcon::FalconFirmware::m_loopCount [protected] |
Number of successful loops that have been run by this firmware instance
uint64_t libnifalcon::FalconFirmware::m_outputCount [protected] |
Number of successful loops that have been run by this firmware instance