Skip to content

Commit 1455c69

Browse files
authored
Merge pull request #1316 from gazebosim/merge_13_14_20230830
Merge 13 -> 14
2 parents 017e1f6 + f7b355f commit 1455c69

18 files changed

+698
-251
lines changed

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ if (BUILD_SDF)
4343
gz_configure_project(
4444
NO_PROJECT_PREFIX
4545
REPLACE_INCLUDE_PATH sdf
46-
VERSION_SUFFIX)
46+
VERSION_SUFFIX pre1)
4747

4848
#################################################
4949
# Find tinyxml2.

Changelog.md

+30
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,36 @@
44

55
## libsdformat 13.X
66

7+
### libsdformat 13.6.0 (2023-08-30)
8+
9+
1. Use relative path in an urdf include to avoid confusion between internal and system headers
10+
* [Pull request #1259](https://github.com/gazebosim/sdformat/pull/1259)
11+
12+
1. parser.cc update calls to use sdf::Errors output
13+
* [Pull request #1294](https://github.com/gazebosim/sdformat/pull/1294)
14+
15+
1. Fix deeply nested merge-include for custom parsed files
16+
* [Pull request #1293](https://github.com/gazebosim/sdformat/pull/1293)
17+
18+
1. Updated findfile() to search localpath first
19+
* [Pull request #1292](https://github.com/gazebosim/sdformat/pull/1292)
20+
21+
1. World requires a scene and atmosphere
22+
* [Pull request #1308](https://github.com/gazebosim/sdformat/pull/1308)
23+
24+
1. Infrastructure
25+
* [Pull request #1307](https://github.com/gazebosim/sdformat/pull/1307)
26+
* [Pull request #1306](https://github.com/gazebosim/sdformat/pull/1306)
27+
28+
1. Remove robot not found error when parsing fails
29+
* [Pull request #1290](https://github.com/gazebosim/sdformat/pull/1290)
30+
31+
1. Make some sdfdbg messages sdfmsgs
32+
* [Pull request #1288](https://github.com/gazebosim/sdformat/pull/1288)
33+
34+
1. Minor clean up of tests
35+
* [Pull request #1289](https://github.com/gazebosim/sdformat/pull/1289)
36+
737
### libsdformat 13.5.0 (2023-05-18)
838

939
1. Added projector Python wrapper

include/sdf/Error.hh

+4
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,10 @@ namespace sdf
223223
/// \return Error message.
224224
public: std::string Message() const;
225225

226+
/// \brief Sets the message associated with this error.
227+
/// \param [in] _message Message that describes this error.
228+
public: void SetMessage(const std::string &_message);
229+
226230
/// \brief Get the file path associated with this error.
227231
/// \return Returns the path of the file that this error is related to,
228232
/// nullopt otherwise.

include/sdf/parser.hh

+130-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@ namespace sdf
5555
SDFORMAT_VISIBLE
5656
bool init(SDFPtr _sdf, const ParserConfig &_config);
5757

58+
/// \brief Initialize the SDF interface from the embedded root spec file
59+
/// \param[out] _errors Vector of errors.
60+
/// \param[out] _sdf Pointer to an SDF object.
61+
/// \param[in] _config Custom parser configuration
62+
/// \return True if successful.
63+
SDFORMAT_VISIBLE
64+
bool init(sdf::Errors &_errors, SDFPtr _sdf, const ParserConfig &_config);
65+
5866
/// \brief Initialize the SDF interface using a file
5967
/// \param[in] _filename Name of the SDF file
6068
/// \param[out] _sdf Pointer to an SDF object.
@@ -71,9 +79,20 @@ namespace sdf
7179
bool initFile(
7280
const std::string &_filename, const ParserConfig &_config, SDFPtr _sdf);
7381

82+
/// \brief Initialize the SDF interface using a file
83+
/// \param[in] _filename Name of the SDF file
84+
/// \param[in] _config Custom parser configuration
85+
/// \param[out] _sdf Pointer to an SDF object.
86+
/// \param[out] _errors Vector of errors.
87+
/// \return True if successful.
88+
SDFORMAT_VISIBLE
89+
bool initFile(
90+
const std::string &_filename, const ParserConfig &_config, SDFPtr _sdf,
91+
sdf::Errors &_errors);
92+
7493
/// \brief Initialize an SDF Element interface using a file
7594
/// \param[in] _filename Name of the SDF file
76-
/// \param[in] _sdf Pointer to an SDF Element object.
95+
/// \param[out] _sdf Pointer to an SDF Element object.
7796
/// \return True if successful.
7897
SDFORMAT_VISIBLE
7998
bool initFile(const std::string &_filename, ElementPtr _sdf);
@@ -87,6 +106,16 @@ namespace sdf
87106
bool initFile(const std::string &_filename, const ParserConfig &_config,
88107
ElementPtr _sdf);
89108

109+
/// \brief Initialize an SDFElement interface using a file
110+
/// \param[in] _filename Name of the SDF file
111+
/// \param[in] _config Custom parser configuration
112+
/// \param[out] _sdf Pointer to an SDF Element object.
113+
/// \param[out] _errors Vector of errors.
114+
/// \return True if successful.
115+
SDFORMAT_VISIBLE
116+
bool initFile(const std::string &_filename, const ParserConfig &_config,
117+
ElementPtr _sdf, sdf::Errors &_errors);
118+
90119
/// \brief Initialize the SDF interface using a string
91120
/// \param[in] _xmlString XML string to be parsed.
92121
/// \param[out] _sdf Pointer to an SDF object.
@@ -103,6 +132,16 @@ namespace sdf
103132
bool initString(
104133
const std::string &_xmlString, const ParserConfig &_config, SDFPtr _sdf);
105134

135+
/// \brief Initialize the SDF interface using a string
136+
/// \param[in] _xmlString XML string to be parsed.
137+
/// \param[in] _config Custom parser configuration
138+
/// \param[out] _sdf Pointer to an SDF object.
139+
/// \param[out] _errors Vector of errors.
140+
/// \return True if successful.
141+
SDFORMAT_VISIBLE
142+
bool initString(const std::string &_xmlString, const ParserConfig &_config,
143+
SDFPtr _sdf, sdf::Errors &_errors);
144+
106145
/// \brief Populate the SDF values from a file
107146
///
108147
/// This populates a new SDF pointer from a file. If the file is a URDF
@@ -317,6 +356,16 @@ namespace sdf
317356
SDFORMAT_VISIBLE
318357
std::string getModelFilePath(const std::string &_modelDirPath);
319358

359+
/// \brief Get the file path to the model file
360+
/// \param[out] _errors Vector of errors.
361+
/// \param[in] _modelDirPath directory system path of the model
362+
/// \return string with the full filesystem path to the best version (greater
363+
/// SDF protocol supported by this sdformat version) of the .sdf
364+
/// model files hosted by _modelDirPath.
365+
SDFORMAT_VISIBLE
366+
std::string getModelFilePath(sdf::Errors &_errors,
367+
const std::string &_modelDirPath);
368+
320369
/// \brief Convert an SDF file to a specific SDF version.
321370
/// \param[in] _filename Name of the SDF file to convert.
322371
/// \param[in] _version Version to convert _filename to.
@@ -387,6 +436,17 @@ namespace sdf
387436
SDFORMAT_VISIBLE
388437
bool checkCanonicalLinkNames(const sdf::Root *_root);
389438

439+
/// \brief Check that for each model, the canonical_link attribute value
440+
/// matches the name of a link in the model if the attribute is set and
441+
/// not empty.
442+
/// This checks recursively and should check the files exhaustively
443+
/// rather than terminating early when the first error is found.
444+
/// \param[out] _errors Vector of errors.
445+
/// \param[in] _root SDF Root object to check recursively.
446+
/// \return True if all models have valid canonical_link attributes.
447+
SDFORMAT_VISIBLE
448+
bool checkCanonicalLinkNames(sdf::Errors &_errors, const sdf::Root *_root);
449+
390450
/// \brief For the world and each model, check that the attached_to graphs
391451
/// build without errors and have no cycles.
392452
/// Confirm that following directed edges from each vertex in the graph
@@ -398,6 +458,18 @@ namespace sdf
398458
SDFORMAT_VISIBLE
399459
bool checkFrameAttachedToGraph(const sdf::Root *_root);
400460

461+
/// \brief For the world and each model, check that the attached_to graphs
462+
/// build without errors and have no cycles.
463+
/// Confirm that following directed edges from each vertex in the graph
464+
/// leads to a model, link, or world frame.
465+
/// This checks recursively and should check the files exhaustively
466+
/// rather than terminating early when the first error is found.
467+
/// \param[out] _errors Vector of errors.
468+
/// \param[in] _root SDF Root object to check recursively.
469+
/// \return True if all attached_to graphs are valid.
470+
SDFORMAT_VISIBLE
471+
bool checkFrameAttachedToGraph(sdf::Errors &_errors, const sdf::Root *_root);
472+
401473
/// \brief Check that for each frame, the attached_to attribute value
402474
/// does not match its own frame name but does match the name of a
403475
/// link, joint, or other frame in the model if the attribute is set and
@@ -409,6 +481,18 @@ namespace sdf
409481
SDFORMAT_VISIBLE
410482
bool checkFrameAttachedToNames(const sdf::Root *_root);
411483

484+
/// \brief Check that for each frame, the attached_to attribute value
485+
/// does not match its own frame name but does match the name of a
486+
/// link, joint, or other frame in the model if the attribute is set and
487+
/// not empty.
488+
/// This checks recursively and should check the files exhaustively
489+
/// rather than terminating early when the first error is found.
490+
/// \param[out] _errors Vector of errors.
491+
/// \param[in] _root SDF Root object to check recursively.
492+
/// \return True if all frames have valid attached_to attributes.
493+
SDFORMAT_VISIBLE
494+
bool checkFrameAttachedToNames(sdf::Errors &_errors, const sdf::Root *_root);
495+
412496
/// \brief Check that all joints in contained models specify parent
413497
/// and child link names that match the names of sibling links.
414498
/// This checks recursively and should check the files exhaustively
@@ -469,6 +553,18 @@ namespace sdf
469553
SDFORMAT_VISIBLE
470554
bool checkPoseRelativeToGraph(const sdf::Root *_root);
471555

556+
/// \brief For the world and each model, check that the attached_to graphs
557+
/// build without errors and have no cycles.
558+
/// Confirm that following directed edges from each vertex in the graph
559+
/// leads to a model, link, or world frame.
560+
/// This checks recursively and should check the files exhaustively
561+
/// rather than terminating early when the first error is found.
562+
/// \param[out] _errors Vector of errors.
563+
/// \param[in] _root SDF Root object to check recursively.
564+
/// \return True if all attached_to graphs are valid.
565+
SDFORMAT_VISIBLE
566+
bool checkPoseRelativeToGraph(sdf::Errors &_errors, const sdf::Root *_root);
567+
472568
/// \brief Check that all sibling elements of the same type have unique names.
473569
/// This checks recursively and should check the files exhaustively
474570
/// rather than terminating early when the first duplicate name is found.
@@ -478,6 +574,17 @@ namespace sdf
478574
SDFORMAT_VISIBLE
479575
bool recursiveSameTypeUniqueNames(sdf::ElementPtr _elem);
480576

577+
/// \brief Check that all sibling elements of the same type have unique names.
578+
/// This checks recursively and should check the files exhaustively
579+
/// rather than terminating early when the first duplicate name is found.
580+
/// \param[out] _errors Vector of errors.
581+
/// \param[in] _elem SDF Element to check recursively.
582+
/// \return True if all contained elements have do not share a name with
583+
/// sibling elements of the same type.
584+
SDFORMAT_VISIBLE
585+
bool recursiveSameTypeUniqueNames(sdf::Errors &_errors,
586+
sdf::ElementPtr _elem);
587+
481588
/// \brief Check that all sibling elements of the any type have unique names.
482589
/// This checks recursively and should check the files exhaustively
483590
/// rather than terminating early when the first duplicate name is found.
@@ -487,6 +594,16 @@ namespace sdf
487594
SDFORMAT_VISIBLE
488595
bool recursiveSiblingUniqueNames(sdf::ElementPtr _elem);
489596

597+
/// \brief Check that all sibling elements of the any type have unique names.
598+
/// This checks recursively and should check the files exhaustively
599+
/// rather than terminating early when the first duplicate name is found.
600+
/// \param[out] _errors Vector of errors.
601+
/// \param[in] _elem SDF Element to check recursively.
602+
/// \return True if all contained elements have do not share a name with
603+
/// sibling elements of any type.
604+
SDFORMAT_VISIBLE
605+
bool recursiveSiblingUniqueNames(sdf::Errors &_errors, sdf::ElementPtr _elem);
606+
490607
/// \brief Check that all sibling elements do not contain the delimiter
491608
/// double colons '::' in element names, which is reserved for forming scopes
492609
/// in SDFormat 1.8. This checks recursively and should check the files
@@ -497,6 +614,18 @@ namespace sdf
497614
SDFORMAT_VISIBLE
498615
bool recursiveSiblingNoDoubleColonInNames(sdf::ElementPtr _elem);
499616

617+
/// \brief Check that all sibling elements do not contain the delimiter
618+
/// double colons '::' in element names, which is reserved for forming scopes
619+
/// in SDFormat 1.8. This checks recursively and should check the files
620+
/// exhaustively rather than terminating early when the first name
621+
/// containing '::' is found.
622+
/// \param[out] _errors Vector of errors.
623+
/// \param[in] _elem SDF Element to check recursively.
624+
/// \return True if all contained element names do not have the delimiter '::'
625+
SDFORMAT_VISIBLE
626+
bool recursiveSiblingNoDoubleColonInNames(sdf::Errors &_errors,
627+
sdf::ElementPtr _elem);
628+
500629
/// \brief Check whether the element should be validated. If this returns
501630
/// false, validators such as the unique name and reserve name checkers should
502631
/// skip this element and its descendants.

src/Error.cc

+6
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ std::string Error::Message() const
8484
return this->dataPtr->message;
8585
}
8686

87+
/////////////////////////////////////////////////
88+
void Error::SetMessage(const std::string &_message)
89+
{
90+
this->dataPtr->message = _message;
91+
}
92+
8793
/////////////////////////////////////////////////
8894
std::optional<std::string> Error::FilePath() const
8995
{

src/Root.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ Errors Root::Load(const std::string &_filename, const ParserConfig &_config)
197197
if (!sdfParsed)
198198
{
199199
errors.push_back(
200-
{ErrorCode::FILE_READ, "Unable to read file:" + _filename});
200+
{ErrorCode::FILE_READ, "Unable to read file: [" + _filename + "]"});
201201
return errors;
202202
}
203203

0 commit comments

Comments
 (0)