Skip to content

Commit

Permalink
4 ➡️ 5 (#324)
Browse files Browse the repository at this point in the history
Signed-off-by: Louise Poubel <[email protected]>
  • Loading branch information
chapulina authored Jan 10, 2022
2 parents 20a9d69 + 415dffd commit abd7c45
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 36 deletions.
27 changes: 27 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,33 @@

### Ignition Physics 4.x.x (20XX-XX-XX)

### Ignition Physics 4.3.0 (2021-11-11)

1. Remove unused ign_auto_headers.hh.in
* [Pull request #305](https:/ignitionrobotics/ign-physics/pull/305)

1. Added DART feature for setting joint limits dynamically.
* [Pull request #260](https:/ignitionrobotics/ign-physics/pull/260)

1. Allow customization of contact surface properties
* [Pull request #267](https:/ignitionrobotics/ign-physics/pull/267)

1. Avoid `auto` usage in Eigen expressions.
* [Pull request #301](https:/ignitionrobotics/ign-physics/pull/301)

1. [dartsim] Add support for joint frame semantics
* [Pull request #288](https:/ignitionrobotics/ign-physics/pull/288)

1. Fix TPE Link velocity not being updated and Model velocity not having any effect.
* [Pull request #289](https:/ignitionrobotics/ign-physics/pull/289)

1. Infrastructure
* [Pull request #287](https:/ignitionrobotics/ign-physics/pull/287)
* [Pull request #281](https:/ignitionrobotics/ign-physics/pull/281)

1. Make ignition-physics CMake config files relocatable
* [Pull request #282](https:/ignitionrobotics/ign-physics/pull/282)

### Ignition Physics 4.2.0 (2021-07-16)

1. Support FreeGroup features for nested models
Expand Down
2 changes: 2 additions & 0 deletions dartsim/include/ignition/physics/dartsim/World.hh
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ class RetrieveWorld : public virtual Feature
};

/////////////////////////////////////////////////
//! [feature template]
template <typename PolicyT, typename FeaturesT>
dart::simulation::WorldPtr RetrieveWorld::World<PolicyT, FeaturesT>
::GetDartsimWorld()
{
return this->template Interface<RetrieveWorld>()
->GetDartsimWorld(this->identity);
}
//! [feature template]

}
}
Expand Down
2 changes: 2 additions & 0 deletions dartsim/src/CustomFeatures.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ namespace physics {
namespace dartsim {

/////////////////////////////////////////////////
//! [implementation]
dart::simulation::WorldPtr CustomFeatures::GetDartsimWorld(
const Identity &_worldID)
{
return this->worlds.at(_worldID);
}
//! [implementation]

}
}
Expand Down
2 changes: 2 additions & 0 deletions dartsim/src/CustomFeatures.hh
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ namespace ignition {
namespace physics {
namespace dartsim {

//! [add to list]
using CustomFeatureList = FeatureList<
RetrieveWorld
>;
//! [add to list]

class CustomFeatures :
public virtual Base,
Expand Down
2 changes: 2 additions & 0 deletions examples/hello_world_loader/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

project(ign-physics-hello-world-loader)

set(IGN_PLUGIN_VER 1)
find_package(ignition-plugin${IGN_PLUGIN_VER} 1.1 REQUIRED COMPONENTS all)

Expand Down
2 changes: 2 additions & 0 deletions examples/hello_world_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

project(ign-physics-hello-world-plugin)

set(IGN_PLUGIN_VER 1)
find_package(ignition-plugin${IGN_PLUGIN_VER} 1.1 REQUIRED COMPONENTS all)

Expand Down
2 changes: 2 additions & 0 deletions examples/simple_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

project(ign-physics-simple-plugin)

set(IGN_PLUGIN_VER 1)
find_package(ignition-plugin${IGN_PLUGIN_VER} 1.1 REQUIRED COMPONENTS all)

Expand Down
9 changes: 4 additions & 5 deletions tutorials/05_plugin_loading.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ plugin using \ref ignition::physics "Ignition Physics" API.
## Prerequisites

- \ref installation "Installation"
- \ref physicsplugin "Understand physics plugin"
- \ref physicsplugin "Understanding the physics plugin"

## Write a simple loader

We will use a simplified physics plugin example for this tutorial. Source code can be found at [ign-physics2/examples](https:/ignitionrobotics/ign-physics/tree/ign-physics3/examples/hello_world_loader) folder.
-We will use a simplified physics plugin example for this tutorial. Source code can be found at [ign-physics/examples](https:/ignitionrobotics/ign-physics/tree/ign-physics2/examples/hello_world_loader) folder.

First, create a workspace for the example plugin loader.

Expand All @@ -41,7 +41,7 @@ be used in our code. After the `std` C++ libraries are the `Loader.hh` and
and plugin pointers. Next includes from \ref ignition::physics are the tools for
retrieving \ref ignition::physics::Feature "Feature" and
\ref ignition::physics::Entity "Entity" from physics plugins (please refer to
\ref physicsplugin "Understand Physics Plugin" tutorial for their
\ref physicsplugin "Understanding the physics plugin" tutorial for their
design concepts).

\snippet examples/hello_world_loader/hello_world_loader.cc include statements
Expand All @@ -55,8 +55,7 @@ available in the path using @ref ignition::plugin::Loader::Instantiate member
function. Then for each instantiated plugin, using
@ref ignition::physics::RequestEngine3d<Features>::From, it will request an
engine implementing a \ref ignition::physics::FeaturePolicy "FeaturePolicy" (3D
in this case).
.
in this case).

\snippet examples/hello_world_loader/hello_world_loader.cc main

Expand Down
22 changes: 11 additions & 11 deletions tutorials/06-physics-simulation-concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ For a comprehensive tutorial for constructing your robot model from SDFormat, re
In this tutorial, we will show how to
manipulate and visualize some physics aspects using demos on Ignition Gazebo.

All demos can be found in [ign-gazebo3/examples/worlds](https:/ignitionrobotics/ign-gazebo/blob/ign-gazebo3/examples/worlds/) folder.
All demos can be found in [ign-gazebo/examples/worlds](https:/ignitionrobotics/ign-gazebo/blob/ign-gazebo3/examples/worlds/) folder.

### Differential drive

Expand All @@ -53,7 +53,7 @@ ign gazebo velocity_control.sdf --physics-engine ignition-physics-tpe-plugin # s
```

To control the car movement, in a separate terminal window, we publish a
\ref ignition::msgs::Twist "Twist" message using Ignition Transport library:
Twist message using Ignition Transport library:

```bash
ign topic -t "/model/vehicle_blue/cmd_vel" -m ignition.msgs.Twist -p "linear: {x: 1.0}, angular: {z: 0.5}"
Expand All @@ -65,7 +65,7 @@ This command tells the car to move in its coordinate frame with velocity
second in Z-axis.

Note that the mechanism to move the car is different depending on the used physics
engine, see \ref physicsengine "Use different physics engine" for details on how to change physics engine used by simulation.
engine, see \ref physicsengine "Use different physics engines" for details on how to change physics engine used by simulation.

Dartsim moves the car by applying force on the joints, whereas TPE directly set velocity on the model.

Expand All @@ -76,7 +76,7 @@ select the drop-down list `Pose`. Moreover, we could also read the model
links' poses relative to their parent link by selecting the
corresponding link on the model tree:

@image html img/diff_drive_link.gif
@image html img/diff_drive_link.gif width=100%

Note that using the model tree as shown in the above gif, we can view the
parameters and properties such as `visual` or `collision` of each link or joint
Expand All @@ -89,7 +89,7 @@ Ignition Gazebo also simulates realistic collision effect. While the `vehicle_bl
car is moving in a circle, we can move the `vehicle_green` to be on `vehicle_blue`'s
upcoming path. The blue car will then push the green car in the following demo.

@image html img/diff_drive_collision.gif
@image html img/diff_drive_collision.gif width=100%

To see where these collision parameters are set in SDFormat and how it works,
please see this [SDFormat tutorial](http://sdformat.org/tutorials?tut=spec_shapes&cat=specification&).
Expand All @@ -110,7 +110,7 @@ ign gazebo lift_drag.sdf
```

To see how the rotor lifts the cube due to wind force pressure, in a separate terminal window, we can publish a
\ref ignition::msgs::Double "Double" message represeting the torque (Nm) applying to
Double message represeting the torque (Nm) applying to
the rotor rod axis:

```bash
Expand All @@ -126,7 +126,7 @@ ign topic -t "/model/lift_drag_demo_model/joint/rod_1_joint/cmd_force" -m igniti
You will see the cube drops due to no lift force from support torque on the rod,
and the blades will stop after some time due to friction.

@image html img/lift_drag_torque.gif
@image html img/lift_drag_torque.gif width=100%

Several simulation features come into effect in this demo. The lift and drag force is computed by taking the wind pressure, mass of the cude, and gravity into account, and the resulting force is exerted on multiple joints. Dartsim is used to power this demo.

Expand All @@ -153,7 +153,7 @@ ign gazebo buoyancy.sdf

After pressing the Play button, demo will run as below:

@image html img/buoyancy.gif
@image html img/buoyancy.gif width=100%

The buoyancy concept is implemented by
simulating fluid density and applying the force on the object in the fluid
Expand All @@ -180,7 +180,7 @@ After pressing the Play button, you will see that the pendulum will oscillate ar
its main revolute joint forever due to lack of friction (it is undeclared in the
SDFormat file).

@image html img/pendulum.gif
@image html img/pendulum.gif width=100%

The oscillation period or the max angular speed of the joint
will change if we modify the inertia of the rods. According to the demo below,
Expand All @@ -205,7 +205,7 @@ ign gazebo multicopter_velocity_control.sdf
```

To control the multicopter to ascend and hover, in a separate terminal window, send a
\ref ignition::msgs::Twist "Twist" message to command the `X3` multicopter
Twist message to command the `X3` multicopter
ascending 0.1 m.s as follow:

```bash
Expand All @@ -218,7 +218,7 @@ then hovering:
ign topic -t "/X3/gazebo/command/twist" -m ignition.msgs.Twist -p " "
```

@image html img/hover.gif
@image html img/hover.gif width=100%

Do the same for the `X4` multicopter. After pressing the Play button, you will see
both of the multicopters will ascend, this demonstrates how the physics engine
Expand Down
14 changes: 7 additions & 7 deletions tutorials/07-implementing-a-physics-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ This tutorial shows how to develop a simple plugin that implements a
## Prerequisites

- \ref installation "Installation"
- \ref physicsplugin "Understand physics plugin"
- \ref loadplugin "Load physics plugin"
- \ref physicsplugin "Understanding the physics plugin"
- \ref pluginloading "Loading physics plugins"

## Write a simple physics plugin

Expand Down Expand Up @@ -44,7 +44,7 @@ Next, we use a dummy namespace `mock` and list all the features we would like to

The plugin will be able to return its physics engine metadata.
We will now implement our plugin class named `HelloWorldPlugin`
using the defined \ref ignition::physics::FeatureList `FeatureList` above.
using the defined \ref ignition::physics::FeatureList "FeatureList" above.
The class is inherited from \ref ignition::physics::Implements3d "Implements3d"
to declare that the plugin's `HelloWorldFeatureList` will be in the 3D
coordinate system.
Expand All @@ -53,11 +53,11 @@ coordinate system.

Because we are not using a real physics engines, a dummy
physics engines is defined inside member function `InitiateEngine` by simply setting the `engineName` to `HelloWorld`,
and returning the engine object using \ref ignition::physics::Identity. Then, we
and returning the engine object using `Identity`. Then, we
define the metadata getters `GetEngineIndex` and `GetEngineName` for the
feature \ref ignition::physics::GetEngineInfo "GetEngineInfo" (please look into
corresponding public member functions defined in the subclasses). A list of other
pre-defined features are can be found in the [`GetEntities` FeatureList](https://ignitionrobotics.org/api/physics/2.0/GetEntities_8hh.html).
pre-defined features can be found in the [`GetEntities` FeatureList](https://ignitionrobotics.org/api/physics/2.0/GetEntities_8hh.html).

Finally, we only have to register our plugin in Ignition Physics as a physics
engine by:
Expand All @@ -76,7 +76,7 @@ plugin provides, i.e. `HelloWorldFeatureList`
Now create a file named `CMakeLists.txt` with your favorite editor and add these
lines for finding `ign-plugin` and `ign-physics` dependencies for the Fortress release:

\snippet examples/hello_world_plugin/CMakeLists.txt
\include examples/hello_world_plugin/CMakeLists.txt

## Build and run

Expand Down Expand Up @@ -104,7 +104,7 @@ and `HelloWorldPlugin.dll` on Windows.

### Test loading the plugin on Linux

Please first follow the \ref loadplugin "Load physics plugin" tutorial
Please first follow the \ref pluginloading "Loading physics plugins" tutorial
to create a simple loader. Then we test our plugin using the loader as follow:

```bash
Expand Down
24 changes: 11 additions & 13 deletions tutorials/08-implementing-a-custom-feature.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
## Prerequisites

- \ref installation "Installation"
- \ref physicsplugin "Understand physics plugin"
- \ref loadplugin "Load physics plugin"
- \ref implementfeature "Implement physics feature"
- \ref physicsplugin "Understanding the physics plugin"
- \ref pluginloading "Loading physics plugins"
- \ref createphysicsplugin "Implement a physics feature"

## Implement a custom feature in DART plugin

In the last \ref implementfeature "Implement physics feature" tutorial, we
In the last \ref createphysicsplugin "Implement a physics feature" tutorial, we
know how to implement a dummy physics engine as a plugin and load it using
\ref ignition::physics "Ignition Physics API". In this tutorial, we will look
deeper into the structure of a physics engine plugin, for example, the available
Expand Down Expand Up @@ -37,8 +37,7 @@ ign-physics
└── CMakeLists.txt CMake build script.
```

As shown above, there are two physics engines available (more detail
in \ref physicsplugin "Physics plugin tutorial"):
As shown above, there are two physics engines available:
- **DART**: `ignition-physics-dartsim-plugin`.
- **TPE**: `ignition-physics-tpe-plugin`.

Expand All @@ -61,8 +60,7 @@ functionality of the external physics engine can be defined as a header in
be added in a \ref ignition::physics::FeatureList "FeatureList"
and implemented its functionalities in `src` folder.

The `dartsim` plugin's \ref ignition::physics::FeatureList "FeatureList" could be
found in \ref physicsplugin "Understand physics plugin" tutorial.
See the \ref physicsplugin "Understanding the physics plugin" tutorial for details on physics engines.

### Plugin and feature requirements

Expand Down Expand Up @@ -138,7 +136,7 @@ will not run at the same time when requested.

With the requirements and restrictions above, we first need to define a feature template for the custom feature. In this case, this feature will be responsible for retrieving world pointer from the physics engine. The template is placed in [World.hh](https:/ignitionrobotics/ign-physics/blob/ign-physics2/dartsim/include/ignition/physics/dartsim/World.hh):

\snippet dartsim/include/ignition/physcis/dartsim/World.hh
\snippet dartsim/include/ignition/physics/dartsim/World.hh feature template

The `RetrieveWorld` feature retrieves
world pointer from physics engine, so we will use the `World` entity inherited
Expand Down Expand Up @@ -175,7 +173,7 @@ implement the `RetrieveWorld` feature function using Dartsim API.
After defining the feature template, we can add it to a custom
\ref ignition::physics::FeatureList "FeatureList":

\snippet dartsim/src/CustomFeatures.hh
\snippet dartsim/src/CustomFeatures.hh add to list

The custom feature `RetrieveWorld` is added to `CustomFeatureList`, other custom
features could also be added here.
Expand All @@ -189,7 +187,7 @@ custom feature with \ref ignition::physics::FeaturePolicy3d "FeaturePolicy3d"
We will then implement the actual function with Dartsim API in [CustomFeatures.cc](https:/ignitionrobotics/ign-physics/blob/ign-physics2/dartsim/src/CustomFeatures.cc) to override the member function
declared in the custom feature header file:

\snippet dartsim/src/CustomFeatures.cc
\snippet dartsim/src/CustomFeatures.cc implementation

Here, we implement the behavior of `GetDartsimWorld` with Dartsim API to return the
world pointer from `EntityStorage` object storing world pointers of `dartsim` in
Expand All @@ -198,8 +196,8 @@ world pointer from `EntityStorage` object storing world pointers of `dartsim` in
In the end, we add the implemented `CustomFeatures` "FeatureList" together with
other \ref ignition::physics::FeatureList "FeatureList" to final `DartsimFeatures`
"FeatureList" as in [dartsim/src/plugin.cc](https:/ignitionrobotics/ign-physics/blob/ign-physics2/dartsim/src/plugin.cc)
(please see \ref implementfeature "Implement physics feature" for
registering the plugin to Ignition Physics).
(please see the \ref createphysicsplugin "Implement a physics feature" tutorial
for registering the plugin to Ignition Physics).

The folder structure is shown below:

Expand Down

0 comments on commit abd7c45

Please sign in to comment.