Skip to content

Commit

Permalink
World exporter (#474)
Browse files Browse the repository at this point in the history
* Added world exporter

Signed-off-by: Gonzalo de Pedro <[email protected]>

* Fixed CMake

Signed-off-by: Gonzalo de Pedro <[email protected]>

* Changes based on review

Signed-off-by: Gonzalo de Pedro <[email protected]>

* Added example world

Signed-off-by: Nate Koenig <[email protected]>

* bump required ign-common version

Signed-off-by: Louise Poubel <[email protected]>

* PR updates

Signed-off-by: Nate Koenig <[email protected]>

* Update documentation to have simulation self terminate

Signed-off-by: Nate Koenig <[email protected]>

* Rename world_export to collada_world_exporter

Signed-off-by: Nate Koenig <[email protected]>

* Finish world exporter renaming

Signed-off-by: Nate Koenig <[email protected]>

* Revert change

Signed-off-by: Nate Koenig <[email protected]>

* Added a tutorial

Signed-off-by: Nate Koenig <[email protected]>

* Update transform

Signed-off-by: Nate Koenig <[email protected]>

* Added message

Signed-off-by: Nate Koenig <[email protected]>

* Added a test

Signed-off-by: Nate Koenig <[email protected]>

* Added more shapes

Signed-off-by: Nate Koenig <[email protected]>

* Cleanup in two locations

Signed-off-by: Nate Koenig <[email protected]>

* Fix build

Signed-off-by: Nate Koenig <[email protected]>

* Apply scale, and fix codecheck

Signed-off-by: Nate Koenig <[email protected]>

Co-authored-by: Louise Poubel <[email protected]>
Co-authored-by: Nate Koenig <[email protected]>
  • Loading branch information
3 people authored Jan 29, 2021
1 parent 59ea1c6 commit f6a7329
Show file tree
Hide file tree
Showing 13 changed files with 777 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ set(IGN_MSGS_VER ${ignition-msgs6_VERSION_MAJOR})
#--------------------------------------
# Find ignition-common
# Always use the profiler component to get the headers, regardless of status.
ign_find_package(ignition-common3 VERSION 3.5
ign_find_package(ignition-common3 VERSION 3.8
COMPONENTS
profiler
events
Expand Down
180 changes: 180 additions & 0 deletions examples/worlds/collada_world_exporter.sdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
<?xml version="1.0" ?>
<!--
This world will load the ColladaWorldExporter plugin, which is designed to
convert a world to a single Collada file. When this world is run, a subdirectory
named after the world is created. Within this subdirectory is the mesh and
materials for the world.
This example just exports simple shapes into a Collada file. To run use:
ign gazebo -v 4 -s -r --iterations 1 collada_world_exporter.sdf
-->
<sdf version="1.6">
<world name="shapes">

<plugin
filename="ignition-gazebo-collada-world-exporter-system"
name="ignition::gazebo::systems::ColladaWorldExporter">
</plugin>

<scene>
<ambient>1.0 1.0 1.0</ambient>
<background>0.8 0.8 0.8</background>
</scene>

<light type="directional" name="sun">
<cast_shadows>true</cast_shadows>
<pose>0 0 10 0 0 0</pose>
<diffuse>0.8 0.8 0.8 1</diffuse>
<specular>0.8 0.8 0.8 1</specular>
<attenuation>
<range>1000</range>
<constant>0.9</constant>
<linear>0.01</linear>
<quadratic>0.001</quadratic>
</attenuation>
<direction>-0.5 0.1 -0.9</direction>
</light>

<model name="ground_plane">
<static>true</static>
<link name="link">
<collision name="collision">
<geometry>
<plane>
<normal>0 0 1</normal>
</plane>
</geometry>
</collision>
<visual name="visual">
<geometry>
<plane>
<normal>0 0 1</normal>
<size>100 100</size>
</plane>
</geometry>
<material>
<ambient>0.8 0.8 0.8 1</ambient>
<diffuse>0.8 0.8 0.8 1</diffuse>
<specular>0.8 0.8 0.8 1</specular>
</material>
</visual>
</link>
</model>

<model name="box">
<pose>0 0 0.5 0 0 0</pose>
<link name="box_link">
<inertial>
<inertia>
<ixx>1</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>1</iyy>
<iyz>0</iyz>
<izz>1</izz>
</inertia>
<mass>1.0</mass>
</inertial>
<collision name="box_collision">
<geometry>
<box>
<size>1 1 1</size>
</box>
</geometry>
</collision>

<visual name="box_visual">
<geometry>
<box>
<size>1 1 1</size>
</box>
</geometry>
<material>
<ambient>1 0 0 1</ambient>
<diffuse>1 0 0 1</diffuse>
<specular>1 0 0 1</specular>
</material>
</visual>
</link>
</model>

<model name="cylinder">
<pose>0 -1.5 0.5 0 0 0</pose>
<link name="cylinder_link">
<inertial>
<inertia>
<ixx>2</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>2</iyy>
<iyz>0</iyz>
<izz>2</izz>
</inertia>
<mass>2.0</mass>
</inertial>
<collision name="cylinder_collision">
<geometry>
<cylinder>
<radius>0.5</radius>
<length>1.0</length>
</cylinder>
</geometry>
</collision>

<visual name="cylinder_visual">
<geometry>
<cylinder>
<radius>0.5</radius>
<length>1.0</length>
</cylinder>
</geometry>
<material>
<ambient>0 1 0 1</ambient>
<diffuse>0 1 0 1</diffuse>
<specular>0 1 0 1</specular>
</material>
</visual>
</link>
</model>

<model name="sphere">
<pose>0 1.5 0.5 0 0 0</pose>
<link name="sphere_link">
<inertial>
<inertia>
<ixx>3</ixx>
<ixy>0</ixy>
<ixz>0</ixz>
<iyy>3</iyy>
<iyz>0</iyz>
<izz>3</izz>
</inertia>
<mass>3.0</mass>
</inertial>
<collision name="sphere_collision">
<geometry>
<sphere>
<radius>0.5</radius>
</sphere>
</geometry>
</collision>

<visual name="sphere_visual">
<geometry>
<sphere>
<radius>0.5</radius>
</sphere>
</geometry>
<material>
<ambient>0 0 1 1</ambient>
<diffuse>0 0 1 1</diffuse>
<specular>0 0 1 1</specular>
</material>
</visual>
</link>
</model>
</world>
</sdf>
4 changes: 2 additions & 2 deletions src/ServerPrivate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,15 @@ void ServerPrivate::AddRecordPlugin(const ServerConfig &_config)
bool sdfUseLogRecord = (recordPluginElem != nullptr);

bool hasRecordResources {false};
bool hasCompress {false};
bool hasRecordTopics {false};

bool sdfRecordResources;
bool sdfCompress;
std::vector<std::string> sdfRecordTopics;

if (sdfUseLogRecord)
{
bool hasCompress {false};
bool sdfCompress;
std::tie(sdfRecordResources, hasRecordResources) =
recordPluginElem->Get<bool>("record_resources", false);
std::tie(sdfCompress, hasCompress) =
Expand Down
1 change: 1 addition & 0 deletions src/systems/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ add_subdirectory(apply_joint_force)
add_subdirectory(battery_plugin)
add_subdirectory(breadcrumbs)
add_subdirectory(buoyancy)
add_subdirectory(collada_world_exporter)
add_subdirectory(contact)
add_subdirectory(camera_video_recorder)
add_subdirectory(detachable_joint)
Expand Down
4 changes: 4 additions & 0 deletions src/systems/collada_world_exporter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gz_add_system(collada-world-exporter
SOURCES
ColladaWorldExporter.cc
)
Loading

0 comments on commit f6a7329

Please sign in to comment.