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

Initial urdf parser plugin that parses sdformat #1

Merged
merged 152 commits into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
152 commits
Select commit Hold shift + click to select a range
b8a6ff5
Initial urdf parser plugin that parses sdformat
sloretz Jul 15, 2020
035dbc8
Visual and Collision with Box geometry
sloretz Jul 17, 2020
c80edcc
Sphere geometry
sloretz Jul 17, 2020
30de800
Cylinder geometry
sloretz Jul 17, 2020
9f9ac7e
Mesh support
sloretz Jul 18, 2020
4f0ef01
remove TODO comment about resolving poses
sloretz Aug 3, 2020
db1551b
Let downstream worry about resolving mesh URIs
sloretz Aug 3, 2020
c84a46d
Reword assumption about kinematic root link
sloretz Aug 3, 2020
ecb6e32
Make fall through comments easier to see
sloretz Aug 3, 2020
dd02e31
Create urdf_mesh variable
sloretz Aug 4, 2020
5967756
Handle inertia
sloretz Aug 4, 2020
edf7519
Mesh scale
sloretz Aug 4, 2020
3c0a28f
Visibility control header
sloretz Aug 4, 2020
d6021c6
Remove resource_retriever dependency
sloretz Aug 13, 2020
348723b
Support joint axis expressed in other frames
sloretz Aug 13, 2020
ab6637b
Include ignition/math/Pose3.hh
sloretz Sep 21, 2020
21adf18
Use final on plugin class
sloretz Sep 21, 2020
7a5ad72
Use TinyXML2 to filter non-sdf XML documents
sloretz Sep 21, 2020
512dfc2
Apache 2.0 License
sloretz Sep 21, 2020
63fd805
Satisfy uncrustify
sloretz Sep 22, 2020
16c133f
Satisfy cpplint
sloretz Sep 22, 2020
54c2983
Add linter tests
sloretz Sep 22, 2020
1e36db1
Add test for pose_link case
sloretz Sep 24, 2020
b07df19
Actually add test files
sloretz Sep 24, 2020
61e4cfe
Add SDF link pose to URDF link members
sloretz Sep 24, 2020
2f5f7df
Pose link test actually checks pose
sloretz Sep 24, 2020
0c434fd
Add SDF visual pose test
sloretz Sep 24, 2020
34f3a8e
Add SDF collision pose test
sloretz Sep 24, 2020
1661389
Add SDF inertial pose test
sloretz Sep 24, 2020
b6ee85a
Add test for model with pose, plus refactor test tools
sloretz Sep 24, 2020
467fbd9
Replace todo with explanation
sloretz Sep 25, 2020
4cfbcbc
Add pose_link_all test
sloretz Sep 25, 2020
f96ec4c
Assert model name is correct
sloretz Sep 25, 2020
77d2960
Add pose_link_in_frame test
sloretz Sep 25, 2020
57703ac
Add pose_collision_in_frame test
sloretz Sep 25, 2020
e3b00ed
Add pose_visual_in_frame test
sloretz Sep 25, 2020
b14eeb5
Add skipped pose_inertial_in_frame test
sloretz Sep 29, 2020
bcb85e2
Depend on sdformat
sloretz Sep 30, 2020
276b013
Fix link poses of child links
sloretz Sep 30, 2020
743b0ca
Add test for model with joint pose
sloretz Sep 30, 2020
5ea4bbb
Remove unused variable
sloretz Sep 30, 2020
db3a641
Add test for model with joint pose in frame
sloretz Sep 30, 2020
1134ffb
Rename variables for consistent ordering
sloretz Sep 30, 2020
14bc1d2
Fix fame names in calculating joint pose
sloretz Oct 1, 2020
8d8441b
URDF link frames are coincident with joint frames
sloretz Oct 2, 2020
58e865c
Add pose_chain test
sloretz Oct 2, 2020
11c7073
Clearer description of pose_collision expectations
sloretz Oct 2, 2020
b49a80f
Clearer description of pose_collision_in_frame expectations
sloretz Oct 2, 2020
faa7e16
Clearer pose_inertial* expectations
sloretz Oct 2, 2020
6714d71
Remove unnecessary ASSERT
sloretz Oct 2, 2020
9ad8bfe
Initializer lists
sloretz Oct 2, 2020
08afd02
Remove unnecessary ASSERT
sloretz Oct 2, 2020
cd57fc6
Initializer lists
sloretz Oct 2, 2020
1a4d195
Fix pose_link* test expectations
sloretz Oct 2, 2020
e0d722f
Clearer pose_visual* test expecations
sloretz Oct 2, 2020
184393f
Shorter file name
sloretz Oct 2, 2020
a697bfb
Shorter file name
sloretz Oct 2, 2020
57db264
Add graph_loop test
sloretz Oct 3, 2020
06beeeb
Add graph_four_bar test
sloretz Oct 3, 2020
34700ae
Alphabetize
sloretz Oct 3, 2020
e8fe43b
Refactor tree traversal code
sloretz Oct 5, 2020
1b36817
Add graph_tree_non_canonical_root test
sloretz Oct 5, 2020
4d9416a
Transfrom -> transform
sloretz Oct 5, 2020
1b64b32
Different error when XML file has no model
sloretz Oct 5, 2020
0410a84
urdf child link keeps weak reference to parent link
sloretz Oct 5, 2020
ba62b98
Add graph_tree test and EXPECT_NAMES util
sloretz Oct 5, 2020
27ceefc
Add graph_chain test
sloretz Oct 5, 2020
f02e1ac
Add graph_chain_non_canonical_root test
sloretz Oct 5, 2020
bb10917
Add geometry_plane test
sloretz Oct 5, 2020
312c308
Add geometry_box test
sloretz Oct 5, 2020
d4e1611
Add geometry_cylinder test
sloretz Oct 5, 2020
8afb524
Add geometry_sphere test
sloretz Oct 5, 2020
aad25df
Add geometry_heightmap test
sloretz Oct 5, 2020
911a6fc
Add geometry_collada test
sloretz Oct 5, 2020
aa8d277
Add geometry_obj test
sloretz Oct 5, 2020
d32e4fe
Add geometry_stl test
sloretz Oct 5, 2020
d9a6adc
Add geometry_mesh_scaled test
sloretz Oct 5, 2020
621d8b6
Add tests for zero and two models
sloretz Oct 6, 2020
3743f8f
Add joint_ball test
sloretz Oct 6, 2020
ce65068
Get rid of num_axes variable
sloretz Oct 6, 2020
c8e033e
Add damping and friction info to joints
sloretz Oct 6, 2020
9a48ea2
Add joint_continuous test
sloretz Oct 6, 2020
dc21ca8
Add joint_fixed test
sloretz Oct 6, 2020
4f7de1a
Add joint limits info
sloretz Oct 7, 2020
d6d122a
Add joint_prismatic test
sloretz Oct 7, 2020
da03bc6
Add axis expectations
sloretz Oct 7, 2020
f48200e
Add joint_revolute test
sloretz Oct 7, 2020
3dbbe6d
Add joint_revolute2 test
sloretz Oct 7, 2020
95a2d04
Add joint_screw test
sloretz Oct 7, 2020
ec10874
Add joint_universal test
sloretz Oct 7, 2020
0746ec6
Add link_inertia test
sloretz Oct 7, 2020
25d9a54
Add joint_revolute_axis test
sloretz Oct 7, 2020
523a18d
Warn on non-default values of unsupported <joint> tags
sloretz Oct 8, 2020
48156b5
Add link_multiple_collisions test
sloretz Oct 8, 2020
5797057
Add link_multiple_visuals test
sloretz Oct 8, 2020
00b1aa7
Add joint_revolute_axis_in_frame test
sloretz Oct 8, 2020
4d9d79e
Add joint_revolute_default_limits test
sloretz Oct 8, 2020
2d8dc1a
Detect kinematic loops involving redundant joints
sloretz Oct 8, 2020
9574007
Add joint_revolute_two_joints_two_links test
sloretz Oct 8, 2020
3e4c495
Warn if <sensor> or <light> are used on <link>
sloretz Oct 9, 2020
5752044
Add link_sensor_imu test
sloretz Oct 9, 2020
47754a1
Add link_light_point test
sloretz Oct 9, 2020
d8c59b8
Sensors -> lights
sloretz Oct 9, 2020
cafee11
Move package into folder in repo
sloretz Oct 9, 2020
e6b4f87
Add sdformat_test_files package to repo
sloretz Oct 9, 2020
f7fcfe5
lilnk -> link
sloretz Oct 9, 2020
135cb90
Whitespace
sloretz Oct 9, 2020
c9ca571
Save a line
sloretz Oct 9, 2020
44763d4
Move PlaneShape check lower
sloretz Oct 9, 2020
0dd8103
Remove impossible condition after make_shared
sloretz Oct 9, 2020
2ac36ec
Make names shorter
sloretz Oct 9, 2020
fc8490a
Remove accidentally comitted file
sloretz Oct 9, 2020
c816318
Add material_blinn_phong test
sloretz Oct 9, 2020
41c3f8e
Warn if unsupported <material><lighting> feature is used
sloretz Oct 9, 2020
bf74e9d
Add skipped material_dynamic_lights test
sloretz Oct 9, 2020
2f46b1c
Remove unfinished material models and add TODO for them
sloretz Oct 9, 2020
8bbee66
Expect no Algorithm errors
sloretz Oct 9, 2020
f967e20
Add joint_gearbox model and test
sloretz Oct 9, 2020
d57948b
Update descriptions of all models
sloretz Oct 13, 2020
c0c29e2
Add sdformat_test_files README
sloretz Oct 13, 2020
4805f38
Add README for sdformat_urdf
sloretz Oct 13, 2020
c5f665a
Misc tiny edits
sloretz Oct 13, 2020
7737d83
Eliminate elements
sloretz Oct 13, 2020
f90c64e
Add repo level readme
sloretz Oct 13, 2020
ab97a51
Remove .
sloretz Oct 13, 2020
1ad8428
Trick to use sdformat9 from source
sloretz Oct 13, 2020
867a0d9
Remove condition hack
sloretz Oct 14, 2020
c3ca66a
Add colcon.pkg for building sdformat from source
sloretz Oct 14, 2020
ce0812d
check errors instead of valid pointer
sloretz Oct 22, 2020
034edd1
Make urdf a <depend>
sloretz Oct 22, 2020
abeb693
Remove std::cout dbg print
sloretz Oct 22, 2020
6552021
the the -> the
sloretz Oct 22, 2020
4681be2
Compare WorldCount against 0u
sloretz Oct 22, 2020
197bbf8
Concatenate link and visual names to make material name
sloretz Oct 22, 2020
a533c05
Compatibility with CMake earlier than 3.14
sloretz Oct 22, 2020
f25ffe2
Use target_link_libraries()
sloretz Oct 22, 2020
86f5f54
One install rule per target
sloretz Oct 22, 2020
2c375de
voilated -> violated
sloretz Oct 22, 2020
48d9136
Use axis2 for second axis
sloretz Oct 22, 2020
7d0ac7a
Universal joint perpendicular axis
sloretz Oct 22, 2020
b06afde
Use Pose3d::operator*
sloretz Oct 23, 2020
aff9def
structures -> DOM objects
sloretz Oct 23, 2020
e924fe6
Document EXPECT_NAMES()
sloretz Oct 28, 2020
84d23f5
Compare normalized joint axes
sloretz Oct 29, 2020
bb65e1f
Check casted pointer before using them
sloretz Oct 29, 2020
9ae4804
Check geometry pointer isn't null before using it
sloretz Oct 29, 2020
d9ca9fb
Assert joint isn't null before using it
sloretz Oct 29, 2020
ec3f81b
Assert link isn't null before using it
sloretz Oct 29, 2020
645a2e9
Assert link isn't null before using it
sloretz Oct 29, 2020
c84405d
Color = 0.4 * ambient + 0.8 * diffuse
sloretz Oct 29, 2020
6582d52
Fix application of link pose on inertial/visual/collision
sloretz Oct 29, 2020
e4664a8
Add pose_joint_all test
sloretz Oct 29, 2020
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
73 changes: 73 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
cmake_minimum_required(VERSION 3.5)

