libnifalcon::FalconFirmwareNovintSDK Class Reference
[Firmware Classes]

#include <FalconFirmwareNovintSDK.h>

Inherits libnifalcon::FalconFirmware.

Collaboration diagram for libnifalcon::FalconFirmwareNovintSDK:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 FalconFirmwareNovintSDK ()
virtual ~FalconFirmwareNovintSDK ()
virtual std::string getRawReturn ()
bool runIOLoop ()
int32_t getGripInfoSize ()
const uint8_t * getGripInfo ()

Protected Member Functions

void formatInput ()
bool formatOutput ()

Protected Attributes

uint8_t m_gripInfo
uint8_t m_rawData [128]
uint8_t m_rawInput [17]
uint8_t m_rawOutput [17]
uint8_t m_rawOutputInternal [17]
unsigned int m_currentOutputIndex
unsigned int m_rawDataSize

Private Member Functions

 DECLARE_LOGGER ()


Detailed Description

FalconFirmwareNovintSDK implements the firmware communications strategy for the firmware that comes with the Novint drivers, and with the nVent software.

Intro to Novint Firmware Format

16 bytes sent to the Falcon causes 16 bytes to be returned. It's expected that the host will be constantly polling the falcon to set motor positions, as it is assumed that the PID loops for the control exist in the software, not the hardware.

Input and output strings are printable. Each string starts with 0x3c ('<') and ends with 0x3e ('>'), and the byte range is 0x41 ('A') to 0x50 ('P').

A null input/output string looks like:

<AAAAAAAAAAAAAA>

However, after any amount of usage, the input/output string will probably look something like:

<HNGPOKOPFPOPAA>

Input Layout (To Controller)

0x3C 0x(g0) 0x(g1) 0x(g2) 0x(g3) 0x(h0) 0x(h1) 0x(h2) 0x(h3) 0x(i0) 0x(i1) 0x(i2) 0x(i3) 0x(j0) 0x(k0) 0x3E

Input Packet Byte Definitions:

Homing and LED Controls (Value of j0 byte):

Output Layout (To Controller)

0x3C 0x(m0) 0x(m1) 0x(m2) 0x(m3) 0x(n0) 0x(n1) 0x(n2) 0x(n3) 0x(o0) 0x(o1) 0x(o2) 0x(o3) 0x4(p0) 0x(q0) 0x3E

Output packet byte definitions:

Buttons and Homing Control Report (Value of j0 byte) - Directions taken from looking at the Falcon from the front:

Output Layout (To Controller)

Retrieving/Setting Axis Position:

Example:

  1. Test GUI gives us 1447 for first encoder, so that's the number we're trying to get to in the end.
  2. Driver gives us (positions represented by .s can be ignored): <JFBA..........>
  3. Translate to ascii values: 0x3c 0x4A 0x46 0x4B 0x50
  4. Drop first byte since it's just a marker: 0x4A 0x46 0x4B 0x50
  5. Subtract 0x41 (ASCII value for A) from all bytes: 0x9 0x5 0xA 0xF
  6. //(For readability only, not in the drivers)// Reverse into Big Endian: 0xF 0xA 0x5 0x9
  7. Shift into 16 bit number: 0xFA59
  8. Twos compliment conversion (~x+1): 0x05A7
  9. Decimal conversion (16 bit signed): 1447

Constructor & Destructor Documentation

libnifalcon::FalconFirmwareNovintSDK::FalconFirmwareNovintSDK (  ) 

Constructor

libnifalcon::FalconFirmwareNovintSDK::~FalconFirmwareNovintSDK (  )  [virtual]

Destructor


Member Function Documentation

libnifalcon::FalconFirmwareNovintSDK::DECLARE_LOGGER (  )  [private]

Reimplemented from libnifalcon::FalconFirmware.

void libnifalcon::FalconFirmwareNovintSDK::formatInput (  )  [protected]

Formats current input (forces, LED commands, etc...) for sending to falcon.

bool libnifalcon::FalconFirmwareNovintSDK::formatOutput (  )  [protected]

Formats current output from falcon (joint positions, calibration, etc...)

Returns:
True if at least one complete packet has been parsed

const uint8_t* libnifalcon::FalconFirmwareNovintSDK::getGripInfo (  )  [inline, virtual]

Accessor for raw grip info

Returns:
Const pointer to internal representation of raw grip info

Implements libnifalcon::FalconFirmware.

int32_t libnifalcon::FalconFirmwareNovintSDK::getGripInfoSize (  )  [inline, virtual]

Returns size of the grip data portion of the message. Currently always 1.

Returns:
Size of the grip data portion of the message. Currently always 1.

Implements libnifalcon::FalconFirmware.

std::string libnifalcon::FalconFirmwareNovintSDK::getRawReturn (  )  [virtual]

Get the raw data string returned from the falcon

Returns:
std::string of last full packet received from the falcon

Reimplemented from libnifalcon::FalconFirmware.

bool libnifalcon::FalconFirmwareNovintSDK::runIOLoop (  )  [virtual]

Runs device polling, then tries to write next command to device, or read return from device if write has already happened.

Returns:
True if we've read something, false otherwise. Sets error and returns false on communications error.

Implements libnifalcon::FalconFirmware.


Member Data Documentation

How far the firmware object is into parsing the current packet

Internal representation of grip data (buttons pressed, etc...)

Raw buffer to read into

Amount of data last returned from communications object read

Raw buffer for formatting input. Plus one character to make it zero terminated

Raw buffer for last full output packet. Plus one character to make it zero terminated

Raw buffer for formatting output incrementally. Plus one character to make it zero terminated


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

Generated on Sun Sep 20 12:24:31 2009 for libnifalcon by  doxygen 1.5.9