Skip to content

Commit

Permalink
Merge branch 'arjo/feat/reset_test_fixture' of https://github.com/gaz…
Browse files Browse the repository at this point in the history
…ebosim/gz-sim into arjo/feat/reset_test_fixture
  • Loading branch information
arjo129 committed Dec 16, 2024
2 parents ecbe724 + 4a9e69f commit 90a7247
Show file tree
Hide file tree
Showing 38 changed files with 92 additions and 69 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
#============================================================================
# Initialize the project
#============================================================================
project(gz-sim9 VERSION 9.0.0)
project(gz-sim10 VERSION 10.0.0)
set (GZ_DISTRIBUTION "Ionic")

#============================================================================
Expand All @@ -18,7 +18,7 @@ find_package(gz-cmake4 REQUIRED)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

gz_configure_project(VERSION_SUFFIX)
gz_configure_project(VERSION_SUFFIX pre1)

#============================================================================
# Set project-specific options
Expand Down
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Gazebo Sim 10.x

### Gazebo Sim 10.0.0 (20XX-XX-XX)

## Gazebo Sim 9.x

### Gazebo Sim 9.0.0 (2024-09-25)
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

Build | Status
-- | --
Test coverage | [![codecov](https://codecov.io/gh/gazebosim/gz-sim/tree/gz-sim9/graph/badge.svg)](https://codecov.io/gh/gazebosim/gz-sim/tree/gz-sim9)
Ubuntu Noble | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_sim-ci-gz-sim9-noble-amd64)](https://build.osrfoundation.org/job/gz_sim-ci-gz-sim9-noble-amd64)
Homebrew | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_sim-ci-gz-sim9-homebrew-amd64)](https://build.osrfoundation.org/job/gz_sim-ci-gz-sim9-homebrew-amd64)
Windows | [![Build Status](https://build.osrfoundation.org/job/gz_sim-9-win/badge/icon)](https://build.osrfoundation.org/job/gz_sim-9-win/)
Test coverage | [![codecov](https://codecov.io/gh/gazebosim/gz-sim/tree/main/graph/badge.svg)](https://codecov.io/gh/gazebosim/gz-sim/tree/main)
Ubuntu Noble | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_sim-ci-main-noble-amd64)](https://build.osrfoundation.org/job/gz_sim-ci-main-noble-amd64)
Homebrew | [![Build Status](https://build.osrfoundation.org/buildStatus/icon?job=gz_sim-ci-main-homebrew-amd64)](https://build.osrfoundation.org/job/gz_sim-ci-main-homebrew-amd64)
Windows | [![Build Status](https://build.osrfoundation.org/job/gz_sim-main-win/badge/icon)](https://build.osrfoundation.org/job/gz_sim-main-win/)

Gazebo Sim is an open source robotics simulator. Through Gazebo Sim, users have access to high fidelity physics, rendering, and sensor models. Additionally, users and developers have multiple points of entry to simulation including a graphical user interface, plugins, and asynchronous message passing and services.

Expand Down
4 changes: 2 additions & 2 deletions examples/plugin/command_actor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ project(CommandActor)
find_package(gz-plugin3 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin3_VERSION_MAJOR})

find_package(gz-sim9 REQUIRED)
find_package(gz-sim10 REQUIRED)
add_library(CommandActor SHARED CommandActor.cc)
set_property(TARGET CommandActor PROPERTY CXX_STANDARD 17)
target_link_libraries(CommandActor
PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER}
PRIVATE gz-sim9::gz-sim9)
PRIVATE gz-sim10::gz-sim10)
4 changes: 2 additions & 2 deletions examples/plugin/custom_component/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ project(CustomComponentPlugin)
find_package(gz-plugin3 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin3_VERSION_MAJOR})

find_package(gz-sim9 REQUIRED)
find_package(gz-sim10 REQUIRED)
add_library(CustomComponentPlugin SHARED
CustomComponentPlugin.cc
)
set_property(TARGET CustomComponentPlugin PROPERTY CXX_STANDARD 17)
target_link_libraries(CustomComponentPlugin
PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER}
PRIVATE gz-sim9::gz-sim9)
PRIVATE gz-sim10::gz-sim10)
6 changes: 3 additions & 3 deletions examples/plugin/custom_sensor_system/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ project(OdometerSystem)
gz_find_package(gz-plugin3 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin3_VERSION_MAJOR})

gz_find_package(gz-sim9 REQUIRED)
set(GZ_SIM_VER ${gz-sim9_VERSION_MAJOR})
gz_find_package(gz-sim10 REQUIRED)
set(GZ_SIM_VER ${gz-sim10_VERSION_MAJOR})

find_package(gz-sensors9 REQUIRED)
set(GZ_SENSORS_VER ${gz-sensors9_VERSION_MAJOR})
Expand All @@ -20,7 +20,7 @@ include(FetchContent)
FetchContent_Declare(
sensors_clone
GIT_REPOSITORY https://github.com/gazebosim/gz-sensors
GIT_TAG main
GIT_TAG gz-sensors${GZ_SENSORS_VER}
)
FetchContent_Populate(sensors_clone)
add_subdirectory(${sensors_clone_SOURCE_DIR}/examples/custom_sensor ${sensors_clone_BINARY_DIR})
Expand Down
4 changes: 2 additions & 2 deletions examples/plugin/gui_system_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ project(GuiSystemPlugin)

set(CMAKE_AUTOMOC ON)

find_package(gz-sim9 REQUIRED COMPONENTS gui)
find_package(gz-sim10 REQUIRED COMPONENTS gui)

QT5_ADD_RESOURCES(resources_RCC ${PROJECT_NAME}.qrc)

Expand All @@ -17,5 +17,5 @@ add_library(${PROJECT_NAME} SHARED
${resources_RCC}
)
target_link_libraries(${PROJECT_NAME}
PRIVATE gz-sim9::gui
PRIVATE gz-sim10::gui
)
4 changes: 2 additions & 2 deletions examples/plugin/hello_world/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ project(Hello_world)
gz_find_package(gz-plugin3 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin3_VERSION_MAJOR})

