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: LeastNormIKSolver 1036 2004-02-11 20:48:55Z jungd $ 00019 $Revision: 1.6 $ 00020 $Date: 2004-02-11 15:48:55 -0500 (Wed, 11 Feb 2004) $ 00021 $Author: jungd $ 00022 00023 ****************************************************************************/ 00024 00025 #ifndef _ROBOT_CONTROL_KINEMATICS_LEASTNORMIKSOLVER_ 00026 #define _ROBOT_CONTROL_KINEMATICS_LEASTNORMIKSOLVER_ 00027 00028 #include <robot/control/kinematics/kinematics> 00029 00030 #include <robot/control/kinematics/InverseKinematicsSolver> 00031 #include <robot/control/kinematics/MPPseudoInvSolver> 00032 00033 00034 namespace robot { 00035 namespace control { 00036 namespace kinematics { 00037 00038 /// Inverse kinematics solver using the Moore-Penrose Pseudo Inverse. 00039 /** 00040 * Equivelent to a least norm solution without any 00041 * constraints. 00042 */ 00043 class LeastNormIKSolver : public InverseKinematicsSolver 00044 { 00045 public: 00046 LeastNormIKSolver(); 00047 00048 virtual String className() const { return String("LeastNormIKSolver"); } 00049 00050 /// Solve inverse kinematics 00051 /** 00052 * Takes current the joint parameters (q) and the required change in 00053 * end-effector position (dx) and returns the changes in joint 00054 * parameters (dq) that will achieve the requested dx. 00055 * 00056 * @param dx see InverseKinematicsSolver 00057 * @param x see InverseKinematicsSolver 00058 * @param q see InverseKinematicsSolver 00059 * @param J see InverseKinematicsSolver 00060 * @param optMethod Ignored. The solver only provides a single solution, hence 00061 * no optimization is necessary. 00062 * @param optCriterion Must be LeastNorm. 00063 * @param optConstraints Ignored. No constraints can be specified. 00064 * @param orientationRepresentation see InverseKinematicsSolver 00065 * @return see InverseKinematicsSolver 00066 * @exception see MPPseudoInvSolver::solve() 00067 */ 00068 virtual Vector solve(const Vector& dx, const Vector& x, const Vector& q, 00069 const base::Matrix& J, 00070 OptimizationMethod optMethod = PseudoInv, 00071 OptimizationCriterion optCriterion = LeastNorm, 00072 OptimizationConstraints optConstraints = OptimizationConstraints(DefaultConstraints), 00073 base::Orient::Representation orientationRepresentation = base::Orient::EulerRPY); 00074 00075 protected: 00076 ref<MPPseudoInvSolver> solver; 00077 }; 00078 00079 00080 } // namespace kinematics 00081 } // namespace control 00082 } // namespace robot 00083 00084 #endif