project(sdformat_urdf)

# Default to C++14
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic -Wnon-virtual-dtor -Woverloaded-virtual)
endif()

find_package(ament_cmake_ros REQUIRED)

find_package(pluginlib REQUIRED)
find_package(rcutils REQUIRED)
find_package(resource_retriever REQUIRED)
find_package(sdformat9 REQUIRED)
find_package(urdfdom_headers REQUIRED)
find_package(urdf_parser_plugin REQUIRED)

# Add sdformat_urdf shared library
add_library(sdformat_urdf SHARED
src/sdformat_urdf.cpp
)
target_link_libraries(sdformat_urdf
PUBLIC
sdformat9::sdformat9
)
target_link_libraries(sdformat_urdf
PRIVATE
resource_retriever::resource_retriever
)
target_include_directories(sdformat_urdf
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>"
${urdfdom_headers_INCLUDE_DIRS}
)

# Add sdformat_urdf_plugin module library
add_library(sdformat_urdf_plugin MODULE
src/sdformat_urdf_plugin.cpp
)
target_link_libraries(sdformat_urdf_plugin PUBLIC
sdformat_urdf
)
ament_target_dependencies(sdformat_urdf_plugin PUBLIC
"pluginlib"
"rcutils"
"urdf_parser_plugin"
)