gz_find_package(gz-sim9 REQUIRED)
set(GZ_SIM_VER ${gz-sim9_VERSION_MAJOR})
gz_find_package(gz-sim10 REQUIRED)
set(GZ_SIM_VER ${gz-sim10_VERSION_MAJOR})

add_library(HelloWorld SHARED HelloWorld.cc)
set_property(TARGET HelloWorld PROPERTY CXX_STANDARD 17)
Expand Down
4 changes: 2 additions & 2 deletions examples/plugin/priority_printer_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ project(Priority_printer)
gz_find_package(gz-plugin3 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin3_VERSION_MAJOR})

gz_find_package(gz-sim9 REQUIRED)
set(GZ_SIM_VER ${gz-sim9_VERSION_MAJOR})
gz_find_package(gz-sim10 REQUIRED)
set(GZ_SIM_VER ${gz-sim10_VERSION_MAJOR})

add_library(PriorityPrinter SHARED PriorityPrinter.cc)
set_property(TARGET PriorityPrinter PROPERTY CXX_STANDARD 17)
Expand Down
4 changes: 2 additions & 2 deletions examples/plugin/rendering_plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ target_link_libraries(${GUI_PLUGIN}
set(SERVER_PLUGIN RenderingServerPlugin)

find_package(gz-plugin3 REQUIRED COMPONENTS register)
find_package(gz-sim9 REQUIRED)
find_package(gz-sim10 REQUIRED)

add_library(${SERVER_PLUGIN} SHARED ${SERVER_PLUGIN}.cc)
set_property(TARGET ${SERVER_PLUGIN} PROPERTY CXX_STANDARD 17)
target_link_libraries(${SERVER_PLUGIN}
PRIVATE
gz-plugin3::gz-plugin3
gz-sim9::gz-sim9
gz-sim10::gz-sim10
gz-rendering9::gz-rendering9
)
4 changes: 2 additions & 2 deletions examples/plugin/reset_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ project(ResetPlugins)
find_package(gz-plugin3 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin3_VERSION_MAJOR})

