00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PEEKABOT_JOINT_HH_INCLUDED
00024 #define PEEKABOT_JOINT_HH_INCLUDED
00025
00026
00027 #include <stdexcept>
00028 #include <Eigen/Geometry>
00029
00030 #include "Types.hh"
00031 #include "SceneObject.hh"
00032 #include "XMLHandler.hh"
00033
00034
00035 namespace peekabot
00036 {
00037 class ScopedHandler;
00038
00039
00047 class Joint : public SceneObject
00048 {
00049 public:
00056 Joint(const std::string &default_name) throw();
00057
00058 Joint(const std::string &default_name,
00059 ScopedHandler *handler) throw();
00060
00061 virtual ~Joint() throw();
00062
00066 float get_min_value() const throw();
00067
00079 void set_min_value(float min) throw(std::domain_error);
00080
00084 float get_max_value() const throw();
00085
00097 void set_max_value(float max) throw(std::domain_error);
00098
00105 float get_value() const throw();
00106
00107 void set_value_offset(float offset) throw();
00108
00109 float get_value_offset() const throw();
00110
00118 void set_value(float value) throw(std::domain_error);
00119
00127 virtual Eigen::Transform3f calculate_dof_transform(float value)
00128 const throw() = 0;
00129
00130 Eigen::Transform3f get_full_transform(float value)
00131 const throw();
00132
00135
00136 typedef boost::signals2::signal<void ()> JointValueSetSignal;
00137
00138 typedef boost::signals2::signal<void ()> JointMinSetSignal;
00139
00140 typedef boost::signals2::signal<void ()> JointMaxSetSignal;
00141
00142 typedef boost::signals2::signal<void ()> JointOffsetSetSignal;
00143
00144 inline JointValueSetSignal &joint_value_set_signal()
00145 {
00146 return m_joint_value_set_signal;
00147 }
00148
00149 inline JointMinSetSignal &joint_min_set_signal()
00150 {
00151 return m_joint_min_set_signal;
00152 }
00153
00154 inline JointMaxSetSignal &joint_max_set_signal()
00155 {
00156 return m_joint_max_set_signal;
00157 }
00158
00159 inline JointOffsetSetSignal &joint_offset_set_signal()
00160 {
00161 return m_joint_offset_set_signal;
00162 }
00163
00165
00166 protected:
00171 void check_pre_transform() const throw();
00172
00173
00178 mutable Eigen::Transform3f m_pre_dof_mtop;
00179
00180
00188 Eigen::Transform3f m_dof_xform;
00189
00190 virtual PropMap &get_prop_adapters();
00191
00192 private:
00193 static void create_prop_adapters(PropMap &adapters);
00194
00195 private:
00201 float m_min;
00202
00208 float m_max;
00209
00215 float m_val;
00216
00217 float m_offset;
00218
00219 JointValueSetSignal m_joint_value_set_signal;
00220 JointMinSetSignal m_joint_min_set_signal;
00221 JointMaxSetSignal m_joint_max_set_signal;
00222 JointOffsetSetSignal m_joint_offset_set_signal;
00223 };
00224 }
00225
00226
00227 #endif // PEEKABOT_JOINT_HH_INCLUDED