diff --git a/CMakeLists.txt b/CMakeLists.txt index 660c29dc1a5718fad16a7c6cefaf1d3abfaf43f4..6c91d11a15209ec10d0afee5752fc5f2d920bed2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,6 +123,7 @@ SET(${PROJECT_NAME}_MULTIBODY_PARSER_HEADERS ) SET(${PROJECT_NAME}_MULTIBODY_HEADERS + multibody/fwd.hpp multibody/constraint.hpp multibody/force-set.hpp multibody/joint.hpp diff --git a/src/multibody/fwd.hpp b/src/multibody/fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4272cbb0a8f2041d29c67ed78b8691f2523ebb7a --- /dev/null +++ b/src/multibody/fwd.hpp @@ -0,0 +1,30 @@ +// +// Copyright (c) 2016 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_multibody_fwd_hpp__ +#define __se3_multibody_fwd_hpp__ + +namespace se3 +{ + typedef std::size_t Index; + typedef Index JointIndex; + typedef Index GeomIndex; + typedef Index FrameIndex; + +} // namespace se3 + +#endif // #ifndef __se3_multibody_fwd_hpp__ diff --git a/src/multibody/model.hpp b/src/multibody/model.hpp index 52546e72f0901967ff8bcece7a409b75d4fb08e2..2ebada1f02fc02ba08f29c6bf1336a199f54a65a 100644 --- a/src/multibody/model.hpp +++ b/src/multibody/model.hpp @@ -25,6 +25,7 @@ #include "pinocchio/spatial/motion.hpp" #include "pinocchio/spatial/inertia.hpp" #include "pinocchio/spatial/frame.hpp" +#include "pinocchio/multibody/fwd.hpp" #include "pinocchio/multibody/joint/joint-variant.hpp" #include "pinocchio/tools/string-generator.hpp" #include <iostream> @@ -40,20 +41,20 @@ namespace se3 { class Model; class Data; - + class Model { public: - typedef std::size_t Index; - typedef Index JointIndex; // For better comprehension of what object we are working with - typedef Index GeomIndex; // - typedef Index FrameIndex; // + typedef Index Index; + typedef JointIndex JointIndex; + typedef GeomIndex GeomIndex; + typedef FrameIndex FrameIndex; int nq; // Dimension of the configuration representation int nv; // Dimension of the velocity vector space int nbody; // Number of bodies (= number of joints + 1) int nFixBody; // Number of fixed-bodies (= number of fixed-joints) - int nOperationalFrames; // Number of extra frames + int nOperationalFrames; // Number of operational frames std::vector<Inertia> inertias; // Spatial inertias of the body <i> in the supporting joint frame <i> std::vector<SE3> jointPlacements; // Placement (SE3) of the input of joint <i> in parent joint output <li> diff --git a/src/spatial/frame.hpp b/src/spatial/frame.hpp index 450bf33dd438e4e75f7e549c9b201f3dd63a0a05..803379d7972881fadbb6c91a021bf45ea961dd22 100644 --- a/src/spatial/frame.hpp +++ b/src/spatial/frame.hpp @@ -20,6 +20,7 @@ #include "pinocchio/spatial/fwd.hpp" #include "pinocchio/spatial/se3.hpp" +#include "pinocchio/multibody/fwd.hpp" #include "pinocchio/tools/string-generator.hpp" #include <Eigen/StdVector> @@ -33,8 +34,7 @@ namespace se3 /// struct Frame { - typedef std::size_t Index; - typedef Index JointIndex; + typedef JointIndex JointIndex; Frame() : name(random(8)), parent_id(), framePlacement() {} // needed by EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION @@ -45,7 +45,7 @@ namespace se3 /// \param[in] parent_id Index of the parent joint in the kinematic tree. /// \param[in] frame_placement Placement of the frame wrt the parent joint frame. /// - Frame(const std::string & name, const Index parent_id, const SE3 & frame_placement): + Frame(const std::string & name, const JointIndex parent_id, const SE3 & frame_placement): name(name) , parent_id(parent_id) , framePlacement(frame_placement) @@ -66,7 +66,7 @@ namespace se3 std::string name; /// \brief Index of the parent joint. - Index parent_id; + JointIndex parent_id; /// \brief Placement of the frame wrt the parent joint. SE3 framePlacement;