Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: resolve XSD aliasing and parse missed elements #643

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
bc0eced
BUG: missing sdf + copy types.xsd
FirefoxMetzger Jul 23, 2021
22bba46
FEAT: python schema generator
FirefoxMetzger Jul 25, 2021
2d4a457
MAINT: remove (unnecessary) validators
FirefoxMetzger Jul 25, 2021
4548b82
MAINT: use etree for xml generation
FirefoxMetzger Jul 27, 2021
55396a8
MAINT: remove refactored files
FirefoxMetzger Jul 27, 2021
302d66e
MAINT: integrate recursion into class structure
FirefoxMetzger Jul 28, 2021
1334ed1
BUG: match time pattern with SDF default values
FirefoxMetzger Jul 28, 2021
2a86353
MAINT: refactor
FirefoxMetzger Jul 28, 2021
e36edce
BUG: missing sdf + copy types.xsd
FirefoxMetzger Jul 23, 2021
97cb10c
FEAT: python schema generator
FirefoxMetzger Jul 25, 2021
688a9f7
MAINT: remove (unnecessary) validators
FirefoxMetzger Jul 25, 2021
d1798cb
MAINT: use etree for xml generation
FirefoxMetzger Jul 27, 2021
b29e905
MAINT: remove refactored files
FirefoxMetzger Jul 27, 2021
bbec0be
MAINT: integrate recursion into class structure
FirefoxMetzger Jul 28, 2021
d856458
BUG: match time pattern with SDF default values
FirefoxMetzger Jul 28, 2021
887ef67
MAINT: refactor
FirefoxMetzger Jul 28, 2021
de3a5b3
Merge branch 'xml_namespaces' of github.com:FirefoxMetzger/sdformat i…
FirefoxMetzger Jul 28, 2021
587d652
MAINT: migrate v1.5 - v1.7 to new XSD parser
FirefoxMetzger Jul 28, 2021
38d5337
BUG: backport changes of types.xsd
FirefoxMetzger Jul 29, 2021
290da7b
MAINT: move description into type schema
FirefoxMetzger Aug 1, 2021
a666c1e
MAINT: unwrap elements from choice block
FirefoxMetzger Aug 1, 2021
e19c366
BUG: partially fix ignored min/maxOccurs
FirefoxMetzger Aug 1, 2021
fa986c0
MAINT: remove dataclasses
FirefoxMetzger Aug 1, 2021
d0b8836
BUG: remove dataclass import
FirefoxMetzger Aug 1, 2021
bdb2ab7
MAINT: refactor complex type generation
FirefoxMetzger Aug 1, 2021
e5a7042
BUG: remove dataclass decorators
FirefoxMetzger Aug 1, 2021
4d6cf32
MAINT: absolute pathing for namespace
FirefoxMetzger Aug 1, 2021
b06c665
MAINT: handle non-ASCII inside sdf files
FirefoxMetzger Aug 2, 2021
c471f41
TEST: add missing elements to double_pendulum.sdf
FirefoxMetzger Aug 2, 2021
cf1dad5
Apply suggestions from code review
FirefoxMetzger Mar 31, 2022
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
6 changes: 4 additions & 2 deletions sdf/1.5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ foreach(FIL ${sdfs})

add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.xsd"
COMMAND ${RUBY} ${CMAKE_SOURCE_DIR}/tools/xmlschema.rb
ARGS -s ${CMAKE_CURRENT_SOURCE_DIR} -i ${ABS_FIL} -o ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/xmlschema.py
ARGS -s ${CMAKE_CURRENT_SOURCE_DIR} -i ${FIL} -o ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${ABS_FIL}
COMMENT "Running xml schema compiler on ${FIL}"
VERBATIM)
endforeach()

configure_file(schema/types.xsd ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)

add_custom_target(schema1_5 ALL DEPENDS ${SDF_SCHEMA})

set_source_files_properties(${SDF_SCHEMA} PROPERTIES GENERATED TRUE)
Expand Down
5 changes: 3 additions & 2 deletions sdf/1.5/schema/types.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns="http://sdformat.org/schemas/types.xsd" targetNamespace="http://sdformat.org/schemas/types.xsd">
<xsd:simpleType name="vector3">
<xsd:restriction base="xsd:string">
<xsd:pattern value="(\s*(-|\+)?(\d+(\.\d*)?|\.\d+|\d+\.\d+[eE][-\+]?[0-9]+)\s+){2}((-|\+)?(\d+(\.\d*)?|\.\d+|\d+\.\d+[eE][-\+]?[0-9]+))\s*"/>
Expand Down Expand Up @@ -31,7 +31,8 @@
</xsd:simpleType>

<xsd:simpleType name="time">
<xsd:restriction base="xsd:double">
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d+ \d+"/>
</xsd:restriction>
</xsd:simpleType>

Expand Down
7 changes: 5 additions & 2 deletions sdf/1.6/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,16 @@ foreach(FIL ${sdfs})

add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.xsd"
COMMAND ${RUBY} ${CMAKE_SOURCE_DIR}/tools/xmlschema.rb
ARGS -s ${CMAKE_CURRENT_SOURCE_DIR} -i ${ABS_FIL} -o ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/xmlschema.py
ARGS -s ${CMAKE_CURRENT_SOURCE_DIR} -i ${FIL} -o ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${ABS_FIL}
COMMENT "Running xml schema compiler on ${FIL}"
VERBATIM)
endforeach()

