kinematic_options_map.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2014, SRI International
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 Willow Garage 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 /* Author: Acorn Pooley */
36 
37 #pragma once
38 
40 #include <boost/thread.hpp>
41 #include <boost/function.hpp>
42 
43 namespace robot_interaction
44 {
45 // Maintains a set of KinematicOptions with a key/value mapping and a default
46 // value.
47 class KinematicOptionsMap
48 {
49 public:
52 
54  static const std::string DEFAULT;
55 
57  static const std::string ALL;
58 
66  bool setStateFromIK(moveit::core::RobotState& state, const std::string& key, const std::string& group,
67  const std::string& tip, const geometry_msgs::Pose& pose) const;
68 
71  KinematicOptions getOptions(const std::string& key) const;
72 
82  void setOptions(const std::string& key, const KinematicOptions& options,
84 
88  void merge(const KinematicOptionsMap& other);
89 
90 private:
91  // this protects all members.
92  mutable boost::mutex lock_;
93 
94  // default kinematic options.
95  // PROTECTED BY lock_
96  KinematicOptions defaults_;
97 
98  typedef std::map<std::string, KinematicOptions> M_options;
99 
100  // per key kinematic options.
101  // If key is not here, defaults are used.
102  // PROTECTED BY lock_
104 };
105 } // namespace robot_interaction
robot_interaction::KinematicOptionsMap::options_
M_options options_
Definition: kinematic_options_map.h:167
robot_interaction::KinematicOptions::OptionBitmask
OptionBitmask
Definition: kinematic_options.h:120
robot_interaction::KinematicOptionsMap::defaults_
KinematicOptions defaults_
Definition: kinematic_options_map.h:160
robot_interaction::KinematicOptions::ALL
@ ALL
Definition: kinematic_options.h:128
robot_interaction::KinematicOptionsMap::setOptions
void setOptions(const std::string &key, const KinematicOptions &options, KinematicOptions::OptionBitmask fields=KinematicOptions::ALL)
Definition: kinematic_options_map.cpp:62
robot_interaction::KinematicOptionsMap::merge
void merge(const KinematicOptionsMap &other)
Definition: kinematic_options_map.cpp:109
moveit::core::RobotState
robot_interaction::KinematicOptionsMap::setStateFromIK
bool setStateFromIK(moveit::core::RobotState &state, const std::string &key, const std::string &group, const std::string &tip, const geometry_msgs::Pose &pose) const
Definition: kinematic_options_map.cpp:132
robot_interaction::KinematicOptionsMap::M_options
std::map< std::string, KinematicOptions > M_options
Definition: kinematic_options_map.h:162
robot_interaction::KinematicOptionsMap::ALL
static const std::string ALL
When used as key this means set ALL keys (including default)
Definition: kinematic_options_map.h:121
robot_interaction
Definition: interaction.h:54
kinematic_options.h
robot_interaction::KinematicOptionsMap::lock_
boost::mutex lock_
Definition: kinematic_options_map.h:156
robot_interaction::KinematicOptionsMap::getOptions
KinematicOptions getOptions(const std::string &key) const
Definition: kinematic_options_map.cpp:49
robot_interaction::KinematicOptionsMap::KinematicOptionsMap
KinematicOptionsMap()
Constructor - set all options to reasonable default values.
Definition: kinematic_options_map.cpp:43
robot_interaction::KinematicOptionsMap::DEFAULT
static const std::string DEFAULT
When used as key this means the default value.
Definition: kinematic_options_map.h:118


robot_interaction
Author(s): Ioan Sucan
autogenerated on Sat Mar 15 2025 02:26:54