joint_limits_validator.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Pilz GmbH & Co. KG
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8 
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13 
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
20 
21 
24 
26 
28 {
30 }
31 
33 {
35 }
36 
38 {
40 }
41 
43 {
45 }
46 
48  (bool (*eq_func)(const pilz_extensions::JointLimit&, const pilz_extensions::JointLimit&),
49  const pilz::JointLimitsContainer& joint_limits)
50 {
51  // If there are no joint_limits it is considered equal
52  if(joint_limits.empty())
53  {
54  return true;
55  }
56 
57  pilz_extensions::JointLimit reference = joint_limits.begin()->second;
58 
59  for(auto it = std::next(joint_limits.begin()); it != joint_limits.end(); ++it)
60  {
61  if(!eq_func(reference, it->second))
62  {
63  return false;
64  }
65  }
66 
67  return true;
68 }
69 
71  const pilz_extensions::JointLimit &rhs)
72 {
73  // Return false if .has_velocity_limits differs
74  if(lhs.has_position_limits != rhs.has_position_limits)
75  {
76  return false;
77  }
78 
79  // If velocity limits are the same make sure they are equal
80  if(lhs.has_position_limits && ((lhs.max_position != rhs.max_position) || (lhs.min_position != rhs.min_position))){
81  return false;
82  }
83  return true;
84 }
85 
87  const pilz_extensions::JointLimit &rhs)
88 {
89  // Return false if .has_velocity_limits differs
90  if(lhs.has_velocity_limits != rhs.has_velocity_limits)
91  {
92  return false;
93  }
94 
95  // If velocity limits are the same make sure they are equal
96  if(lhs.has_velocity_limits && (lhs.max_velocity != rhs.max_velocity)){
97  return false;
98  }
99 
100  return true;
101 }
102 
104  const pilz_extensions::JointLimit &rhs)
105 {
106  // Return false if .has_acceleration_limits differs
107  if(lhs.has_acceleration_limits != rhs.has_acceleration_limits)
108  {
109  return false;
110  }
111 
112  // If velocity limits are the same make sure they are equal
113  if(lhs.has_acceleration_limits && (lhs.max_acceleration != rhs.max_acceleration)){
114  return false;
115  }
116 
117  return true;
118 }
119 
121  const pilz_extensions::JointLimit &rhs)
122 {
123  // Return false if .has_acceleration_limits differs
125  {
126  return false;
127  }
128 
129  // If velocity limits are the same make sure they are equal
131  return false;
132  }
133 
134  return true;
135 }
136 
static bool validateWithEqualFunc(bool(*eq_func)(const pilz_extensions::JointLimit &, const pilz_extensions::JointLimit &), const pilz::JointLimitsContainer &joint_limits)
static bool validateAllAccelerationLimitsEqual(const pilz::JointLimitsContainer &joint_limits)
Validates that the acceleration of all limits is equal.
static bool validateAllVelocityLimitsEqual(const pilz::JointLimitsContainer &joint_limits)
Validates that the velocity of all limits is equal.
static bool validateAllDecelerationLimitsEqual(const pilz::JointLimitsContainer &joint_limits)
Validates that the deceleration of all limits is equal.
std::map< std::string, pilz_extensions::JointLimit >::const_iterator end() const
ConstIterator to the underlying data structure.
static bool velocityEqual(const pilz_extensions::JointLimit &lhs, const pilz_extensions::JointLimit &rhs)
Container for JointLimits, essentially a map with convenience functions. Adds the ability to as for l...
std::map< std::string, pilz_extensions::JointLimit >::const_iterator begin() const
ConstIterator to the underlying data structure.
bool empty() const
Returns wether the container is empty.
static bool validateAllPositionLimitsEqual(const pilz::JointLimitsContainer &joint_limits)
Validates that the position limits of all limits are equal.
static bool positionEqual(const pilz_extensions::JointLimit &lhs, const pilz_extensions::JointLimit &rhs)
static bool accelerationEqual(const pilz_extensions::JointLimit &lhs, const pilz_extensions::JointLimit &rhs)
static bool decelerationEqual(const pilz_extensions::JointLimit &lhs, const pilz_extensions::JointLimit &rhs)


pilz_trajectory_generation
Author(s):
autogenerated on Mon Apr 6 2020 03:17:33