Skip to content

Commit

Permalink
Merge from gz-msgs10
Browse files Browse the repository at this point in the history
Signed-off-by: Ian Chen <ichen@openrobotics.org>
  • Loading branch information
iche033 committed Feb 20, 2025
2 parents 21a942b + 3c0ca94 commit 6bf1288
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 10 deletions.
6 changes: 6 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ load(
"gz_proto_library",
)
load("@rules_license//rules:license.bzl", "license")
load("@rules_python//python:proto.bzl", "py_proto_library")

package(
default_applicable_licenses = [GZ_ROOT + "msgs:license"],
Expand Down Expand Up @@ -90,6 +91,11 @@ proto_library(
],
)

py_proto_library(
name = "gzmsgs_proto_py_pb2",
deps = [":gzmsgs_proto"]
)

gz_proto_library(
name = "gzmsgs_cc_proto",
proto_deps = [":gzmsgs_proto"],
Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ set(GZ_UTILS_VER ${gz-utils3_VERSION_MAJOR})
gz_find_package(gz-math8 REQUIRED)
set(GZ_MATH_VER ${gz-math8_VERSION_MAJOR})

find_package(Python3 REQUIRED COMPONENTS Interpreter)

#--------------------------------------
# Find if command is available. This is used to enable tests.
# Note that CLI files are installed regardless of whether the dependency is
Expand Down
18 changes: 18 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,24 @@

## Gazebo Msgs 10.x

### Gazebo Msgs 10.3.2 (2025-02-10)

1. cmake extras: only find Python3 if needed
* [Pull request #479](https://github.com/gazebosim/gz-msgs/pull/479)

### Gazebo Msgs 10.3.1 (2024-11-11)

1. Add rule to build python version of protos
* [Pull request #474](https://github.com/gazebosim/gz-msgs/pull/474)

1. Return only unique message types in `MessageFactory::Types` function
* [Pull request #472](https://github.com/gazebosim/gz-msgs/pull/472)

### Gazebo Msgs 10.3.0 (2024-06-18)

1. Backport: Adding cone primitives.
* [Pull request #442](https://github.com/gazebosim/gz-msgs/pull/442)

### Gazebo Msgs 10.2.0 (2024-05-17)

1. CameraTrack message for advanced tracking and following.
Expand Down
24 changes: 16 additions & 8 deletions core/src/MessageFactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*
*/

#include <unordered_set>

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4146 4251)
Expand Down Expand Up @@ -60,16 +62,16 @@ MessageFactory::MessagePtr MessageFactory::New(
{
type = kGzMsgsPrefix + _msgType.substr(8);
}
// Convert ".gz_msgs." prefix
else if (_msgType.find(".gz_msgs.") == 0)
{
type = kGzMsgsPrefix + _msgType.substr(9);
}
// Convert ".gz.msgs." prefix
else if (_msgType.find(".gz.msgs.") == 0)
{
type = kGzMsgsPrefix + _msgType.substr(9);
}
// Convert ".gz_msgs." prefix
else if (_msgType.find(".gz_msgs.") == 0)
{
type = kGzMsgsPrefix + _msgType.substr(9);
}
else
{
type = _msgType;
Expand Down Expand Up @@ -130,15 +132,21 @@ void MessageFactory::Types(std::vector<std::string> &_types)
{
_types.clear();

// Add the types loaded from descriptor files
std::vector<std::string> dynTypes;
this->dynamicFactory->Types(dynTypes);

// Use set to remove duplicates
std::unordered_set<std::string> typesSet(dynTypes.begin(), dynTypes.end());

// Return the list of all known message types.
std::map<std::string, FactoryFn>::const_iterator iter;
for (iter = msgMap.begin(); iter != msgMap.end(); ++iter)
{
_types.push_back(iter->first);
typesSet.insert(iter->first);
}

// Add the types loaded from descriptor files
this->dynamicFactory->Types(_types);
std::copy(typesSet.begin(), typesSet.end(), std::back_inserter(_types));
}

/////////////////////////////////////////////////
Expand Down

0 comments on commit 6bf1288

Please # to comment.