find_package(gz-sim9 REQUIRED)
set(GZ_SIM_VER ${gz-sim9_VERSION_MAJOR})
find_package(gz-sim10 REQUIRED)
set(GZ_SIM_VER ${gz-sim10_VERSION_MAJOR})

add_library(JointPositionRandomizer SHARED JointPositionRandomizer.cc)
target_link_libraries(JointPositionRandomizer
Expand Down
4 changes: 2 additions & 2 deletions examples/plugin/system_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ project(SampleSystem)
find_package(gz-plugin3 REQUIRED COMPONENTS register)
set(GZ_PLUGIN_VER ${gz-plugin3_VERSION_MAJOR})

find_package(gz-sim9 REQUIRED)
find_package(gz-sim10 REQUIRED)
add_library(SampleSystem SHARED SampleSystem.cc SampleSystem2.cc)
set_property(TARGET SampleSystem PROPERTY CXX_STANDARD 17)
target_link_libraries(SampleSystem
PRIVATE gz-plugin${GZ_PLUGIN_VER}::gz-plugin${GZ_PLUGIN_VER}
PRIVATE gz-sim9::gz-sim9)
PRIVATE gz-sim10::gz-sim10)
2 changes: 1 addition & 1 deletion examples/scripts/python_api/systems/test_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

from gz.math8 import Vector3d
from gz.sim9 import Model, Link
from gz.sim10 import Model, Link
import random


Expand Down
2 changes: 1 addition & 1 deletion examples/scripts/python_api/testFixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import os

from gz.common6 import set_verbosity
from gz.sim9 import TestFixture, World, world_entity
from gz.sim10 import TestFixture, World, world_entity
from gz.math8 import Vector3d

set_verbosity(4)
Expand Down
4 changes: 2 additions & 2 deletions examples/standalone/acoustic_comms_demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ project(gz-sim-acoustic-comms-demo)
find_package(gz-transport14 QUIET REQUIRED OPTIONAL_COMPONENTS log)
set(GZ_TRANSPORT_VER ${gz-transport14_VERSION_MAJOR})

find_package(gz-sim9 REQUIRED)
set(GZ_SIM_VER ${gz-sim9_VERSION_MAJOR})
find_package(gz-sim10 REQUIRED)
set(GZ_SIM_VER ${gz-sim10_VERSION_MAJOR})

add_executable(acoustic_comms_demo acoustic_comms_demo.cc)
target_link_libraries(acoustic_comms_demo
Expand Down
4 changes: 2 additions & 2 deletions examples/standalone/custom_server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
project(gz-sim-custom-server)

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
find_package(gz-sim9 REQUIRED)
set(GZ_SIM_VER ${gz-sim9_VERSION_MAJOR})
find_package(gz-sim10 REQUIRED)
set(GZ_SIM_VER ${gz-sim10_VERSION_MAJOR})

add_executable(custom_server custom_server.cc)
target_link_libraries(custom_server
Expand Down
4 changes: 2 additions & 2 deletions examples/standalone/each_performance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)

project(gz-sim-each-performance)

find_package(gz-sim9 QUIET REQUIRED)
find_package(gz-sim10 QUIET REQUIRED)

add_executable(each each.cc)
target_link_libraries(each
gz-sim9::core)
gz-sim10::core)
4 changes: 2 additions & 2 deletions examples/standalone/external_ecm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)

project(gz-sim-external-ecm)

find_package(gz-sim9 REQUIRED)
find_package(gz-sim10 REQUIRED)

