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/bindings/rtt/toolkit.hpp>
00032 #include <kdl/frames.hpp>
00033
00034 #include <rtt/RTT.hpp>
00035 #if defined (OROPKG_OS_LXRT)
00036
00037 #include "drivers/jr3_lxrt_common.h"
00038
00039 #else
00040
00041 struct s16Forces
00042 {
00043 short Fx, Fy, Fz, Tx, Ty, Tz;
00044 };
00045
00046 #endif
00047
00048 #include <ocl/OCL.hpp>
00049
00050 namespace OCL
00051 {
00059 class WrenchSensor : public RTT::TaskContext
00060 {
00061 public:
00062 WrenchSensor(std::string name);
00063 virtual ~WrenchSensor(){};
00064
00065 protected:
00066 virtual bool configureHook();
00067 virtual bool startHook();
00068 virtual void updateHook();
00069 virtual void stopHook();
00070 virtual void cleanupHook(){};
00071
00073 RTT::DataPort<KDL::Wrench> outdatPort;
00074
00077 RTT::Event<void(std::string)> maximumLoadEvent;
00078
00080 RTT::Method<KDL::Wrench(void)> maxMeasurement_mtd;
00082 RTT::Method<KDL::Wrench(void)> minMeasurement_mtd;
00084 RTT::Method<KDL::Wrench(void)> zeroMeasurement_mtd;
00086 RTT::Command<bool(double)> chooseFilter_cmd;
00088 RTT::Command<bool(KDL::Wrench)> setOffset_cmd;
00090 RTT::Command<bool(KDL::Wrench)> addOffset_cmd;
00091
00092 RTT::Property<KDL::Wrench> offset;
00093 RTT::Property<unsigned int> dsp_prop;
00094 RTT::Property<double> filter_period_prop;
00095
00096 private:
00097 virtual KDL::Wrench maxMeasurement() const;
00098 virtual KDL::Wrench minMeasurement() const;
00099 virtual KDL::Wrench zeroMeasurement() const;
00100
00101 virtual bool chooseFilter(double period);
00102 virtual bool chooseFilterDone() const;
00103
00104 virtual bool setOffset(KDL::Wrench in);
00105 virtual bool addOffset(KDL::Wrench in);
00106 virtual bool setOffsetDone() const;
00107
00108 unsigned int filterToReadFrom;
00109 unsigned int dsp;
00110
00111 KDL::Wrench writeBuffer;
00112 s16Forces write_struct,full_scale;
00113
00114 };
00115 }
00116
00117 #endif