jspace/jspace/Controller.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_HPP
00027 #define JSPACE_CONTROLLER_HPP
00028 
00029 #include <jspace/Status.hpp>
00030 #include <jspace/wrap_eigen.hpp>
00031 #include <vector>
00032 
00033 
00034 namespace jspace {
00035   
00036   class Model;
00037   
00038   
00041   struct controller_info_getter_s {
00042     virtual ~controller_info_getter_s() {}
00043     virtual void getDOFNames(Model const & model, std::vector<std::string> & names) const = 0;
00044     virtual void getDOFUnits(Model const & model, std::vector<std::string> & names) const = 0;
00045     virtual void getGainNames(Model const & model, std::vector<std::string> & names) const = 0;
00046     virtual void getLimits(Model const & model, Vector & limits_lower, Vector & limits_upper) const = 0;
00047   };
00048   
00050   struct jspace_controller_info_getter_s
00051     : public controller_info_getter_s {
00052     virtual void getDOFNames(Model const & model, std::vector<std::string> & names) const;
00053     virtual void getDOFUnits(Model const & model, std::vector<std::string> & names) const;
00054     virtual void getGainNames(Model const & model, std::vector<std::string> & names) const;
00055     virtual void getLimits(Model const & model, Vector & limits_lower, Vector & limits_upper) const;
00056   };
00057   
00058   
00059   class Controller
00060   {
00061   public:
00062     Controller();
00063     virtual ~Controller();
00064     
00079     virtual controller_info_getter_s const * getInfo() const;
00080     
00084     virtual Status init(Model const & model) { Status ok; return ok; }
00085     
00086     virtual Status setGoal(Vector const & goal) = 0;
00087     virtual Status getGoal(Vector & goal) const = 0;
00088     virtual Status getActual(Vector & actual) const = 0;
00089     
00090     virtual Status setGains(Vector const & kp, Vector const & kd) = 0;
00091     virtual Status getGains(Vector & kp, Vector & kd) const = 0;
00092     
00097     virtual Status latch(Model const & model) = 0;
00098     
00099     virtual Status computeCommand(Model const & model, Vector & tau) = 0;
00100     
00101   protected:
00102     mutable jspace_controller_info_getter_s * info_getter_;
00103   };
00104   
00105 }
00106 
00107 #endif // JSPACE_CONTROLLER_HPP

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