Aria  2.8.0
ArLaserLogger Class Reference

This class can be used to create log files for the laser mapper. More...

#include <ArLaserLogger.h>

Public Member Functions

void addGoal (void)
 Adds a goal where the robot is at the moment.
 
void addInfoToLog (const char *str,...)
 Adds a string to the log file without a tag for where or when we are. More...
 
void addInfoToLogPlain (const char *str)
 Same as addToInfo, but does it without marking robot position. More...
 
void addTagToLog (const char *str,...)
 Adds a string to the log file with a tag at the given moment. More...
 
void addTagToLogPlain (const char *str)
 Same ass addToLog, but no varargs, wrapper for java. More...
 
 ArLaserLogger (ArRobot *robot, ArLaser *laser, double distDiff, double degDiff, const char *fileName, bool addGoals=false, ArJoyHandler *joyHandler=NULL, const char *baseDirectory=NULL, bool useReflectorValues=false, ArRobotJoyHandler *robotJoyHandler=NULL, const std::map< std::string, ArRetFunctor3< int, ArTime, ArPose *, ArPoseWithTime *> *, ArStrCaseCmpOp > *extraLocationData=NULL, std::list< ArLaser *> *extraLasers=NULL)
 Constructor. More...
 
double getDegDiff (void)
 Gets the degrees to turn at which the robot will take a new reading.
 
double getDistDiff (void)
 Gets the distance at which the robot will take a new reading.
 
void setDegDiff (double degDiff)
 Sets the degrees to turn at which the robot will take a new reading.
 
void setDistDiff (double distDiff)
 Sets the distance at which the robot will take a new reading.
 
void takeNewReadings (bool takeNew)
 Sets if we're taking old (scan1:) readings.
 
void takeOldReadings (bool takeOld)
 Sets if we're taking old (sick1:) readings.
 
void takeReading (void)
 Explicitly tells the robot to take a reading.
 
bool takingNewReadings (void)
 Gets if we're taking new (scan1:) readings.
 
bool takingOldReadings (void)
 Gets if we're taking old (sick1:) readings.
 
bool wasFileOpenedSuccessfully (void)
 Sees if the file was opened successfully.
 
virtual ~ArLaserLogger ()
 Destructor.
 

Protected Member Functions

void goalKeyCallback (void)
 
void internalAddGoal (void)
 
void internalPrintLaserPoseAndConf (ArLaser *laser, int laserNumber)
 
void internalPrintPos (ArPose encoderPoseTaken, ArPose goalPoseTaken, ArTime timeTaken)
 
void internalTakeLaserReading (ArLaser *laser, int laserNumber)
 
void internalTakeReading (void)
 
void internalWriteTags (void)
 
bool loopPacketHandler (ArRobotPacket *packet)
 
void robotTask (void)
 The task which gets attached to the robot.
 

Protected Attributes

bool myAddGoalExplicit
 
bool myAddGoalKeyboard
 
bool myAddGoals
 
std::string myBaseDirectory
 
double myDegDiff
 
double myDistDiff
 
std::map< std::string, ArRetFunctor3< int, ArTime, ArPose *, ArPoseWithTime * > *, ArStrCaseCmpOpmyExtraLocationData
 
FILE * myFile
 
std::string myFileName
 
bool myFirstGoalTaken
 
bool myFirstTaken
 
ArFunctorC< ArLaserLoggermyGoalKeyCB
 
bool myIncludeRawEncoderPose
 
std::list< std::string > myInfos
 
ArJoyHandlermyJoyHandler
 
ArLasermyLaser
 
std::list< ArLaser * > myLasers
 
ArPose myLast
 
bool myLastAddGoalKeyboard
 
ArPose myLastGoalTakenPose
 
ArTime myLastGoalTakenTime
 
bool myLastJoyButton
 
unsigned char myLastLoops
 
bool myLastRobotJoyButton
 
double myLastVel
 
ArRetFunctor1C< bool, ArLaserLogger, ArRobotPacket * > myLoopPacketHandlerCB
 
bool myNewReadings
 
int myNumGoal
 
bool myOldReadings
 
ArRobotmyRobot
 
ArRobotJoyHandlermyRobotJoyHandler
 
int myScanNumber
 
ArSectors mySectors
 
ArTime myStartTime
 
std::list< std::string > myTags
 
bool myTakeReadingExplicit
 
ArFunctorC< ArLaserLoggermyTaskCB
 
bool myUseReflectorValues
 
bool myWrote
 

Detailed Description