add_executable(external_ecm external_ecm.cc)
target_link_libraries(external_ecm
gz-sim9::core)
gz-sim10::core)
4 changes: 2 additions & 2 deletions examples/standalone/gtest_setup/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
project(GTestSetup)

# Find Gazebo
find_package(gz-sim9 REQUIRED)
set(GZ_SIM_VER ${gz-sim9_VERSION_MAJOR})
find_package(gz-sim10 REQUIRED)
set(GZ_SIM_VER ${gz-sim10_VERSION_MAJOR})

# Fetch and configure GTest
include(FetchContent)
Expand Down
4 changes: 2 additions & 2 deletions examples/standalone/light_control/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ project(gz-sim-light-control)
find_package(gz-transport14 QUIET REQUIRED OPTIONAL_COMPONENTS log)
set(GZ_TRANSPORT_VER ${gz-transport14_VERSION_MAJOR})

find_package(gz-sim9 REQUIRED)
set(GZ_SIM_VER ${gz-sim9_VERSION_MAJOR})
find_package(gz-sim10 REQUIRED)
set(GZ_SIM_VER ${gz-sim10_VERSION_MAJOR})

add_executable(light_control light_control.cc)
target_link_libraries(light_control
Expand Down
4 changes: 2 additions & 2 deletions examples/standalone/lrauv_control/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ project(gz-sim-lrauv-control)
find_package(gz-transport14 QUIET REQUIRED OPTIONAL_COMPONENTS log)
set(GZ_TRANSPORT_VER ${gz-transport14_VERSION_MAJOR})

find_package(gz-sim9 REQUIRED)
set(GZ_SIM_VER ${gz-sim9_VERSION_MAJOR})
find_package(gz-sim10 REQUIRED)
set(GZ_SIM_VER ${gz-sim10_VERSION_MAJOR})

add_executable(lrauv_control lrauv_control.cc)
target_link_libraries(lrauv_control
Expand Down
4 changes: 2 additions & 2 deletions examples/standalone/multi_lrauv_race/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ project(gz-sim-multi-lrauv-race)
find_package(gz-transport14 QUIET REQUIRED OPTIONAL_COMPONENTS log)
set(GZ_TRANSPORT_VER ${gz-transport14_VERSION_MAJOR})

find_package(gz-sim9 REQUIRED)
set(GZ_SIM_VER ${gz-sim9_VERSION_MAJOR})
find_package(gz-sim10 REQUIRED)
set(GZ_SIM_VER ${gz-sim10_VERSION_MAJOR})

add_executable(multi_lrauv_race multi_lrauv_race.cc)
target_link_libraries(multi_lrauv_race
Expand Down
25 changes: 19 additions & 6 deletions include/gz/sim/components/Model.hh
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,18 @@ namespace serializers
}
}

_out << "<?xml version=\"1.0\" ?>"
<< "<sdf version='" << SDF_PROTOCOL_VERSION << "'>"
<< (skip ? std::string() : modelElem->ToString(""))
<< "</sdf>";
if (!skip)
{
_out << "<?xml version=\"1.0\" ?>"
<< "<sdf version='" << SDF_PROTOCOL_VERSION << "'>"
<< modelElem->ToString("")
<< "</sdf>";

}
else
{
_out << "";
}
return _out;
}

