Simbody  3.6
ObservedPointFitter.h
Go to the documentation of this file.
1 #ifndef SimTK_SIMBODY_OBSERVED_POINT_FITTER_H_
2 #define SimTK_SIMBODY_OBSERVED_POINT_FITTER_H_
3 
4 /* -------------------------------------------------------------------------- *
5  * Simbody(tm) *
6  * -------------------------------------------------------------------------- *
7  * This is part of the SimTK biosimulation toolkit originating from *
8  * Simbios, the NIH National Center for Physics-Based Simulation of *
9  * Biological Structures at Stanford, funded under the NIH Roadmap for *
10  * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody. *
11  * *
12  * Portions copyright (c) 2007-12 Stanford University and the Authors. *
13  * Authors: Peter Eastman *
14  * Contributors: *
15  * *
16  * Licensed under the Apache License, Version 2.0 (the "License"); you may *
17  * not use this file except in compliance with the License. You may obtain a *
18  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
19  * *
20  * Unless required by applicable law or agreed to in writing, software *
21  * distributed under the License is distributed on an "AS IS" BASIS, *
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
23  * See the License for the specific language governing permissions and *
24  * limitations under the License. *
25  * -------------------------------------------------------------------------- */
26 
27 #include "SimTKcommon.h"
30 
31 namespace SimTK {
32 
46 public:
52  static Real findBestFit
53  (const MultibodySystem& system,
54  State& state,
55  const Array_<MobilizedBodyIndex>& bodyIxs,
56  const Array_<Array_<Vec3> >& stations,
57  const Array_<Array_<Vec3> >& targetLocations,
58  Real tolerance=0.001);
59 
61  static Real findBestFit
62  (const MultibodySystem& system,
63  State& state,
64  const std::vector<MobilizedBodyIndex>& bodyIxs,
65  const std::vector<std::vector<Vec3> >& stations,
66  const std::vector<std::vector<Vec3> >& targetLocations,
67  Real tolerance=0.001)
68  {
69  Array_<Array_<Vec3> > stationCopy(stations);
70  Array_<Array_<Vec3> > targetCopy(targetLocations);
71  return findBestFit(system,state,
72  ArrayViewConst_<MobilizedBodyIndex>(bodyIxs), // no copying here
73  stationCopy, targetCopy, tolerance);
74  }
75 
90  static Real findBestFit
91  (const MultibodySystem& system,
92  State& state,
93  const Array_<MobilizedBodyIndex>& bodyIxs,
94  const Array_<Array_<Vec3> >& stations,
95  const Array_<Array_<Vec3> >& targetLocations,
96  const Array_<Array_<Real> >& weights,
97  Real tolerance=0.001);
98 
100  static Real findBestFit
101  (const MultibodySystem& system,
102  State& state,
103  const std::vector<MobilizedBodyIndex>& bodyIxs,
104  const std::vector<std::vector<Vec3> >& stations,
105  const std::vector<std::vector<Vec3> >& targetLocations,
106  const std::vector<std::vector<Real> >& weights,
107  Real tolerance=0.001)
108  {
109  Array_<Array_<Vec3> > stationCopy(stations);
110  Array_<Array_<Vec3> > targetCopy(targetLocations);
111  Array_<Array_<Real> > weightCopy(weights);
112  return findBestFit(system,state,
113  ArrayViewConst_<MobilizedBodyIndex>(bodyIxs), // no copying here
114  stationCopy, targetCopy, weightCopy,
115  tolerance);
116  }
117 
118 
119 private:
120  static void createClonedSystem(const MultibodySystem& original, MultibodySystem& copy, const Array_<MobilizedBodyIndex>& originalBodyIxs, Array_<MobilizedBodyIndex>& copyBodyIxs, bool& hasArtificialBaseBody);
121  static void findUpstreamBodies(MobilizedBodyIndex currentBodyIx, const Array_<int> numStations, const SimbodyMatterSubsystem& matter, Array_<MobilizedBodyIndex>& bodyIxs, int requiredStations);
122  static void findDownstreamBodies(MobilizedBodyIndex currentBodyIx, const Array_<int> numStations, const Array_<Array_<MobilizedBodyIndex> > children, Array_<MobilizedBodyIndex>& bodyIxs, int& requiredStations);
123  static int findBodiesForClonedSystem(MobilizedBodyIndex primaryBodyIx, const Array_<int> numStations, const SimbodyMatterSubsystem& matter, const Array_<Array_<MobilizedBodyIndex> > children, Array_<MobilizedBodyIndex>& bodyIxs);
124  class OptimizerFunction;
125 };
126 
127 } // namespace SimTK
128 
129 #endif // SimTK_SIMBODY_OBSERVED_POINT_FITTER_H_
This is for arrays indexed by mobilized body number within a subsystem (typically the SimbodyMatterSu...
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
Every Simbody header and source file should include this header before any other Simbody header...
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:606
This class attempts to find the configuration of an internal coordinate model which best fits a set o...
Definition: ObservedPointFitter.h:45
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
Includes internal headers providing declarations for the basic SimTK Core classes, including Simmatrix.
The Array_<T> container class is a plug-compatible replacement for the C++ standard template library ...
Definition: Array.h:53
The job of the MultibodySystem class is to coordinate the activities of various subsystems which can ...
Definition: MultibodySystem.h:48
This Array_ helper class is the base class for ArrayView_ which is the base class for Array_; here we...
Definition: Array.h:51
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
void copy(Row< 1, E1, S1 > &r1, const Row< 1, E2, S2 > &r2)
Definition: Row.h:105
This subsystem contains the bodies ("matter") in the multibody system, the mobilizers (joints) that d...
Definition: SimbodyMatterSubsystem.h:133