To see the different things you can set on a laser, call the functions canSetDegrees, canChooseRange, canSetIncrement, canChooseIncrement, canChooseUnits, canChooseReflectorBits, canSetPowerControlled, canChooseStartBaud, and canChooseAutoBaud to see what is available (the help for each of those tells you what functions they are associated with, and for each function associated with one of those it tells you to see the associated function). You should probably just use the ArLaserConnector to do this though, unless you are a very advanced user with a specific goal.
If you want to create your own new laser class to deal with sensors that are not default in ARIA, you can do that more easily now. All the laser* calls are ones meant for the inheriting laser classes to call, they all have help that says what they are meant for. ArUrg is the best current example to show how to use it all (and the smallest and most self contained). A brief overview is you should use the laserAllow* calls to set up what settings the new laser will allow. You may also want to use the override the laserSetName call so that your own mutexes will get named appropriately. You can use laserSetDefaultTcpPort to set the default TCP port (which you should do if the laser normally is connected to over TCP). You can use laserSetDefaultPortType to the type of port normally used (so that if a port is passed in we can make a reasonable guess as to what type, so that people don't always have to pass in a type). Before you connect you should call laserPullUnsetParams to fill in the parameters that weren't set explicitly with the default ones in the .p files. If the maximum range of the laser changes depending on settings (like on the LMS2xx) you should call laserSetAbsoluteMaxRange (after you call laserPullUnsetParamsFromRobot). Implement the blockingConnect, asyncConnect, disconnect, isConnected, and isTryingToConnect calls... while calling laserConnect, laserFailedConnect, laserDisconnectNormally, and laserDisconnectOnError calls to let the laser base class call the appropriate callbacks. You should use the laserCheckLostConnection in your runThread to see if the laser has lost connection (see its documentation for details). Then after you get your readings call laserProcessReadings to fill them from the raw buffer into the current and cumulative buffer (and call the reading callbacks). The internal* calls are all internal to the base class and shouldn't have to be used by inheriting classes. After you have created a new laser type you can add it to Aria by using the Aria::laserAddCreator call and then it will work like any of the built in laser types (see the documentation for that function for what the creator needs to do, and an example is ArLaserCreatorHelper in the ariaUtil.h/cpp files). Similiarly if you need a new connection type (ie not serial or tcp) you implement them and then use Aria::deviceConnectionAddCreator call to add new types so they too will then be treated the same as the built in Aria ones (ArDeviceConnectionCreatorHelper in ariaUtil.h/cpp file is the example for that one).
|
Public Member Functions |
void | addConnectCB (ArFunctor *functor, int position=50) |
| Adds a connect callback.
|
void | addDisconnectNormallyCB (ArFunctor *functor, int position=50) |
| Adds a callback for when disconnect is called while connected.
|
void | addDisconnectOnErrorCB (ArFunctor *functor, int position=50) |
| Adds a callback for when disconnection happens because of an error.
|
void | addFailedConnectCB (ArFunctor *functor, int position=50) |
| Adds a callback for when a connection to the robot is failed.
|
void | addIgnoreReading (double ignoreReading) |
| Adds a degree at which to ignore readings (within 1 degree of nearest integer).
|
bool | addIgnoreReadings (const char *ignoreReadings) |
| Adds a series of degree at which to ignore readings (within 1 degree of nearest integer).
|
void | addReadingCB (ArFunctor *functor, int position=50) |
| Adds a callback that is called whenever a laser reading is processed.
|
virtual void | applyTransform (ArTransform trans, bool doCumulative=true) |
| Applies a transform to the buffers.
|
| ArLaser (int laserNumber, const char *name, unsigned int absoluteMaxRange, bool locationDependent=false, bool appendLaserNumberToName=true) |
| Constructor.
|
virtual bool | asyncConnect (void)=0 |
| Connect to the laser without blocking.
|
virtual bool | blockingConnect (void)=0 |
| Connect to the laser and block for the result.
|
bool | canChooseAutoBaud (void) |
bool | canChooseDegrees (void) |
bool | canChooseIncrement (void) |
bool | canChooseReflectorBits (void) |
bool | canChooseStartingBaud (void) |
bool | canChooseUnits (void) |
bool | canSetDegrees (void) |
| Sees if this class can set the degrees with doubles or not.
|
bool | canSetIncrement (void) |
bool | canSetPowerControlled (void) |
bool | chooseAutoBaud (const char *reflectorBits) |
| Sets the reflectorBits to one of the choices from getAutoBaudChoices.
|
bool | chooseDegrees (const char *range) |
| Sets the range to one of the choices from getDegreesChoices.
|
bool | chooseIncrement (const char *increment) |
| Sets the increment to one of the choices from getIncrementChoices.
|
bool | chooseReflectorBits (const char *reflectorBits) |
| Sets the reflectorBits to one of the choices from getReflectorBitsChoices.
|
bool | chooseStartingBaud (const char *reflectorBits) |
| Sets the reflectorBits to one of the choices from getStartingBaudChoices.
|
bool | chooseUnits (const char *units) |
| Sets the units to one of the choices from getUnitsChoices.
|
void | clearIgnoreReadings (void) |
| Clears the degrees we ignore readings at.
|
virtual bool | disconnect (void)=0 |
| Disconnect from the laser.
|
unsigned int | getAbsoluteMaxRange (void) |
| Gets the absolute maximum range on the sensor.
|
const char * | getAutoBaudChoice (void) |
| Gets the reflectorBits that was chosen.
|
std::list< std::string > | getAutoBaudChoices (void) |
| Gets the list of reflectorBits choices.
|
const char * | getAutoBaudChoicesString (void) |
| Gets a string with the list of reflectorBits choices seperated by |s.
|
virtual double | getConnectionTimeoutSeconds (void) |
| Gets the number of seconds without a response until connection assumed lost.
|
double | getCumulativeCleanDist (void) |
| Cumulative readings that are this close to current beams are discarded.
|
int | getCumulativeCleanInterval (void) |
| Cumulative readings are cleaned every this number of milliseconds.
|
int | getCumulativeCleanOffset (void) |
| Gets the offset for cumulative cleaning.
|
const char * | getDefaultPortType (void) |
| Gets the default port type for the laser.
|
int | getDefaultTcpPort (void) |
| Gets the default TCP port for the laser.
|
const char * | getDegreesChoice (void) |
| Gets the range that was chosen.
|
double | getDegreesChoiceDouble (void) |
| Gets the range that was chosen as a double.
|
std::list< std::string > | getDegreesChoices (void) |
| Gets the list of range choices.
|
std::map< std::string, double > | getDegreesChoicesMap (void) |
| Gets the map of degrees choices to what they mean.
|
const char * | getDegreesChoicesString (void) |
| Gets a string with the list of degrees choices seperated by |s.
|
virtual ArDeviceConnection * | getDeviceConnection (void) |
| Gets the device connection.
|
double | getEndDegrees (void) |
| Gets the end angle.
|
double | getEndDegreesMax (void) |
| Gets the maximum value for the end angle.
|
double | getEndDegreesMin (void) |
| Gets the minimum value for the end angle.
|
bool | getFlipped (void) |
| Gets if the laser is flipped or not.
|
const std::set< int > * | getIgnoreReadings (void) const |
| Gets the list of readings that we ignore.
|
double | getIncrement (void) |
| Gets the increment.
|
const char * | getIncrementChoice (void) |
| Gets the increment that was chosen.
|
double | getIncrementChoiceDouble (void) |
| Gets the increment that was chosen as a double.
|
std::list< std::string > | getIncrementChoices (void) |
| Gets the list of increment choices.
|
std::map< std::string, double > | getIncrementChoicesMap (void) |
| Gets the map of increment choices to what they mean.
|
const char * | getIncrementChoicesString (void) |
| Gets a string with the list of increment choices seperated by |s.
|
double | getIncrementMax (void) |
| Gets the increment maximum.
|
double | getIncrementMin (void) |
| Gets the increment minimum.
|
ArLog::LogLevel | getInfoLogLevel (void) |
| Gets the log level that informational things are logged at.
|
int | getLaserNumber (void) |
| Gets the number of the laser this is.
|
ArTime | getLastReadingTime (void) |
| Gets the time data was last receieved.
|
bool | getPowerControlled (void) |
| Gets if the power is controlled.
|
int | getReadingCount (void) |
| Gets the number of laser readings received in the last second.
|
const char * | getReflectorBitsChoice (void) |
| Gets the reflectorBits that was chosen.
|
std::list< std::string > | getReflectorBitsChoices (void) |
| Gets the list of reflectorBits choices.
|
const char * | getReflectorBitsChoicesString (void) |
| Gets a string with the list of reflectorBits choices seperated by |s.
|
ArPose | getSensorPosition (void) |
| Gets the position of the sensor on the robot.
|
double | getSensorPositionTh (void) |
| Gets the heading of the sensor on the robot.
|
double | getSensorPositionX (void) |
| Gets the X position of the sensor on the robot.
|
double | getSensorPositionY (void) |
| Gets the Y position of the sensor on the robot.
|
double | getStartDegrees (void) |
| Gets the start angle.
|
double | getStartDegreesMax (void) |
| Gets the maximum value for the start angle.
|
double | getStartDegreesMin (void) |
| Gets the minimum value for the start angle.
|
const char * | getStartingBaudChoice (void) |
| Gets the reflectorBits that was chosen.
|
std::list< std::string > | getStartingBaudChoices (void) |
| Gets the list of reflectorBits choices.
|
const char * | getStartingBaudChoicesString (void) |
| Gets a string with the list of reflectorBits choices seperated by |s.
|
const char * | getUnitsChoice (void) |
| Gets the units that was chosen.
|
std::list< std::string > | getUnitsChoices (void) |
| Gets the list of units choices.
|
const char * | getUnitsChoicesString (void) |
| Gets a string with the list of units choices seperated by |s.
|
bool | hasSensorPosition (void) |
| Gets if the sensor pose has been set.
|
virtual bool | isConnected (void)=0 |
| See if the laser is connected.
|
virtual bool | isTryingToConnect (void)=0 |
| See if the laser is trying to connect.
|
virtual bool | laserCheckParams (void) |
void | remConnectCB (ArFunctor *functor) |
| Adds a disconnect callback.
|
void | remDisconnectNormallyCB (ArFunctor *functor) |
| Removes a callback for when disconnect is called while connected.
|
void | remDisconnectOnErrorCB (ArFunctor *functor) |
| Removes a callback for when disconnection happens because of an error.
|
void | remFailedConnectCB (ArFunctor *functor) |
| Removes a callback for when a connection to the robot is failed.
|
void | remReadingCB (ArFunctor *functor) |
| Removes a callback that is called whenever a laser reading is processed.
|
void | resetLastCumulativeCleanTime (void) |
| Resets when the cumulative cleaning happened (so offset can help).
|
virtual void | setConnectionTimeoutSeconds (double seconds) |
| Sets the numter of seconds without a response until connection assumed lost.
|
virtual void | setCumulativeBufferSize (size_t size) |
| override the default to keep track of its been set or not
|
void | setCumulativeCleanDist (double dist) |
| Cumulative readings that are this close to current beams are discarded.
|
void | setCumulativeCleanInterval (int milliSeconds) |
| Cumulative readings are cleaned every this number of milliseconds.
|
void | setCumulativeCleanOffset (int milliSeconds) |
| Offset for cumulative cleaning.
|
virtual void | setDeviceConnection (ArDeviceConnection *conn) |
| Sets the device connection.
|
bool | setEndDegrees (double endDegrees) |
| Sets the end angle, it must be between getEndDegreesMin and getEndDegreesMax.
|
bool | setFlipped (bool flipped) |
| Sets if the laser is flipped or not.
|
bool | setIncrement (double increment) |
| Sets the increment.
|
void | setInfoLogLevel (ArLog::LogLevel infoLogLevel) |
| Sets the log level that informational things are logged at.
|
virtual void | setMaxRange (unsigned int maxRange) |
| override the default to bound the maxrange by the absolute max range
|
bool | setPowerControlled (bool powerControlled) |
| Sets if the power is controlled.
|
void | setSensorPosition (ArPose pose) |
| Sets the position of the sensor on the robot.
|
void | setSensorPosition (double x, double y, double th) |
| Sets the position of the sensor on the robot.
|
bool | setStartDegrees (double startDegrees) |
| Sets the start angle, it must be between getStartDegreesMin and getStartDegreesMax.
|
virtual | ~ArLaser () |
| Destructor.
|
Protected Member Functions |
void | internalBuildChoices (std::map< std::string, double > *choices, std::string *str, std::list< std::string > *choicesList) |
void | internalBuildChoicesString (std::list< std::string > *choices, std::string *str) |
bool | internalCheckChoice (const char *check, const char *choice, std::map< std::string, double > *choices, const char *choicesStr, double *choiceDouble) |
bool | internalCheckChoice (const char *check, const char *choice, std::list< std::string > *choices, const char *choicesStr) |
virtual void | internalGotReading (void) |
void | internalProcessReading (double x, double y, unsigned int range, bool clean, bool onlyClean) |
void | laserAllowAutoBaudChoices (const char *defaultAutoBaudChoice, std::list< std::string > autoBaudChoices) |
| Allows setting the auto baud speed to one of a number of choices.
|
void | laserAllowDegreesChoices (const char *defaultDegreesChoice, std::map< std::string, double > degreesChoices) |
| Allows setting the degrees the laser uses to one of a number of choices.
|
void | laserAllowIncrementChoices (const char *defaultIncrementChoice, std::map< std::string, double > incrementChoices) |
| Allows setting the increment to one of a number of choices.
|
void | laserAllowReflectorBitsChoices (const char *defaultReflectorBitsChoice, std::list< std::string > reflectorBitsChoices) |
void | laserAllowSetDegrees (double defaultStartDegrees, double startDegreesMin, double startDegreesMax, double defaultEndDegrees, double endDegreesMin, double endDegreesMax) |
| Allows setting the degrees the laser uses to anything in a range.
|
void | laserAllowSetIncrement (double defaultIncrement, double incrementMin, double incrementMax) |
| Allows setting the increment the laser uses to anything in a range.
|
void | laserAllowSetPowerControlled (bool defaultPowerControlled) |
| Allows setting if the power is controlled or not.
|
void | laserAllowStartingBaudChoices (const char *defaultStartingBaudChoice, std::list< std::string > startingBaudChoices) |
| Allows setting the starting baud to one of a number of choices.
|
void | laserAllowUnitsChoices (const char *defaultUnitsChoice, std::list< std::string > unitsChoices) |
| Allows setting the units the laser will use to one of a number of choices.
|
bool | laserCheckLostConnection (void) |
virtual void | laserConnect (void) |
| Function for a laser to call when it connects.
|
virtual void | laserDisconnectNormally (void) |
| Function for a laser to call when it disconnects normally.
|
virtual void | laserDisconnectOnError (void) |
| Function for a laser to call when it loses connection.
|
virtual void | laserFailedConnect (void) |
| Function for a laser to call when it fails to connects.
|
void | laserProcessReadings (void) |
bool | laserPullUnsetParamsFromRobot (void) |
| Pulls the unset params from the robot parameter file.
|
void | laserSetAbsoluteMaxRange (unsigned int absoluteMaxRange) |
| Sets the absolute maximum range on the sensor.
|
void | laserSetDefaultPortType (const char *defaultPortType) |
| Sets the laser's default connection port type.
|
void | laserSetDefaultTcpPort (int defaultLaserTcpPort) |
| Sets the laser's default TCP port.
|
virtual void | laserSetName (const char *name) |
| Called when the lasers name is set.
|
Protected Attributes |
unsigned int | myAbsoluteMaxRange |
std::string | myAutoBaudChoice |
std::list< std::string > | myAutoBaudChoices |
bool | myAutoBaudChoiceSet |
std::string | myAutoBaudChoicesString |
bool | myCanChooseAutoBaud |
bool | myCanChooseDegrees |
bool | myCanChooseIncrement |
bool | myCanChooseReflectorBits |
bool | myCanChooseStartingBaud |
bool | myCanChooseUnits |
bool | myCanSetDegrees |
bool | myCanSetIncrement |
bool | myCanSetPowerControlled |
ArDeviceConnection * | myConn |
ArCallbackList | myConnectCBList |
ArMutex | myConnMutex |
bool | myCumulativeBufferSizeSet |
double | myCumulativeCleanDist |
double | myCumulativeCleanDistSquared |
int | myCumulativeCleanInterval |
int | myCumulativeCleanOffset |
ArTime | myCumulativeLastClean |
ArCallbackList | myDataCBList |
std::string | myDefaultPortType |
int | myDefaultTcpPort |
std::string | myDegreesChoice |
double | myDegreesChoiceDouble |
std::map< std::string, double > | myDegreesChoices |
bool | myDegreesChoiceSet |
std::list< std::string > | myDegreesChoicesList |
std::string | myDegreesChoicesString |
ArCallbackList | myDisconnectNormallyCBList |
ArCallbackList | myDisconnectOnErrorCBList |
double | myEndDegrees |
double | myEndDegreesMax |
double | myEndDegreesMin |
bool | myEndDegreesSet |
ArCallbackList | myFailedConnectCBList |
bool | myFlipped |
bool | myFlippedSet |
bool | myHaveSensorPose |
std::set< int > | myIgnoreReadings |
double | myIncrement |
std::string | myIncrementChoice |
double | myIncrementChoiceDouble |
std::map< std::string, double > | myIncrementChoices |
bool | myIncrementChoiceSet |
std::list< std::string > | myIncrementChoicesList |
std::string | myIncrementChoicesString |
double | myIncrementMax |
double | myIncrementMin |
bool | myIncrementSet |
ArLog::LogLevel | myInfoLogLevel |
int | myLaserNumber |
ArTime | myLastReading |
bool | myMaxRangeSet |
bool | myPowerControlled |
bool | myPowerControlledSet |
int | myReadingCount |
int | myReadingCurrentCount |
std::string | myReflectorBitsChoice |
std::list< std::string > | myReflectorBitsChoices |
bool | myReflectorBitsChoiceSet |
std::string | myReflectorBitsChoicesString |
bool | myRobotRunningAndConnected |
ArPose | mySensorPose |
double | myStartDegrees |
double | myStartDegreesMax |
double | myStartDegreesMin |
bool | myStartDegreesSet |
std::string | myStartingBaudChoice |
std::list< std::string > | myStartingBaudChoices |
bool | myStartingBaudChoiceSet |
std::string | myStartingBaudChoicesString |
time_t | myTimeLastReading |
double | myTimeoutSeconds |
std::string | myUnitsChoice |
std::list< std::string > | myUnitsChoices |
bool | myUnitsChoiceSet |
std::string | myUnitsChoicesString |