Skip to content

Commit

Permalink
Merge pull request #886 from ignitionrobotics/merge12main
Browse files Browse the repository at this point in the history
Merge 12 -> main
  • Loading branch information
scpeters authored Mar 18, 2022
2 parents 297aef2 + 0a74524 commit e648189
Show file tree
Hide file tree
Showing 34 changed files with 3,105 additions and 26 deletions.
7 changes: 6 additions & 1 deletion .github/ci/before_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ BUILD_DIR=`pwd`
cd /tmp

# check that we can compile USD from sources (only Focal)
# see https://github.com/ignitionrobotics/sdformat/issues/869
return_code=0
if [ "$(lsb_release -r -s)" != "20.04" ]; then
return_code=$(($return_code + 1))
fi

mkdir cmake_test
cd cmake_test

echo "cmake_minimum_required(VERSION 3.12)" > CMakeLists.txt

return_code=0
cmake . || return_code=$(($return_code + $?))
if [ $return_code -eq 0 ]
then
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,12 @@ jobs:
codecov-enabled: true
cppcheck-enabled: true
cpplint-enabled: true
jammy-ci:
runs-on: ubuntu-latest
name: Ubuntu Jammy CI
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Compile and test
id: ci
uses: ignition-tooling/action-ignition-ci@jammy
117 changes: 117 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,123 @@

## libsdformat 12.X

### libsdformat 12.4.0 (2022-03-xx)

