Public Types | |
enum | Traversal { forward = 1, backward = -1 } |
Public Member Functions | |
void | clear () |
Traversal | traversal () const |
void | setTraversal (Traversal eDirection) |
int | factor () const |
int | aggress () const |
int | fileFactorAggress () const |
const PecSample & | operator[] (int nRow) const |
PecSample::Val | value (int nRow) const |
int | valueInt (int nRow) const |
bool | set (int nFactor, int nAggress, const QVector< PecSample::Val > &aTable) |
bool | setFactor (int nFactor) |
bool | setAggress (int nAggress) |
bool | setFileFactorAggress (int nFactorAggress) |
bool | setValue (int nRow, PecSample::Val eVal) |
void | setFinish () |
bool | calc (const QVector< double > &aProfile, double dfPecPosScale, int nAggressMin, int nAggressMax, int nFactorMax, IProgress *pProgress) |
bool | fit (const QVector< double > &aProfile, double dfPecPosScale, IProgress *pProgress) |
Static Public Attributes | |
static const int | c_nRowNum = 256 |
static const int | c_nRowGen = 4 |
static const int | c_nAggressNum = 15 |
static const int | c_nFactorNum = 15 |
Private Member Functions | |
void | recalcGeo () |
Private Attributes | |
int | m_nFactor |
int | m_nAggress |
QVector< PecSample > | m_aTable |
Traversal | m_eTraversal |
int | m_nOffset |
This class holds data for PEC (periodic error correction).
void PecData::clear | ( | ) |
Clear PEC table
Sets all PEC value to PecSample::reset.
bool PecData::calc | ( | const QVector< double > & | aProfile, | |
double | dfPecPosScale, | |||
int | nAggressMin, | |||
int | nAggressMax, | |||
int | nFactorMax, | |||
IProgress * | pProgress | |||
) |
Calculate PEC table to achieve the given PE profile aProfile
Background:
PE is a positional error of the worm gear.
Let x
denote the rotation angle of the worm, running from 0
... 256
for one worm revolution (360°).
Let y
denote the rotation angle of the worm wheel, running from 0
... 256
when advancing by one worm wheel tooth (360° / number of worm wheel teeth).
Ideally, y = x + C
, with C being an arbitrary constant (worm and worm wheel beeing endless, so there's no special start point).
With PE, y = x + e(x) + C
.
To compensate the PE, the MCU models e(x) with an approximation c(x), which has discrete slope values. The MCU holds a PEC table of 256 entries and a PEC factor f, which describe c(x)
. A PEC table entry has one of the following values:
0
: slope of c(x) is unchanged,c(x+1) - c(x) = c(x) - c(x-1)
1
: slope of c(x) increases by a, if slope is < f, otherwise is unchanged,c(x+1) - c(x) = c(x) - c(x-1) + a
2
: slope of c(x) decreases by a, if slope is > -f, otherwise is unchanged,c(x+1) - c(x) = c(x) - c(x-1) - a
3
: slope of c(x) is set to 0,c(x+1) - c(x) = 0
c(x) is dependent on the traversal direction, i.e. whether the PEC table is processed with increasing or decreasing x. When traversing backwards, the MCU uses the PEC table entry at x to calculate the speed while moving from c(x+1) to c(x), i.e. it does a kind of look-ahead. It seems that currently the MCU always traverses the PEC table with decreasing x, so switching the RA direction (from Normal to Reversed or vice versa) or switching the Hemisphere invalidates the PEC table.
Concerning a
, empirical measurements suggest a value of aggressiveness / (2 * max. goto rate)
, which is 1/80 for firmware v3.59, aggressiveness/240 for v4.00rc4 and less, and aggressiveness/200 for v4.00rc5 and above.
void PecData::recalcGeo | ( | ) | [private] |
Recalculate acceleration, speed and position from raw PEC table values