00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef WRENCH_SENSOR_H
00023 #define WRENCH_SENSOR_H
00024
00025 #include <rtt/TaskContext.hpp>
00026 #include <rtt/Attribute.hpp>
00027 #include <rtt/Event.hpp>
00028 #include <rtt/Method.hpp>
00029 #include <rtt/Command.hpp>
00030 #include <rtt/Ports.hpp>
00031 #include <kdl/frames.hpp>
00032
00033 #include <rtt/RTT.hpp>
00034 #if defined (OROPKG_OS_LXRT)
00035
00036 #include "drivers/jr3_lxrt_common.h"
00037
00038 #else
00039
00040 struct s16Forces
00041 {
00042 short Fx, Fy, Fz, Tx, Ty, Tz;
00043 };
00044
00045 #endif
00046
00047 #include <ocl/OCL.hpp>
00048
00049 namespace OCL
00050 {
00058 class WrenchSensor : public RTT::TaskContext
00059 {
00060 public:
00061 WrenchSensor(std::string name);
00062 virtual ~WrenchSensor(){};
00063
00064 protected:
00065 virtual bool configureHook();
00066 virtual bool startHook();
00067 virtual void updateHook();
00068 virtual void stopHook();
00069 virtual void cleanupHook(){};
00070
00072 RTT::DataPort<KDL::Wrench> outdatPort;
00073
00076 RTT::Event<void(std::string)> maximumLoadEvent;
00077
00079 RTT::Method<KDL::Wrench(void)> maxMeasurement_mtd;
00081 RTT::Method<KDL::Wrench(void)> minMeasurement_mtd;
00083 RTT::Method<KDL::Wrench(void)> zeroMeasurement_mtd;
00085 RTT::Command<bool(double)> chooseFilter_cmd;
00087 RTT::Command<bool(KDL::Wrench)> setOffset_cmd;
00089 RTT::Command<bool(KDL::Wrench)> addOffset_cmd;
00090
00091 RTT::Property<KDL::Wrench> offset;
00092 RTT::Property<unsigned int> dsp_prop;
00093 RTT::Property<double> filter_period_prop;
00094
00095 private:
00096 virtual KDL::Wrench maxMeasurement() const;
00097 virtual KDL::Wrench minMeasurement() const;
00098 virtual KDL::Wrench zeroMeasurement() const;
00099
00100 virtual bool chooseFilter(double period);
00101 virtual bool chooseFilterDone() const;
00102
00103 virtual bool setOffset(KDL::Wrench in);
00104 virtual bool addOffset(KDL::Wrench in);
00105 virtual bool setOffsetDone() const;
00106
00107 unsigned int filterToReadFrom;
00108 unsigned int dsp;
00109
00110 KDL::Wrench writeBuffer;
00111 s16Forces write_struct,full_scale;
00112
00113 };
00114 }
00115
00116 #endif