AURobotServers  4
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
UPoseHistNotUsed Class Reference

#include <uposehist.h>

Inheritance diagram for UPoseHistNotUsed:
Inheritance graph

Public Member Functions

bool addIfNeeded (UPoseTime pose, double velocity)
 
void addPoseHist (UPoseTime poseAtTime)
 
void addPoseHist (UPose pose, UTime atTime)
 
void clear ()
 
double getHistHeading (double closeBy, double farAway, const UPoseTime *ref, double *histAge)
 
double getMinDist ()
 
double getMinTheta ()
 
double getMinTime ()
 
UPoseTime getNewest (double *velocity)
 
UPoseTime getOldest ()
 
UTime getOldestTime ()
 
UPoseTime getPose (int index)
 
UPose getPoseAtTime (UTime)
 
double getPoseFitAtDistance (double closeBy, double farAway, const UPose *ref, UPoseTime *closeFitPose)
 
bool getPoseNearDistance (const double away, const UPose *ref, UPoseTime *closer, UPoseTime *moreDistant)
 
bool getPoseNearTime (UTime atTime, UPoseTime *justBefore, UPoseTime *justAfter)
 
int getPosesCnt ()
 
char * getReplayFileName (char *fn, const int fnCnt)
 
int getReplayLogLine ()
 
const char * getReplaySubdir ()
 
UTime getReplayTimeNext ()
 
UTime getReplayTimeNow ()
 
UTime getTimeAtDistance (double away)
 
bool isReplay ()
 
bool isReplayFileOpen ()
 
virtual const char * print (const char *preString, char *buff, int buffCnt)
 
bool replayStep (int steps)
 
bool replayTime (UTime untilTime)
 
void saveToLog (FILE *logf)
 
void setMinDist (double value)
 
void setMinTheta (double value)
 
void setMinTime (double value)
 
bool setReplay (bool value)
 
void setReplaySubdir (const char *subdir)
 
 UPoseHistNotUsed ()
 
 ~UPoseHistNotUsed ()
 
- Public Member Functions inherited from UResBase
void createReplayVar (UVarPool *pool)
 
virtual void createResources ()
 
UCmdExegetCorePointer ()
 
char * getLogFileName (char *fn, const int fnCnt)
 
int getResFuncIdx ()
 
const char * getResID ()
 
int getResVersion ()
 
virtual bool gotAllResources (char *, int)
 
bool isA (const char *idStr)
 
bool isAlsoA (const char *id)
 
virtual void print (const char *preString)
 
virtual void saveSettings ()
 
void setCorePointer (UCmdExe *serverCore)
 
void setResFuncIdx (int idx)
 
virtual void setResID (const char *id, const int version)
 
virtual bool setResource (UResBase *, bool)
 
virtual void stop (bool)
 
virtual void updateReplayStatus ()
 
 UResBase ()
 
virtual ~UResBase ()
 
- Public Member Functions inherited from UReplay
void addChild (UReplay *child)
 
virtual bool decodeReplayLine (char *)
 
char * getLogFileName (char *fn, const int fnCnt)
 
char * getReplayFileName (char *fn, const int fnCnt)
 
int getReplayLogLine ()
 
bool isReplay ()
 
bool isReplayFileOpen ()
 
void removeChild (UReplay *child)
 
virtual void replayAdvanceTime (UTime untilTime)
 
void replaySetBaseFileName (const char *name, const char *preName="")
 
void replaySetFileName (const char *name)
 
int replayStep (int steps)
 
virtual bool replayToTime (UTime untilTime)
 
void setParent (UReplay *parent)
 
bool setReplay (bool value)
 
 UReplay ()
 
virtual ~UReplay ()
 
- Public Member Functions inherited from ULock
bool lock ()
 
void lockInit ()
 
void post ()
 
bool tryLock ()
 
bool tryWait ()
 
 ULock ()
 
void unlock ()
 
bool wait ()
 
 ~ULock ()
 

Static Public Member Functions

static const char * getResID ()
 
static int getResVersion ()
 

Protected Member Functions

bool replayStep ()
 
- Protected Member Functions inherited from UResBase
UResBasegetStaticResource (const char *resName, bool mayCreate, bool staticOnly=true)
 get a pointer to a static resource. More...
 

Private Attributes

double minDistChange
 
double minHeadingChange
 
double minTimeChange
 
int newest
 
UPoseTime poseNew
 
UPoseTime poses [MAX_HIST_POSES]
 
int posesCnt
 
bool replay
 
FILE * replayFile
 
char replayLine [MAX_LOG_LINE_LENGTH]
 
