#include <moveCommand.h>
Public Member Functions | |
virtual double | getPos (double TimeElapsed) |
returns the planned position for TimeElapsed (seconds) More... | |
double | getPos () |
virtual double | getTotalTime () |
returns the planned total time for the movement (in seconds) More... | |
virtual double | getVel (double TimeElapsed) |
returns the planned velocity for TimeElapsed (seconds) More... | |
double | getVel () |
virtual bool | inPhase1 () |
virtual bool | inPhase3 () |
virtual RampCommand & | operator= (const RampCommand &rc) |
RampCommand (double x0, double v0, double xtarget, double amax, double vmax) | |
RampCommand (const RampCommand &rc) | |
virtual double | T1 () |
Return the times of the different phases of the ramp move. More... | |
virtual double | T2 () |
virtual double | T3 () |
virtual | ~RampCommand () |
Public Member Functions inherited from moveCommand | |
virtual bool | isActive () |
returns true if the the end of the movement is not reached yet More... | |
moveCommand () | |
virtual double | pos () |
returns the planned position at time of function call (desired position) More... | |
virtual void | start () |
sets the starttime for the movement to the current time More... | |
virtual double | timeRemaining () |
returns remaining time More... | |
virtual double | vel () |
returns the planned velocity at time of function call (desired velocitys) More... | |
virtual | ~moveCommand () |
Static Public Member Functions | |
static void | calculateAV (double x0, double v0, double xtarget, double time, double T3, double amax, double vmax, double &a, double &v) |
Calculate the necessary a and v of a rampmove, so that the move will take the desired time. More... | |
Private Attributes | |
double | m_a1 |
double | m_a3 |
double | m_amax |
RampCommand * | m_nachumkehr |
double | m_T1 |
double | m_T2 |
double | m_T3 |
bool | m_umkehr |
double | m_v0 |
double | m_v2 |
double | m_vmax |
double | m_x0 |
double | m_xtarget |
Static Private Attributes | |
static std::ofstream | debug |
Additional Inherited Members | |
Protected Attributes inherited from moveCommand | |
TimeStamp | m_now |
TimeStamp | m_timeStarted |
Definition at line 104 of file moveCommand.h.
RampCommand::RampCommand | ( | double | x0, |
double | v0, | ||
double | xtarget, | ||
double | amax, | ||
double | vmax | ||
) |
Just absolute values should be used. The direction will be set later on by using Delta
Set up the movement phases:
Current velocity should have same sign as desired velocity. (No reversion possible.)
Absolute value of current velocity is less than value of desired velocity.
Calculate critical deltas:
delta = 0
Absolute value of current velocity is greater than value of desired velocity.
Calculate critical values:
v0 / root(2)
(fabs(m_vmax) < fabs(vstern))
if (m_v0 * m_vmax >= 0) If sign of current velocity different to sign of desired velocity -> reversion needed
Go on till 0. By reaching 0 calling new RampCommand with v0 = 0
Done. Contructor finished, motion defined.
Definition at line 26 of file moveCommand.cpp.
RampCommand::RampCommand | ( | const RampCommand & | rc | ) |
Attention of recursion! In this implementation we make sure that m_nachumkehr RampCommand has no antoher m_nachumkehr ( (*m_nachumkehr).m_nachumkehr=NULL ). After possible changes please make sure there is not any longer infinite recursion.
Definition at line 149 of file moveCommand.cpp.
|
inlinevirtual |
Definition at line 112 of file moveCommand.h.
|
static |
Calculate the necessary a and v of a rampmove, so that the move will take the desired time.
If possible, the deceleration phase should take the time T3, so that it can be made equal for all joints
Do not trust sign, set correct sign by have a look on delta
ToDo: Noch Fehlerhaft! Wurzelterme < 0 etc, richtig machen!
v by calculation formula (I). a,b,c for quadratic formula:
Quadratic formula:
Now calculate a with formula (1):
fabs(delta) > d2s verhindert, prevent root of negative values!
v by calculation formula (II). a,b,c for quadratic formula:
Quadratic formula:
Now calculate a with formula (1):
ToDo: Check if needed
Dieser Fall bei bestimmten (relativ biedrigen) Deltas in Kombination mit relativ hohen v0s auf, und für diesen Fall kann ich keine Formel finden, für die Abbremsphase = T3 !!! Ich finde es komisch, dass hier die Formel oben versagt (Wurzelterm < 0) und die untere falsche Ergebnisse liefert... Lösung, bei der Abbremsphase != T3: out << " Fall 3:\n";
ToDo This special case is not solved yet. Occures with great values of v0 "Wrong Solution" (Joint arrives to soon):
Dieser Spezialfall ist noch nicht gelöst, tritt bei eher größeren v0 auf "Falsche Lösung" (Joint kommt zu früh an):
ToDo Oversteer. It can't be ensure to have a slowing-down process while T3. (System of equations would be overdetermined.)
Übersteuern, hier kann nicht gewährleistet werden, dass Abbremsphase Während T3 (Gleichungssystem wäre überbestimmt). out << " Fall 4\n";
Root does not make any problems.
Root reports some issues, temporary solution:
out << " Fall 5\n"; This is not "clean" yet ... temporary, incorrect solution
out << " Error in RampCommand::CalculateAV! time T3 is negative!\n";
out << " acc: " << acc << ",\tvel: " << vel << "\n"; out << "RampCommand::calculateAV ENDE\n"; debug.flush();
Definition at line 296 of file moveCommand.cpp.
|
virtual |
returns the planned position for TimeElapsed (seconds)
Returns the planned position for TimeElapsed (seconds)
Motion done. Targetposition reached.
Implements moveCommand.
Definition at line 207 of file moveCommand.cpp.
|
inline |
Definition at line 122 of file moveCommand.h.
|
virtual |
returns the planned total time for the movement (in seconds)
Returns the planned total time for the movement in seconds.
Implements moveCommand.
Definition at line 282 of file moveCommand.cpp.
|
virtual |
returns the planned velocity for TimeElapsed (seconds)
returns the planned velocity for TimeElapsed
Motion done. Motor inactive.
Implements moveCommand.
Definition at line 246 of file moveCommand.cpp.
|
inline |
Definition at line 131 of file moveCommand.h.
|
inlinevirtual |
Definition at line 141 of file moveCommand.h.
|
inlinevirtual |
Definition at line 146 of file moveCommand.h.
|
virtual |
Attention of recursion! In this implementation we make sure that m_nachumkehr RampCommand has no antoher m_nachumkehr ( (*m_nachumkehr).m_nachumkehr=NULL ). After possible changes please make sure there is not any longer infinite recursion.
Definition at line 174 of file moveCommand.cpp.
|
inlinevirtual |
Return the times of the different phases of the ramp move.
Definition at line 155 of file moveCommand.h.
|
inlinevirtual |
Definition at line 159 of file moveCommand.h.
|
inlinevirtual |
Definition at line 163 of file moveCommand.h.
|
staticprivate |
Definition at line 175 of file moveCommand.h.
|
private |
Definition at line 182 of file moveCommand.h.
|
private |
Definition at line 182 of file moveCommand.h.
|
private |
Definition at line 179 of file moveCommand.h.
|
private |
Definition at line 184 of file moveCommand.h.
|
private |
Definition at line 181 of file moveCommand.h.
|
private |
Definition at line 181 of file moveCommand.h.
|
private |
Definition at line 181 of file moveCommand.h.
|
private |
Definition at line 183 of file moveCommand.h.
|
private |
Definition at line 177 of file moveCommand.h.
|
private |
Definition at line 182 of file moveCommand.h.
|
private |
Definition at line 179 of file moveCommand.h.
|
private |
Definition at line 177 of file moveCommand.h.
|
private |
Definition at line 178 of file moveCommand.h.