Simbody
3.4 (development)
|
00001 #ifndef SimTK_SIMBODY_MOBILIZED_BODY_GIMBAL_H_ 00002 #define SimTK_SIMBODY_MOBILIZED_BODY_GIMBAL_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) 2007-13 Stanford University and the Authors. * 00013 * Authors: Michael Sherman * 00014 * Contributors: Paul Mitiguy, Peter Eastman * 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 00069 class SimTK_SIMBODY_EXPORT MobilizedBody::Gimbal : public MobilizedBody { 00070 public: 00073 Gimbal() {} 00074 00080 Gimbal(MobilizedBody& parent, const Transform& X_PF, 00081 const Body& bodyInfo, const Transform& X_BM, Direction=Forward); 00082 00085 Gimbal(MobilizedBody& parent, const Body& bodyInfo, Direction=Forward); 00086 00092 Gimbal& setDefaultInboardFrame(const Transform& X_PF) 00093 { (void)MobilizedBody::setDefaultInboardFrame(X_PF); return *this; } 00094 00100 Gimbal& setDefaultOutboardFrame(const Transform& X_BM) 00101 { (void)MobilizedBody::setDefaultOutboardFrame(X_BM); return *this; } 00102 00111 Gimbal& setDefaultRotation(const Rotation& R_FM) 00112 { return setDefaultQ(R_FM.convertRotationToBodyFixedXYZ()); } 00113 00120 Rotation getDefaultRotation() const { 00121 const Vec3& q = getDefaultQ(); 00122 return Rotation(BodyRotationSequence, 00123 q[0], XAxis, q[1], YAxis, q[2], ZAxis); 00124 } 00125 00128 Gimbal& addBodyDecoration(const Transform& X_BD, const DecorativeGeometry& g) 00129 { (void)MobilizedBody::addBodyDecoration(X_BD,g); return *this; } 00130 00134 Gimbal& addOutboardDecoration(const Transform& X_MD, const DecorativeGeometry& g) 00135 { (void)MobilizedBody::addOutboardDecoration(X_MD,g); return *this; } 00136 00139 Gimbal& addInboardDecoration (const Transform& X_FD, const DecorativeGeometry& g) 00140 { (void)MobilizedBody::addInboardDecoration(X_FD,g); return *this; } 00141 00142 00146 Gimbal& setDefaultRadius(Real r); 00148 Real getDefaultRadius() const; 00149 00155 const Vec3& getDefaultQ() const; // X,Y,Z body-fixed Euler angles 00161 Gimbal& setDefaultQ(const Vec3& q); 00162 00166 const Vec3& getQ(const State& state) const; 00171 const Vec3& getQDot(const State& state) const; 00177 const Vec3& getQDotDot(const State& state) const; 00178 00183 const Vec3& getU(const State& state) const; 00188 const Vec3& getUDot(const State& state) const; 00189 00194 void setQ(State& state, const Vec3& q) const; 00199 void setU(State& state, const Vec3& u) const; 00200 00207 const Vec3& getMyPartQ(const State& state, const Vector& qlike) const; 00210 const Vec3& getMyPartU(const State& state, const Vector& ulike) const; 00211 00215 Vec3& updMyPartQ(const State& state, Vector& qlike) const; 00219 Vec3& updMyPartU(const State& state, Vector& ulike) const; // Hide from Doxygen. 00223 SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(Gimbal, GimbalImpl, MobilizedBody); 00225 }; 00226 00227 00228 } // namespace SimTK 00229 00230 #endif // SimTK_SIMBODY_MOBILIZED_BODY_GIMBAL_H_ 00231 00232 00233