int replayLogLine
 
char replaySubPath [MAX_SUBPATH_LENGTH]
 
UTime replayTimeNext
 
UTime replayTimeNow
 
double speed
 

Static Private Attributes

static const int MAX_LOG_LINE_LENGTH = 200
 
static const int MAX_SUBPATH_LENGTH = 100
 

Additional Inherited Members

- Public Attributes inherited from UReplay
bool replayTimeAdvancePending
 
UTime replayTimeNow
 
- Protected Attributes inherited from UResBase
int resFuncIdx
 
char resID [MAX_RESOURCE_ID_LENGTH]
 
char resIsAlso [MAX_RESOURCE_ISALSO_LENGTH]
 
int resVersion
 
- Protected Attributes inherited from UReplay
bool replay
 
FILE * replayFile
 
char replayFileName [REPLAY_FILE_NAME_LENGTH]
 replay filename More...
 
char replayLine [MAX_LOG_LINE_LENGTH]
 
int replayLogLine
 
UReplayreplayParent
 
UTime replayTimeNext
 
- Static Protected Attributes inherited from UReplay
static const int MAX_LOG_LINE_LENGTH = 10000
 
static const int REPLAY_FILE_NAME_LENGTH = 264
 max length of replay filename More...
 

Detailed Description

Class to hold some 50 meter of pose history for drive calculations

Author
Christian Andersen

Constructor & Destructor Documentation

UPoseHistNotUsed::UPoseHistNotUsed ( )
UPoseHistNotUsed::~UPoseHistNotUsed ( )

Constructor

Member Function Documentation

bool UPoseHistNotUsed::addIfNeeded ( UPoseTime  pose,
double  velocity 
)

Add this pose to the pose history - if needed, i.e. distance or heading change is above a limit. Returns true if position is added to history poses.

References absf(), addPoseHist(), UPose::getDistance(), UPose::getHeadingDiff(), getPose(), UTime::getSec(), minDistChange, minHeadingChange, minTimeChange, poseNew, posesCnt, speed, and UPoseTime::t.

Referenced by getResVersion(), and replayStep().

void UPoseHistNotUsed::addPoseHist ( UPoseTime  poseAtTime)

Add a history pose (in cronological order)

References ULock::lock(), MAX_HIST_POSES, newest, poseNew, poses, posesCnt, and ULock::unlock().

Referenced by addIfNeeded(), addPoseHist(), and getResVersion().

void UPoseHistNotUsed::addPoseHist ( UPose  pose,
UTime  atTime 
)

Add a history pose (in cronological order)

References addPoseHist().

void UPoseHistNotUsed::clear ( void  )

Clear current pose history

References newest, and posesCnt.

Referenced by getResVersion(), and setReplay().

double UPoseHistNotUsed::getHistHeading ( double  closeBy,
double  farAway,
const UPoseTime ref,
double *  histAge 
)

Get heading over a distance in pose history from 'closeBy' to 'farAway' (in meters) relative to the 'ref' pose. Returns the general heading over this distance (in radians). If 'histAge' != NULL, then the age of the last

References UPose::h, ULock::lock(), newest, poses, posesCnt, UPoseTime::t, ULock::unlock(), UPose::x, and UPose::y.

Referenced by getPosesCnt().

double UPoseHistNotUsed::getMinDist ( )
inline

Get minimum distance required to store a pose history pose

References minDistChange.

double UPoseHistNotUsed::getMinTheta ( )
inline

Get minimum distance required to store a pose history pose

References minHeadingChange.

double UPoseHistNotUsed::getMinTime ( )
inline

Get minimum distance required to store a pose history pose

References minTimeChange.

UPoseTime UPoseHistNotUsed::getNewest ( double *  velocity)
inline

Get newest stored position. If storage is empty time is zero.

References getOldestTime(), getPoseNearTime(), poseNew, and speed.

UPoseTime UPoseHistNotUsed::getOldest ( )

Get time of oldest data

References ULock::lock(), MAX_HIST_POSES, newest, poses, posesCnt, and ULock::unlock().

Referenced by getOldestTime(), and getResVersion().

UTime UPoseHistNotUsed::getOldestTime ( )

Get Oldest supportet time

References getOldest(), UTime::Now(), posesCnt, and UPoseTime::t.

Referenced by getNewest().

UPoseTime UPoseHistNotUsed::getPose ( int  index)

Get a history pose by index from the newest and back - NB! unsafe (if not locked), as element at index may have changed - no lock using this function. (Relative safe for all the newer poses, but especially the older ones may be overwritten.)

