Simbody
3.4 (development)
|
00001 #ifndef SimTK_SIMBODY_MOBILIZED_BODY_BUSHING_H_ 00002 #define SimTK_SIMBODY_MOBILIZED_BODY_BUSHING_H_ 00003 00004 /* -------------------------------------------------------------------------- * 00005 * Simbody(tm) * 00006 * -------------------------------------------------------------------------- * 00007 * This is part of the SimTK biosimulation toolkit originating from * 00008 * Simbios, the NIH National Center for Physics-Based Simulation of * 00009 * Biological Structures at Stanford, funded under the NIH Roadmap for * 00010 * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody. * 00011 * * 00012 * Portions copyright (c) 2012-13 Stanford University and the Authors. * 00013 * Authors: Michael Sherman * 00014 * Contributors: * 00015 * * 00016 * Licensed under the Apache License, Version 2.0 (the "License"); you may * 00017 * not use this file except in compliance with the License. You may obtain a * 00018 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * 00019 * * 00020 * Unless required by applicable law or agreed to in writing, software * 00021 * distributed under the License is distributed on an "AS IS" BASIS, * 00022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 00023 * See the License for the specific language governing permissions and * 00024 * limitations under the License. * 00025 * -------------------------------------------------------------------------- */ 00026 00030 #include "simbody/internal/MobilizedBody.h" 00031 00032 namespace SimTK { 00033 00086 class SimTK_SIMBODY_EXPORT MobilizedBody::Bushing : public MobilizedBody { 00087 public: 00090 Bushing() {} 00091 00097 Bushing(MobilizedBody& parent, const Transform& X_PF, 00098 const Body& bodyInfo, const Transform& X_BM, Direction=Forward); 00099 00102 Bushing(MobilizedBody& parent, const Body& bodyInfo, Direction=Forward); 00103 00109 Bushing& setDefaultInboardFrame(const Transform& X_PF) 00110 { (void)MobilizedBody::setDefaultInboardFrame(X_PF); return *this; } 00111 00117 Bushing& setDefaultOutboardFrame(const Transform& X_BM) 00118 { (void)MobilizedBody::setDefaultOutboardFrame(X_BM); return *this; } 00119 00129 Bushing& setDefaultTransform(const Transform& X_FM) 00130 { Vec6 q; 00131 q.updSubVec<3>(0) = X_FM.R().convertRotationToBodyFixedXYZ(); 00132 q.updSubVec<3>(3) = X_FM.p(); 00133 return setDefaultQ(q); } 00134 00137 Transform getDefaultTransform() const { 00138 const Vec6& q = getDefaultQ(); 00139 return Transform(Rotation(BodyRotationSequence, 00140 q[0], XAxis, q[1], YAxis, q[2], ZAxis), 00141 q.getSubVec<3>(3)); 00142 } 00143 00146 Bushing& addBodyDecoration(const Transform& X_BD, const DecorativeGeometry& g) 00147 { (void)MobilizedBody::addBodyDecoration(X_BD,g); return *this; } 00148 00152 Bushing& addOutboardDecoration(const Transform& X_MD, const DecorativeGeometry& g) 00153 { (void)MobilizedBody::addOutboardDecoration(X_MD,g); return *this; } 00154 00157 Bushing& addInboardDecoration (const Transform& X_FD, const DecorativeGeometry& g) 00158 { (void)MobilizedBody::addInboardDecoration(X_FD,g); return *this; } 00159 00167 const Vec6& getDefaultQ() const; 00174 Bushing& setDefaultQ(const Vec6& q); 00175 00179 const Vec6& getQ(const State& state) const; 00187 const Vec6& getQDot(const State& state) const; 00194 const Vec6& getQDotDot(const State& state) const; 00195 00200 const Vec6& getU(const State& state) const; 00205 const Vec6& getUDot(const State& state) const; 00206 00214 void setQ(State& state, const Vec6& q) const; 00224 void setU(State& state, const Vec6& u) const; 00225 00232 const Vec6& getMyPartQ(const State& state, const Vector& qlike) const; 00235 const Vec6& getMyPartU(const State& state, const Vector& ulike) const; 00236 00240 Vec6& updMyPartQ(const State& state, Vector& qlike) const; 00244 Vec6& updMyPartU(const State& state, Vector& ulike) const; // Hide from Doxygen. 00248 SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(Bushing, BushingImpl, MobilizedBody); 00250 }; 00251 00252 00253 } // namespace SimTK 00254 00255 #endif // SimTK_SIMBODY_MOBILIZED_BODY_BUSHING_H_ 00256 00257 00258