All Classes Namespaces Files Functions Variables Enumerations Enumerator
libs/range_sensor/UrgCtrl.h
Go to the documentation of this file.
00001 #ifndef URG_CTRL_H
00002 #define URG_CTRL_H
00003 
00013 #include "RangeSensor.h"
00014 #include "Coordinate.h"
00015 
00016 
00017 namespace qrk
00018 {
00019     class Connection;
00020 
00021 
00027     class UrgCtrl : public Coordinate, public RangeSensor
00028     {
00029     public:
00030 
00031         enum {
00032             DefaultBaudrate = 115200, 
00033             DefaultRetryTimes = 8,
00034             Infinity = 0,
00035 
00036             Off = 0,                  
00037             On = 1,                   
00038         };
00039 
00040         UrgCtrl(void);
00041         virtual ~UrgCtrl(void);
00042 
00043         const char* what(void) const;
00044 
00045         bool connect(const char* device, long baudrate = DefaultBaudrate);
00046         void setConnection(Connection* con);
00047         Connection* connection(void);
00048         void disconnect(void);
00049         bool isConnected(void) const;
00050 
00051         long minDistance(void) const;
00052         long maxDistance(void) const;
00053         int maxScanLines(void) const;
00054 
00055 
00056         void setRetryTimes(size_t times);
00057         void setCapturesSize(size_t size);
00058         int scanMsec(void) const;
00059         void setCaptureMode(RangeCaptureMode mode);
00060         RangeCaptureMode captureMode(void);
00061         void setCaptureRange(int begin_index, int end_index);
00062         void setCaptureFrameInterval(size_t interval);
00063         void setCaptureTimes(size_t times);
00064         size_t remainCaptureTimes(void);
00065         void setCaptureSkipLines(size_t skip_lines);
00066         int capture(std::vector<long>& data, long* timestamp = NULL);
00067         int captureWithIntensity(std::vector<long>& data,
00068                                  std::vector<long>& intensity_data,
00069                                  long* timestamp = NULL);
00070         void stop(void);
00071         bool setTimestamp(int timestamp = 0, int* response_msec = NULL,
00072                           int* force_delay_msec = NULL);
00073         long recentTimestamp(void) const;
00074         bool setLaserOutput(bool on);
00075 
00076         double index2rad(const int index) const;
00077         int rad2index(const double radian) const;
00078         void setParameter(const RangeSensorParameter& parameter);
00079         RangeSensorParameter parameter(void) const;
00080         bool loadParameter(void);
00081         bool versionLines(std::vector<std::string>& lines);
00082         bool reboot(void);
00083         bool reset(void);
00084 
00085 
00086     protected:
00087         virtual void captureReceived(void);
00088 
00089 
00090     private:
00091         UrgCtrl(const UrgCtrl& rhs);
00092         UrgCtrl& operator = (const UrgCtrl& rhs);
00093 
00094         struct pImpl;
00095         std::auto_ptr<pImpl> pimpl;
00096     };
00097 }
00098 
00099 
00100 #endif /* !URG_CTRL_H */