moveit2
The MoveIt Motion Planning Framework for ROS 2.
included_xacro_config.hpp
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2022, Metro Robots
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 Metro Robots 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 
37 #pragma once
38 
41 
42 namespace moveit_setup
43 {
48 {
49 public:
50  void onInit() override
51  {
52  // Register the modified config and access it to ensure it is generated
53  config_data_->registerType("modified_urdf", "moveit_setup::ModifiedUrdfConfig");
54  config_data_->get("modified_urdf", "moveit_setup::ModifiedUrdfConfig");
55 
56  urdf_config_ = config_data_->get<URDFConfig>("urdf");
57  }
58 
66  virtual std::string getFilepath() const = 0;
67 
71  virtual bool hasChanges() const = 0;
72 
78  virtual std::vector<std::pair<std::string, std::string>> getArguments() const
79  {
80  return {};
81  };
82 
88  virtual std::vector<std::string> getCommands() const
89  {
90  return {};
91  }
92 
93  using Ptr = std::shared_ptr<IncludedXacroConfig>;
94 
95 protected:
96  std::shared_ptr<URDFConfig> urdf_config_;
97 };
98 
99 } // namespace moveit_setup
A virtual class that represents a xacro header that should be included in the modified urdf configura...
virtual bool hasChanges() const =0
Returns if the xacro and its properties have changed, resulting in the whole urdf needing regeneratio...
virtual std::vector< std::pair< std::string, std::string > > getArguments() const
Returns a list of name/value pairs for arguments that the modified urdf should have.
virtual std::vector< std::string > getCommands() const
Return a list of additional commands that need to be inserted after the xacro is included.
std::shared_ptr< IncludedXacroConfig > Ptr
std::shared_ptr< URDFConfig > urdf_config_
void onInit() override
Overridable initialization method.
virtual std::string getFilepath() const =0
The file path to use in the <xacro:include> tag.
where all the data for each part of the configuration is stored.
Definition: config.hpp:58
std::shared_ptr< DataWarehouse > config_data_
Definition: config.hpp:161