libnifalcon
1.0.1
|
#include <FalconFirmware.h>
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 std::array< int, 3 >(&force)) |
std::array< int, 3 > | getEncoderValues () |
void | setLEDStatus (unsigned int leds) |
uint8_t | getLEDStatus () |
void | setHomingMode (bool value) |
unsigned int | getHomingModeStatus () |
bool | isHomed () |
void | setFalconComm (std::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 () |
![]() | |
FalconCore () | |
virtual | ~FalconCore () |
int | getErrorCode () |
Public Attributes | |
enum libnifalcon::FalconFirmware:: { ... } | FalconFirmwareLEDValues |
enum libnifalcon::FalconFirmware:: { ... } | FalconFirmwareHomingValues |
enum libnifalcon::FalconFirmware:: { ... } | FalconFirmwareErrorValues |
Protected Attributes | |
std::shared_ptr< FalconComm > | m_falconComm |
std::string | m_firmwareFilename |
bool | m_isFirmwareLoaded |
bool | m_homingMode |
unsigned int | m_ledStatus |
std::array< int, 3 > | m_forceValues |
std::array< int, 3 > | m_encoderValues |
unsigned int | m_homingStatus |
uint64_t | m_loopCount |
uint64_t | m_outputCount |
bool | m_hasWritten |
![]() | |
int | m_errorCode |
Private Member Functions | |
DECLARE_LOGGER () | |
Firmware dictates the format we talk to the falcon in after we've loaded a certain firmware. We assume all falcon firmware provides a certain set of functions:
This class provides the pure virtual functions that need to be filled in by specific firmware implementations.
Homing mode is a feature of the firmware that allows the falcon to self-correct the origin of the grip. The homing mode bit must be set in each input packet sent in order for the falcon to stay homed.
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
|
inlinevirtual |
Destructor
|
private |
|
inline |
Returns an array of current motor encoder values from the last I/O loop
|
pure virtual |
Retrieves the buffer containing grip data
Implemented in libnifalcon::FalconFirmwareNovintSDK.
|
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.
|
inline |
Return the homing status of each encoder
|
inline |
Returns the current LED status bitfield
|
inline |
Get the number of successful I/O loops run
|
inlinevirtual |
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.
|
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 | ( | 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::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 | ( | 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 |
|
inlinevirtual |
Used to reset the state of the communications if reloading firmware more than once in the same session
|
pure virtual |
Run one read/write loop
Implemented in libnifalcon::FalconFirmwareNovintSDK.
|
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 |
|
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 |
|
inline |
Sets the homing mode for the next I/O loop
value | True to turn homing mode on, false for off |
|
inline |
Sets the LEDs to turn on or off at the next I/O loop
leds | Bitfield of the LED flags |
enum { ... } libnifalcon::FalconFirmware::FalconFirmwareErrorValues |
enum { ... } libnifalcon::FalconFirmware::FalconFirmwareHomingValues |
enum { ... } libnifalcon::FalconFirmware::FalconFirmwareLEDValues |
|
protected |
Encoder values from the last I/O loop
|
protected |
Communications object for I/O
|
protected |
Filename of the firmware to load
|
protected |
Force values for the next I/O loop
|
protected |
True if we're waiting for a read return
|
protected |
True if homing mode is on, false for homing mode off
|
protected |
Current homing status from the last I/O loop
|
protected |
True if firmware has been loaded, false otherwise
|
protected |
Bitfield for LED Status
|
protected |
Number of successful loops that have been run by this firmware instance
|
protected |
Number of successful loops that have been run by this firmware instance