manipulator_info.cpp
Go to the documentation of this file.
1 
29 #include <boost/algorithm/string.hpp>
30 #include <boost/serialization/nvp.hpp>
32 
35 #include <tesseract_common/utils.h>
36 
37 namespace tesseract_common
38 {
39 ManipulatorInfo::ManipulatorInfo(std::string manipulator_,
40  std::string working_frame_,
41  std::string tcp_frame_,
42  std::variant<std::string, Eigen::Isometry3d> tcp_offset_)
43  : manipulator(std::move(manipulator_))
44  , working_frame(std::move(working_frame_))
45  , tcp_frame(std::move(tcp_frame_))
46  , tcp_offset(std::move(tcp_offset_))
47 {
48 }
49 
51 {
52  ManipulatorInfo combined = *this;
53 
54  if (!manip_info_override.manipulator.empty())
55  combined.manipulator = manip_info_override.manipulator;
56 
57  if (!manip_info_override.manipulator_ik_solver.empty())
58  combined.manipulator_ik_solver = manip_info_override.manipulator_ik_solver;
59 
60  if (!manip_info_override.working_frame.empty())
61  combined.working_frame = manip_info_override.working_frame;
62 
63  if (!manip_info_override.tcp_frame.empty())
64  {
65  combined.tcp_frame = manip_info_override.tcp_frame;
66  combined.tcp_offset = manip_info_override.tcp_offset;
67  }
68 
69  return combined;
70 }
71 
73 {
74  // This struct is empty if either the manipulator or tcp_frame members are empty since they are required
75  return manipulator.empty() || working_frame.empty() || tcp_frame.empty();
76 }
77 
79 {
80  bool ret_val = true;
81  ret_val &= (manipulator == rhs.manipulator);
82  ret_val &= (manipulator_ik_solver == rhs.manipulator_ik_solver);
83  ret_val &= (working_frame == rhs.working_frame);
84  ret_val &= (tcp_frame == rhs.tcp_frame);
85  ret_val &= (tcp_offset.index() == rhs.tcp_offset.index());
86  if (ret_val)
87  {
88  if (tcp_offset.index() == 0)
89  ret_val &= (std::get<std::string>(tcp_offset) == std::get<std::string>(rhs.tcp_offset));
90  else
91  ret_val &= std::get<Eigen::Isometry3d>(tcp_offset).isApprox(std::get<Eigen::Isometry3d>(rhs.tcp_offset));
92  }
93 
94  return ret_val;
95 }
96 bool ManipulatorInfo::operator!=(const ManipulatorInfo& rhs) const { return !operator==(rhs); }
97 
98 template <class Archive>
99 void ManipulatorInfo::serialize(Archive& ar, const unsigned int /*version*/)
100 {
101  ar& boost::serialization::make_nvp("manipulator", manipulator);
102  ar& boost::serialization::make_nvp("manipulator_ik_solver", manipulator_ik_solver);
103  ar& boost::serialization::make_nvp("working_frame", working_frame);
104  ar& boost::serialization::make_nvp("tcp_frame", tcp_frame);
105  ar& boost::serialization::make_nvp("tcp_offset", tcp_offset);
106 }
107 
108 } // namespace tesseract_common
109 
112 BOOST_CLASS_EXPORT_IMPLEMENT(tesseract_common::ManipulatorInfo)
113 
115 BOOST_CLASS_EXPORT_IMPLEMENT(tesseract_common::ManipulatorInfoAnyPoly)
tesseract_common
Definition: allowed_collision_matrix.h:19
tesseract_common::ManipulatorInfo
Contains information about a robot manipulator.
Definition: manipulator_info.h:44
TESSERACT_SERIALIZE_ARCHIVES_INSTANTIATE
#define TESSERACT_SERIALIZE_ARCHIVES_INSTANTIATE(Type)
Definition: serialization.h:49
macros.h
Common Tesseract Macros.
tesseract_common::ManipulatorInfo::serialize
void serialize(Archive &ar, const unsigned int version)
Definition: manipulator_info.cpp:99
tesseract_common::ManipulatorInfo::operator==
bool operator==(const ManipulatorInfo &rhs) const
Definition: manipulator_info.cpp:78
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
Definition: macros.h:71
tesseract_common::AnyWrapper
Definition: any_poly.h:80
tesseract_common::ManipulatorInfo::operator!=
bool operator!=(const ManipulatorInfo &rhs) const
Definition: manipulator_info.cpp:96
tesseract_common::ManipulatorInfo::tcp_offset
std::variant< std::string, Eigen::Isometry3d > tcp_offset
(Optional) Offset transform applied to the tcp_frame link to represent the manipulator TCP
Definition: manipulator_info.h:73
manipulator_info.h
utils.h
Common Tesseract Utility Functions.
tesseract_common::ManipulatorInfo::getCombined
ManipulatorInfo getCombined(const ManipulatorInfo &manip_info_override) const
If the provided manipulator information member is not empty it will override this and return a new ma...
Definition: manipulator_info.cpp:50
tesseract_common::ManipulatorInfo::tcp_frame
std::string tcp_frame
The coordinate frame within to the environment to use as the reference frame for the tool center poin...
Definition: manipulator_info.h:70
tesseract_common::ManipulatorInfo::manipulator_ik_solver
std::string manipulator_ik_solver
(Optional) IK Solver to be used
Definition: manipulator_info.h:76
eigen_serialization.h
tesseract_common::ManipulatorInfo::ManipulatorInfo
EIGEN_MAKE_ALIGNED_OPERATOR_NEW ManipulatorInfo()=default
TESSERACT_COMMON_IGNORE_WARNINGS_POP
#define TESSERACT_COMMON_IGNORE_WARNINGS_POP
Definition: macros.h:72
tesseract_common::ManipulatorInfo::manipulator
std::string manipulator
Name of the manipulator group.
Definition: manipulator_info.h:57
serialization.h
Additional Boost serialization wrappers.
tesseract_common::ManipulatorInfo::empty
bool empty() const
Check if any data is current being stored.
Definition: manipulator_info.cpp:72
tesseract_common::ManipulatorInfo::working_frame
std::string working_frame
The working frame to which waypoints are relative.
Definition: manipulator_info.h:64


tesseract_common
Author(s): Levi Armstrong
autogenerated on Sun May 18 2025 03:01:40