Skip to content

Commit 7d79d21

Browse files
committed
Merge branch 'gz-sim7' into scpeters/merge_7_main
2 parents 6dd0984 + 30eeb62 commit 7d79d21

File tree

89 files changed

+4165
-250
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+4165
-250
lines changed

.github/workflows/ci.yml

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name: Ubuntu CI
22

33
on: [push, pull_request]
44

5+
# Every time you make a push to your PR, it cancel immediately the previous checks,
6+
# and start a new one. The other runner will be available more quickly to your PR.
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
9+
cancel-in-progress: true
10+
511
jobs:
612
jammy-ci:
713
runs-on: ubuntu-latest

.github/workflows/triage.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Add ticket to inbox
13-
uses: technote-space/create-project-card-action@v1
13+
uses: actions/add-to-project@v0.5.0
1414
with:
15-
PROJECT: Core development
16-
COLUMN: Inbox
17-
GITHUB_TOKEN: ${{ secrets.TRIAGE_TOKEN }}
18-
CHECK_ORG_PROJECT: true
15+
project-url: https://github.com/orgs/gazebosim/projects/7
16+
github-token: ${{ secrets.TRIAGE_TOKEN }}

Changelog.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -3053,7 +3053,7 @@
30533053
1. Fix generation of systems library symlinks in build directory
30543054
* [Pull request #1160](https://github.com/gazebosim/gz-sim/pull/1160)
30553055

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

30593059
1. Support setting the background color for sensors

Migration.md

+22-15
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ message's header.
5959
* CMake `-config` files
6060
* Paths that depend on the project name
6161

62+
* The `Scene3D` plugin has been removed and replaced with `gz-gui`'s `MinimalScene` plugin. See
63+
this same document for the instructions to replace it when it was deprecated 5.x to 6.x.
64+
Setting `<legacy>false</legacy>` is no longer required for `TransformControl` and
65+
`ViewAndle` plugins.
66+
6267
* Python library imports such `import ignition.gazebo` and `from ignition import
6368
gazebo` should be replaced with `import gz.sim7` and `from gz import sim7`.
6469
Note the change from `ignition` to `gz` and the addition of the major version
@@ -69,7 +74,6 @@ message's header.
6974
+ In the Hydrodynamics plugin, inverted the added mass contribution to make it
7075
act in the correct direction.
7176

72-
7377
## Gazebo Sim 6.11.X to 6.12.X
7478

7579
* **Modified**:
@@ -126,20 +130,23 @@ since pose information is being logged in the `changed_state` topic.
126130
* The `GzScene3D` GUI plugin is being deprecated in favor of `MinimalScene`. In
127131
order to get the same functionality as `GzScene3D`, users need to add the
128132
following plugins:
129-
+ `MinimalScene`: base rendering functionality
130-
+ `GzSceneManager`: adds / removes / moves entities in the scene
131-
+ `EntityContextMenuPlugin`: right-click menu
132-
+ `InteractiveViewControl`: orbit controls
133-
+ `CameraTracking`: Move to, follow, set camera pose
134-
+ `MarkerManager`: Enables the use of markers
135-
+ `SelectEntities`: Select entities clicking on the scene
136-
+ `Spawn`: Functionality to spawn entities into the scene via GUI
137-
+ `VisualizationCapabilities`: View collisions, inertial, CoM, joints, etc.
138-
139-
Moreover, legacy mode needs to be turned off for the following plugins
140-
for them to work with `MinimalScene` (set `<legacy>false</legacy>`):
141-
+ `TransformControl`: Translate and rotate
142-
+ `ViewAndle`: Move camera to preset angles
133+
+ `MinimalScene`: base rendering functionality
134+
+ `GzSceneManager`: adds / removes / moves entities in the scene
135+
+ `EntityContextMenuPlugin`: right-click menu
136+
+ `InteractiveViewControl`: orbit controls
137+
+ `CameraTracking`: Move to, follow, set camera pose
138+
+ `MarkerManager`: Enables the use of markers
139+
+ `SelectEntities`: Select entities clicking on the scene
140+
+ `Spawn`: Functionality to spawn entities into the scene via GUI
141+
+ `VisualizationCapabilities`: View collisions, inertial, CoM, joints, etc.
142+
143+
SDF code for all these can be found in:
144+
https://github.com/gazebosim/gz-sim/blob/ff1c82b41e548dfdc8076374f9500db2df2c35a1/examples/worlds/minimal_scene.sdf#L29-L128
145+
146+
Moreover, legacy mode needs to be turned off for the following plugins
147+
for them to work with `MinimalScene` (set `<legacy>false</legacy>`):
148+
+ `TransformControl`: Translate and rotate
149+
+ `ViewAndle`: Move camera to preset angles
143150

144151
* The `gui.config` and `server.config` files are now located in a versioned
145152
folder inside `$HOME/.gz/sim`, i.e. `$HOME/.gz/sim/6/gui.config`.
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Copyright (C) 2023 Open Source Robotics Foundation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
#ifndef GZ_SIM_INSTALLATION_DIRECTORIES_HH_
19+
#define GZ_SIM_INSTALLATION_DIRECTORIES_HH_
20+
21+
#include <string>
22+
23+
#include <gz/sim/config.hh>
24+
#include <gz/sim/Export.hh>
25+
26+
namespace gz
27+
{
28+
namespace sim
29+
{
30+
inline namespace GZ_SIM_VERSION_NAMESPACE {
31+
32+
/// \brief getInstallPrefix return the install prefix of the library
33+
/// i.e. CMAKE_INSTALL_PREFIX unless the library has been moved
34+
GZ_SIM_VISIBLE std::string getInstallPrefix();
35+
36+
/// \brief getGUIConfigPath return the GUI config path
37+
GZ_SIM_VISIBLE std::string getGUIConfigPath();
38+
39+
/// \brief getSystemConfigPath return the system config path
40+
GZ_SIM_VISIBLE std::string getSystemConfigPath();
41+
42+
/// \brief getServerConfigPath return the server config path
43+
GZ_SIM_VISIBLE std::string getServerConfigPath();
44+
45+
/// \brief getPluginInstallDir return the plugin install dir
46+
GZ_SIM_VISIBLE std::string getPluginInstallDir();
47+
48+
/// \brief getGUIPluginInstallDir return the GUI plugin install dir
49+
GZ_SIM_VISIBLE std::string getGUIPluginInstallDir();
50+
51+
/// \brief getWorldInstallDir return the world install dir
52+
GZ_SIM_VISIBLE std::string getWorldInstallDir();
53+
}
54+
}
55+
}
56+
57+
#endif

include/gz/sim/Link.hh

+13
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,19 @@ namespace gz
306306
const math::Vector3d &_force,
307307
const math::Vector3d &_torque) const;
308308