configure_file(schema/types.xsd ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)


add_custom_target(schema1_6 ALL DEPENDS ${SDF_SCHEMA})

set_source_files_properties(${SDF_SCHEMA} PROPERTIES GENERATED TRUE)
Expand Down
5 changes: 3 additions & 2 deletions sdf/1.6/schema/types.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns="http://sdformat.org/schemas/types.xsd" targetNamespace="http://sdformat.org/schemas/types.xsd">
<xsd:simpleType name="vector3">
<xsd:restriction base="xsd:string">
<xsd:pattern value="(\s*(-|\+)?(\d+(\.\d*)?|\.\d+|\d+\.\d+[eE][-\+]?[0-9]+)\s+){2}((-|\+)?(\d+(\.\d*)?|\.\d+|\d+\.\d+[eE][-\+]?[0-9]+))\s*"/>
Expand Down Expand Up @@ -31,7 +31,8 @@
</xsd:simpleType>

<xsd:simpleType name="time">
<xsd:restriction base="xsd:double">
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d+ \d+"/>
</xsd:restriction>
</xsd:simpleType>

Expand Down
6 changes: 4 additions & 2 deletions sdf/1.7/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ foreach(FIL ${sdfs})

add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.xsd"
COMMAND ${RUBY} ${CMAKE_SOURCE_DIR}/tools/xmlschema.rb
ARGS -s ${CMAKE_CURRENT_SOURCE_DIR} -i ${ABS_FIL} -o ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/xmlschema.py
ARGS -s ${CMAKE_CURRENT_SOURCE_DIR} -i ${FIL} -o ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${ABS_FIL}
COMMENT "Running xml schema compiler on ${FIL}"
VERBATIM)
endforeach()

configure_file(schema/types.xsd ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)

add_custom_target(schema1_7 ALL DEPENDS ${SDF_SCHEMA})

set_source_files_properties(${SDF_SCHEMA} PROPERTIES GENERATED TRUE)
Expand Down
5 changes: 3 additions & 2 deletions sdf/1.7/schema/types.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns="http://sdformat.org/schemas/types.xsd" targetNamespace="http://sdformat.org/schemas/types.xsd">
<xsd:simpleType name="vector3">
<xsd:restriction base="xsd:string">
<xsd:pattern value="(\s*(-|\+)?(\d+(\.\d*)?|\.\d+|\d+\.\d+[eE][-\+]?[0-9]+)\s+){2}((-|\+)?(\d+(\.\d*)?|\.\d+|\d+\.\d+[eE][-\+]?[0-9]+))\s*"/>
Expand Down Expand Up @@ -31,7 +31,8 @@
</xsd:simpleType>

<xsd:simpleType name="time">
<xsd:restriction base="xsd:double">
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d+ \d+"/>
</xsd:restriction>
</xsd:simpleType>

Expand Down
6 changes: 4 additions & 2 deletions sdf/1.8/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ foreach(FIL ${sdfs})

add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.xsd"
COMMAND ${RUBY} ${CMAKE_SOURCE_DIR}/tools/xmlschema.rb
ARGS -s ${CMAKE_CURRENT_SOURCE_DIR} -i ${ABS_FIL} -o ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/xmlschema.py
ARGS -s ${CMAKE_CURRENT_SOURCE_DIR} -i ${FIL} -o ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${ABS_FIL}
COMMENT "Running xml schema compiler on ${FIL}"
VERBATIM)
endforeach()

configure_file(schema/types.xsd ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)

add_custom_target(schema1_8 ALL DEPENDS ${SDF_SCHEMA})

set_source_files_properties(${SDF_SCHEMA} PROPERTIES GENERATED TRUE)
Expand Down
5 changes: 3 additions & 2 deletions sdf/1.8/schema/types.xsd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns="http://sdformat.org/schemas/types.xsd" targetNamespace="http://sdformat.org/schemas/types.xsd">
<xsd:simpleType name="vector3">
<xsd:restriction base="xsd:string">
<xsd:pattern value="(\s*(-|\+)?(\d+(\.\d*)?|\.\d+|\d+\.\d+[eE][-\+]?[0-9]+)\s+){2}((-|\+)?(\d+(\.\d*)?|\.\d+|\d+\.\d+[eE][-\+]?[0-9]+))\s*"/>
Expand Down Expand Up @@ -31,7 +31,8 @@
</xsd:simpleType>

<xsd:simpleType name="time">
<xsd:restriction base="xsd:double">
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d+ \d+"/>
</xsd:restriction>
</xsd:simpleType>

Expand Down
10 changes: 10 additions & 0 deletions test/sdf/double_pendulum.sdf
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,11 @@
<child>upper_link</child>
<axis>
<xyz>1.0 0 0</xyz>
<use_parent_model_frame>0</use_parent_model_frame>
<limit>
<lower>0</lower>
<upper>0.5</upper>
</limit>
</axis>
</joint>
<!-- pin joint for lower link, at origin of child link -->
Expand All @@ -205,6 +210,11 @@
<child>lower_link</child>
<axis>
<xyz>1.0 0 0</xyz>
<use_parent_model_frame>0</use_parent_model_frame>
<limit>
<lower>0</lower>
<upper>0.5</upper>
</limit>
</axis>
</joint>
</model>
Expand Down
Loading