References MAX_HIST_POSES, newest, and poses.

Referenced by addIfNeeded(), getPosesCnt(), and saveToLog().

UPose UPoseHistNotUsed::getPoseAtTime ( UTime  atTime)

Get the nearest pose at this time

References UPoseTime::getPose(), UPoseTime::getPoseAtTime(), getPoseNearTime(), and UPoseTime::t.

Referenced by getResVersion().

double UPoseHistNotUsed::getPoseFitAtDistance ( double  closeBy,
double  farAway,
const UPose ref,
UPoseTime closeFitPose 
)

Get Bet fit line from this distance interval. Return the fit variance, but negative (-1.0) if no result. Returns the close position, adjusted to the fittet line.

References U2Dline::fit(), U2Dline::getOnLine(), ULock::lock(), newest, poses, posesCnt, UPose::set(), ULock::unlock(), UPose::x, and UPose::y.

Referenced by getPosesCnt().

bool UPoseHistNotUsed::getPoseNearDistance ( const double  away,
const UPose ref,
UPoseTime closer,
UPoseTime moreDistant 
)

Get the two nearest poses this distance away from the reference position 'ref'.

References ULock::lock(), newest, poses, posesCnt, ULock::unlock(), UPose::x, and UPose::y.

Referenced by getPosesCnt(), and getTimeAtDistance().

bool UPoseHistNotUsed::getPoseNearTime ( UTime  atTime,
UPoseTime justBefore,
UPoseTime justAfter 
)

Get the two nearst poses to time

References UTime::getMicrosec(), UTime::getSec(), ULock::lock(), newest, poseNew, poses, posesCnt, UPoseTime::t, and ULock::unlock().

Referenced by getNewest(), and getPoseAtTime().

int UPoseHistNotUsed::getPosesCnt ( )
inline
char * UPoseHistNotUsed::getReplayFileName ( char *  fn,
const int  fnCnt 
)

Get the full replay logfile name. Returns pointer fn[] string.

References imagePath, and replaySubPath.

Referenced by getReplayLogLine(), and setReplay().

int UPoseHistNotUsed::getReplayLogLine ( )
inline

Get current line number in replay logfile

References getReplayFileName(), replayLogLine, replayStep(), and replayTime().

const char* UPoseHistNotUsed::getReplaySubdir ( )
inline

Get pointer to replay subdir

References replaySubPath.

UTime UPoseHistNotUsed::getReplayTimeNext ( )
inline

Get replat time next

References replayTimeNext.

UTime UPoseHistNotUsed::getReplayTimeNow ( )
inline

Get replat time now

References replayTimeNow.

static const char* UPoseHistNotUsed::getResID ( )
inlinestatic

Fixed name of this resource type

Referenced by UPoseHistNotUsed().

static int UPoseHistNotUsed::getResVersion ( )
inlinestatic

Fixed varsion number for this resource type. Should follow release version, i.e. version 1.28 gives number 128. Should be incremented only when there is change to this class definition, i.e new or changed functions or variables.

References addIfNeeded(), addPoseHist(), clear(), getOldest(), and getPoseAtTime().

Referenced by UPoseHistNotUsed().

UTime UPoseHistNotUsed::getTimeAtDistance ( double  away)

Get time, when robot were (at least) this distance from newest position. If a pose at this distance is not in buffer, then the returned tme is zero.

References getPoseNearDistance(), ULock::lock(), newest, poses, posesCnt, UTime::setTime(), UPoseTime::t, and ULock::unlock().

Referenced by getPosesCnt().

bool UPoseHistNotUsed::isReplay ( )
inline

Get replay flag

References replay.

bool UPoseHistNotUsed::isReplayFileOpen ( )
inline

is replay file open

References replayFile.

const char * UPoseHistNotUsed::print ( const char *  preString,
char *  buff,
int  buffCnt 
)
virtual

Print the (short) status of resource - to a string buffer

Reimplemented from UResBase.

References posesCnt.

Referenced by getPosesCnt().

bool UPoseHistNotUsed::replayStep ( int  steps)

Replay N singles from the logfile. Returns true if N steps available.

References replayStep().

bool UPoseHistNotUsed::replayStep ( )
protectedvirtual

Replay a single step from the logfile. Returns true if EOF not found.

Reimplemented from UReplay.

References addIfNeeded(), UPose::h, MAX_LOG_LINE_LENGTH, replay, replayFile, replayLine, replayLogLine, replayTimeNext, replayTimeNow, UTime::setTimeTod(), UPoseTime::t, UTime::valid, UPose::x, and UPose::y.

Referenced by getReplayLogLine(), replayStep(), and replayTime().

bool UPoseHistNotUsed::replayTime ( UTime  untilTime)

Replay until just before this time

References replayStep(), and replayTimeNext.

Referenced by getReplayLogLine().

void UPoseHistNotUsed::saveToLog ( FILE *  logf)

Save pose history to logfile

References UTime::getMicrosec(), getPose(), UTime::getSec(), UPose::h, poseNew, posesCnt, UPoseTime::t, UPose::x, and UPose::y.

Referenced by getPosesCnt().

void UPoseHistNotUsed::setMinDist ( double  value)
inline

Set minimum distance required to store a pose history pose

References minDistChange.

void UPoseHistNotUsed::setMinTheta ( double  value)
inline

Set minimum distance required to store a pose history pose

References minHeadingChange.

void UPoseHistNotUsed::setMinTime ( double  value)
inline

Set minimum distance required to store a pose history pose

References minTimeChange, setReplay(), and setReplaySubdir().

bool UPoseHistNotUsed::setReplay ( bool  value)

Set replay flag. If replay flag is changed to true, the logfile (odo.log) is attempted opened. If successfull, the current pose history is cleared and the first record read and implemented. If not successfull, the replay flag is set to true, and the pose history is cleared only. Returns true if replay file is opened

References clear(), getReplayFileName(), MAX_LOG_LINE_LENGTH, replay, replayFile, replayLine, replayLogLine, replayTimeNext, UTime::setTimeTod(), and UTime::valid.

Referenced by setMinTime().

void UPoseHistNotUsed::setReplaySubdir ( const char *  subdir)

Set replay subdir. Sets the value to the subdir buffer, but nothing else is changed.

References MAX_PATH_LENGTH, and replaySubPath.

Referenced by setMinTime().

Member Data Documentation

const int UPoseHistNotUsed::MAX_LOG_LINE_LENGTH = 200
staticprivate

Maximum length of a line in the logfile

Referenced by replayStep(), and setReplay().

const int UPoseHistNotUsed::MAX_SUBPATH_LENGTH = 100
staticprivate

length of subpath

Referenced by UPoseHistNotUsed().

double UPoseHistNotUsed::minDistChange
private

Distance change before qualified to be saved

Referenced by addIfNeeded(), getMinDist(), setMinDist(), and UPoseHistNotUsed().

double UPoseHistNotUsed::minHeadingChange
private

Heading change before qualified to be saved

Referenced by addIfNeeded(), getMinTheta(), setMinTheta(), and UPoseHistNotUsed().

double UPoseHistNotUsed::minTimeChange
private

Time change before qualified to be saved

Referenced by addIfNeeded(), getMinTime(), setMinTime(), and UPoseHistNotUsed().

int UPoseHistNotUsed::newest
private
UPoseTime UPoseHistNotUsed::poseNew
private
UPoseTime UPoseHistNotUsed::poses[MAX_HIST_POSES]
private
int UPoseHistNotUsed::posesCnt
private
bool UPoseHistNotUsed::replay
private

Replay flag - source of info for pose history a change in this flag clears the current pose history.

Referenced by isReplay(), replayStep(), setReplay(), and UPoseHistNotUsed().

FILE* UPoseHistNotUsed::replayFile
private

Replay file handle

Referenced by isReplayFileOpen(), replayStep(), setReplay(), and UPoseHistNotUsed().

char UPoseHistNotUsed::replayLine[MAX_LOG_LINE_LENGTH]
private

Buffer for latest line (but not used) line from logfile

Referenced by replayStep(), setReplay(), and UPoseHistNotUsed().

int UPoseHistNotUsed::replayLogLine
private

Current line number in logfile

Referenced by getReplayLogLine(), replayStep(), setReplay(), and UPoseHistNotUsed().

char UPoseHistNotUsed::replaySubPath[MAX_SUBPATH_LENGTH]
private

Replay file subdir - relative to imagePath

Referenced by getReplayFileName(), getReplaySubdir(), setReplaySubdir(), and UPoseHistNotUsed().

UTime UPoseHistNotUsed::replayTimeNext
private

Replay time of next data from in logfile (line buffer)

Referenced by getReplayTimeNext(), replayStep(), replayTime(), and setReplay().

UTime UPoseHistNotUsed::replayTimeNow
private

Replay time of last used data from logfile

Referenced by getReplayTimeNow(), and replayStep().

double UPoseHistNotUsed::speed
private

Newest speed

Referenced by addIfNeeded(), and getNewest().


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