309+
/// \brief Add a wrench expressed in world coordinates and applied to
310+
/// the link at an offset from the link's origin. This wrench
311+
/// is applied for one simulation step.
312+
/// \param[in] _ecm Mutable Entity-component manager.
313+
/// \param[in] _force Force to be applied expressed in world coordinates
314+
/// \param[in] _torque Torque to be applied expressed in world coordinates
315+
/// \param[in] _offset The point of application of the force expressed
316+
/// in the link frame
317+
public: void AddWorldWrench(EntityComponentManager &_ecm,
318+
const math::Vector3d &_force,
319+
const math::Vector3d &_torque,
320+
const math::Vector3d &_offset) const;
321+
309322
/// \brief Pointer to private data.
310323
private: std::unique_ptr<LinkPrivate> dataPtr;
311324
};

include/gz/sim/ServerConfig.hh

+2-2
Original file line numberDiff line numberDiff line change
@@ -324,14 +324,14 @@ namespace gz
324324
UpdatePeriod() const;
325325

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

333333
/// \brief Set the path to where simulation resources, such as models
334-
/// downloaded from fuel.ignitionrobotics.org, should be stored.
334+
/// downloaded from fuel.gazebosim.org, should be stored.
335335
/// \param[in] _path Path to a location on disk. An empty string
336336
/// indicates that the default value will be used, which is currently
337337
/// ~/.gz/fuel.

include/gz/sim/Util.hh

+7
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
#include <unordered_set>
2525
#include <vector>
2626

27+
#include <gz/common/Mesh.hh>
2728
#include <gz/math/Pose3.hh>
29+
#include <sdf/Mesh.hh>
2830

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

314+
/// \brief Load a mesh from a Mesh SDF DOM
315+
/// \param[in] _meshSdf Mesh SDF DOM
316+
/// \return The loaded mesh or null if the mesh can not be loaded.
317+
GZ_SIM_VISIBLE const common::Mesh *loadMesh(const sdf::Mesh &_meshSdf);
318+
312319
/// \brief Environment variable holding resource paths.
313320
const std::string kResourcePathEnv{"GZ_SIM_RESOURCE_PATH"};
314321

include/gz/sim/config.hh.in

+6-6
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@
3333

3434
#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"
3535

36-
#define GZ_SIM_GUI_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}/gui"
37-
#define GZ_SIM_SYSTEM_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}/systems"
38-
#define GZ_SIM_SERVER_CONFIG_PATH "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}"
39-
#define GZ_SIM_PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins"
40-
#define GZ_SIM_GUI_PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins/gui"
41-
#define GZ_SIM_WORLD_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${GZ_DATA_INSTALL_DIR}/worlds"
36+
#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"
37+
#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"
38+
#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}"
39+
#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"
40+
#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"
41+
#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"
4242
#define GZ_DISTRIBUTION "${GZ_DISTRIBUTION}"
4343

4444
#endif

include/gz/sim/rendering/MarkerManager.hh

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <memory>
2121
#include <string>
2222

23+
#include <gz/sim/config.hh>
2324
#include <gz/sim/rendering/Export.hh>
2425

