|
Aria
2.8.0
|
Receives sonar data from an MTX robot Use ArSonarConnector to establish the connection and create and initiate the ArSonarMTX thread. More...
#include <ArSonarMTX.h>
Inherits ArASyncTask.
Public Types | |
| enum | Headers { HEADER1 =0xfa, HEADER2 =0xf5 } |
Public Types inherited from ArThread | |
| typedef std::map< ThreadType, ArThread * > | MapType |
| enum | Status { STATUS_FAILED =1, STATUS_NORESOURCE, STATUS_NO_SUCH_THREAD, STATUS_INVALID, STATUS_JOIN_SELF, STATUS_ALREADY_DETATCHED } |
| typedef pthread_t | ThreadType |
Public Member Functions | |
| void | addDisconnectOnErrorCB (ArFunctor *functor, int position=51) |
| Adds a callback for when disconnection happens because of an error. | |
| ArSonarMTX (int sonarBoardNum=0, const char *name="MTXSonar", ArDeviceConnection *conn=NULL, ArRobot *robot=NULL) | |
| Constructor. | |
| virtual bool | blockingConnect (bool sendTracking, bool recvTracking) |
| bool | checkLostConnection (void) |
| check for lost connections More... | |
| bool | disableForAutonomousDriving () |
| virtual bool | disconnect (void) |
| void | disconnectOnError (void) |
| disconnect | |
| virtual bool | fakeConnect () |
| Connect used for debug replay. | |
| int | getBoardDelay (void) const |
| Board Delay. | |
| int | getBoardDetectionThreshold (void) const |
| int | getBoardGain (void) const |
| int | getBoardMaxRange (void) const |
| int | getBoardNum (void) |
| bool | getBoardUseForAutonomousDriving (void) const |
| virtual double | getConnectionTimeoutSeconds (void) |
| Gets the number of seconds without a response until connection assumed lost. | |
| const char * | getDefaultPortType (void) |
| Gets the default port type for the sonar. | |
| const char * | getDefaultTcpPort (void) |
| Gets the default port type for the sonar. | |
| ArDeviceConnection * | getDeviceConnection (void) |
| Gets the device this instance receives packets from. | |
| int | getFirmwareVersion (void) const |
| ArTime | getLastReadingTime (void) |
| Gets the time data was last receieved. | |
| virtual const char * | getName (void) const |
| virtual const char * | getNameWithBoard (void) const |
| int | getNumConfiguredTransducers (void) const |
| Number of Configured Transducers. | |
| int | getNumTransducers (void) const |
| Number of Transducers from board query. | |
| ArRobotPacketReceiver * | getPacketReceiver (void) |
| Very Internal call that gets the packet sender, shouldn't be used. | |
| ArRobotPacketSender * | getPacketSender (void) |
| Very Internal call that gets the packet sender, shouldn't be used. | |
| int | getReadingCount (void) |
| Gets the number of sonar readings received in the last second. | |
| int | getUnitDetectionThres (int unit) const |
| int | getUnitGain (int unit) const |
| int | getUnitLastReading (int unit) const |
| int | getUnitMapping (int unit) const |
| int | getUnitTh (int unit) const |
| int | getUnitX (int unit) const |
| int | getUnitY (int unit) const |
| virtual void | internalGotReading (void) |
| virtual bool | isConnected (void) |
| virtual bool | isTryingToConnect (void) |
| virtual int | lockDevice () |
| Lock this device. | |
| void | log (void) |
| Logs the information about the sensor. | |
| bool | queryFirmwareVersion () |
| void | remDisconnectOnErrorCB (ArFunctor *functor) |
| Removes a callback for when disconnection happens because of an error. | |
| bool | requestFirmwareVersion () |
| bool | sendAlive () |
| bool | sendGetDelay () |
| bool | sendGetGain (unsigned char transducerNumber) |
| bool | sendGetMask () |
| bool | sendGetMaxRange (unsigned char transducerNumber) |
| bool | sendGetNumThresholdRanges () |
| bool | sendGetThresholds (unsigned char transducerNumber) |
| bool | sendGetTransducerCount () |
| bool | sendReset () |
| bool | sendSetDelay (unsigned char delay) |
| bool | sendSetGain (unsigned char transducerNumber, unsigned char gain) |
| bool | sendSetMask (unsigned char maskLsb, unsigned char maskMsb) |
| bool | sendSetMaxRange (unsigned char transducerNumber, int echoSampleSize) |
| bool | sendSetThresholds (unsigned char transducerNumber, int thres) |
| bool | sendStart () |
| bool | sendStop () |
| virtual void | setConnectionTimeoutSeconds (double seconds) |
| Sets the numter of seconds without a response until connection assumed lost. | |
| void | setDeviceConnection (ArDeviceConnection *conn) |
| Sets the device this instance receives packets from. | |
| void | setInfoLogLevel (ArLog::LogLevel infoLogLevel) |
| virtual void | setRobot (ArRobot *robot) |
| Sets the robot pointer, also attaches its process function to the robot as a Sensor Interpretation task. More... | |
| virtual int | tryLockDevice () |
| Try to lock this device. | |
| bool | turnOffTransducers () |
| bool | turnOnTransducers () |
| virtual int | unlockDevice () |
| Unlock this device. | |
| bool | validateDelay () |
| bool | validateGain () |
| bool | validateMaxRange () |
| bool | validateNumThresholdRanges () |
| bool | validateThresholds () |
| bool | validateTransducers () |
| virtual | ~ArSonarMTX () |
| Destructor. | |
Public Member Functions inherited from ArASyncTask | |
| ArASyncTask () | |
| Constructor. | |
| virtual int | create (bool joinable=true, bool lowerPriority=true) |
| Create the task and start it going. | |
| virtual const char * | getThreadActivity (void) |
| Gets a string that describes what the thread is doing, or NULL if it doesn't know. More... | |
| virtual void | run (void) |
| Run without creating a new thread. More... | |
| virtual void | runAsync (void) |
| Run in its own thread. | |
| virtual void * | runInThisThread (void *arg=0) |
| Internal function used with system threading system to run the new thread. More... | |
| virtual void | stopRunning (void) |
| Stop the thread. | |
| virtual | ~ArASyncTask () |
| Destructor. | |
Public Member Functions inherited from ArThread | |
| ArThread (bool blockAllSignals=true) | |
| Constructor. | |
| ArThread (ThreadType thread, bool joinable, bool blockAllSignals=true) | |
| Constructor - starts the thread. | |
| ArThread (ArFunctor *func, bool joinable=true, bool blockAllSignals=true) | |
| Constructor - starts the thread. | |
| virtual void | cancel (void) |
| Cancel the thread. | |
| virtual int | detach (void) |
| Detatch the thread so it cant be joined. | |
| bool | getBlockAllSignals (void) |
| Do we block all process signals at startup? | |
| virtual ArFunctor * | getFunc (void) const |
| Get the functor that the thread runs. | |
| virtual bool | getJoinable (void) const |
| Get the joinable status of the thread. | |
| virtual ThreadType | getOSThread (void) const |
| Get the underlying os thread type. | |
| pid_t | getPID (void) |
| virtual bool | getRunning (void) const |
| Get the running status of the thread. | |
| virtual bool | getRunningWithLock (void) |
| Get the running status of the thread, locking around the variable. | |
| virtual const ThreadType * | getThread (void) const |
| Get the underlying thread type. | |
| virtual const char * | getThreadName (void) |
| Gets the name of the thread. | |
| pid_t | getTID (void) |
| virtual bool | isThreadFinished () const |
| Returns whether the thread has been completed and can be deleted. More... | |
| virtual bool | isThreadStarted () const |
| Returns whether the thread has been started. More... | |
| virtual int | join (void **ret=NULL) |
| Join on the thread. | |
| int | lock (void) |
| Lock the thread instance. More... | |
| virtual void | logThreadInfo (void) |
| Logs the information about this thread. | |
| virtual void | setRunning (bool running) |
| Set the running value on the thread. | |
| virtual void | setThreadName (const char *name) |
| Sets the name of the thread. | |
| virtual void | threadFinished (void) |
| Marks the thread as finished and logs useful debugging information. More... | |
| virtual void | threadStarted (void) |
| Marks the thread as started and logs useful debugging information. More... | |
| int | tryLock (void) |
| Try to lock the thread instance without blocking. More... | |
| int | unlock (void) |
| Unlock the thread instance. More... | |
| virtual | ~ArThread () |
| Destructor. | |
Protected Member Functions | |
| void | clear (void) |
| void | failedToConnect (void) |
| virtual void * | runThread (void *arg) |
| void | sensorInterp (void) |
| virtual void | sonarSetName (const char *name) |
Protected Member Functions inherited from ArThread | |
| virtual int | doJoin (void **ret=NULL) |
Protected Attributes | |
| ArRetFunctorC< bool, ArSonarMTX > | myAriaExitCB |
| unsigned char | myAutonomousDrivingTransducerMaskLSB |
| unsigned char | myAutonomousDrivingTransducerMaskMSB |
| unsigned int | myBoardDelay |
| unsigned int | myBoardDetectionThreshold |
| unsigned int | myBoardGain |
| unsigned int | myBoardMaxRange |
| int | myBoardNum |
| bool | myBoardUseForAutonomousDriving |
| ArDeviceConnection * | myConn |
| ArMutex | myDataMutex |
| std::string | myDefaultPortType |
| std::string | myDefaultTcpPort |
| ArMutex | myDeviceMutex |
| ArCallbackList | myDisconnectOnErrorCBList |
| int | myFirmwareVersion |
| ArLog::LogLevel | myInfoLogLevel |
| bool | myIsConnected |
| ArTime | myLastReading |
| ArLog::LogLevel | myLogLevel |
| std::string | myName |
| char | myNameWithBoard [100] |
| int | myNumConfiguredTransducers |
| int | myNumTransducers |
| std::list< ArRobotPacket * > | myPackets |
| ArMutex | myPacketsMutex |
| ArTime | myPrevSensorIntTime |
| ArFunctorC< ArSonarMTX > | myProcessCB |
| int | myReadingCount |
| int | myReadingCurrentCount |
| ArRobotPacketReceiver * | myReceiver |
| bool | myRecvTracking |
| ArRobot * | myRobot |
| bool | myRobotRunningAndConnected |
| ArRobotPacketSender * | mySender |
| bool | mySendTracking |
| ArFunctorC< ArSonarMTX > | mySensorInterpTask |
| std::map< int, std::map< int, int > > | mySonarMap |
| bool | myStartConnect |
| time_t | myTimeLastReading |
| double | myTimeoutSeconds |
| unsigned char | myTransducerMaskLSB |
| unsigned char | myTransducerMaskMSB |
| bool | myTransducersAreOn |
| bool | myTryingToConnect |
| unsigned char | myVersion |
| bool | myWarnedAboutExtraSonar |
Protected Attributes inherited from ArThread | |
| bool | myBlockAllSignals |
| bool | myFinished |
| ArFunctor * | myFunc |
| bool | myJoinable |
| ArMutex | myMutex |
| std::string | myName |
| pid_t | myPID |
| bool | myRunning |
| State variable to denote when the thread should continue or exit. | |
| bool | myStarted |
| ArStrMap | myStrMap |
| ThreadType | myThread |
| pid_t | myTID |
Additional Inherited Members | |
Static Public Member Functions inherited from ArThread | |
| static void | cancelAll (void) |
| Cancel all threads. | |
| static ArLog::LogLevel | getLogLevel (void) |
| Gets the logging level for thread information. | |
| static ThreadType | getThisOSThread (void) |
| Get the underlying os thread type of this thread. | |
| static const ThreadType * | getThisThread (void) |
| Get the underlying thread type of this thread. | |
| static const char * | getThisThreadName (void) |
| Gets the name of the this thread. | |
| static void | init (void) |
| Initialize the internal book keeping structures. More... | |
| static void | joinAll (void) |
| Join on all threads. | |
| static ThreadType | osSelf (void) |
| Returns the os self of the current thread. More... | |
| static ArThread * | self (void) |
| Returns the instance of your own thread (the current one) More... | |
| static void | setLogLevel (ArLog::LogLevel level) |
| Sets the logging level for thread information. | |
| static void | shutdown () |
| Shuts down and deletes the last remaining thread; call after joinAll. | |
| static void | stopAll () |
| Stop all threads. | |
| static void | yieldProcessor (void) |
| Yield the processor to another thread. | |
Static Protected Member Functions inherited from ArThread | |
| static void | addThreadToMap (ThreadType pt, ArThread *at) |
| static ArThread * | findThreadInMap (ThreadType t) |
| static void | removeThreadFromMap (ThreadType t) |
Static Protected Attributes inherited from ArThread | |
| static ArLog::LogLevel | ourLogLevel = ArLog::Verbose |
| static MapType | ourThreads |
| static ArMutex | ourThreadsMutex |
| static std::string | ourUnknownThreadName = "unknown" |
Receives sonar data from an MTX robot Use ArSonarConnector to establish the connection and create and initiate the ArSonarMTX thread.
|
virtual |
MPL added these lines to help someone debug sonar ESD stuff
| bool ArSonarMTX::checkLostConnection | ( | void | ) |
check for lost connections
This will check if the sonar has lost connection.
If there is no robot it is a straightforward check of last reading time against getConnectionTimeoutSeconds. If there is a robot then it will not start the check until the sonar is running and connected.
|
virtual |
Sets the robot pointer, also attaches its process function to the robot as a Sensor Interpretation task.