ament_export_dependencies(urdfdom_headers)
ament_export_dependencies(sdformat9)

install(TARGETS sdformat_urdf sdformat_urdf_plugin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)

install(
DIRECTORY include/
DESTINATION include
)

install(TARGETS sdformat_urdf EXPORT sdformat_urdf-export)
ament_export_targets(sdformat_urdf-export)

pluginlib_export_plugin_description_file(urdf_parser_plugin "sdformat_urdf_plugin.xml")

ament_package()
38 changes: 38 additions & 0 deletions include/sdformat_urdf/sdformat_urdf.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright 2020 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <string>

#include <sdf/sdf.hh>
#include <urdf_world/types.h>
#include <urdf_model/types.h>

#include <sdformat_urdf/visibility_control.hpp>

namespace sdformat_urdf {
/// \brief Parse an SDFormat XML string and return URDF C++ structures
SDFORMAT_URDF_PUBLIC
urdf::ModelInterfaceSharedPtr
parse(const std::string & data, sdf::Errors & errors);

/// \brief Convert SDFormat C++ structures to URDF C++ structures
SDFORMAT_URDF_PUBLIC
urdf::ModelInterfaceSharedPtr
sdf_to_urdf(const sdf::Root & sdf_dom, sdf::Errors & errors);

/// \brief Convert SDFormat Model to URDF Model
SDFORMAT_URDF_PUBLIC
urdf::ModelInterfaceSharedPtr
convert_model(const sdf::Model & sdf_model, sdf::Errors & errors);
} // namespace sdformat_urdf
58 changes: 58 additions & 0 deletions include/sdformat_urdf/visibility_control.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright 2020 Open Source Robotics Foundation, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef SDFORMAT_URDF__VISIBILITY_CONTROL_H_
#define SDFORMAT_URDF__VISIBILITY_CONTROL_H_

