-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Citadel] Physics Plugin Documentation #36
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
b9b578b
add physics engine doc layout
1ffb287
add high level concept
6e8a987
focus on plugin instead of physics engine
5c69999
add Dart vs. TPE feature comparison amd definition
8f70397
Merged ign-physics2 into dart_tpe_feature_doc
7748583
move up featurelist definitions
648e2a7
add links to resources
c7ce15c
merge ign-physics2
fab71d2
proof
ef0a83e
Close branch tpe_doc_edit
51f1a84
Merged tpe_doc_edit into dart_tpe_feature_doc
167b274
Merged ign-physics2 into dart_tpe_feature_doc
23d5168
address review comments
7baf77c
Merged ign-physics2 into dart_tpe_feature_doc
d287c26
add bullet plugin to doc
488e10c
chaneg doc title
acac98f
address azeey's review comments
0f4a4cc
Merge branch 'ign-physics2' into dart_tpe_feature_doc
48d1c05
remove bullet since it's unlikely to get in before blueprint EOL
9a6705a
Merge branch 'ign-physics2' into dart_tpe_feature_doc
eda9db5
Merge branch 'ign-physics2' into dart_tpe_feature_doc
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
\page physicsplugin Understanding the Physics Plugin | ||
|
||
This is an introduction to different physics engines and how they are integrated into the Ignition Physics library. | ||
|
||
## Ignition Physics | ||
|
||
The \ref ignition::physics "Ignition Physics" library integrates external physics engines into the Ignition Simulation eco-system. | ||
It allows users to select from multiple supported physics engines based on their simulation needs. | ||
Its plugin interface loads physics engines with requested features at runtime. | ||
It is also possible to integrate your own selected physics engine by writing a compatible plugin interface. | ||
|
||
To get a more in-depth understanding of how the physics plugin works in Ignition, we will start with some high level concepts and definitions. | ||
|
||
<!-- TODO: add tutorial on how to write your own physics plugin --> | ||
|
||
### High Level Concept | ||
|
||
Conceptually, the physics plugin can be viewed from two sides of its interface: user vs. implementation. | ||
|
||
Each physics engine provides access to different features implemented by the Ignition Physics engine. | ||
The interface is made possible through the \ref ignition::plugin "Ignition Plugin" library, which instantiates \ref ignition::physics::Feature "Features" in \ref ignition::physics::FeatureList "FeatureLists" and supplies pointers to the selected engine. | ||
This "user side interface" makes the Ignition Physics library "callable" from other Ignition libraries. | ||
|
||
The implementation side interface handles specific implementations of each `Feature`. | ||
Depending on what external physics engine we are using (DART, TPE etc.), the interface might be different. | ||
This interface is more internal facing, i.e. used mostly inside the Ignition Physics library. | ||
|
||
The implementation of the physics plugin revolves around four key elements. | ||
|
||
1. \ref ignition::physics::Entity "Entity" | ||
|
||
This is the base class of all "proxy objects". | ||
The "proxy objects" are essentially interfaces into the actual objects which exist inside of the various physics engine implementations. | ||
The proxy objects contain the minimal amount of data (e.g. a unique identifier, a reference-counter for the implementation object, and a reference to the implementation interface that it needs) necessary to interface with the object inside of the implementation that it refers to. | ||
|
||
2. \ref ignition::physics::FeaturePolicy "FeaturePolicy" | ||
|
||
FeaturePolicy is a "policy class" used to provide metadata to features about what kind of simulation engine they are going to be used in. | ||
Many physics simulations software libraries model 3-dimensional systems, though some (like Box2d) only consider 2-dimensional systems. | ||
A FeaturePolicy is used to customize Ignition Physics' APIs by the number of dimensions (2 or 3) and also the floating point scalar type (float or double). | ||
Dartsim and TPE reference implementations both use FeaturePolicy3d (3 dimensions, double). | ||
|
||
3. \ref ignition::physics::Feature "Feature" | ||
|
||
This class defines the concept of a `Feature`, examples like `GetWorldFromEngine`, \ref ignition::physics::GetEngineInfo "GetEngineInfo" etc. | ||
There is a pre-defined list of features in Ignition Physics. | ||
They are implemented by using external physics engines' APIs to fulfill simulation needs requested by Ignition. | ||
|
||
4. \ref ignition::physics::FeatureList "FeatureList" | ||
|
||
This is the class that aggregates a list of features. | ||
FeatureLists can be constructed in hierarchies, e.g. a `FeatureList` can be passed into another `FeatureList`, and the set of all features in the new list will be the sum. | ||
|
||
|
||
### FeatureList Definitions | ||
|
||
This list of `FeatureLists` is specific to the implementation of `Dartsim` and `TPE-plugin`. | ||
Users do not need to organize their own plugin implementations this way. | ||
|
||
| Name | Definition | | ||
|---|---| | ||
| Base | contains data structures and functions that define and use "proxy objects" | | ||
| CustomFeatures | retrieves `World` entity from physics engine| | ||
| EntityManagementFeatures | provides features to get, remove and construct entities | | ||
| FreeGroupFeatures | finds free group entities and sets world pose, linear and angular velocities | | ||
| JointFeatures | defines types of joints used and sets joint properties | | ||
| KinematicsFeatures | computes frame relative to world | | ||
| LinkFeatures | applies external force and torque to link | | ||
| SDFFeatures | constructs entities from SDF file | | ||
| ShapeFeatures | retrieves `Shape` related properties like `BoundingBox`, `ShapeSize` etc. | | ||
| SimulationFeatures | updates `World` and everything within by defined stepsize | | ||
|
||
### Dart vs. TPE | ||
|
||
<!-- TODO: add Bullet once it's supported --> | ||
<!-- ### Bullet --> | ||
|
||
Dart ([Dynamic Animation and Robotics Toolkit](https://dartsim.github.io/)) is an open source library that provides data structures and algorithms for kinematic and dynamic applications in robotics and computer animation. | ||
It is the default physics engine used in Ignition Simulation. | ||
The source code for Dartsim plugin can be found in [Ignition Physics repository](https://github.com/ignitionrobotics/ign-physics/tree/master) under `dartsim` directory. | ||
|
||
TPE ([Trivial Physics Engine](<!-- add repo link after merged-->)) is an open source library created by Open Robotics that enables fast, inexpensive kinematics simulation for entities at large scale. | ||
It supports higher-order fleet dynamics without real physics (eg. gravity, force, constraint etc.) and multi-machine synchronization. | ||
Ignition support for TPE targets [Citadel](https://ignitionrobotics.org/docs/citadel) and onward releases. | ||
The source code for TPE plugin can be found in [Ignition Physics repository](https://github.com/ignitionrobotics/ign-physics/tree/ign-physics2) under `tpe/plugin` directory | ||
|
||
The following is a list of features supported by each physics engine to help users select one that fits their needs. | ||
|
||
#### Entity Comparison | ||
|
||
The following is a table of `Entity` names used in Ignition Physics plugin interface, Dart and TPE. | ||
Entities are arranged in top-down hierarchical order. | ||
|
||
| Physics Plugin | Dart | TPE | | ||
|:-:|:-:|:-:| | ||
| Engine | Engine | Engine | | ||
| World | World | World | | ||
| Frame | Frame | N/A | | ||
| Model | Skeleton | Model | | ||
| Joint | Joint | N/A | | ||
| Link | BodyNode | Link | | ||
| Shape | Shape | Collision | | ||
| Box/Sphere/Cylinder etc. | Box/Sphere/Cylinder etc. | Box/Sphere/Cylinder/Mesh etc. | | ||
|
||
#### Feature Comparison | ||
|
||
The following is a table of implemented `Features` of Dartsim and TPE-Plugin. | ||
|
||
| Features | Dartsim | TPE-Plugin | | ||
|:-:|:-:|:-:| | ||
| GetEntities | ✓ | ✓ (no joint in TPE) | | ||
| RemoveEntities | ✓ | ✓ | | ||
| ConstructEmptyWorldFeature | ✓ | ✓ | | ||
| ConstructEmptyModelFeature | ✓ | ✓ | | ||
| ConstructEmptyLinkFeature | ✓ | ✓ | | ||
| CollisionFilterMaskFeature | ✓ | ✕ | | ||
| FindFreeGroupFeature | ✓ | ✓ | | ||
| SetFreeGroupWorldPose | ✓ | ✓ | | ||
| SetFreeGroupWorldVelocity | ✓ | ✓ | | ||
| GetBasicJointState | ✓ | ✕ | | ||
| SetBasicJointState | ✓ | ✕ | | ||
| GetBasicJointProperties | ✓ | ✕ | | ||
| SetJointTransformFromParentFeature | ✓ | ✕ | | ||
| SetJointTransformToChildFeature |✓ | ✕ | | ||
| DetachJointFeature | ✓ | ✕ | | ||
| SetFreeJointRelativeTransformFeature | ✓ | ✕ | | ||
| AttachFixedJointFeature | ✓ | ✕ | | ||
| SetRevoluteJointProperties | ✓ | ✕ | | ||
| GetRevoluteJointProperties | ✓ | ✕ | | ||
| AttachRevoluteJointFeature | ✓ | ✕ | | ||
| SetPrismaticJointProperties | ✓ | ✕ | | ||
| GetPrismaticJointProperties | ✓ | ✕ | | ||
| AttachPrismaticJointFeature | ✓ | ✕ | | ||
| SetJointVelocityCommandFeature | ✓ | ✕ | | ||
| LinkFrameSemantics | ✓ | ✕ | | ||
| ShapeFrameSemantics | ✓ | ✓ | | ||
| FreeGroupFrameSemantics | ✓ | ✕ | | ||
| AddLinkExternalForceTorque | ✓ | ✕ | | ||
| sdf::ConstructSdfWorld | ✓ | ✓ | | ||
| sdf::ConstructSdfModel | ✓ | ✓ | | ||
| sdf::ConstructSdfLink | ✓ | ✓ | | ||
| sdf::ConstructSdfJoint | ✓ | ✕ | | ||
| sdf::ConstructSdfCollision | ✓ | ✕ | | ||
| sdf::ConstructSdfVisual | ✓ | ✓ | | ||
| GetShapeKinematicProperties | ✓ | ✓ | | ||
| SetShapeKinematicProperties | ✓ | ✕ | | ||
| GetShapeBoundingBox | ✓ | ✓ | | ||
| GetBoxShapeProperties | ✓ | ✓ | | ||
| AttachBoxShapeFeature | ✓ | ✓ | | ||
| GetCylinderShapeProperties | ✓ | ✓ | | ||
| AttachCylinderShapeFeature | ✓ | ✓ | | ||
| GetSphereShapeProperties | ✓ | ✓ | | ||
| AttachSphereShapeFeature | ✓ | ✓ | | ||
| mesh::GetMeshShapeProperties | ✓ | ✓ | | ||
| mesh::AttachMeshShapeFeature | ✓ | ✓ | | ||
| ForwardStep | ✓ | ✓ | ✓ | | ||
| GetContactsFromLastStepFeature | ✓ | ✕ | |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.