moveit2
The MoveIt Motion Planning Framework for ROS 2.
joint_limits_container.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2018 Pilz GmbH & Co. KG
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Pilz GmbH & Co. KG nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 #pragma once
36 
38 
39 #include <map>
40 #include <vector>
41 #include <string>
42 
44 {
52 {
53 public:
62  bool addLimit(const std::string& joint_name, JointLimit joint_limit);
63 
69  bool hasLimit(const std::string& joint_name) const;
70 
75  size_t getCount() const;
76 
81  bool empty() const;
82 
92  JointLimit getCommonLimit() const;
93 
105  JointLimit getCommonLimit(const std::vector<std::string>& joint_names) const;
106 
113  JointLimit getLimit(const std::string& joint_name) const;
114 
119  std::map<std::string, JointLimit>::const_iterator begin() const;
120 
125  std::map<std::string, JointLimit>::const_iterator end() const;
126 
133  bool verifyVelocityLimit(const std::string& joint_name, const double& joint_velocity) const;
134 
141  bool verifyPositionLimit(const std::string& joint_name, const double& joint_position) const;
142 
143 private:
149  static void updateCommonLimit(const JointLimit& joint_limit, JointLimit& common_limit);
150 
151 protected:
153  std::map<std::string, JointLimit> container_;
154 };
155 } // namespace pilz_industrial_motion_planner
Container for JointLimits, essentially a map with convenience functions. Adds the ability to as for l...
JointLimit getLimit(const std::string &joint_name) const
getLimit get the limit for the given joint name
bool hasLimit(const std::string &joint_name) const
Check if there is a limit for a joint with the given name in this container.
bool verifyVelocityLimit(const std::string &joint_name, const double &joint_velocity) const
verify position limit of single joint
bool verifyPositionLimit(const std::string &joint_name, const double &joint_position) const
verify position limit of single joint
std::map< std::string, JointLimit >::const_iterator end() const
ConstIterator to the underlying data structure.
std::map< std::string, JointLimit > container_
Actual container object containing the data.
bool addLimit(const std::string &joint_name, JointLimit joint_limit)
Add a limit.
std::map< std::string, JointLimit >::const_iterator begin() const
ConstIterator to the underlying data structure.
size_t getCount() const
Get Number of limits in the container.
bool empty() const
Returns whether the container is empty.
JointLimit getCommonLimit() const
Returns joint limit fusion of all(position, velocity, acceleration, deceleration) limits for all join...
Extends joint_limits_interface::JointLimits with a deceleration parameter.