Blender V2.61 - r43446
|
00001 /* 00002 * ControlledObject.hpp 00003 * 00004 * Created on: Jan 5, 2009 00005 * Author: rubensmits 00006 */ 00007 00008 #ifndef CONTROLLEDOBJECT_HPP_ 00009 #define CONTROLLEDOBJECT_HPP_ 00010 00011 #include "kdl/frames.hpp" 00012 #include "eigen_types.hpp" 00013 00014 #include "Object.hpp" 00015 #include "ConstraintSet.hpp" 00016 #include <vector> 00017 00018 namespace iTaSC { 00019 00020 #define CONSTRAINT_ID_ALL ((unsigned int)-1) 00021 00022 class ControlledObject : public Object { 00023 protected: 00024 e_scalar m_maxDeltaQ; 00025 unsigned int m_nq,m_nc,m_nee; 00026 e_matrix m_Wq,m_Cq; 00027 e_vector m_Wy,m_ydot,m_qdot; 00028 std::vector<e_matrix> m_JqArray; 00029 public: 00030 ControlledObject(); 00031 virtual ~ControlledObject(); 00032 00033 class JointLockCallback { 00034 public: 00035 JointLockCallback() {} 00036 virtual ~JointLockCallback() {} 00037 00038 // lock a joint, no need to update output 00039 virtual void lockJoint(unsigned int q_nr, unsigned int ndof) = 0; 00040 // lock a joint and update output in view of reiteration 00041 virtual void lockJoint(unsigned int q_nr, unsigned int ndof, double* qdot) = 0; 00042 }; 00043 00044 virtual void initialize(unsigned int _nq,unsigned int _nc, unsigned int _nee); 00045 00046 // returns true when a joint has been locked via the callback and the solver must run again 00047 virtual bool updateJoint(const Timestamp& timestamp, JointLockCallback& callback) = 0; 00048 virtual void updateControlOutput(const Timestamp& timestamp)=0; 00049 virtual void setJointVelocity(const e_vector qdot_in){m_qdot = qdot_in;}; 00050 virtual double getMaxTimestep(double& timestep); 00051 virtual bool setControlParameter(unsigned int constraintId, unsigned int valueId, ConstraintAction action, e_scalar value, double timestep=0.0)=0; 00052 00053 virtual const e_vector& getControlOutput() const{return m_ydot;} 00054 00055 virtual const e_matrix& getJq(unsigned int ee) const; 00056 00057 virtual const e_matrix& getCq() const{return m_Cq;}; 00058 00059 virtual e_matrix& getWq() {return m_Wq;}; 00060 virtual void setWq(const e_matrix& Wq_in){m_Wq = Wq_in;}; 00061 00062 virtual const e_vector& getWy() const {return m_Wy;}; 00063 00064 virtual const unsigned int getNrOfCoordinates(){return m_nq;}; 00065 virtual const unsigned int getNrOfConstraints(){return m_nc;}; 00066 }; 00067 00068 } 00069 00070 #endif /* CONTROLLEDOBJECT_HPP_ */