Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Guilhem Saurel
pinocchio
Commits
2f1d2fa4
Commit
2f1d2fa4
authored
Feb 23, 2017
by
jcarpent
Browse files
[Parsers] Move URDF types to a dedicated file
parent
91286173
Changes
3
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
2f1d2fa4
...
...
@@ -262,6 +262,7 @@ IF(URDFDOM_FOUND)
LIST
(
APPEND
${
PROJECT_NAME
}
_PARSERS_HEADERS
parsers/urdf.hpp
parsers/urdf/utils.hpp
parsers/urdf/types.hpp
)
ADD_DEFINITIONS
(
-DWITH_URDFDOM
)
...
...
src/parsers/urdf.hpp
View file @
2f1d2fa4
...
...
@@ -22,78 +22,10 @@
#include
"pinocchio/multibody/model.hpp"
#include
"pinocchio/deprecated.hh"
#include
"pinocchio/multibody/geometry.hpp"
#include
"pinocchio/parsers/urdf/types.hpp"
#include
<urdf_model/model.h>
#include
<string>
#include
<exception>
#ifdef URDFDOM_USE_STD_SHARED_PTR
#include
<memory>
#define URDF_SHARED_PTR(type) std::shared_ptr<type>
#define URDF_WEAK_PTR(type) std::weak_ptr<type>
#else
#include
<boost/shared_ptr.hpp>
#define URDF_SHARED_PTR(type) boost::shared_ptr<type>
#define URDF_WEAK_PTR(type) boost::weak_ptr<type>
#endif
#ifndef URDFDOM_TYPEDEF_SHARED_PTR
#define URDF_TYPEDEF_CLASS_POINTER(Class) \
typedef URDF_SHARED_PTR(Class) Class##SharedPtr; \
typedef URDF_SHARED_PTR(const Class) Class##ConstSharedPtr; \
typedef URDF_WEAK_PTR(Class) Class##WeakPtr
namespace
urdf
{
URDF_TYPEDEF_CLASS_POINTER
(
Box
);
URDF_TYPEDEF_CLASS_POINTER
(
Collision
);
URDF_TYPEDEF_CLASS_POINTER
(
Cylinder
);
URDF_TYPEDEF_CLASS_POINTER
(
Geometry
);
URDF_TYPEDEF_CLASS_POINTER
(
Inertial
);
URDF_TYPEDEF_CLASS_POINTER
(
Joint
);
URDF_TYPEDEF_CLASS_POINTER
(
Link
);
URDF_TYPEDEF_CLASS_POINTER
(
Material
);
URDF_TYPEDEF_CLASS_POINTER
(
Mesh
);
URDF_TYPEDEF_CLASS_POINTER
(
ModelInterface
);
URDF_TYPEDEF_CLASS_POINTER
(
Sphere
);
URDF_TYPEDEF_CLASS_POINTER
(
Visual
);
template
<
class
T
,
class
U
>
URDF_SHARED_PTR
(
T
)
const_pointer_cast
(
URDF_SHARED_PTR
(
U
)
const
&
r
)
{
#ifdef URDFDOM_USE_STD_SHARED_PTR
return
std
::
const_pointer_cast
<
T
>
(
r
);
#else
return
boost
::
const_pointer_cast
<
T
>
(
r
);
#endif
}
template
<
class
T
,
class
U
>
URDF_SHARED_PTR
(
T
)
dynamic_pointer_cast
(
URDF_SHARED_PTR
(
U
)
const
&
r
)
{
#ifdef URDFDOM_USE_STD_SHARED_PTR
return
std
::
dynamic_pointer_cast
<
T
>
(
r
);
#else
return
boost
::
dynamic_pointer_cast
<
T
>
(
r
);
#endif
}
template
<
class
T
,
class
U
>
URDF_SHARED_PTR
(
T
)
static_pointer_cast
(
URDF_SHARED_PTR
(
U
)
const
&
r
)
{
#ifdef URDFDOM_USE_STD_SHARED_PTR
return
std
:
static_pointer_cast
<
T
>
(
r
);
#else
return
boost
::
static_pointer_cast
<
T
>
(
r
);
#endif
}
}
#undef URDF_TYPEDEF_CLASS_POINTER
#endif
namespace
se3
{
namespace
urdf
...
...
src/parsers/urdf/types.hpp
0 → 100644
View file @
2f1d2fa4
//
// Copyright (c) 2015-2017 CNRS
//
// This file is part of Pinocchio
// Pinocchio is free software: you can redistribute it
// and/or modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation, either version
// 3 of the License, or (at your option) any later version.
//
// Pinocchio is distributed in the hope that it will be
// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Lesser Public License for more details. You should have
// received a copy of the GNU Lesser General Public License along with
// Pinocchio If not, see
// <http://www.gnu.org/licenses/>.
#ifndef __se3_parsers_urdf_types_hpp__
#define __se3_parsers_urdf_types_hpp__
#include
<urdf_model/model.h>
#include
<string>
#include
<exception>
#ifdef URDFDOM_USE_STD_SHARED_PTR
#include
<memory>
#define URDF_SHARED_PTR(type) std::shared_ptr<type>
#define URDF_WEAK_PTR(type) std::weak_ptr<type>
#else
#include
<boost/shared_ptr.hpp>
#define URDF_SHARED_PTR(type) boost::shared_ptr<type>
#define URDF_WEAK_PTR(type) boost::weak_ptr<type>
#endif
#ifndef URDFDOM_TYPEDEF_SHARED_PTR
#define URDF_TYPEDEF_CLASS_POINTER(Class) \
typedef URDF_SHARED_PTR(Class) Class##SharedPtr; \
typedef URDF_SHARED_PTR(const Class) Class##ConstSharedPtr; \
typedef URDF_WEAK_PTR(Class) Class##WeakPtr
namespace
urdf
{
URDF_TYPEDEF_CLASS_POINTER
(
Box
);
URDF_TYPEDEF_CLASS_POINTER
(
Collision
);
URDF_TYPEDEF_CLASS_POINTER
(
Cylinder
);
URDF_TYPEDEF_CLASS_POINTER
(
Geometry
);
URDF_TYPEDEF_CLASS_POINTER
(
Inertial
);
URDF_TYPEDEF_CLASS_POINTER
(
Joint
);
URDF_TYPEDEF_CLASS_POINTER
(
Link
);
URDF_TYPEDEF_CLASS_POINTER
(
Material
);
URDF_TYPEDEF_CLASS_POINTER
(
Mesh
);
URDF_TYPEDEF_CLASS_POINTER
(
ModelInterface
);
URDF_TYPEDEF_CLASS_POINTER
(
Sphere
);
URDF_TYPEDEF_CLASS_POINTER
(
Visual
);
template
<
class
T
,
class
U
>
URDF_SHARED_PTR
(
T
)
const_pointer_cast
(
URDF_SHARED_PTR
(
U
)
const
&
r
)
{
#ifdef URDFDOM_USE_STD_SHARED_PTR
return
std
::
const_pointer_cast
<
T
>
(
r
);
#else
return
boost
::
const_pointer_cast
<
T
>
(
r
);
#endif
}
template
<
class
T
,
class
U
>
URDF_SHARED_PTR
(
T
)
dynamic_pointer_cast
(
URDF_SHARED_PTR
(
U
)
const
&
r
)
{
#ifdef URDFDOM_USE_STD_SHARED_PTR
return
std
::
dynamic_pointer_cast
<
T
>
(
r
);
#else
return
boost
::
dynamic_pointer_cast
<
T
>
(
r
);
#endif
}
template
<
class
T
,
class
U
>
URDF_SHARED_PTR
(
T
)
static_pointer_cast
(
URDF_SHARED_PTR
(
U
)
const
&
r
)
{
#ifdef URDFDOM_USE_STD_SHARED_PTR
return
std
:
static_pointer_cast
<
T
>
(
r
);
#else
return
boost
::
static_pointer_cast
<
T
>
(
r
);
#endif
}
}
#undef URDF_TYPEDEF_CLASS_POINTER
#endif
#endif // ifndef __se3_parsers_urdf_types_hpp__
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment