00001 #ifndef ETHERCAT_IO_HPP
00002 #define ETHERCAT_IO_HPP
00003
00004 #include "dev/DigitalEtherCATOutputDevice.hpp"
00005 #include "dev/DigitalEtherCATInputDevice.hpp"
00006 #include "dev/AnalogEtherCATOutputDevice.hpp"
00007 #include "dev/AnalogEtherCATInputDevice.hpp"
00008 #include "dev/EtherCATEncoder.hpp"
00009
00010 #include <vector>
00011 #include <rtt/RTT.hpp>
00012
00013 #include <rtt/TaskContext.hpp>
00014 #include <rtt/Ports.hpp>
00015 #include <rtt/Event.hpp>
00016 #include <rtt/Properties.hpp>
00017 #include <rtt/Command.hpp>
00018
00019 #include <rtt/dev/AnalogOutput.hpp>
00020 #include <rtt/dev/DigitalOutput.hpp>
00021
00022 #include <ocl/OCL.hpp>
00023
00024 struct netif;
00025
00026 namespace OCL
00027 {
00031 class EthercatIO : public RTT::TaskContext
00032 {
00033
00034 Property<std::string> rteth;
00035 Method <int(void)> get_pos;
00036 Method <void(int)> set_pos;
00037 Method <int(void)> get_turn;
00038 Method <void(int)> set_turn;
00039 Method <bool(void)> upcounting;
00040 int mget_pos(void);
00041 void mset_pos(int);
00042 int mget_turn(void);
00043 void mset_turn(int);
00044 bool mupcounting(void);
00045 struct netif *ni;
00046 int cnt_dig;
00047 unsigned char* fmmu_buffer;
00048 DigitalEtherCATOutputDevice digoutputs;
00049 DigitalEtherCATOutputDevice digoutputs2;
00050 DigitalEtherCATInputDevice diginputs;
00051 AnalogEtherCATOutputDevice anaoutputs;
00052 AnalogEtherCATInputDevice anainputs;
00053 EtherCATEncoder enc;
00054 double prevvoltage;
00055
00056
00057
00058 public:
00059 EthercatIO(std::string name);
00060 ~EthercatIO();
00061
00062 DigitalInInterface* getDigitalIn() { return &diginputs;}
00063 DigitalOutInterface* getDigitalOut() { return &digoutputs;}
00064 AnalogInInterface* getAnalogIn() { return &anainputs;}
00065 AnalogOutInterface* getAnalogOut() { return &anaoutputs;}
00066
00071 virtual bool startup();
00072
00076 virtual void update();
00077
00081 virtual void shutdown();
00082
00083 };
00084 }
00085 #endif // EthercatDemoIO