00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _ROBOT_PLATFORMDESCRIPTION_
00026 #define _ROBOT_PLATFORMDESCRIPTION_
00027
00028 #include <robot/robot>
00029
00030 #include <base/Named>
00031 #include <base/Externalizable>
00032 #include <base/ReferencedObject>
00033 #include <base/Dimension3>
00034 #include <base/Expression>
00035 #include <robot/KinematicChain>
00036
00037
00038 namespace robot {
00039
00040
00041
00042
00043
00044 class PlatformDescription : public base::Named, public base::Externalizable, public base::ReferencedObject
00045 {
00046 public:
00047 PlatformDescription()
00048 : Named("platform"), mobile(false),
00049 holonomic(true), dims(base::Dimension3(1,1,0.1)) , offset(0,0,-0.05)
00050 {}
00051
00052 PlatformDescription(String name, const base::Dimension3& dimensions,
00053 const base::Vector3& originOffset,
00054 bool mobile, bool holonomic=true, Real L=1, Real W=2)
00055 : Named(name), mobile(mobile), holonomic(holonomic),
00056 dims(dimensions),offset(originOffset), nhL(L), nhW(W) {}
00057
00058 PlatformDescription(const PlatformDescription& p)
00059 : Named(p),
00060 mobile(p.mobile), holonomic(p.holonomic),
00061 dims(p.dims), offset(p.offset), nhL(p.nhL), nhW(p.nhW) {}
00062
00063 PlatformDescription& operator=(const PlatformDescription& p)
00064 {
00065 setName(p.getName());
00066 mobile = p.mobile;
00067 holonomic = p.holonomic;
00068 dims = p.dims;
00069 offset = p.offset;
00070 nhL = p.nhL;
00071 nhW = p.nhW;
00072 return *this;
00073 }
00074
00075 void set(String name, const base::Dimension3& dimensions,
00076 const base::Vector3& originOffset,
00077 bool mobile, bool holonomic=true, Real L=1, Real W=2)
00078 {
00079 setName(name);
00080 setMobile(mobile);
00081 setHolonomic(holonomic);
00082 setDimensions(dimensions);
00083 setOriginOffset(originOffset);
00084 setL(L);
00085 setW(W);
00086 }
00087
00088
00089 virtual String className() const { return String("PlatformDescription"); }
00090
00091 virtual bool isMobile() const
00092 { return mobile; }
00093 virtual bool isHolonomic() const
00094 { return holonomic; }
00095
00096 virtual base::Dimension3 dimensions() const
00097 { return dims; }
00098
00099 virtual base::Vector3 originOffset() const
00100 { return offset; }
00101
00102 virtual Real L() const
00103 { return nhL; }
00104
00105 virtual Real W() const
00106 { return nhW; }
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118 virtual KinematicChain getKinematicChain(Int platformDOF=0, const base::Matrix4& platformTransform = base::Matrix4()) const;
00119
00120
00121
00122
00123
00124
00125
00126 virtual Real requiredSteeringAngle(const Vector& q, const Vector& qp) const;
00127
00128
00129
00130 virtual bool formatSupported(const String format, Real version = 1.0, ExternalizationType type = IO) const
00131 { return ( (format=="xml") && (version==1.0) ); }
00132 virtual void externalize(base::Externalizer& e, String format = "", Real version = 1.0);
00133 virtual void externalize(base::Externalizer& e, String format = "", Real version = 1.0) const
00134 { Externalizable::externalize(e,format,version); }
00135
00136 protected:
00137 PlatformDescription(String name) : Named(name), mobile(false) {}
00138
00139 void setMobile(bool mobile) { this->mobile = mobile; }
00140 void setHolonomic(bool holonomic) { this->holonomic = holonomic; }
00141 void setDimensions(base::Dimension3 dimensions) { dims = dimensions; }
00142 void setOriginOffset(base::Vector3 originOffset) { offset = originOffset; }
00143 void setL(Real L) { nhL = L; }
00144 void setW(Real W) { nhW = W; }
00145
00146 private:
00147 bool mobile;
00148 bool holonomic;
00149
00150 base::Dimension3 dims;
00151 base::Vector3 offset;
00152
00153
00154 Real nhL;
00155 Real nhW;
00156
00157 friend class Robot;
00158 };
00159
00160
00161 }
00162
00163 #endif