change_joint_position_limits_command.cpp
Go to the documentation of this file.
1 
28 #include <boost/serialization/access.hpp>
29 #include <boost/serialization/nvp.hpp>
30 #if (BOOST_VERSION >= 107400) && (BOOST_VERSION < 107500)
31 #include <boost/serialization/library_version_type.hpp>
32 #endif
33 #include <boost/serialization/unordered_map.hpp>
34 #include <string>
36 
37 #include <tesseract_common/utils.h>
39 
40 namespace tesseract_environment
41 {
44 
45 ChangeJointPositionLimitsCommand::ChangeJointPositionLimitsCommand(std::string joint_name, double lower, double upper)
47  , limits_({ std::make_pair(std::move(joint_name), std::make_pair(lower, upper)) })
48 {
49  assert(upper > lower);
50 }
51 
53  std::unordered_map<std::string, std::pair<double, double>> limits)
54  : Command(CommandType::CHANGE_JOINT_POSITION_LIMITS), limits_(std::move(limits))
55 {
56  assert(std::all_of(limits_.begin(), limits_.end(), [](const auto& p) { return p.second.second > p.second.first; }));
57 }
58 
59 const std::unordered_map<std::string, std::pair<double, double>>& ChangeJointPositionLimitsCommand::getLimits() const
60 {
61  return limits_;
62 }
63 
65 {
66  auto fn = [](const std::pair<double, double>& p1, const std::pair<double, double>& p2) {
67  return tesseract_common::almostEqualRelativeAndAbs(p1.first, p2.first) &&
68  tesseract_common::almostEqualRelativeAndAbs(p1.second, p2.second);
69  };
70  bool equal = true;
71  equal &= Command::operator==(rhs);
72  equal &= tesseract_common::isIdenticalMap<std::unordered_map<std::string, std::pair<double, double>>,
73  std::pair<double, double>>(limits_, rhs.limits_, fn);
74  return equal;
75 }
77 {
78  return !operator==(rhs);
79 }
80 
81 template <class Archive>
82 void ChangeJointPositionLimitsCommand::serialize(Archive& ar, const unsigned int /*version*/)
83 {
84  ar& BOOST_SERIALIZATION_BASE_OBJECT_NVP(Command);
85  ar& BOOST_SERIALIZATION_NVP(limits_);
86 }
87 } // namespace tesseract_environment
88 
tesseract_environment::ChangeJointPositionLimitsCommand::operator==
bool operator==(const ChangeJointPositionLimitsCommand &rhs) const
Definition: change_joint_position_limits_command.cpp:64
tesseract_environment::Command::operator==
bool operator==(const Command &rhs) const
Definition: command.cpp:60
tesseract_environment
Definition: command.h:45
tesseract_environment::ChangeJointPositionLimitsCommand::operator!=
bool operator!=(const ChangeJointPositionLimitsCommand &rhs) const
Definition: change_joint_position_limits_command.cpp:76
tesseract_environment::Command
Definition: command.h:83
utils.h
tesseract_environment::ChangeJointPositionLimitsCommand::ChangeJointPositionLimitsCommand
ChangeJointPositionLimitsCommand()
Definition: change_joint_position_limits_command.cpp:42
tesseract_common::almostEqualRelativeAndAbs
bool almostEqualRelativeAndAbs(const Eigen::Ref< const Eigen::VectorXd > &v1, const Eigen::Ref< const Eigen::VectorXd > &v2, const Eigen::Ref< const Eigen::VectorXd > &max_diff, const Eigen::Ref< const Eigen::VectorXd > &max_rel_diff)
TESSERACT_SERIALIZE_ARCHIVES_INSTANTIATE
#define TESSERACT_SERIALIZE_ARCHIVES_INSTANTIATE(Type)
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
tesseract_environment::ChangeJointPositionLimitsCommand::serialize
void serialize(Archive &ar, const unsigned int version)
Definition: change_joint_position_limits_command.cpp:82
tesseract_environment::CommandType::CHANGE_JOINT_POSITION_LIMITS
@ CHANGE_JOINT_POSITION_LIMITS
tesseract_environment::ChangeJointPositionLimitsCommand::limits_
std::unordered_map< std::string, std::pair< double, double > > limits_
Definition: change_joint_position_limits_command.h:74
serialization.h
change_joint_position_limits_command.h
Used to change a joints position limits in environment.
TESSERACT_COMMON_IGNORE_WARNINGS_POP
tesseract_environment::ChangeJointPositionLimitsCommand::getLimits
const std::unordered_map< std::string, std::pair< double, double > > & getLimits() const
Definition: change_joint_position_limits_command.cpp:59
macros.h
tesseract_environment::CommandType
CommandType
Definition: command.h:47
tesseract_environment::ChangeJointPositionLimitsCommand
Definition: change_joint_position_limits_command.h:46


tesseract_environment
Author(s): Levi Armstrong
autogenerated on Sun May 18 2025 03:02:21