frame.hpp 2.43 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//
// 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_frame_hpp__
#define __se3_frame_hpp__

#include "pinocchio/spatial/fwd.hpp"
#include "pinocchio/spatial/se3.hpp"
23
#include "pinocchio/multibody/fwd.hpp"
24
#include "pinocchio/tools/string-generator.hpp"
25
26

#include <Eigen/StdVector>
27
28
29
30
#include <iostream>

namespace se3
{
31

32
  ///
33
  /// \brief A Plucker coordinate frame attached to a parent joint inside a kinematic tree
34
35
  ///
  struct Frame
36
  {
37
    typedef se3::JointIndex JointIndex;
38
      
39
40
41
42
43
44
45
46
47
    Frame() : name(random(8)), parent_id(), framePlacement() {} // needed by EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION
    
    ///
    /// \brief Default constructor of a Frame
    ///
    /// \param[in] name Name of the frame.
    /// \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.
    ///
48
    Frame(const std::string & name, const JointIndex parent_id, const SE3 & frame_placement):
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
    name(name)
    , parent_id(parent_id)
    , framePlacement(frame_placement)
    {}
    
    ///
    /// \brief Compare the current Frame with another frame. Return true if all properties match.
    ///
    /// \param[in] other The frame to which the current frame is compared.
    ///
    bool operator == (const Frame & other) const
    {
      return name == other.name && parent_id == other.parent_id
      && framePlacement == other.framePlacement ;
    }
    
    /// \brief Name of the frame.
    std::string name;
    
    /// \brief Index of the parent joint.
69
    JointIndex parent_id;
70
71
72
73
74
    
    /// \brief Placement of the frame wrt the parent joint.
    SE3 framePlacement;
    
  }; // struct Frame
75

76
} // namespace se3
77

78
EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(se3::Frame)
79
80

#endif // ifndef __se3_frame_hpp__