Simbody  3.4 (development)
SimTK::MobilizedBody::Custom Class Reference

The handle class MobilizedBody::Custom (dataless) and its companion class MobilizedBody::Custom::Implementation can be used together to define new MobilizedBody types with arbitrary properties. More...

#include <MobilizedBody_Custom.h>

+ Inheritance diagram for SimTK::MobilizedBody::Custom:

List of all members.

Classes

class  Implementation
 This is the implementation class for Custom mobilizers. More...

Public Member Functions

 Custom ()
 Default constructor provides an empty handle that can be assigned to reference any MobilizedBody::Custom.
 Custom (MobilizedBody &parent, Implementation *implementation, const Transform &X_PF, const Body &bodyInfo, const Transform &X_BM, Direction direction=Forward)
 Create a Custom mobilizer between an existing parent (inboard) body P and a new child (outboard) body B created by copying the given bodyInfo into a privately-owned Body within the constructed MobilizedBody object.
 Custom (MobilizedBody &parent, Implementation *implementation, const Body &bodyInfo, Direction direction=Forward)
 Abbreviated constructor you can use if the mobilizer frames are coincident with the parent and child body frames.

Protected Member Functions

const ImplementationgetImplementation () const
ImplementationupdImplementation ()

Detailed Description

The handle class MobilizedBody::Custom (dataless) and its companion class MobilizedBody::Custom::Implementation can be used together to define new MobilizedBody types with arbitrary properties.

To use it, create a class that extends MobilizedBody::Custom::Implementation. You can then create an instance of it and pass it to the MobilizedBody::Custom constructor:

MobilizedBody::Custom myMobilizedBody(new MyMobilizedBodyImplementation(args));

("args" here and below stands for whatever arguments are needed for your particular mobilizer; it isn't meant literally.)

Alternatively, you can also create a new Handle class which is a subclass of MobilizedBody::Custom and which creates the Implementation itself in its constructors.

class MyMobilizedBody : public MobilizedBody::Custom {
public:
  MyMobilizedBody(args) 
  :   MobilizedBody::Custom(new MyMobilizedBodyImplementation(args)) {}
};

This allows an end user to simply write

MyMobilizedBody(args);

and not worry about implementation classes or creating objects on the heap. If you do this, your MobilizedBody::Custom subclass must not have any data members or virtual methods. If it does, it will not work correctly. Instead, store all data in the Implementation subclass.

See also:
MobilizedBody::Custom::Implementation

Constructor & Destructor Documentation

Default constructor provides an empty handle that can be assigned to reference any MobilizedBody::Custom.

SimTK::MobilizedBody::Custom::Custom ( MobilizedBody parent,
Implementation implementation,
const Transform X_PF,
const Body bodyInfo,
const Transform X_BM,
Direction  direction = Forward 
)

Create a Custom mobilizer between an existing parent (inboard) body P and a new child (outboard) body B created by copying the given bodyInfo into a privately-owned Body within the constructed MobilizedBody object.

Specify the mobilizer frames F fixed to parent P and M fixed to child B.

See also:
MobilizedBody for a diagram and explanation of terminology.
Parameters:
parentthe MobilizedBody's parent (inboard) body
implementationthe object which implements the custom mobilized body. The MobilizedBody::Custom takes over ownership of the implementation object, and deletes it when the MobilizedBody itself is deleted.
X_PFthe MobilizedBody's F (inboard) frame
bodyInfodescribes this MobilizedBody's physical properties
X_BMthe MobilizedBody's M (outboard) frame
directionwhether you want the coordinates defined as though parent & child were swapped
SimTK::MobilizedBody::Custom::Custom ( MobilizedBody parent,
Implementation implementation,
const Body bodyInfo,
Direction  direction = Forward 
)

Abbreviated constructor you can use if the mobilizer frames are coincident with the parent and child body frames.


Member Function Documentation


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines