• Main Page
  • Related Pages
  • Classes
  • Files
  • File List

src/Joint.hh

00001 /*
00002  * Copyright Staffan Gimåker 2006-2010.
00003  * Copyright Anders Boberg 2007.
00004  *
00005  * ---
00006  *
00007  * This file is part of peekabot.
00008  *
00009  * peekabot is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 3 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * peekabot is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
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

Generated on Sun Jan 30 2011 for peekabot by  doxygen 1.7.1