#ifdef __cplusplus
extern "C"
{
#endif

// This logic was borrowed (then namespaced) from the examples on the gcc wiki:
// https://gcc.gnu.org/wiki/Visibility

#if defined _WIN32 || defined __CYGWIN__
#ifdef __GNUC__
#define SDFORMAT_URDF_EXPORT __attribute__ ((dllexport))
#define SDFORMAT_URDF_IMPORT __attribute__ ((dllimport))
#else
#define SDFORMAT_URDF_EXPORT __declspec(dllexport)
#define SDFORMAT_URDF_IMPORT __declspec(dllimport)
#endif
#ifdef SDFORMAT_URDF_BUILDING_DLL
#define SDFORMAT_URDF_PUBLIC SDFORMAT_URDF_EXPORT
#else
#define SDFORMAT_URDF_PUBLIC SDFORMAT_URDF_IMPORT
#endif
#define SDFORMAT_URDF_PUBLIC_TYPE SDFORMAT_URDF_PUBLIC
#define SDFORMAT_URDF_LOCAL
#else
#define SDFORMAT_URDF_EXPORT __attribute__ ((visibility("default")))
#define SDFORMAT_URDF_IMPORT
#if __GNUC__ >= 4
#define SDFORMAT_URDF_PUBLIC __attribute__ ((visibility("default")))
#define SDFORMAT_URDF_LOCAL __attribute__ ((visibility("hidden")))
#else
#define SDFORMAT_URDF_PUBLIC
#define SDFORMAT_URDF_LOCAL
#endif
#define SDFORMAT_URDF_PUBLIC_TYPE
#endif

#ifdef __cplusplus
}
#endif

#endif // SDFORMAT_URDF__VISIBILITY_CONTROL_H_
36 changes: 36 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0"?>
<package format="2">
<name>sdformat_urdf</name>
<version>0.1.0</version>
<description>
URDF plugin to parse SDFormat XML into URDF C++ structures.
</description>

<author email="sloretz@openrobotics.org">Shane Loretz</author>
<maintainer email="sloretz@osrfoundation.org">Shane Loretz</maintainer>

<license>Apache 2.0</license>

<url type="repository">https://github.com/ros/sdformat_urdf</url>
<url type="bugtracker">https://github.com/ros/sdformat_urdf/issues</url>

<buildtool_depend>ament_cmake_ros</buildtool_depend>
<buildtool_export_depend>ament_cmake_ros</buildtool_export_depend>

<build_export_depend>urdf</build_export_depend>

<build_depend>liburdfdom-headers-dev</build_depend>
<build_depend>pluginlib</build_depend>
<build_depend>resource_retriever</build_depend>
<build_depend>urdf</build_depend>
<build_depend>urdf_parser_plugin</build_depend>
<build_depend>resource_retriever</build_depend>

<exec_depend>resource_retriever</exec_depend>
<exec_depend>urdf</exec_depend>
<exec_depend>urdf_parser_plugin</exec_depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
8 changes: 8 additions & 0 deletions sdformat_urdf_plugin.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<library path="sdformat_urdf_plugin">
<class name="sdformat_urdf_plugin/SDFormatURDFParser" type="sdformat_urdf::SDFormatURDFParser" base_class_type="urdf::URDFParser">
<description>
Parse models as URDF from SDFormat XML.
</description>
</class>
</library>
Loading