gazebosim / gazebosim/sdformat
Converted SDF doesn't parse successfully.
- Dominant language
- C++
- Stars
- 216
- Forks
- 125
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 14
Description
## Environment
* OS Version: Debian bullseye
* Source or binary build? Source: 17a4cf853a097b9adfa508876250044f367a4090
## Description
* Expected behavior: Either
1. Parses the SDF correctly (this SDF parses in `libsdformat` version 6.2).
2. Produces an error saying that it could not be converted properly.
* Actual behavior: Produces an SDF that cannot be parsed correctly.
Note: using `::sdf::readString` directly seems to work fine, but using the available API, this doesn't give access to an `::sdf::Root` object.
## Steps to reproduce
Run the following program:
```
#include
#include
#include
#include "sdf/sdf.hh"
int main(int argc, char** argv) {
const std::string sdf_text = R"(
1 2 3 0 0 0
)";
::sdf::SDFPtr sdf_ptr(new ::sdf::SDF);
::sdf::init(sdf_ptr);
if (!::sdf::convertString(sdf_text, SDF_PROTOCOL_VERSION, sdf_ptr)) {
std::cerr << "Error converting SDF";
return 1;
}
std::cout << sdf_ptr->ToString();
::sdf::Root sdf_root;
auto errors = sdf_root.Load(sdf_ptr);
if (!errors.empty()) {
std::stringstream status_string;
for (const auto& error : errors) {
status_string << error << "\n";
}
std::cerr << status_string.str();
return 1;
}
std::cout << "Parsed sdf correctly!";
return 0;
}
```
## Output
```
1 2 3 0 -0 0
Error Code 16 Msg: A model must have at least one link.
Error Code 16 Msg: A model must have at least one link.
Error Code 24 Msg: FrameAttachedToGraph error: scope context name[] does not match __model__ or world.
```
Contributor guide
Assessment
This issue has not been assessed yet.