Skip to content

Commit

Permalink
Merge branch 'gz-sim7' into scpeters/merge_7_main
Browse files Browse the repository at this point in the history
  • Loading branch information
scpeters committed Aug 24, 2023
2 parents 6dd0984 + 30eeb62 commit 7d79d21
Show file tree
Hide file tree
Showing 89 changed files with 4,165 additions and 250 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: Ubuntu CI

on: [push, pull_request]

# Every time you make a push to your PR, it cancel immediately the previous checks,
# and start a new one. The other runner will be available more quickly to your PR.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
jammy-ci:
runs-on: ubuntu-latest
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Add ticket to inbox
uses: technote-space/create-project-card-action@v1
uses: actions/[email protected]
with:
PROJECT: Core development
COLUMN: Inbox
GITHUB_TOKEN: ${{ secrets.TRIAGE_TOKEN }}
CHECK_ORG_PROJECT: true
project-url: https://github.com/orgs/gazebosim/projects/7
github-token: ${{ secrets.TRIAGE_TOKEN }}
2 changes: 1 addition & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3053,7 +3053,7 @@
1. Fix generation of systems library symlinks in build directory
* [Pull request #1160](https://github.com/gazebosim/gz-sim/pull/1160)

1. Backport sim::Util::validTopic() from gz-sim4.
1. Backport sim::Util::validTopic() from ign-gazebo4.
* [Pull request #1153](https://github.com/gazebosim/gz-sim/pull/1153)

1. Support setting the background color for sensors
Expand Down
37 changes: 22 additions & 15 deletions Migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ message's header.
* CMake `-config` files
* Paths that depend on the project name

* The `Scene3D` plugin has been removed and replaced with `gz-gui`'s `MinimalScene` plugin. See
this same document for the instructions to replace it when it was deprecated 5.x to 6.x.
Setting `<legacy>false</legacy>` is no longer required for `TransformControl` and
`ViewAndle` plugins.

* Python library imports such `import ignition.gazebo` and `from ignition import
gazebo` should be replaced with `import gz.sim7` and `from gz import sim7`.
Note the change from `ignition` to `gz` and the addition of the major version
Expand All @@ -69,7 +74,6 @@ message's header.
+ In the Hydrodynamics plugin, inverted the added mass contribution to make it
act in the correct direction.


## Gazebo Sim 6.11.X to 6.12.X

* **Modified**:
Expand Down Expand Up @@ -126,20 +130,23 @@ since pose information is being logged in the `changed_state` topic.
* The `GzScene3D` GUI plugin is being deprecated in favor of `MinimalScene`. In
order to get the same functionality as `GzScene3D`, users need to add the
following plugins:
+ `MinimalScene`: base rendering functionality
+ `GzSceneManager`: adds / removes / moves entities in the scene
+ `EntityContextMenuPlugin`: right-click menu
+ `InteractiveViewControl`: orbit controls
+ `CameraTracking`: Move to, follow, set camera pose
+ `MarkerManager`: Enables the use of markers
+ `SelectEntities`: Select entities clicking on the scene
+ `Spawn`: Functionality to spawn entities into the scene via GUI
+ `VisualizationCapabilities`: View collisions, inertial, CoM, joints, etc.

Moreover, legacy mode needs to be turned off for the following plugins
for them to work with `MinimalScene` (set `<legacy>false</legacy>`):
+ `TransformControl`: Translate and rotate
+ `ViewAndle`: Move camera to preset angles
+ `MinimalScene`: base rendering functionality
+ `GzSceneManager`: adds / removes / moves entities in the scene
+ `EntityContextMenuPlugin`: right-click menu
+ `InteractiveViewControl`: orbit controls
+ `CameraTracking`: Move to, follow, set camera pose
+ `MarkerManager`: Enables the use of markers
+ `SelectEntities`: Select entities clicking on the scene
+ `Spawn`: Functionality to spawn entities into the scene via GUI
+ `VisualizationCapabilities`: View collisions, inertial, CoM, joints, etc.

SDF code for all these can be found in:
https://github.com/gazebosim/gz-sim/blob/ff1c82b41e548dfdc8076374f9500db2df2c35a1/examples/worlds/minimal_scene.sdf#L29-L128

Moreover, legacy mode needs to be turned off for the following plugins
for them to work with `MinimalScene` (set `<legacy>false</legacy>`):
+ `TransformControl`: Translate and rotate
+ `ViewAndle`: Move camera to preset angles

* The `gui.config` and `server.config` files are now located in a versioned
folder inside `$HOME/.gz/sim`, i.e. `$HOME/.gz/sim/6/gui.config`.
Expand Down
57 changes: 57 additions & 0 deletions include/gz/sim/InstallationDirectories.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Copyright (C) 2023 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

#ifndef GZ_SIM_INSTALLATION_DIRECTORIES_HH_
#define GZ_SIM_INSTALLATION_DIRECTORIES_HH_

#include <string>

#include <gz/sim/config.hh>
#include <gz/sim/Export.hh>

namespace gz
{
namespace sim
{
inline namespace GZ_SIM_VERSION_NAMESPACE {

/// \brief getInstallPrefix return the install prefix of the library
/// i.e. CMAKE_INSTALL_PREFIX unless the library has been moved
GZ_SIM_VISIBLE std::string getInstallPrefix();

/// \brief getGUIConfigPath return the GUI config path
GZ_SIM_VISIBLE std::string getGUIConfigPath();

/// \brief getSystemConfigPath return the system config path
GZ_SIM_VISIBLE std::string getSystemConfigPath();

/// \brief getServerConfigPath return the server config path
GZ_SIM_VISIBLE std::string getServerConfigPath();

/// \brief getPluginInstallDir return the plugin install dir
GZ_SIM_VISIBLE std::string getPluginInstallDir();

/// \brief getGUIPluginInstallDir return the GUI plugin install dir
GZ_SIM_VISIBLE std::string getGUIPluginInstallDir();

/// \brief getWorldInstallDir return the world install dir
GZ_SIM_VISIBLE std::string getWorldInstallDir();
}
}
}

#endif
13 changes: 13 additions & 0 deletions include/gz/sim/Link.hh
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,19 @@ namespace gz
const math::Vector3d &_force,
const math::Vector3d &_torque) const;

/// \brief Add a wrench expressed in world coordinates and applied to
/// the link at an offset from the link's origin. This wrench
/// is applied for one simulation step.
/// \param[in] _ecm Mutable Entity-component manager.
/// \param[in] _force Force to be applied expressed in world coordinates
/// \param[in] _torque Torque to be applied expressed in world coordinates
/// \param[in] _offset The point of application of the force expressed
/// in the link frame
public: void AddWorldWrench(EntityComponentManager &_ecm,
const math::Vector3d &_force,
const math::Vector3d &_torque,
const math::Vector3d &_offset) const;

/// \brief Pointer to private data.
private: std::unique_ptr<LinkPrivate> dataPtr;
};
Expand Down
4 changes: 2 additions & 2 deletions include/gz/sim/ServerConfig.hh
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,14 @@ namespace gz
UpdatePeriod() const;

