00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef __KRYTON_K600_SENSOR__
00022 #define __KRYTON_K600_SENSOR__
00023
00024 #include <rtt/RTT.hpp>
00025 #include <kdl/frames.hpp>
00026 #include <rtt/RTT.hpp>
00027 #include <rtt/TaskContext.hpp>
00028 #include <rtt/NonPeriodicActivity.hpp>
00029 #include <rtt/Ports.hpp>
00030
00031 #if defined (OROPKG_OS_LXRT)
00032 #include <rtai_mbx.h>
00033 #define MAX_NUM_LEDS 20 // Maximum number of leds
00034 #define NUM_COORD_PER_LED 3 // Number of coordinates per led
00035 #define MAX_NUM_COORD (MAX_NUM_LEDS*NUM_COORD_PER_LED)
00036 #define MAX_MESSAGE_LENGTH (15 + MAX_NUM_COORD * 8)
00037 #endif
00038
00039 #include <ocl/OCL.hpp>
00040
00041 namespace OCL
00042 {
00043 class KryptonK600Sensor
00044 :public RTT::TaskContext
00045 #if defined (OROPKG_OS_LXRT)
00046 ,public RTT::NonPeriodicActivity
00047 #endif
00048 {
00049
00050 public:
00051 KryptonK600Sensor(std::string name, unsigned int num_leds, unsigned int priority=0);
00052 virtual ~KryptonK600Sensor();
00053
00054 private:
00055 virtual bool startup(){return true;}
00056 virtual void update(){};
00057 virtual void shutdown(){};
00058
00059 #if defined (OROPKG_OS_LXRT)
00060 unsigned short _length_msg, _type_msg, _nr_msg, _nr_answer_msg, _type_body_msg, _cycle_nr, _nr_markers;
00061 unsigned char _msg_valid;
00062
00063 SEM * udp_message_arrived;
00064 MBX * udp_message;
00065
00066 bool _keep_running;
00067
00068 bool interprete_K600_Msg(char* msg);
00069
00070 virtual void loop();
00071 #endif
00072
00073 unsigned int _num_leds;
00074
00075 std::vector<KDL::Vector> _ledPositions_local;
00076 RTT::DataPort<std::vector<KDL::Vector> > _ledPositions;
00077 };
00078 };
00079
00080 #endif
00081