1. SDF -> USD:
* [Pull request #818](https://github.com/ignitionrobotics/sdformat/pull/818)
* [Pull request #828](https://github.com/ignitionrobotics/sdformat/pull/828)
* [Pull request #829](https://github.com/ignitionrobotics/sdformat/pull/829)
* [Pull request #830](https://github.com/ignitionrobotics/sdformat/pull/830)
* [Pull request #831](https://github.com/ignitionrobotics/sdformat/pull/831)
* [Pull request #837](https://github.com/ignitionrobotics/sdformat/pull/837)

1. ToElement
* [Pull request #771](https://github.com/ignitionrobotics/sdformat/pull/771)
* [Pull request #772](https://github.com/ignitionrobotics/sdformat/pull/772)
* [Pull request #775](https://github.com/ignitionrobotics/sdformat/pull/775)
* [Pull request #776](https://github.com/ignitionrobotics/sdformat/pull/776)
* [Pull request #777](https://github.com/ignitionrobotics/sdformat/pull/777)
* [Pull request #781](https://github.com/ignitionrobotics/sdformat/pull/781)
* [Pull request #782](https://github.com/ignitionrobotics/sdformat/pull/782)
* [Pull request #783](https://github.com/ignitionrobotics/sdformat/pull/783)

1. Fix compiler warnings
* [Pull request #808](https://github.com/ignitionrobotics/sdformat/pull/808)
* [Pull request #810](https://github.com/ignitionrobotics/sdformat/pull/810)

1. Infrastructure and Documentation
* [Pull request #861](https://github.com/ignitionrobotics/sdformat/pull/861)
* [Pull request #800](https://github.com/ignitionrobotics/sdformat/pull/800)
* [Pull request #686](https://github.com/ignitionrobotics/sdformat/pull/686)
* [Pull request #713](https://github.com/ignitionrobotics/sdformat/pull/713)

1. Use the Plugin DOM in other DOM objects
* [Pull request #858](https://github.com/ignitionrobotics/sdformat/pull/858)

1. Add SDFormat tags for Triggered Cameras
* [Pull request #846](https://github.com/ignitionrobotics/sdformat/pull/846)

1. Fix bug where //include/pose was ignored when using the Interface API
* [Pull request #853](https://github.com/ignitionrobotics/sdformat/pull/853)

1. Fix joint parent/child frame existence checks to include interface elements
* [Pull request #855](https://github.com/ignitionrobotics/sdformat/pull/855)

1. Remove USD visibility macro from internal APIs
* [Pull request #857](https://github.com/ignitionrobotics/sdformat/pull/857)

1. Added non-const mutable accessors for world child objects
* [Pull request #840](https://github.com/ignitionrobotics/sdformat/pull/840)

1. Added non-const accessors for Model child objects
* [Pull request #839](https://github.com/ignitionrobotics/sdformat/pull/839)

1. Added to light if the light is on or off
* [Pull request #851](https://github.com/ignitionrobotics/sdformat/pull/851)

1. Added Root mutable accessors, and Root::Clone function
* [Pull request #841](https://github.com/ignitionrobotics/sdformat/pull/841)

1. Hide USDUtils.hh file from public API
* [Pull request #850](https://github.com/ignitionrobotics/sdformat/pull/850)

1. Added non-const accessors for Link child objects
* [Pull request #838](https://github.com/ignitionrobotics/sdformat/pull/838)

1. Add USDError class
* [Pull request #836](https://github.com/ignitionrobotics/sdformat/pull/836)

1. Use USD component visibility macro
* [Pull request #849](https://github.com/ignitionrobotics/sdformat/pull/849)

1. Add support for merge-include in the Interface API
* [Pull request #768](https://github.com/ignitionrobotics/sdformat/pull/768)

1. Handle `__model__` in joint parent or child when using merge-include
* [Pull request #835](https://github.com/ignitionrobotics/sdformat/pull/835)

1. Allow model frames (__model__) to be used as joint parent or child
* [Pull request #833](https://github.com/ignitionrobotics/sdformat/pull/833)

1. Fix bug where a sdf::ParserConfig object was not passed to all sdf::readFile calls
* [Pull request #824](https://github.com/ignitionrobotics/sdformat/pull/824)

1. Make SDF to USD a separate component of sdformat
* [Pull request #817](https://github.com/ignitionrobotics/sdformat/pull/817)

1. Add ParserConfig flag for preserveFixedJoint
* [Pull request #815](https://github.com/ignitionrobotics/sdformat/pull/815)

1. Fix parsing 'type' attibutes in plugins
* [Pull request #809](https://github.com/ignitionrobotics/sdformat/pull/809)

1. sdf_custom: fix nested model expectations
* [Pull request #807](https://github.com/ignitionrobotics/sdformat/pull/807)

1. Replace custom cmake code with ign-cmake2
* [Pull request #780](https://github.com/ignitionrobotics/sdformat/pull/780)

1. Support printing sdf poses in degrees and allow snapping to commonly used angles
* [Pull request #689](https://github.com/ignitionrobotics/sdformat/pull/689)

1. Refactor FrameSemantics.cc
* [Pull request #764](https://github.com/ignitionrobotics/sdformat/pull/764)

1. Fix loading nested include with custom attributes
* [Pull request #789](https://github.com/ignitionrobotics/sdformat/pull/789)

1. Added plugin to SDF DOM
* [Pull request #788](https://github.com/ignitionrobotics/sdformat/pull/788)

1. Support URI in the Model DOM
* [Pull request #786](https://github.com/ignitionrobotics/sdformat/pull/786)

1. Support adding and clearing sensors from a joint
* [Pull request #785](https://github.com/ignitionrobotics/sdformat/pull/785)

1. PrintConfig option to preserve includes when converting to string
* [Pull request #749](https://github.com/ignitionrobotics/sdformat/pull/749)

### libsdformat 12.3.0 (2021-12-01)

1. Fix empty pose parsing fail for rotation_format='quat_xyzw'
Expand Down
53 changes: 33 additions & 20 deletions src/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ static bool isSdfFile(const std::string &_fileName)

//////////////////////////////////////////////////
template <typename TPtr>
static inline bool _initFile(const std::string &_filename, TPtr _sdf)
static inline bool _initFile(const std::string &_filename,
const ParserConfig &_config,
TPtr _sdf)
{
auto xmlDoc = makeSdfDoc();
if (tinyxml2::XML_SUCCESS != xmlDoc.LoadFile(_filename.c_str()))
Expand All @@ -165,7 +167,7 @@ static inline bool _initFile(const std::string &_filename, TPtr _sdf)
return false;
}

return initDoc(&xmlDoc, _sdf);
return initDoc(&xmlDoc, _config, _sdf);
}

//////////////////////////////////////////////////
Expand All @@ -181,7 +183,9 @@ static inline bool _initFile(const std::string &_filename, TPtr _sdf)
/// \param[out] _errors Captures errors encountered during parsing.
static void insertIncludedElement(sdf::SDFPtr _includeSDF,
const SourceLocation &_sourceLoc, bool _merge,
sdf::ElementPtr _parent, sdf::Errors &_errors)
sdf::ElementPtr _parent,
const ParserConfig &_config,
sdf::Errors &_errors)
{
Error invalidFileError(ErrorCode::FILE_READ,
"Included model is invalid. Skipping model.");
Expand Down Expand Up @@ -230,7 +234,7 @@ static void insertIncludedElement(sdf::SDFPtr _includeSDF,
// We create a throwaway sdf::Root object in order to validate the
// included entity.
sdf::Root includedRoot;
sdf::Errors includeDOMerrors = includedRoot.Load(_includeSDF);
sdf::Errors includeDOMerrors = includedRoot.Load(_includeSDF, _config);
_errors.insert(_errors.end(), includeDOMerrors.begin(),
includeDOMerrors.end());

Expand Down Expand Up @@ -369,7 +373,7 @@ bool init(SDFPtr _sdf)
std::string xmldata = SDF::EmbeddedSpec("root.sdf", false);
auto xmlDoc = makeSdfDoc();
xmlDoc.Parse(xmldata.c_str());
return initDoc(&xmlDoc, _sdf);
return initDoc(&xmlDoc, ParserConfig::GlobalConfig(), _sdf);
}

//////////////////////////////////////////////////
Expand All @@ -387,9 +391,10 @@ bool initFile(
{
auto xmlDoc = makeSdfDoc();
xmlDoc.Parse(xmldata.c_str());
return initDoc(&xmlDoc, _sdf);
return initDoc(&xmlDoc, _config, _sdf);
}
return _initFile(sdf::findFile(_filename, true, false, _config), _sdf);
return _initFile(sdf::findFile(_filename, true, false, _config), _config,
_sdf);
}

//////////////////////////////////////////////////
Expand All @@ -407,14 +412,15 @@ bool initFile(
{
auto xmlDoc = makeSdfDoc();
xmlDoc.Parse(xmldata.c_str());
return initDoc(&xmlDoc, _sdf);
return initDoc(&xmlDoc, _config, _sdf);
}
return _initFile(sdf::findFile(_filename, true, false, _config), _sdf);
return _initFile(sdf::findFile(_filename, true, false, _config), _config,
_sdf);
}

//////////////////////////////////////////////////
bool initString(
const std::string &_xmlString, const ParserConfig &, SDFPtr _sdf)
const std::string &_xmlString, const ParserConfig &_config, SDFPtr _sdf)
{
auto xmlDoc = makeSdfDoc();
if (xmlDoc.Parse(_xmlString.c_str()))
Expand All @@ -423,7 +429,7 @@ bool initString(
return false;
}

return initDoc(&xmlDoc, _sdf);
return initDoc(&xmlDoc, _config, _sdf);
}

//////////////////////////////////////////////////
Expand Down Expand Up @@ -452,31 +458,37 @@ inline tinyxml2::XMLElement *_initDocGetElement(tinyxml2::XMLDocument *_xmlDoc)
}

//////////////////////////////////////////////////
bool initDoc(tinyxml2::XMLDocument *_xmlDoc, SDFPtr _sdf)
bool initDoc(tinyxml2::XMLDocument *_xmlDoc,
const ParserConfig &_config,
SDFPtr _sdf)
{
auto element = _initDocGetElement(_xmlDoc);
if (!element)
{
return false;
}

return initXml(element, _sdf->Root());
return initXml(element, _config, _sdf->Root());
}

//////////////////////////////////////////////////
bool initDoc(tinyxml2::XMLDocument *_xmlDoc, ElementPtr _sdf)
bool initDoc(tinyxml2::XMLDocument *_xmlDoc,
const ParserConfig &_config,
ElementPtr _sdf)
{
auto element = _initDocGetElement(_xmlDoc);
if (!element)
{
return false;
}

return initXml(element, _sdf);
return initXml(element, _config, _sdf);
}

//////////////////////////////////////////////////
bool initXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf)
bool initXml(tinyxml2::XMLElement *_xml,
const ParserConfig &_config,
ElementPtr _sdf)
{
const char *refString = _xml->Attribute("ref");
if (refString)
Expand Down Expand Up @@ -594,7 +606,7 @@ bool initXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf)
else
{
ElementPtr element(new Element);
initXml(child, element);
initXml(child, _config, element);
_sdf->AddElementDescription(element);
}
}
Expand All @@ -607,7 +619,7 @@ bool initXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf)

ElementPtr element(new Element);

initFile(filename, element);
initFile(filename, _config, element);

// override description for include elements
tinyxml2::XMLElement *description = child->FirstChildElement("description");
Expand Down Expand Up @@ -1510,7 +1522,7 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
ElementPtr refSDF;
refSDF.reset(new Element);
std::string refFilename = refSDFStr + ".sdf";
initFile(refFilename, refSDF);
initFile(refFilename, _config, refSDF);
_sdf->RemoveFromParent();
_sdf->Copy(refSDF);

Expand Down Expand Up @@ -1803,7 +1815,8 @@ bool readXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf,
SourceLocation sourceLoc{includeXmlPath, _source,
elemXml->GetLineNum()};

insertIncludedElement(includeSDF, sourceLoc, toMerge, _sdf, _errors);
insertIncludedElement(includeSDF, sourceLoc, toMerge, _sdf, _config,
_errors);
continue;
}
}
Expand Down
19 changes: 16 additions & 3 deletions src/parser_private.hh
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,37 @@ namespace sdf
/// This actually forwards to initXml after converting the inputs
/// \param[in] _xmlDoc TinyXML2 document containing the SDFormat description
/// file that corresponds with the input SDFPtr
/// \param[in] _config Custom parser configuration
/// \param[out] _sdf SDF interface to be initialized
bool initDoc(tinyxml2::XMLDocument *_xmlDoc, SDFPtr _sdf);
/// \return True on success, false on error.
bool initDoc(tinyxml2::XMLDocument *_xmlDoc,
const ParserConfig &_config,
SDFPtr _sdf);

/// \brief Initialize the SDF Element using a TinyXML2 document
///
/// This actually forwards to initXml after converting the inputs
/// \param[in] _xmlDoc TinyXML2 document containing the SDFormat description
/// file that corresponds with the input ElementPtr
/// \param[in] _config Custom parser configuration
/// \param[out] _sdf SDF Element to be initialized
bool initDoc(tinyxml2::XMLDocument *_xmlDoc, ElementPtr _sdf);
/// \return True on success, false on error.
bool initDoc(tinyxml2::XMLDocument *_xmlDoc,
const ParserConfig &_config,
ElementPtr _sdf);

/// \brief Initialize the SDF Element by parsing the SDFormat description in
/// the input TinyXML2 element. This is where SDFormat spec/description files
/// are parsed
/// \remark For internal use only. Do not use this function.
/// \param[in] _xml TinyXML2 element containing the SDFormat description
/// file that corresponds with the input ElementPtr
/// \param[in] _config Custom parser configuration
/// \param[out] _sdf SDF ElementPtr to be initialized
bool initXml(tinyxml2::XMLElement *_xml, ElementPtr _sdf);
/// \return True on success, false on error.
bool initXml(tinyxml2::XMLElement *_xml,
const ParserConfig &_config,
ElementPtr _sdf);

/// \brief Populate the SDF values from a TinyXML document
bool readDoc(tinyxml2::XMLDocument *_xmlDoc, SDFPtr _sdf,
Expand All @@ -83,6 +95,7 @@ namespace sdf
/// \param[in] _xmlRoot Pointer to the root level TinyXML element.
/// \param[in] _source Source of the XML document.
/// \param[in] _errors Captures errors found during the checks.
/// \return True on success, false on error.
bool checkXmlFromRoot(tinyxml2::XMLElement *_xmlRoot,
const std::string &_source, Errors &_errors);

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e648189

Please sign in to comment.