2526
#include "gz/rendering/RenderTypes.hh"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Copyright (C) 2023 Open Source Robotics Foundation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
#ifndef GZ_SIM_WRENCHVISUALIZER_HH_
18+
#define GZ_SIM_WRENCHVISUALIZER_HH_
19+
20+
#include <memory>
21+
22+
#include <gz/sim/config.hh>
23+
#include <gz/sim/rendering/Export.hh>
24+
#include <gz/utils/ImplPtr.hh>
25+
26+
#include <gz/math/Vector3.hh>
27+
#include <gz/rendering/RenderTypes.hh>
28+
29+
namespace gz
30+
{
31+
namespace sim
32+
{
33+
// Inline bracket to help doxygen filtering.
34+
inline namespace GZ_SIM_VERSION_NAMESPACE
35+
{
36+
namespace detail
37+
{
38+
/// \brief Creates, deletes, and maintains force and torque visuals
39+
class GZ_SIM_RENDERING_VISIBLE WrenchVisualizer
40+
{
41+
/// \brief Constructor
42+
public: WrenchVisualizer();
43+
44+
/// \brief Destructor
45+
public: ~WrenchVisualizer();
46+
47+
/// \brief Initialize the Wrench visualizer
48+
/// \param[in] _scene The rendering scene where the visuals are created
49+
/// \return True if the scene is valid
50+
bool Init(rendering::ScenePtr _scene);
51+
52+
/// \brief Create a new force visual
53+
/// \param[in] _material The material used for the visual
54+
/// \return Pointer to the created ArrowVisual
55+
public: rendering::ArrowVisualPtr CreateForceVisual(
56+
rendering::MaterialPtr _material);
57+
58+
/// \brief Create a new torque visual
59+
/// \param[in] _material The material used for the visual
60+
/// \return Pointer to the created Visual
61+
public: rendering::VisualPtr CreateTorqueVisual(
62+
rendering::MaterialPtr _material);
63+
64+
/// \brief Update the visual of a vector to match its direction and position
65+
/// \param[in] _visual Pointer to the vector visual to be updated
66+
/// \param[in] _direction Direction of the vector
67+
/// \param[in] _position Position of the arrow
68+
/// \param[in] _size Size of the arrow in meters
69+
/// \param[in] _tip True if _position specifies the tip of the vector,
70+
/// false if it specifies tha base of the vector
71+
public: void UpdateVectorVisual(rendering::VisualPtr _visual,
72+
const math::Vector3d &_direction,
73+
const math::Vector3d &_position,
74+
const double _size,
75+
const bool _tip = false);
76+
77+
/// \internal
78+
/// \brief Private data pointer
79+
GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr)
80+
};
81+
}
82+
}
83+
}
84+
}
85+
#endif

src/CMakeLists.txt

+18
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ set (sources
5050
ComponentFactory.cc
5151
EntityComponentManager.cc
5252
EntityComponentManagerDiff.cc
53+
InstallationDirectories.cc
5354
Joint.cc
5455
LevelManager.cc
5556
Light.cc
@@ -163,6 +164,21 @@ target_link_libraries(${gz_lib_target}
163164

164165
# Create the library target
165166
gz_create_core_library(SOURCES ${sources} CXX_STANDARD 17)
167+
gz_add_get_install_prefix_impl(GET_INSTALL_PREFIX_FUNCTION gz::sim::getInstallPrefix
168+
GET_INSTALL_PREFIX_HEADER gz/sim/InstallationDirectories.hh
169+
OVERRIDE_INSTALL_PREFIX_ENV_VARIABLE GZ_SIM_INSTALL_PREFIX)
170+
171+
set_property(
172+
SOURCE InstallationDirectories.cc
173+
PROPERTY COMPILE_DEFINITIONS
174+
GZ_SIM_GUI_CONFIG_RELATIVE_PATH="${GZ_DATA_INSTALL_DIR}/gui"
175+
GZ_SIM_SYSTEM_CONFIG_RELATIVE_PATH="${GZ_DATA_INSTALL_DIR}/systems"
176+
GZ_SIM_SERVER_CONFIG_RELATIVE_PATH="${GZ_DATA_INSTALL_DIR}"
177+
GZ_SIM_PLUGIN_RELATIVE_INSTALL_DIR="${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins"
178+
GZ_SIM_GUI_PLUGIN_RELATIVE_INSTALL_DIR="${GZ_LIB_INSTALL_DIR}/gz-${GZ_DESIGNATION}-${PROJECT_VERSION_MAJOR}/plugins/gui"
179+
GZ_SIM_WORLD_RELATIVE_INSTALL_DIR="${GZ_DATA_INSTALL_DIR}/worlds"
180+
)
181+
166182
target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME}
167183
PUBLIC
168184
gz-math${GZ_MATH_VER}
@@ -208,6 +224,8 @@ gz_build_tests(TYPE UNIT
208224
${PROJECT_LIBRARY_TARGET_NAME}
209225
${EXTRA_TEST_LIB_DEPS}
210226
gz-sim${PROJECT_VERSION_MAJOR}
227+
ENVIRONMENT
228+
GZ_SIM_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
211229
)
212230

213231
# Some server unit tests require rendering.

0 commit comments

Comments
 (0)