Skip to content

Commit

Permalink
core: Setup back GeometryObject deprecated constructor (deprecated si…
Browse files Browse the repository at this point in the history
…nce pinocchio 3)
  • Loading branch information
jorisv committed May 24, 2024
1 parent fabb713 commit 7f8b46a
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .cmake-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ parse:
MODULE: 1
FILES: '*'
add_project_dependency:
pargs: "*"
pargs: '*'
kwargs:
PKG_CONFIG_REQUIRES: 1
FOR_COMPONENT: 1
Expand Down
23 changes: 23 additions & 0 deletions include/pinocchio/bindings/python/multibody/geometry-object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "pinocchio/bindings/python/utils/address.hpp"
#include "pinocchio/bindings/python/utils/copyable.hpp"
#include "pinocchio/bindings/python/utils/registration.hpp"
#include "pinocchio/bindings/python/utils/deprecation.hpp"
#include "pinocchio/bindings/python/utils/pickle.hpp"
#include "pinocchio/bindings/python/serialization/serializable.hpp"

Expand Down Expand Up @@ -127,6 +128,28 @@ namespace pinocchio
"mesh_material"),
"Reduced constructor of a GeometryObject. This constructor does not require to specify "
"the parent frame index."))
.def(bp::init<
std::string, FrameIndex, JointIndex, CollisionGeometryPtr, const SE3 &,
bp::optional<
std::string, const Eigen::Vector3d &, bool, const Eigen::Vector4d &, std::string,
GeometryMaterial>>(
bp::args(
"self", "name", "parent_frame", "parent_joint", "collision_geometry", "placement",
"mesh_path", "mesh_scale", "override_material", "mesh_color",
"mesh_texture_path"
"mesh_material"),
"Deprecated. Full constructor of a GeometryObject.")[deprecated_function<>()])
.def(bp::init<
std::string, JointIndex, CollisionGeometryPtr, const SE3 &,
bp::optional<
std::string, const Eigen::Vector3d &, bool, const Eigen::Vector4d &, std::string,
GeometryMaterial>>(
bp::args(
"self", "name", "parent_joint", "collision_geometry", "placement", "mesh_path",
"mesh_scale", "override_material", "mesh_color", "mesh_texture_path",
"mesh_material"),
"Deprecated. Reduced constructor of a GeometryObject. This constructor does not "
"require to specify the parent frame index.")[deprecated_function<>()])
.def(bp::init<const GeometryObject &>(
bp::args("self", "otherGeometryObject"), "Copy constructor"))
.add_property(
Expand Down
82 changes: 82 additions & 0 deletions include/pinocchio/multibody/geometry-object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,88 @@ namespace pinocchio
{
}

///
/// \brief Full constructor.
///
/// \param[in] name Name of the geometry object.
/// \param[in] parent_frame Index of the parent frame.
/// \param[in] parent_joint Index of the parent joint (that supports the geometry).
/// \param[in] collision_geometry The FCL collision geometry object.
/// \param[in] placement Placement of the geometry with respect to the joint frame.
/// \param[in] meshPath Path of the mesh (may be needed extarnally to load the mesh inside a
/// viewer for instance) [if applicable]. \param[in] meshScale Scale of the mesh [if
/// applicable]. \param[in] overrideMaterial If true, this option allows to overrite the
/// material [if applicable]. \param[in] meshColor Color of the mesh [if applicable]. \param[in]
/// meshTexturePath Path to the file containing the texture information [if applicable].
/// \param[in] meshMaterial Material of the mesh [if applicable].
///
/// \deprecated This constructor is now deprecated, and its argument order has been changed.
///
PINOCCHIO_DEPRECATED GeometryObject(
const std::string & name,
const FrameIndex parent_frame,
const JointIndex parent_joint,
const CollisionGeometryPtr & collision_geometry,
const SE3 & placement,
const std::string & meshPath = "",
const Eigen::Vector3d & meshScale = Eigen::Vector3d::Ones(),
const bool overrideMaterial = false,
const Eigen::Vector4d & meshColor = Eigen::Vector4d(0, 0, 0, 1),
const std::string & meshTexturePath = "",
const GeometryMaterial & meshMaterial = GeometryNoMaterial())
: Base(name, parent_joint, parent_frame, placement)
, geometry(collision_geometry)
, meshPath(meshPath)
, meshScale(meshScale)
, overrideMaterial(overrideMaterial)
, meshColor(meshColor)
, meshMaterial(meshMaterial)
, meshTexturePath(meshTexturePath)
, disableCollision(false)
{
}

///
/// \brief Reduced constructor.
/// \remarks Compared to the other constructor, this one assumes that there is no parentFrame
/// associated to the geometry.
///
/// \param[in] name Name of the geometry object.
/// \param[in] parent_joint Index of the parent joint (that supports the geometry).
/// \param[in] collision_geometry The FCL collision geometry object.
/// \param[in] placement Placement of the geometry with respect to the joint frame.
/// \param[in] meshPath Path of the mesh (may be needed extarnally to load the mesh inside a
/// viewer for instance) [if applicable]. \param[in] meshScale Scale of the mesh [if
/// applicable]. \param[in] overrideMaterial If true, this option allows to overrite the
/// material [if applicable]. \param[in] meshColor Color of the mesh [if applicable]. \param[in]
/// meshTexturePath Path to the file containing the texture information [if applicable].
/// \param[in] meshMaterial Material of the mesh [if applicable].
///
/// \deprecated This constructor is now deprecated, and its argument order has been changed.
///
PINOCCHIO_DEPRECATED GeometryObject(
const std::string & name,
const JointIndex parent_joint,
const CollisionGeometryPtr & collision_geometry,
const SE3 & placement,
const std::string & meshPath = "",
const Eigen::Vector3d & meshScale = Eigen::Vector3d::Ones(),
const bool overrideMaterial = false,
const Eigen::Vector4d & meshColor = Eigen::Vector4d(0, 0, 0, 1),
const std::string & meshTexturePath = "",
const GeometryMaterial & meshMaterial = GeometryNoMaterial())
: Base(name, parent_joint, std::numeric_limits<FrameIndex>::max(), placement)
, geometry(collision_geometry)
, meshPath(meshPath)
, meshScale(meshScale)
, overrideMaterial(overrideMaterial)
, meshColor(meshColor)
, meshMaterial(meshMaterial)
, meshTexturePath(meshTexturePath)
, disableCollision(false)
{
}

GeometryObject(const GeometryObject & other) = default;
GeometryObject & operator=(const GeometryObject & other) = default;

Expand Down

0 comments on commit 7f8b46a

Please sign in to comment.