Skip to content

Commit

Permalink
Allow SDF model to be constructed in a single shot (#1560)
Browse files Browse the repository at this point in the history
This PR tweaks the behavior of the physics system so that when constructing a model it will first check if a ModelSdf component is available for the entity. If so, it uses that component to fill in all the model information, overriding the fields that are given by the other entity components (e.g. name and pose).


Signed-off-by: Michael X. Grey <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: ahcorde <[email protected]>
Co-authored-by: Michael Carroll <[email protected]>
Co-authored-by: ahcorde <[email protected]>
  • Loading branch information
3 people authored Nov 9, 2022
1 parent 5a15834 commit 8ba08a8
Show file tree
Hide file tree
Showing 32 changed files with 584 additions and 61 deletions.
24 changes: 24 additions & 0 deletions examples/worlds/ackermann_steering.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
<ode>
<mu>50</mu>
</ode>
<bullet>
<friction>1</friction>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down Expand Up @@ -156,6 +160,11 @@
<mu2>1.0</mu2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>0.5</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down Expand Up @@ -201,6 +210,11 @@
<mu2>1.0</mu2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>0.5</friction>
<friction2>1</friction2>
<rolling_friction>0.5</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down Expand Up @@ -246,6 +260,11 @@
<mu2>1.0</mu2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>0.5</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down Expand Up @@ -291,6 +310,11 @@
<mu2>1.0</mu2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>0.5</friction>
<friction2>1</friction2>
<rolling_friction>0.5</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down
8 changes: 4 additions & 4 deletions examples/worlds/acoustic_comms_demo.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@

<include>
<pose>-5 0 0 0 0 0</pose>
<uri>https://fuel.ignitionrobotics.org/1.0/mabelzhang/models/Turquoise turbidity generator</uri>
<uri>https://fuel.gazebosim.org/1.0/mabelzhang/models/Turquoise turbidity generator</uri>
</include>

<include>
<pose>0 0 1 0 0 1.57</pose>
<uri>https://fuel.ignitionrobotics.org/1.0/accurrent/models/MBARI Tethys LRAUV</uri>
<uri>https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV</uri>

<!-- Acoustic comms endpoint -->
<plugin
Expand Down Expand Up @@ -172,7 +172,7 @@

<include>
<pose>15 0 1 0 0 1.57</pose>
<uri>https://fuel.ignitionrobotics.org/1.0/accurrent/models/MBARI Tethys LRAUV</uri>
<uri>https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV</uri>
<name>triton</name>

<!-- Acoustic comms endpoint -->
Expand Down Expand Up @@ -274,7 +274,7 @@

<include>
<pose>-15 0 1 0 0 1.57</pose>
<uri>https://fuel.ignitionrobotics.org/1.0/accurrent/models/MBARI Tethys LRAUV</uri>
<uri>https://fuel.gazebosim.org/1.0/accurrent/models/MBARI Tethys LRAUV</uri>
<name>daphne</name>

<!-- Acoustic comms endpoint -->
Expand Down
18 changes: 18 additions & 0 deletions examples/worlds/apply_link_wrench.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@
<size>1 1 1</size>
</box>
</geometry>
<surface>
<friction>
<bullet>
<friction>0.7</friction>
<friction2>1</friction2>
<rolling_friction>0.2</rolling_friction>
</bullet>
</friction>
</surface>
</collision>

<visual name="visual">
Expand Down Expand Up @@ -142,6 +151,15 @@
<length>1.0</length>
</cylinder>
</geometry>
<surface>
<friction>
<bullet>
<friction>0.7</friction>
<friction2>1</friction2>
<rolling_friction>0.2</rolling_friction>
</bullet>
</friction>
</surface>
</collision>

<visual name="visual">
Expand Down
20 changes: 20 additions & 0 deletions examples/worlds/breadcrumbs.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@
<slip2>0</slip2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down Expand Up @@ -197,6 +202,11 @@
<slip2>0</slip2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down Expand Up @@ -242,6 +252,11 @@
<slip2>0</slip2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down Expand Up @@ -287,6 +302,11 @@
<slip2>0</slip2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down
4 changes: 2 additions & 2 deletions examples/worlds/buoyancy_engine.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ until it breaches and then start oscillating around the surface. On the other
hand the box on the right will rise forever as no surface is set.
Enter the following in a separate terminal:
```
gz topic -t /model/buoyant_box/buoyancy_engine/ -m gz.msgs.Double
gz topic -t /model/buoyant_box/buoyancy_engine/ -m gz.msgs.Double \
-p "data: 0.003"
```
The boxes will float up. Note that the box on the left will start oscillating
once it breaches the surface.
```
gz topic -t /model/buoyant_box/buoyancy_engine/ -m gz.msgs.Double
gz topic -t /model/buoyant_box/buoyancy_engine/ -m gz.msgs.Double \
-p "data: 0.001"
```
The boxes will go down.
Expand Down
20 changes: 20 additions & 0 deletions examples/worlds/detachable_joint.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@
<slip2>0</slip2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down Expand Up @@ -199,6 +204,11 @@
<slip2>0</slip2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down Expand Up @@ -244,6 +254,11 @@
<slip2>0</slip2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down Expand Up @@ -289,6 +304,11 @@
<slip2>0</slip2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down
68 changes: 68 additions & 0 deletions examples/worlds/diff_drive.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,23 @@
<radius>0.3</radius>
</sphere>
</geometry>
<surface>
<friction>
<ode>
<mu>1</mu>
<mu2>1</mu2>
<slip1>0.035</slip1>
<slip2>0</slip2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
<spinning_friction>0.1</spinning_friction>
</bullet>
</friction>
</surface>
</collision>
</link>

Expand Down Expand Up @@ -178,6 +195,23 @@
<radius>0.3</radius>
</sphere>
</geometry>
<surface>
<friction>
<ode>
<mu>1</mu>
<mu2>1</mu2>
<slip1>0.035</slip1>
<slip2>0</slip2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
<spinning_friction>0.1</spinning_friction>
</bullet>
</friction>
</surface>
</collision>
</link>

Expand Down Expand Up @@ -332,6 +366,23 @@
<radius>0.3</radius>
</sphere>
</geometry>
<surface>
<friction>
<ode>
<mu>1</mu>
<mu2>1</mu2>
<slip1>0.035</slip1>
<slip2>0</slip2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
<spinning_friction>0.1</spinning_friction>
</bullet>
</friction>
</surface>
</collision>
</link>

Expand Down Expand Up @@ -366,6 +417,23 @@
<radius>0.3</radius>
</sphere>
</geometry>
<surface>
<friction>
<ode>
<mu>1</mu>
<mu2>1</mu2>
<slip1>0.035</slip1>
<slip2>0</slip2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
<spinning_friction>0.1</spinning_friction>
</bullet>
</friction>
</surface>
</collision>
</link>

Expand Down
25 changes: 25 additions & 0 deletions examples/worlds/diff_drive_skid.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
<ode>
<mu>50</mu>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down Expand Up @@ -154,6 +159,11 @@
<mu2>1.0</mu2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down Expand Up @@ -197,6 +207,11 @@
<mu2>1.0</mu2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down Expand Up @@ -240,6 +255,11 @@
<mu2>1.0</mu2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down Expand Up @@ -283,6 +303,11 @@
<mu2>1.0</mu2>
<fdir1>0 0 1</fdir1>
</ode>
<bullet>
<friction>1</friction>
<friction2>1</friction2>
<rolling_friction>0.1</rolling_friction>
</bullet>
</friction>
</surface>
</collision>
Expand Down
Loading

0 comments on commit 8ba08a8

Please sign in to comment.