/// \brief Path to where simulation resources, such as models downloaded
/// from fuel.ignitionrobotics.org, should be stored.
/// from fuel.gazebosim.org, should be stored.
/// \return Path to a location on disk. An empty string indicates that
/// the default value will be used, which is currently
/// ~/.gz/fuel.
public: const std::string &ResourceCache() const;

/// \brief Set the path to where simulation resources, such as models
/// downloaded from fuel.ignitionrobotics.org, should be stored.
/// downloaded from fuel.gazebosim.org, should be stored.
/// \param[in] _path Path to a location on disk. An empty string
/// indicates that the default value will be used, which is currently
/// ~/.gz/fuel.
Expand Down
7 changes: 7 additions & 0 deletions include/gz/sim/Util.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#include <unordered_set>
#include <vector>

#include <gz/common/Mesh.hh>
#include <gz/math/Pose3.hh>
#include <sdf/Mesh.hh>

#include "gz/sim/components/Environment.hh"
#include "gz/sim/config.hh"
Expand Down Expand Up @@ -309,6 +311,11 @@ namespace gz
const math::Vector3d& _worldPosition,
const std::shared_ptr<components::EnvironmentalData>& _gridField);

/// \brief Load a mesh from a Mesh SDF DOM
/// \param[in] _meshSdf Mesh SDF DOM
/// \return The loaded mesh or null if the mesh can not be loaded.
GZ_SIM_VISIBLE const common::Mesh *loadMesh(const sdf::Mesh &_meshSdf);

