Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions proto/gz/msgs/entity_factory_with_ns.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* Copyright (C) 2026 Jiayi Cai
Comment thread
C88-YQ marked this conversation as resolved.
Outdated
*
* 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.
*
*/

syntax = "proto3";
package gz.msgs;
option java_package = "com.gz.msgs";
option java_outer_classname = "EntityFactoryWithNsProtos";

/// \ingroup gz.msgs
/// \interface EntityFactoryWithNs
/// \brief Message with namespace to create new entities at a given pose.
/// An entity can be created in one of the following ways:
///
/// 1. From an SDF string (sdf)
/// 2. From an SDF file (sdf_filename)
/// 3. From a message (model / light)
/// 4. Cloning an existing entity (clone_name)

import "gz/msgs/header.proto";
import "gz/msgs/light.proto";
import "gz/msgs/model.proto";
import "gz/msgs/pose.proto";
import "gz/msgs/stringmsg.proto";
import "gz/msgs/spherical_coordinates.proto";

message EntityFactoryWithNs
{
/// \brief Optional header data
Header header = 1;

/// \brief Only one method is supported at a time
oneof from
{
/// \brief SDF description in string format.
string sdf = 2;

/// \brief Full path to SDF file.
string sdf_filename = 3;

/// \brief Description of model to be inserted.
Model model = 4;

/// \brief Description of light to be inserted.
Light light = 5;

/// \brief Name of entity to clone.
string clone_name = 6;
}

/// \brief Pose where the entity will be spawned in the world.
/// If set, `spherical_coordinates` will be ignored.
Pose pose = 7;

/// \brief New name for the entity, overrides the name on the SDF.
string name = 8;

/// \brief Optional new namespace for the entity, overrides the namespace on the SDF.
StringMsg ns = 9;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for this to be StringMsg instead of string? Would setting it to an empty string not be sufficient? Or are you thinking of a usecase where the namespace in the model is replaced with "" (empty namespace)?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the main reason is to distinguish between not set and set to an empty string.

If the user does not provide a namespace, I want to keep the existing namespace and avoid applying any override. But if the user explicitly sets it to "", that should be treated as an override that clears the namespace. A plain string would not let us distinguish those two cases, since its default value is also "".

Comment thread
C88-YQ marked this conversation as resolved.
Outdated
Comment thread
C88-YQ marked this conversation as resolved.
Outdated

/// \brief Whether the server is allowed to rename the entity in case of
/// overlap with existing entities.
bool allow_renaming = 10;

/// \brief The pose will be defined relative to this frame. If left empty,
/// the "world" frame will be used.
string relative_to = 11;

/// \brief Spherical coordinates where the entity will be spawned in the
/// world.
/// If `pose` is also set:
/// * `pose.position` is ignored in favor of latitude, longitude and
/// elevation.
/// * `pose.orientation` is used in conjunction with heading:
/// Quaternion::fromEuler(0, 0, heading) * pose.orientation
SphericalCoordinates spherical_coordinates = 12;
}
36 changes: 36 additions & 0 deletions proto/gz/msgs/entity_factory_with_ns_v.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (C) 2026 Jiayi Cai
* 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.
*
*/

syntax = "proto3";
package gz.msgs;
option java_package = "com.gz.msgs";
option java_outer_classname = "EntityFactoryWithNsVProtos";

/// \ingroup gz.msgs
/// \interface EntityFactoryWithNs_V
/// \brief A message for a vector of EntityFactoryWithNs messages
//
import "gz/msgs/entity_factory_with_ns.proto";
import "gz/msgs/header.proto";

message EntityFactoryWithNs_V
{
/// \brief Optional header data
Header header = 1;

/// \brief The set of entity factory messages.
repeated EntityFactoryWithNs data = 2;
}
Loading