This class can be used to create log files for the laser mapper.

This class has a pointer to a robot and a laser... every time the robot has EITHER moved the distDiff, or turned the degDiff, it will take the current readings from the laser and log them into the log file given as the fileName to the constructor. Readings can also be taken by calling takeReading which explicitly tells the logger to take a reading.

The class can also add goals, see the constructor arg addGoals for information about that... you can also explicitly have it add a goal by calling addGoal.

See also
Laser Scan Log File Format for details on the laser scan log output file format.

Constructor & Destructor Documentation

◆ ArLaserLogger()

ArLaserLogger::ArLaserLogger ( ArRobot robot,
ArLaser laser,
double  distDiff,
double  degDiff,
const char *  fileName,
bool  addGoals = false,
ArJoyHandler joyHandler = NULL,
const char *  baseDirectory = NULL,
bool  useReflectorValues = false,
ArRobotJoyHandler robotJoyHandler = NULL,
const std::map< std::string, ArRetFunctor3< int, ArTime, ArPose *, ArPoseWithTime *> *, ArStrCaseCmpOp > *  extraLocationData = NULL,
std::list< ArLaser *> *  extraLasers = NULL 
)

Constructor.

Note
The laser must be configured, connected and have read at least one set of data from the laser already (the data received is used to calculate FOV information saved in the .2d)
A packet handler will be added for a packet with ID 0x96, but will will not indicate the packet was handled. This will result in warnings printed to the log unless another packet handler handles this packet. ArServerHandlerMapping does this, but standalone use, such as in sickLogger.cpp, does not. This is done so that multiple packet handlers may receive 0x96. (This packet is used for an advanced feature of mapping with some MobileRobots products but which isn't usually needed for must robot maps.)
Parameters
robotThe robot to attach to
laserthe laser to log readings from.
distDiffthe distance traveled at which to take a new reading
degDiffthe degrees turned at which to take a new reading
fileNamethe file name in which to put the log
addGoalswhether to add goals automatically. if true then ArLaserLogger adds a handler for the 'g' key to any ArKeyHandler that has been previously created, and will also monitor the robot joystick for the goal button pressed, and register a handler to joyHandler if provided as well.
joyHandlerjoystick interface to allow control from a computer joystick, including placing goals with the second joystick button
baseDirectorydirectory to place the output file fileName in
useReflectorValuesif true, include laser special-reflectance information
robotJoyHandlerif given, use this as the interface to the robot's own joystick
extraLocationDataif given, place this additional information in the output log file
extraLasersif given, include data from these lasers in the laser log in addition to the primary laser laser.

Member Function Documentation

◆ addInfoToLog()

void ArLaserLogger::addInfoToLog ( const char *  str,
  ... 
)

Adds a string to the log file without a tag for where or when we are.

The robot MUST be locked before you call this function, so that this function is not adding to a list as the robotTask is using it.

Java and Python Wrappers: Not available in Java or Python wrapper libraries.

This function takes the given tag and puts it into the log file by itself

◆ addInfoToLogPlain()

void ArLaserLogger::addInfoToLogPlain ( const char *  str)

Same as addToInfo, but does it without marking robot position.

The robot MUST be locked before you call this function, so that this function is not adding to a list as the robotTask is using it.

This function takes the given tag and puts it into the log file by itself

◆ addTagToLog()

void ArLaserLogger::addTagToLog ( const char *  str,
  ... 
)

Adds a string to the log file with a tag at the given moment.

The robot MUST be locked before you call this function, so that this function is not adding to a list as the robotTask is using it.

Java and Python Wrappers: Not available in Java or Python wrapper libraries.

This function takes the given tag and puts it into the log file along with a tag as to where the robot was and when in the mapping it was

Java and Python Wrappers: Not available in Java or Python wrapper libraries.

See also
addTagToLogPlain()

◆ addTagToLogPlain()

void ArLaserLogger::addTagToLogPlain ( const char *  str)

Same ass addToLog, but no varargs, wrapper for java.

The robot MUST be locked before you call this function, so that this function is not adding to a list as the robotTask is using it.

This function takes the given tag and puts it into the log file along with a tag as to where the robot was and when in the mapping it was

◆ internalTakeLaserReading()

void ArLaserLogger::internalTakeLaserReading ( ArLaser laser,
int  laserNumber 
)
protected

use the adjusted raw readings if we can, otherwise just use the raw readings like before

Note that the the sick1: or scan1: must be the last thing in that timestamp, ie that you should put any other data before it.


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