/// \brief Environment variable holding resource paths.
const std::string kResourcePathEnv{"GZ_SIM_RESOURCE_PATH"};

Expand Down
12 changes: 6 additions & 6 deletions include/gz/sim/config.hh.in
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@

#define GZ_SIM_VERSION_HEADER "Gazebo Sim, version ${PROJECT_VERSION_FULL}\nCopyright (C) 2018 Open Source Robotics Foundation.\nReleased under the Apache 2.0 License.\n\n"

#define GZ_SIM_GUI_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}/gui"
#define GZ_SIM_SYSTEM_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}/systems"
#define GZ_SIM_SERVER_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}"
#define GZ_SIM_PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins"
#define GZ_SIM_GUI_PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins/gui"
#define GZ_SIM_WORLD_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}/worlds"
#define GZ_SIM_GUI_CONFIG_PATH _Pragma ("GCC warning \"'GZ_SIM_GUI_CONFIG_PATH' macro is deprecated, use gz::sim::getGUIConfigPath() function instead. \"") "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}/gui"
#define GZ_SIM_SYSTEM_CONFIG_PATH _Pragma ("GCC warning \"'GZ_SIM_SYSTEM_CONFIG_PATH' macro is deprecated, use gz::sim::getSystemConfigPath() function instead. \"") "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}/systems"
#define GZ_SIM_SERVER_CONFIG_PATH _Pragma ("GCC warning \"'GZ_SIM_SERVER_CONFIG_PATH' macro is deprecated, use gz::sim::getServerConfigPath() function instead. \"") "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}"
#define GZ_SIM_PLUGIN_INSTALL_DIR _Pragma ("GCC warning \"'GZ_SIM_PLUGIN_INSTALL_DIR' macro is deprecated, use gz::sim::getPluginInstallDir() function instead. \"") "${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins"
#define GZ_SIM_GUI_PLUGIN_INSTALL_DIR _Pragma ("GCC warning \"'GZ_SIM_GUI_PLUGIN_INSTALL_DIR' macro is deprecated, use gz::sim::getGUIPluginInstallDir() function instead. \"") "${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins/gui"
#define GZ_SIM_WORLD_INSTALL_DIR _Pragma ("GCC warning \"'GZ_SIM_WORLD_INSTALL_DIR' macro is deprecated, use gz::sim::getWorldInstallDir() function instead. \"") "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}/worlds"
#define GZ_DISTRIBUTION "${GZ_DISTRIBUTION}"

#endif
1 change: 1 addition & 0 deletions include/gz/sim/rendering/MarkerManager.hh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <memory>
#include <string>

#include <gz/sim/config.hh>
#include <gz/sim/rendering/Export.hh>

