moveit2
The MoveIt Motion Planning Framework for ROS 2.
Loading...
Searching...
No Matches
default_collisions.hpp
Go to the documentation of this file.
1/*********************************************************************
2 * Software License Agreement (BSD License)
3 *
4 * Copyright (c) 2021, PickNik Robotics
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 PickNik Robotics 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: David V. Lu!! */
36#pragma once
37
40#include <boost/thread/thread.hpp>
41
42// less operation for two CollisionPairs
44{
45 bool operator()(const srdf::Model::CollisionPair& left, const srdf::Model::CollisionPair& right) const
46 {
47 // use std::pair's operator<: (left.link1_, left.link2_) < (right.link1_, right.link2_)
48 return left.link1_ < right.link1_ || (!(right.link1_ < left.link1_) && left.link2_ < right.link2_);
49 }
50};
51
52namespace moveit_setup
53{
54namespace srdf_setup
55{
57{
58public:
59 std::string getName() const override
60 {
61 return "Self-Collisions";
62 }
63
64 std::vector<std::string> getCollidingLinks();
65
69 void linkPairsToSRDF();
70
75 void linkPairsToSRDFSorted(size_t skip_mask = 0);
76
80 void linkPairsFromSRDF();
81
83 {
84 return link_pairs_;
85 }
86
87 // For Threaded Operations
88 void startGenerationThread(unsigned int num_trials, double min_frac, bool verbose = true);
91 int getThreadProgress() const;
92
93protected:
94 void generateCollisionTable(unsigned int num_trials, double min_frac, bool verbose);
95
98
99 // For threaded operations
100 boost::thread worker_;
101 unsigned int progress_;
102};
103} // namespace srdf_setup
104} // namespace moveit_setup
void startGenerationThread(unsigned int num_trials, double min_frac, bool verbose=true)
void linkPairsFromSRDF()
Load Link Pairs from SRDF Format.
LinkPairMap link_pairs_
main storage of link pair data
std::string getName() const override
Returns the name of the setup step.
void generateCollisionTable(unsigned int num_trials, double min_frac, bool verbose)
void linkPairsToSRDFSorted(size_t skip_mask=0)
Output Link Pairs to SRDF Format; sorted; with optional filter.
void linkPairsToSRDF()
Output Link Pairs to SRDF Format.
Setup Step that contains the SRDFConfig.
Definition srdf_step.hpp:49
std::map< std::pair< std::string, std::string >, LinkPairData > LinkPairMap
LinkPairMap is an adjacency list structure containing links in string-based form. Used for disabled l...
bool operator()(const srdf::Model::CollisionPair &left, const srdf::Model::CollisionPair &right) const