Simbody
3.4 (development)
|
00001 #ifndef SimTK_SIMBODY_MOBILIZED_BODY_TRANSLATION_H_ 00002 #define SimTK_SIMBODY_MOBILIZED_BODY_TRANSLATION_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 00038 class SimTK_SIMBODY_EXPORT MobilizedBody::Translation : public MobilizedBody { 00039 public: 00042 Translation() {} 00043 00050 Translation(MobilizedBody& parent, const Transform& X_PF, 00051 const Body& bodyInfo, const Transform& X_BM, 00052 Direction=Forward); 00053 00056 Translation(MobilizedBody& parent, const Body& bodyInfo, Direction=Forward); 00057 00058 Translation& addBodyDecoration(const Transform& X_BD, const DecorativeGeometry& g) { 00059 (void)MobilizedBody::addBodyDecoration(X_BD,g); return *this; 00060 } 00061 Translation& addOutboardDecoration(const Transform& X_MD, const DecorativeGeometry& g) { 00062 (void)MobilizedBody::addOutboardDecoration(X_MD,g); return *this; 00063 } 00064 Translation& addInboardDecoration (const Transform& X_FD, const DecorativeGeometry& g) { 00065 (void)MobilizedBody::addInboardDecoration(X_FD,g); return *this; 00066 } 00067 00068 Translation& setDefaultInboardFrame(const Transform& X_PF) { 00069 (void)MobilizedBody::setDefaultInboardFrame(X_PF); return *this; 00070 } 00071 00072 Translation& setDefaultOutboardFrame(const Transform& X_BM) { 00073 (void)MobilizedBody::setDefaultOutboardFrame(X_BM); return *this; 00074 } 00075 00076 // This is just a nicer name for setting this mobilizer's generalized coordinates, 00077 // which together constitute the vector from the F frame's origin to the M 00078 // frame's origin, expressed in F. 00079 00080 // Set the topological default values for the initial q's. 00081 Translation& setDefaultTranslation(const Vec3& p_FM) { 00082 return setDefaultQ(p_FM); 00083 } 00084 00085 // Get the topological default values for the initial q's. 00086 const Vec3& getDefaultTranslation() const { 00087 return getDefaultQ(); 00088 } 00089 00090 // Set the current value of q's in the given State. Note that this is 00091 // the *cross-mobilizer* translation, not location in the Ground frame. 00092 void setMobilizerTranslation(State& s, const Vec3& p_FM) const { 00093 setQ(s,p_FM); 00094 } 00095 00096 // Get the current value of the q's for this mobilizer from the given State. 00097 const Vec3& getMobilizerTranslation(const State& s) const { 00098 return getQ(s); 00099 } 00100 00101 00102 // Set the current value of u's in the given State. Note that this is 00103 // the *cross-mobilizer* velocity v_FM, not velocity in the Ground frame. 00104 void setMobilizerVelocity(State& s, const Vec3& v_FM) const { 00105 setU(s,v_FM); 00106 } 00107 00108 // Get the current value of the u's for this mobilizer from the given State. 00109 const Vec3& getMobilizerVelocity(const State& s) const { 00110 return getU(s); 00111 } 00112 00113 // Get the value of the udot's for this mobilizer from the given State. 00114 const Vec3& getMobilizerAcceleration(const State& s) const { 00115 return getUDot(s); 00116 } 00117 00118 // Generic default state Topology methods. 00119 const Vec3& getDefaultQ() const; 00120 Translation& setDefaultQ(const Vec3& q); 00121 00122 const Vec3& getQ(const State&) const; 00123 const Vec3& getQDot(const State&) const; 00124 const Vec3& getQDotDot(const State&) const; 00125 const Vec3& getU(const State&) const; 00126 const Vec3& getUDot(const State&) const; 00127 00128 void setQ(State&, const Vec3&) const; 00129 void setU(State&, const Vec3&) const; 00130 00131 const Vec3& getMyPartQ(const State&, const Vector& qlike) const; 00132 const Vec3& getMyPartU(const State&, const Vector& ulike) const; 00133 00134 Vec3& updMyPartQ(const State&, Vector& qlike) const; 00135 Vec3& updMyPartU(const State&, Vector& ulike) const; 00136 // hide from Doxygen 00138 SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(Translation, TranslationImpl, 00139 MobilizedBody); 00141 }; 00142 00143 } // namespace SimTK 00144 00145 #endif // SimTK_SIMBODY_MOBILIZED_BODY_TRANSLATION_H_ 00146 00147 00148