#include "gz/rendering/RenderTypes.hh"
Expand Down
85 changes: 85 additions & 0 deletions include/gz/sim/rendering/WrenchVisualizer.hh
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/*
* Copyright (C) 2023 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef GZ_SIM_WRENCHVISUALIZER_HH_
#define GZ_SIM_WRENCHVISUALIZER_HH_

#include <memory>

#include <gz/sim/config.hh>
#include <gz/sim/rendering/Export.hh>
#include <gz/utils/ImplPtr.hh>

#include <gz/math/Vector3.hh>
#include <gz/rendering/RenderTypes.hh>

namespace gz
{
namespace sim
{
// Inline bracket to help doxygen filtering.
inline namespace GZ_SIM_VERSION_NAMESPACE
{
namespace detail
{
/// \brief Creates, deletes, and maintains force and torque visuals
class GZ_SIM_RENDERING_VISIBLE WrenchVisualizer
{
/// \brief Constructor
public: WrenchVisualizer();

/// \brief Destructor
public: ~WrenchVisualizer();

/// \brief Initialize the Wrench visualizer
/// \param[in] _scene The rendering scene where the visuals are created
/// \return True if the scene is valid
bool Init(rendering::ScenePtr _scene);

/// \brief Create a new force visual
/// \param[in] _material The material used for the visual
/// \return Pointer to the created ArrowVisual
public: rendering::ArrowVisualPtr CreateForceVisual(
rendering::MaterialPtr _material);

/// \brief Create a new torque visual
/// \param[in] _material The material used for the visual
/// \return Pointer to the created Visual
public: rendering::VisualPtr CreateTorqueVisual(
rendering::MaterialPtr _material);

/// \brief Update the visual of a vector to match its direction and position
/// \param[in] _visual Pointer to the vector visual to be updated
/// \param[in] _direction Direction of the vector
/// \param[in] _position Position of the arrow
/// \param[in] _size Size of the arrow in meters
/// \param[in] _tip True if _position specifies the tip of the vector,
/// false if it specifies tha base of the vector
public: void UpdateVectorVisual(rendering::VisualPtr _visual,
const math::Vector3d &_direction,
const math::Vector3d &_position,
const double _size,
const bool _tip = false);

/// \internal
/// \brief Private data pointer
GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
};
}
}
}
}
#endif
18 changes: 18 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ set (sources
ComponentFactory.cc
EntityComponentManager.cc
EntityComponentManagerDiff.cc
InstallationDirectories.cc
Joint.cc
LevelManager.cc
Light.cc
Expand Down Expand Up @@ -163,6 +164,21 @@ target_link_libraries(${gz_lib_target}

# Create the library target
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 17)
gz_add_get_install_prefix_impl(GET_INSTALL_PREFIX_FUNCTION gz::sim::getInstallPrefix
GET_INSTALL_PREFIX_HEADER gz/sim/InstallationDirectories.hh
OVERRIDE_INSTALL_PREFIX_ENV_VARIABLE GZ_SIM_INSTALL_PREFIX)

set_property(
SOURCE InstallationDirectories.cc
PROPERTY COMPILE_DEFINITIONS
GZ_SIM_GUI_CONFIG_RELATIVE_PATH="${GZ_DATA_INSTALL_DIR}/gui"
GZ_SIM_SYSTEM_CONFIG_RELATIVE_PATH="${GZ_DATA_INSTALL_DIR}/systems"
GZ_SIM_SERVER_CONFIG_RELATIVE_PATH="${GZ_DATA_INSTALL_DIR}"
GZ_SIM_PLUGIN_RELATIVE_INSTALL_DIR="${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins"
GZ_SIM_GUI_PLUGIN_RELATIVE_INSTALL_DIR="${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins/gui"
GZ_SIM_WORLD_RELATIVE_INSTALL_DIR="${GZ_DATA_INSTALL_DIR}/worlds"
)

target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
PUBLIC
gz-math${GZ_MATH_VER}
Expand Down Expand Up @@ -208,6 +224,8 @@ gz_build_tests(TYPE UNIT
${PROJECT_LIBRARY_TARGET_NAME}
${EXTRA_TEST_LIB_DEPS}
gz-sim${PROJECT_VERSION_MAJOR}
ENVIRONMENT
GZ_SIM_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
)

# Some server unit tests require rendering.
Expand Down
Loading

0 comments on commit 7d79d21

Please sign in to comment.