Skip to content

Commit 9b2d78a

Browse files
committed
Corrected typos in SDF Prefab Importer comments as well as in Robot Importer Utils comments
Small safety change for the `JointToAttachedModel`, `LinkToAttachedModel` and `NestedModelToAttachedModel` structs to have them initialize their pointer members to nullptr using zero-initialization. Signed-off-by: lumberyard-employee-dm <[email protected]>
1 parent b1d228f commit 9b2d78a

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

Gems/ROS2/Code/Source/RobotImporter/URDF/URDFPrefabMaker.cpp

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ namespace ROS2
7373
struct JointToAttachedModel
7474
{
7575
AZStd::string m_fullyQualifiedName;
76-
const sdf::Joint* m_joint;
77-
const sdf::Model* m_attachedModel;
76+
const sdf::Joint* m_joint{};
77+
const sdf::Model* m_attachedModel{};
7878
};
7979
// this is a unique ordered vector
8080
AZStd::vector<JointToAttachedModel> m_joints;
@@ -121,8 +121,8 @@ namespace ROS2
121121
struct LinkToAttachedModel
122122
{
123123
AZStd::string m_fullyQualifiedName;
124-
const sdf::Link* m_link;
125-
const sdf::Model* m_attachedModel;
124+
const sdf::Link* m_link{};
125+
const sdf::Model* m_attachedModel{};
126126
};
127127
// this is a unique ordered vector
128128
AZStd::vector<LinkToAttachedModel> m_links;
@@ -134,8 +134,8 @@ namespace ROS2
134134
struct NestedModelToAttachedModel
135135
{
136136
AZStd::string m_fullyQualifiedName;
137-
const sdf::Model* m_nestedModel;
138-
const sdf::Model* m_attachedModel;
137+
const sdf::Model* m_nestedModel{};
138+
const sdf::Model* m_attachedModel{};
139139
};
140140
// this is a unique ordered vector
141141
AZStd::vector<NestedModelToAttachedModel> m_models;
@@ -156,7 +156,8 @@ namespace ROS2
156156
}
157157

158158
// Use the model stack to create a mapping from the current model
159-
// to the any model it is attached or nullptr if the model is at the top level SDF Root
159+
// to the parent model it is attached to.
160+
// If the current model has no parent model the attached model is set to nullptr
160161
std::string stdFullModelName;
161162
for (const sdf::Model& ancestorModel : modelStack)
162163
{
@@ -173,7 +174,7 @@ namespace ROS2
173174
return Utils::VisitModelResponse::VisitNestedAndSiblings;
174175
};
175176

176-
// Gather all links and direct nested from all the models in the SDF
177+
// Gather all links and add a mapping of nested model -> parent model for each model in the SDF
177178
Utils::VisitModels(*m_root, GetAllLinksAndSetModelHierarchy, visitNestedModels);
178179

179180
// Build up a list of all entities created as a part of processing the file.

Gems/ROS2/Code/Source/RobotImporter/Utils/RobotImporterUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ namespace ROS2::Utils
368368
if (const sdf::Model* model = world.ModelByIndex(modelIndex); model != nullptr)
369369
{
370370
// Delegate to the sdf::Model call operator overload to visit nested models
371-
// Stop visited the world's <model> children if any children return Stop
371+
// Stop visiting the world's <model> children if any children return Stop
372372
if (VisitModelResponse visitResponse = operator()(*model); visitResponse >= VisitModelResponse::Stop)
373373
{
374374
return visitResponse;
@@ -382,7 +382,7 @@ namespace ROS2::Utils
382382

383383
void operator()(const sdf::Root& root)
384384
{
385-
// Visit the root <model> tag if one exist
385+
// Visit all <model> tags at the root of the SDF
386386
VisitModelResponse modelVisitResponse = VisitModelResponse::VisitNestedAndSiblings;
387387
if (const sdf::Model* model = root.Model(); model != nullptr)
388388
{

0 commit comments

Comments
 (0)