00001
00002
00003
00004
00005
00006
00007
00008
00020 #ifndef __DEVICE_INTERFACE_H_
00021 #define __DEVICE_INTERFACE_H_
00022
00023 #include <ros/ros.h>
00024 #include <art_msgs/DriverState.h>
00025
00026 namespace device_interface
00027 {
00028
00030 class DeviceBase
00031 {
00032 public:
00033
00038 DeviceBase(ros::NodeHandle node):
00039 node_(node)
00040 {}
00041
00042 typedef art_msgs::DriverState::_state_type DeviceState;
00043 virtual DeviceState state(ros::Time recently) = 0;
00044
00045 protected:
00046 ros::NodeHandle node_;
00047 ros::Subscriber sub_;
00048 };
00049
00051 class ServoDeviceBase: public DeviceBase
00052 {
00053 public:
00054
00059 ServoDeviceBase(ros::NodeHandle node):
00060 DeviceBase(node)
00061 {}
00062
00063 virtual float last_request() = 0;
00064 virtual float value() = 0;
00065
00071 virtual void publish(float new_position, ros::Time cycle_time) = 0;
00072
00073 protected:
00074 ros::Publisher pub_;
00075 };
00076
00077 };
00078
00079 #endif // __DEVICE_INTERFACE_H_