Expand All @@ -89,13 +97,18 @@ namespace serializers
public: static std::istream &Deserialize(std::istream &_in,
sdf::Model &_model)
{
sdf::Root root;
std::string sdf(std::istreambuf_iterator<char>(_in), {});
if (sdf.empty())
{
return _in;
}

// Its super expensive to create an SDFElement for some reason
sdf::Root root;
sdf::Errors errors = root.LoadSdfString(sdf);
if (!root.Model())
{
gzwarn << "Unable to deserialize sdf::Model" << std::endl;
gzwarn << "Unable to deserialize sdf::Model " << sdf<< std::endl;
return _in;
}

Expand Down
4 changes: 2 additions & 2 deletions package.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="2">
<name>gz-sim9</name>
<version>9.0.0</version>
<name>gz-sim10</name>
<version>10.0.0</version>
<description>Gazebo Sim : A Robotic Simulator</description>
<maintainer email="[email protected]">Michael Carroll</maintainer>
<license>Apache License 2.0</license>
Expand Down
2 changes: 1 addition & 1 deletion python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ if (BUILD_TESTING)
endif()

set(_env_vars)
list(APPEND _env_vars "PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/python/")
list(APPEND _env_vars "PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/python/:$ENV{PYTHONPATH}")
list(APPEND _env_vars "LD_LIBRARY_PATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}:$ENV{LD_LIBRARY_PATH}")
set_tests_properties(${test} PROPERTIES
ENVIRONMENT "${_env_vars}")
Expand Down
2 changes: 1 addition & 1 deletion python/test/gz_test_deps/sim.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from gz.sim9 import *
from gz.sim10 import *
3 changes: 2 additions & 1 deletion src/systems/multicopter_motor_model/MulticopterMotorModel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,8 @@ void MulticopterMotorModel::PreUpdate(const UpdateInfo &_info,

const auto parentLinkName = _ecm.Component<components::ParentLinkName>(
this->dataPtr->jointEntity);
this->dataPtr->parentLinkName = parentLinkName->Data();
if (parentLinkName)
this->dataPtr->parentLinkName = parentLinkName->Data();
}

if (this->dataPtr->linkEntity == kNullEntity)
Expand Down
2 changes: 1 addition & 1 deletion src/systems/optical_tactile_plugin/OpticalTactilePlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ void OpticalTactilePluginPrivate::Enable(const gz::msgs::Boolean &_req)

this->enabled = _req.data();

if (!_req.data())
if (!_req.data() && this->visualizePtr)
{
this->visualizePtr->RemoveNormalForcesAndContactsMarkers();
}
Expand Down
5 changes: 5 additions & 0 deletions src/systems/tracked_vehicle/TrackedVehicle.hh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ namespace systems
///
/// ## System Parameters
///
/// - `<body_link>`: Name of the link that should be considered the center
/// of rotation. This plugin cannot correctly simulate the effect of CoM
/// on rotation center. Instead, the rotation center is always in the CoM
/// of this specified link. If not specified, the canonical link is used.
///
/// - `<left_track>`: Configuration of a left track link. This element can
/// appear multiple times, and must appear at least once.
///
Expand Down
2 changes: 1 addition & 1 deletion test/integration/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,5 @@ endif()

if (TARGET INTEGRATION_python_system_loader)
set_tests_properties(INTEGRATION_python_system_loader PROPERTIES
ENVIRONMENT "PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/python/")
ENVIRONMENT "PYTHONPATH=${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/python/:$ENV{PYTHONPATH}")
endif()
2 changes: 1 addition & 1 deletion tutorials/adding_system_plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ your turtle does not sink anymore.

```bash
mkdir -p ~/gazebo_maritime/worlds
wget https://raw.githubusercontent.com/gazebosim/gz-sim/gz-sim9/tutorials/files/adding_system_plugins/buoyant_turtle.sdf -O ~/gazebo_maritime/worlds/buoyant_turtle.sdf
wget https://raw.githubusercontent.com/gazebosim/gz-sim/main/tutorials/files/adding_system_plugins/buoyant_turtle.sdf -O ~/gazebo_maritime/worlds/buoyant_turtle.sdf
export GZ_SIM_RESOURCE_PATH=:$HOME/gazebo_maritime/models
gz sim -r ~/gazebo_maritime/worlds/buoyant_turtle.sdf
```
Expand Down
Loading

0 comments on commit 90a7247

Please sign in to comment.