00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __LASERDISTANCE_HARDWARE__
00019 #define __LASERDISTANCE_HARDWARE__
00020
00021 #include <rtt/RTT.hpp>
00022
00023 #include <rtt/RTT.hpp>
00024 #include <rtt/TaskContext.hpp>
00025 #include <rtt/Ports.hpp>
00026 #include <rtt/Event.hpp>
00027 #include <rtt/Properties.hpp>
00028
00029 #define OROPKG_DEVICE_DRIVERS_COMEDI 1
00030
00031 #if defined (OROPKG_DEVICE_DRIVERS_COMEDI)
00032
00033 #include "dev/ComediDevice.hpp"
00034 #include "dev/ComediSubDeviceAIn.hpp"
00035 #include <rtt/dev/AnalogInput.hpp>
00036 #endif
00037
00038 #include <ocl/OCL.hpp>
00039
00040 namespace OCL {
00047 class LaserDistance : public RTT::TaskContext {
00048 public:
00058 LaserDistance(std::string name,unsigned int nr_chan,std::string propertyfilename="cpf/LaserDistance.cpf");
00059 virtual~LaserDistance();
00060
00061 virtual bool startup();
00062 virtual void update();
00063 virtual void shutdown();
00064
00065
00066
00067 private:
00068 #if defined (OROPKG_DEVICE_DRIVERS_COMEDI)
00069 ComediDevice* _comediDev_NI6024;
00070 ComediSubDeviceAIn* _comediSubdevAIn;
00071 std::vector<RTT::AnalogInput*> _LaserInput;
00072 #endif
00073
00074 unsigned int _nr_chan;
00075 protected:
00077 RTT::Property<std::vector<double> > _simulation_values;
00079 RTT::Property<std::vector<double> > _volt2m;
00081 RTT::Property<std::vector<double> > _offsets;
00083 RTT::Property<std::vector<double> > _lowerLimits;
00085 RTT::Property<std::vector<double> > _upperLimits;
00087 RTT::WriteDataPort<std::vector<double> > _distances;
00089 RTT::Event< void(int,double)> _distanceOutOfRange;
00090 private:
00091 std::vector<double> _measurement, _distances_local;
00092 std::string _propertyfile;
00093 };
00094 }
00095
00096 #endif