/usr/include/simbody/simbody/internal/MobilizedBody_FunctionBased.h is in libsimbody-dev 3.5.4+dfsg-1ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | #ifndef SimTK_SIMBODY_MOBILIZED_BODY_FUNCTIONBASED_H_
#define SimTK_SIMBODY_MOBILIZED_BODY_FUNCTIONBASED_H_
/* -------------------------------------------------------------------------- *
* Simbody(tm) *
* -------------------------------------------------------------------------- *
* This is part of the SimTK biosimulation toolkit originating from *
* Simbios, the NIH National Center for Physics-Based Simulation of *
* Biological Structures at Stanford, funded under the NIH Roadmap for *
* Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody. *
* *
* Portions copyright (c) 2007-13 Stanford University and the Authors. *
* Authors: Peter Eastman *
* Contributors: Ajay Seth *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may *
* not use this file except in compliance with the License. You may obtain a *
* copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* -------------------------------------------------------------------------- */
/** @file
Declares the MobilizedBody::FunctionBased class. **/
#include "simbody/internal/MobilizedBody.h"
#include "simbody/internal/MobilizedBody_Custom.h"
namespace SimTK {
/** This is a subclass of MobilizedBody::Custom which uses a set of Function
objects to define the behavior of the %MobilizedBody. When you create it, you
specify the number of generalized coordinates, and six Function objects which
calculate the spatial rotations and translations based on those coordinates.
It assumes there is a one to one correspondence between generalized coordinates
and generalized speeds, so qdot == u.
Each of the Function objects must take some subset of the generalized
coordinates as inputs, and produce a single number as its output. It also must
support derivatives up to second order. Taken together, the six functions
define a SpatialVec giving the body's mobilizer transform. **/
class SimTK_SIMBODY_EXPORT MobilizedBody::FunctionBased
: public MobilizedBody::Custom {
public:
/** Default constructor provides an empty handle that can be assigned to
reference any %MobilizedBody::FunctionBased. **/
FunctionBased() {}
/** Create a FunctionBased MobilizedBody.
@param parent the MobilizedBody's parent body
@param bodyInfo describes this MobilizedBody's physical properties
@param nmobilities the number of generalized coordinates belonging to this MobilizedBody
@param functions the Functions describing how the body moves based on its generalized coordinates.
This must be of length 6. The elements correspond to, in order, x rotation, y rotation, z rotation,
x translation, y translation, and z translation. The MobilizedBody takes over ownership of the functions,
and automatically deletes them when the MobilizedBody is deleted.
@param coordIndices the indices of the generalized coordinates that are inputs to each function. For example, if coordIndices[2] = {0, 1},
that means that functions[2] takes two input arguments, and q[0] and q[1] respectively should be passed as those arguments.
@param direction whether you want the coordinates defined as though parent & child were swapped
@see MobilizedBody for a diagram and explanation of terminology. **/
FunctionBased(MobilizedBody& parent, const Body& bodyInfo,
int nmobilities, const Array_<const Function*>& functions,
const Array_<Array_<int> >& coordIndices,
Direction direction=Forward);
/** For compatibility with std::vector. **/
FunctionBased(MobilizedBody& parent, const Body& bodyInfo,
int nmobilities, const std::vector<const Function*>& functions,
const std::vector<std::vector<int> >& coordIndices,
Direction direction=Forward)
{
Array_< Array_<int> > coordCopy(coordIndices); // sorry, must copy
// Use the above constructor.
new(this) FunctionBased(parent,bodyInfo,nmobilities,
ArrayViewConst_<const Function*>(functions),
coordCopy, direction);
}
/** Create a FunctionBased MobilizedBody.
@param parent the MobilizedBody's parent body
@param X_PF the default inboard frame
@param bodyInfo describes this MobilizedBody's physical properties
@param X_BM the default outboard frame
@param nmobilities the number of generalized coordinates belonging to this MobilizedBody
@param functions the Functions describing how the body moves based on its generalized coordinates.
This must be of length 6. The elements correspond to, in order, x rotation, y rotation, z rotation,
x translation, y translation, and z translation. The MobilizedBody takes over ownership of the functions,
and automatically deletes them when the MobilizedBody is deleted.
@param coordIndices the indices of the generalized coordinates that are inputs to each function. For example, if coordIndices[2] = {0, 1},
that means that functions[2] takes two input arguments, and q[0] and q[1] respectively should be passed as those arguments.
@param direction whether you want the coordinates defined as though parent & child were swapped
@see MobilizedBody for a diagram and explanation of terminology. **/
FunctionBased(MobilizedBody& parent, const Transform& X_PF,
const Body& bodyInfo, const Transform& X_BM,
int nmobilities, const Array_<const Function*>& functions,
const Array_<Array_<int> >& coordIndices,
Direction direction=Forward);
/** For compatibility with std::vector. **/
FunctionBased(MobilizedBody& parent, const Transform& X_PF,
const Body& bodyInfo, const Transform& X_BM,
int nmobilities, const std::vector<const Function*>& functions,
const std::vector<std::vector<int> >& coordIndices,
Direction direction=Forward)
{
Array_< Array_<int> > coordCopy(coordIndices); // sorry, must copy
// Use the above constructor.
new(this) FunctionBased(parent,X_PF,bodyInfo,X_BM,
nmobilities, ArrayViewConst_<const Function*>(functions),
coordCopy, direction);
}
/** Create a FunctionBased MobilizedBody.
@param parent the MobilizedBody's parent body
@param bodyInfo describes this MobilizedBody's physical properties
@param nmobilities the number of generalized coordinates belonging to this MobilizedBody
@param functions the Functions describing how the body moves based on its generalized coordinates.
This must be of length 6. The elements correspond to, in order, x rotation, y rotation, z rotation,
x translation, y translation, and z translation. The MobilizedBody takes over ownership of the functions,
and automatically deletes them when the MobilizedBody is deleted.
@param coordIndices the indices of the generalized coordinates that are inputs to each function. For example, if coordIndices[2] = {0, 1},
that means that functions[2] takes two input arguments, and q[0] and q[1] respectively should be passed as those arguments.
@param axes the axes directions (as Vec3's) for each spatial coordinate, which each function describes, and is therefore length 6.
First 3 and last 3 axes must be linearly independent, otherwise there will be redundant speeds for the same motion.
@param direction whether you want the coordinates defined as though parent & child were swapped
@see MobilizedBody for a diagram and explanation of terminology. **/
FunctionBased(MobilizedBody& parent, const Body& bodyInfo,
int nmobilities, const Array_<const Function*>& functions,
const Array_<Array_<int> >& coordIndices, const Array_<Vec3>& axes,
Direction direction=Forward);
/** For compatibility with std::vector. **/
FunctionBased(MobilizedBody& parent, const Body& bodyInfo,
int nmobilities, const std::vector<const Function*>& functions,
const std::vector<std::vector<int> >& coordIndices, const std::vector<Vec3>& axes,
Direction direction=Forward)
{
Array_< Array_<int> > coordCopy(coordIndices); // sorry, must copy
// Use the above constructor.
new(this) FunctionBased(parent,bodyInfo,
nmobilities, ArrayViewConst_<const Function*>(functions),
coordCopy, ArrayViewConst_<Vec3>(axes),
direction);
}
/** Create a FunctionBased MobilizedBody.
@param parent the MobilizedBody's parent body
@param X_PF the default inboard frame
@param bodyInfo describes this MobilizedBody's physical properties
@param X_BM the default outboard frame
@param nmobilities the number of generalized coordinates belonging to this MobilizedBody
@param functions the Functions describing how the body moves based on its generalized coordinates.
This must be of length 6. The elements correspond to, in order, x rotation, y rotation, z rotation,
x translation, y translation, and z translation. The MobilizedBody takes over ownership of the functions,
and automatically deletes them when the MobilizedBody is deleted.
@param coordIndices the indices of the generalized coordinates that are inputs to each function. For example, if coordIndices[2] = {0, 1},
that means that functions[2] takes two input arguments, and q[0] and q[1] respectively should be passed as those arguments.
@param axes the axes directions (as Vec3's) for each spatial coordinate, which each function describes, and is therefore length 6.
First 3 and last 3 axes must be linearly independent, otherwise there will be redundant speeds for the same motion.
@param direction whether you want the coordinates defined as though parent & child were swapped
@see MobilizedBody for a diagram and explanation of terminology. **/
FunctionBased(MobilizedBody& parent, const Transform& X_PF,
const Body& bodyInfo, const Transform& X_BM,
int nmobilities, const Array_<const Function*>& functions,
const Array_<Array_<int> >& coordIndices, const Array_<Vec3>& axes,
Direction direction=Forward);
/** For compatibility with std::vector. **/
FunctionBased(MobilizedBody& parent, const Transform& X_PF,
const Body& bodyInfo, const Transform& X_BM,
int nmobilities, const std::vector<const Function*>& functions,
const std::vector<std::vector<int> >& coordIndices, const std::vector<Vec3>& axes,
Direction direction=Forward)
{
Array_< Array_<int> > coordCopy(coordIndices); // sorry, must copy
// Use the above constructor.
new(this) FunctionBased(parent,X_PF,bodyInfo,X_BM,
nmobilities, ArrayViewConst_<const Function*>(functions),
coordCopy, ArrayViewConst_<Vec3>(axes),
direction);
}
};
} // namespace SimTK
#endif // SimTK_SIMBODY_MOBILIZED_BODY_FUNCTIONBASED_H_
|