Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

robot/sim/SimulatedManipulatorDescription

Go to the documentation of this file.
00001 /* **-*-c++-*-**************************************************************
00002   Copyright (C)2004 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: SimulatedManipulatorDescription 1033 2004-02-11 20:47:52Z jungd $
00019   $Revision: 1.1 $
00020   $Date: 2004-02-11 15:47:52 -0500 (Wed, 11 Feb 2004) $
00021   $Author: jungd $
00022  
00023 ****************************************************************************/
00024 
00025 #ifndef _ROBOT_SIMULATEDMANIPULATORDESCRIPTION_
00026 #define _ROBOT_SIMULATEDMANIPULATORDESCRIPTION_
00027 
00028 #include <robot/robot>
00029 
00030 #include <robot/ManipulatorDescription>
00031 
00032 
00033 namespace robot {
00034 namespace sim {
00035 
00036 /**
00037  * An description of a manipulator specific to simulations
00038  * (includes information relevant to a simulation, such as the initial joint
00039  *  configuration, link geometry & appearance etc.)
00040  */
00041 class SimulatedManipulatorDescription : public ManipulatorDescription
00042 {
00043 public:
00044   SimulatedManipulatorDescription() {}
00045   
00046   SimulatedManipulatorDescription(String name, Matrix4 baseTransform, KinematicChain kinematicChain)
00047     : ManipulatorDescription(name, baseTransform, kinematicChain), 
00048       q(zeroVector(kinematicChain.dof())), linkGeometrySpecified(false), 
00049       hasProxSensors(false), proxSensorRange(1.0) {}
00050       
00051   SimulatedManipulatorDescription(const ManipulatorDescription& md) 
00052     : ManipulatorDescription(md), q(zeroVector(md.getKinematicChain().dof())), 
00053       linkGeometrySpecified(false), hasProxSensors(false), proxSensorRange(1.0) {}
00054     
00055   SimulatedManipulatorDescription(const SimulatedManipulatorDescription& md) 
00056     : ManipulatorDescription(md), q(md.q), linkGeometrySpecified(md.linkGeometrySpecified), 
00057       linkRadii(md.linkRadii), hasProxSensors(hasProxSensors), proxSensorRange(proxSensorRange) {}
00058 
00059   SimulatedManipulatorDescription& operator=(const SimulatedManipulatorDescription& md)
00060     {
00061       ManipulatorDescription::operator=(md);
00062       q = md.q;
00063       linkGeometrySpecified = md.linkGeometrySpecified;
00064       linkRadii = md.linkRadii;
00065       hasProxSensors = md.hasProxSensors;
00066       proxSensorRange = md.proxSensorRange;
00067       return *this;
00068     }
00069 
00070   virtual String className() const { return String("SimulatedManipulatorDescription"); }
00071 
00072 
00073   bool operator==(const SimulatedManipulatorDescription& md)
00074     {
00075       if (&md == this) return true;
00076       return ManipulatorDescription::operator==(md);
00077     }
00078 
00079   bool operator!=(const SimulatedManipulatorDescription& md) { return !(*this == md); }
00080 
00081   
00082   // Simulation specific information
00083   
00084   Vector initialConfiguration() const { return q; }
00085   bool   hasGeometry() const { return linkGeometrySpecified; }
00086   array<Real> getLinkRadii() const { return linkRadii; }
00087   bool   hasLinkProximitySensors() const { return hasProxSensors; }
00088   Real   linkProximitySensorRange() const { return proxSensorRange; } 
00089 
00090 
00091   // Externalizable
00092   virtual bool formatSupported(const String format, Real version = 1.0, ExternalizationType type = IO) const
00093     { return ( (format=="xml") && (version==1.0) ); }
00094   virtual void externalize(base::Externalizer& e, String format = "", Real version = 1.0);
00095   virtual void externalize(base::Externalizer& e, String format = "", Real version = 1.0) const
00096     { Externalizable::externalize(e,format,version); }
00097 
00098 protected:
00099   SimulatedManipulatorDescription(String name) : ManipulatorDescription(name) {}
00100   
00101 
00102 private:
00103   Vector q; ///< initial joint configuration
00104   bool linkGeometrySpecified;
00105   array<Real> linkRadii;  ///< radius of links (assuming cylindrical)
00106   bool hasProxSensors;
00107   Real proxSensorRange;   ///< max range of link proximity sensors
00108   
00109 //  friend class Robot;
00110 };
00111 
00112 
00113 }
00114 } // robot::sim
00115 
00116 #endif

Generated on Thu Jul 29 15:56:40 2004 for OpenSim by doxygen 1.3.6