Simbody  3.8
Constraint_LineOnLineContact.h
Go to the documentation of this file.
1 #ifndef SimTK_SIMBODY_CONSTRAINT_LINE_ON_LINE_CONTACT_H_
2 #define SimTK_SIMBODY_CONSTRAINT_LINE_ON_LINE_CONTACT_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) 2014 Stanford University and the Authors. *
13  * Authors: Michael Sherman *
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 
31 
32 namespace SimTK {
33 
34 //==============================================================================
35 // LINE ON LINE CONTACT
36 //==============================================================================
143 : public Constraint {
144 public:
145  // no default constructor
146 
147 //------------------------------------------------------------------------------
163 
207  const Transform& defaultEdgeFrameF,
208  Real defaultHalfLengthF,
209  MobilizedBody& mobod_B,
210  const Transform& defaultEdgeFrameB,
211  Real defaultHalfLengthB,
212  bool enforceRolling);
213 
217 
222 
227 
231 bool isEnforcingRolling() const;
232 
238 setDefaultEdgeFrameF(const Transform& defaultEdgeFrameF);
244 setDefaultHalfLengthF(Real defaultHalfLengthF);
250 setDefaultEdgeFrameB(const Transform& defaultEdgeFrameB);
256 setDefaultHalfLengthB(Real defaultHalfLengthF);
257 
268 
281 //------------------------------------------------------------------------------
289 // no controls yet
293 //------------------------------------------------------------------------------
311 
318 const LineOnLineContact&
319 setEdgeFrameF(State& state, const Transform& edgeFrameF) const;
320 
324 const LineOnLineContact&
325 setHalfLengthF(State& state, Real halfLengthF) const;
326 
333 const LineOnLineContact&
334 setEdgeFrameB(State& state, const Transform& edgeFrameB) const;
335 
339 const LineOnLineContact&
340 setHalfLengthB(State& state, Real halfLengthB) const;
341 
345 const Transform& getEdgeFrameF(const State& state) const;
349 Real getHalfLengthF(const State& state) const;
350 
354 const Transform& getEdgeFrameB(const State& state) const;
358 Real getHalfLengthB(const State& state) const;
361 //------------------------------------------------------------------------------
371 Real getPositionError(const State& state) const;
372 
382 Vec3 getVelocityErrors(const State& state) const;
383 
389 Vec3 getAccelerationErrors(const State& state) const;
390 
401 Vec3 getMultipliers(const State& state) const;
402 
410 Vec3 findForceOnBodyBInG(const State& state) const;
411 
422 Transform findContactFrameInG(const State& state) const;
423 
432 void findClosestPointsInG(const State& state, Vec3& Qf, Vec3& Qb,
433  bool& linesAreParallel) const;
434 
442 Real findSeparation(const State& state) const; // hide from Doxygen
447  (LineOnLineContact, LineOnLineContactImpl, Constraint);
449 };
450 
451 } // namespace SimTK
452 
453 #endif // SimTK_SIMBODY_CONSTRAINT_LINE_ON_LINE_CONTACT_H_
454 
455 
456 
This defines the base Constraint class and related classes, which are used to specify limitations on ...
#define SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(DERIVED, DERIVED_IMPL, PARENT)
Definition: PrivateImplementation.h:343
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
This constraint represents a bilateral connection between an edge on one body and a non-parallel edge...
Definition: Constraint_LineOnLineContact.h:143
Real findSeparation(const State &state) const
Calculate the separation distance or penetration depth of the two edges.
const Transform & getEdgeFrameB(const State &state) const
Return the frame of the edge Eb on the second body, mobod_B, as currently set in the given state.
const Transform & getEdgeFrameF(const State &state) const
Return the frame of the edge Ef on the first body, mobod_F, as currently set in the given state.
LineOnLineContact(MobilizedBody &mobod_F, const Transform &defaultEdgeFrameF, Real defaultHalfLengthF, MobilizedBody &mobod_B, const Transform &defaultEdgeFrameB, Real defaultHalfLengthB, bool enforceRolling)
Construct a line-on-line constraint as described in the Constraint::LineOnLineContact class documenta...
Vec3 getVelocityErrors(const State &state) const
The returned velocity error vector has the time derivative of the quantity returned by getPositionErr...
const MobilizedBody & getMobilizedBodyB() const
Return a reference to the second MobilizedBody to which a line is attached.
LineOnLineContact & setDefaultEdgeFrameF(const Transform &defaultEdgeFrameF)
Replace the default frame of the edge attached to the first body, mobod_F, that was supplied on const...
bool isEnforcingRolling() const
Report whether this Constraint was constructed to generate rolling constraints (otherwise it is frict...
const MobilizedBody & getMobilizedBodyF() const
Return a reference to the first MobilizedBody to which a line is attached.
Real getPositionError(const State &state) const
The returned position error can be viewed as the signed distance between the lines.
const LineOnLineContact & setEdgeFrameF(State &state, const Transform &edgeFrameF) const
Modify the frame of the edge on the first body, mobod_F, in this state by providing a new Transform X...
LineOnLineContact & setDefaultHalfLengthB(Real defaultHalfLengthF)
Replace the default half-length for the edge attached to the second body, mobod_B,...
const LineOnLineContact & setEdgeFrameB(State &state, const Transform &edgeFrameB) const
Modify the frame of the edge on the second body, mobod_B, in this state by providing a new Transform ...
LineOnLineContact()
Default constructor creates an empty handle that can be used to reference any LineOnLineContact Const...
Definition: Constraint_LineOnLineContact.h:216
Vec3 getMultipliers(const State &state) const
These are the Lagrange multipliers required to enforce the constraint equations generated here.
LineOnLineContact & setDefaultEdgeFrameB(const Transform &defaultEdgeFrameB)
Replace the default frame of the edge attached to the second body, mobod_B, that was supplied on cons...
Real getDefaultHalfLengthB() const
Return the default half-length for the edge attached to the second body, mobod_B, as set during const...
Real getDefaultHalfLengthF() const
Return the default half-length for the edge attached to the first body, mobod_F, as set during constr...
const Transform & getDefaultEdgeFrameB() const
Return the default frame of the edge attached to the second body, mobod_B, as set during construction...
Vec3 findForceOnBodyBInG(const State &state) const
Return the force vector currently being applied by this constraint to the point of body B that is coi...
const LineOnLineContact & setHalfLengthB(State &state, Real halfLengthB) const
Modify the half-length hb of the edge on the second body, mobod_B, in this state.
Real getHalfLengthB(const State &state) const
Return the half-length of the edge Eb on the second body, mobod_B, as currently set in the given stat...
const Transform & getDefaultEdgeFrameF() const
Return the default frame of the edge attached to the first body, mobod_F, as set during construction ...
LineOnLineContact & setDefaultHalfLengthF(Real defaultHalfLengthF)
Replace the default half-length for the edge attached to the first body, mobod_F, that was supplied o...
const LineOnLineContact & setHalfLengthF(State &state, Real halfLengthF) const
Modify the half-length hf of the edge on the first body, mobod_F, in this state.
Vec3 getAccelerationErrors(const State &state) const
This vector is the time derivative of the value returned by getVelocityError().
Real getHalfLengthF(const State &state) const
Return the half-length of the edge Ef on the first body, mobod_F, as currently set in the given state...
Transform findContactFrameInG(const State &state) const
Return the instantaneous contact frame C in the Ground frame.
void findClosestPointsInG(const State &state, Vec3 &Qf, Vec3 &Qb, bool &linesAreParallel) const
Calculate the closest points on each of the two lines, measured and expressed in Ground.
This is the base class for all Constraint classes, which is just a handle for the underlying hidden i...
Definition: Constraint.h:67
A MobilizedBody is Simbody's fundamental body-and-joint object used to parameterize a system's motion...
Definition: MobilizedBody.h:169
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
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:607