00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __DEMOTOOL_HARDWARE__
00019 #define __DEMOTOOL_HARDWARE__
00020
00021 #include <rtt/RTT.hpp>
00022 #include <rtt/TaskContext.hpp>
00023 #include <rtt/Ports.hpp>
00024 #include <rtt/Event.hpp>
00025 #include <rtt/Properties.hpp>
00026 #include <rtt/Method.hpp>
00027 #include <rtt/Command.hpp>
00028 #include <rtt/TimeService.hpp>
00029 #include <kdl/frames.hpp>
00030
00031 #include <ocl/OCL.hpp>
00032
00033 namespace OCL
00034 {
00035
00042 class Demotool : public RTT::TaskContext
00043 {
00044 public:
00052 Demotool(std::string name, std::string propertyfilename="cpf/Demotool.cpf");
00053 virtual~Demotool();
00054 virtual bool startup();
00055 virtual void update();
00056 virtual void shutdown();
00057
00058 protected:
00059
00060 RTT::Property<std::vector<double> > _pos_leds_demotool;
00061 RTT::Property<double> _mass_demotool;
00062 RTT::Property<KDL::Vector> _center_gravity_demotool, _gravity_dir_world;
00063 RTT::Property<KDL::Frame> _Frame_demotool_manip, _Frame_demotool_fs, _Frame_world_camera;
00064
00065
00066 RTT::ReadDataPort<KDL::Wrench> _Wrench_fs_fs_port;
00067 RTT::ReadDataPort<std::vector<KDL::Vector> > _Vector_led_camera_port;
00068
00069
00070 RTT::DataPort<KDL::Wrench> _Wrench_world_world_port, _Wrench_manip_manip_port;
00071 RTT::DataPort<KDL::Twist> _Twist_world_world_port, _Twist_world_manip_port;
00072 RTT::DataPort<KDL::Frame> _Frame_world_manip_port;
00073 RTT::DataPort<unsigned int> _num_visible_leds_port;
00074
00075
00076 RTT::Command<bool(KDL::Wrench)> _add_offset;
00077
00078
00079 RTT::Method<void(void)> _calibrate_world_to_manip, _calibrate_wrench_sensor;
00080
00081 private:
00082 void calibrateWorldToManip();
00083 void calibrateWrenchSensor();
00084
00085 std::string _propertyfile;
00086 std::vector<KDL::Vector> _Vector_led_demotool, _Vector_led_camera;
00087
00088 KDL::Twist _Twist_world_manip;
00089 KDL::Wrench _Wrench_fs_fs, _Wrench_world_world, _Wrench_gravity_world_world;
00090 KDL::Frame _Frame_world_demotool, _Frame_camera_demotool, _Frame_world_manip, _Frame_world_manip_old, _Frame_world_fs;
00091 unsigned int _num_visible_leds, _num_leds;
00092 std::vector<bool> _visible_leds;
00093 bool _is_initialized;
00094 double _period;
00095 RTT::TimeService::ticks _time_begin;
00096
00097
00098 };
00099 }
00100
00101 #endif