jspace/jspace/controller_library.hpp

Go to the documentation of this file.
00001 /*
00002  * Stanford Whole-Body Control Framework http://stanford-wbc.sourceforge.net/
00003  *
00004  * Copyright (C) 2010 The Board of Trustees of The Leland Stanford Junior University. All rights reserved.
00005  *
00006  * This program is free software: you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public License
00008  * as published by the Free Software Foundation, either version 3 of
00009  * the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this program.  If not, see
00018  * <http://www.gnu.org/licenses/>
00019  */
00020 
00026 #ifndef JSPACE_CONTROLLER_LIBRARY_HPP
00027 #define JSPACE_CONTROLLER_LIBRARY_HPP
00028 
00029 #include <jspace/Controller.hpp>
00030 #include <string>
00031 
00032 
00033 namespace jspace {
00034   
00035   
00036   typedef enum {
00037     COMP_NONE         = 0x00,
00038     COMP_GRAVITY      = 0x01,
00039     COMP_CORIOLIS     = 0x02,
00040     COMP_MASS_INERTIA = 0x04
00041   } compensation_flags_t;
00042   
00043   
00044   class FloatController
00045     : public Controller
00046   {
00047   public:
00048     virtual Status setGoal(Vector const & goal);
00049     virtual Status getGoal(Vector & goal) const;
00050     virtual Status getActual(Vector & actual) const;
00051     
00052     virtual Status setGains(Vector const & kp, Vector const & kd);
00053     virtual Status getGains(Vector & kp, Vector & kd) const;
00054     
00055     virtual Status latch(Model const & model);
00056     virtual Status computeCommand(Model const & model, Vector & tau);
00057   };
00058   
00059   
00060   class GoalControllerBase
00061     : public Controller
00062   {
00063   public:
00064     GoalControllerBase(int compensation_flags,
00065            Vector const & default_kp,
00066            Vector const & default_kd);
00067     
00068     virtual Status init(Model const & model);
00069     
00070     virtual Status setGoal(Vector const & goal);
00071     virtual Status getGoal(Vector & goal) const;
00072     
00073     virtual Status setGains(Vector const & kp, Vector const & kd);
00074     virtual Status getGains(Vector & kp, Vector & kd) const;
00075     
00076   protected:
00077     int compensation_flags_;
00078     Vector default_kp_;
00079     Vector default_kd_;
00080     Vector goal_;
00081     Vector kp_;
00082     Vector kd_;
00083   };
00084   
00085   
00086   class JointGoalController
00087     : public GoalControllerBase
00088   {
00089   public:
00090     JointGoalController(int compensation_flags,
00091       Vector const & default_kp,
00092       Vector const & default_kd);
00093     
00094     virtual Status getActual(Vector & actual) const;
00095     virtual Status latch(Model const & model);
00096     virtual Status computeCommand(Model const & model, Vector & tau);
00097     
00098   protected:
00099     Vector actual_;
00100   };
00101   
00102 }
00103 
00104 #endif // JSPACE_CONTROLLER_LIBRARY_HPP

Generated on Fri Aug 26 01:31:16 2011 for Stanford Whole-Body Control Framework by  doxygen 1.5.4