00001 /* **-*-c++-*-************************************************************** 00002 Copyright (C)2002 David Jung <opensim@pobox.com> 00003 00004 This program/file is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. (http://www.gnu.org) 00013 00014 You should have received a copy of the GNU General Public License 00015 along with this program; if not, write to the Free Software 00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 00018 $Id: AnalyticLagrangianNullSpaceBetaOptimizer 1036 2004-02-11 20:48:55Z jungd $ 00019 $Revision: 1.1 $ 00020 $Date: 2004-02-11 15:48:55 -0500 (Wed, 11 Feb 2004) $ 00021 $Author: jungd $ 00022 00023 ****************************************************************************/ 00024 00025 #ifndef _ROBOT_CONTROL_KINEMATICS_ANALYTICLAGRANGIANNULLSPACEBETAOPTIMIZER_ 00026 #define _ROBOT_CONTROL_KINEMATICS_ANALYTICLAGRANGIANNULLSPACEBETAOPTIMIZER_ 00027 00028 #include <robot/control/kinematics/kinematics> 00029 00030 #include <robot/control/kinematics/LagrangianOptimizer> 00031 #include <robot/control/kinematics/BetaFormConstraints> 00032 00033 00034 namespace robot { 00035 namespace control { 00036 namespace kinematics { 00037 00038 00039 /// A constrained optimizer that uses an analytic Lagrangian solution technique 00040 /** 00041 * Analytic Lagrangian optimizer in the null-space with Beta form constraints. 00042 * Similar to the formulation of the FullSpace method 00043 * (see the AnalyticLagrangianFSBetaOptimizer class), but as the solution is in the 00044 * null-space, the sum of ti constraint can be omitted. 00045 */ 00046 class AnalyticLagrangianNullSpaceBetaOptimizer : public LagrangianOptimizer 00047 { 00048 public: 00049 AnalyticLagrangianNullSpaceBetaOptimizer() 00050 : gs(0) {} 00051 00052 virtual String className() const { return String("AnalyticLagrangianNullSpaceBetaOptimizer"); } 00053 00054 /// set the gs (Matrix of column vectors that span the null-space) 00055 virtual void setGs(const Matrix& gs) { this->gs = &gs; } 00056 00057 /// optimize the objective with the given constraints 00058 virtual Vector optimize(ref<const Objective> objective, ref<const Constraints> constraints) const; 00059 00060 protected: 00061 Matrix const *gs; ///< matrix of column vectors that span the solition space of dq's (from a full-space solver) 00062 00063 mutable Vector o; // convenient zero Vector 00064 mutable Vector e; // convenient Vector of 1s 00065 00066 /// compute t Vector 00067 Vector calct(const Matrix& Ginv, const Vector& H, ref<const BetaFormConstraints> betaConstraints) const; 00068 00069 }; 00070 00071 00072 } // namespace kinematics 00073 } // namespace control 00074 } // namespace robot 00075 00076 #endif