srdf_writer.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2012, Willow Garage, Inc.
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: Dave Coleman */
36 
37 #ifndef _SRDFDOM_SRDF_WRITER_
38 #define _SRDFDOM_SRDF_WRITER_
39 
40 #include <memory>
41 #include <srdfdom/model.h> // use their struct datastructures
42 
43 namespace srdf
44 {
45 // ******************************************************************************************
46 // ******************************************************************************************
47 // Class
48 // ******************************************************************************************
49 // ******************************************************************************************
50 
52 {
53 public:
54  // ******************************************************************************************
55  // Public Functions
56  // ******************************************************************************************
60  SRDFWriter();
61 
65  ~SRDFWriter();
66 
75  bool initString(const urdf::ModelInterface& robot_model, const std::string& srdf_string);
76 
83  void initModel(const urdf::ModelInterface& robot_model, const srdf::Model& srdf_model);
84 
90  void updateSRDFModel(const urdf::ModelInterface& robot_model);
91 
98  bool writeSRDF(const std::string& file_path);
99 
105  std::string getSRDFString();
106 
112  TiXmlDocument generateSRDF();
113 
119  void createGroupsXML(TiXmlElement* root);
120 
126  void createLinkSphereApproximationsXML(TiXmlElement* root);
127 
133  void createDisabledCollisionsXML(TiXmlElement* root);
134 
140  void createGroupStatesXML(TiXmlElement* root);
141 
147  void createEndEffectorsXML(TiXmlElement* root);
148 
154  void createVirtualJointsXML(TiXmlElement* root);
155 
161  void createPassiveJointsXML(TiXmlElement* root);
162 
163  // ******************************************************************************************
164  // Group Datastructures
165  // ******************************************************************************************
166 
167  std::vector<srdf::Model::Group> groups_;
168  std::vector<srdf::Model::GroupState> group_states_;
169  std::vector<srdf::Model::VirtualJoint> virtual_joints_;
170  std::vector<srdf::Model::EndEffector> end_effectors_;
171  std::vector<srdf::Model::LinkSpheres> link_sphere_approximations_;
172  std::vector<srdf::Model::DisabledCollision> disabled_collisions_;
173  std::vector<srdf::Model::PassiveJoint> passive_joints_;
174 
175  // Store the SRDF Model for updating the kinematic_model
177 
178  // Robot name
179  std::string robot_name_;
180 };
181 
182 // ******************************************************************************************
183 // Typedef
184 // ******************************************************************************************
185 typedef std::shared_ptr<SRDFWriter> SRDFWriterPtr;
186 } // namespace srdf
187 
188 #endif
void createEndEffectorsXML(TiXmlElement *root)
void createDisabledCollisionsXML(TiXmlElement *root)
Representation of semantic information about the robot.
Definition: model.h:52
void createGroupStatesXML(TiXmlElement *root)
void updateSRDFModel(const urdf::ModelInterface &robot_model)
void initModel(const urdf::ModelInterface &robot_model, const srdf::Model &srdf_model)
Definition: srdf_writer.cpp:78
std::vector< srdf::Model::VirtualJoint > virtual_joints_
Definition: srdf_writer.h:169
void createPassiveJointsXML(TiXmlElement *root)
std::vector< srdf::Model::DisabledCollision > disabled_collisions_
Definition: srdf_writer.h:172
std::vector< srdf::Model::EndEffector > end_effectors_
Definition: srdf_writer.h:170
std::vector< srdf::Model::LinkSpheres > link_sphere_approximations_
Definition: srdf_writer.h:171
std::string robot_name_
Definition: srdf_writer.h:179
void createVirtualJointsXML(TiXmlElement *root)
srdf::ModelSharedPtr srdf_model_
Definition: srdf_writer.h:176
void createLinkSphereApproximationsXML(TiXmlElement *root)
bool writeSRDF(const std::string &file_path)
Main namespace.
Definition: model.h:49
TiXmlDocument generateSRDF()
void createGroupsXML(TiXmlElement *root)
bool initString(const urdf::ModelInterface &robot_model, const std::string &srdf_string)
Definition: srdf_writer.cpp:61
std::vector< srdf::Model::Group > groups_
Definition: srdf_writer.h:167
std::shared_ptr< SRDFWriter > SRDFWriterPtr
Definition: srdf_writer.h:185
std::shared_ptr< Model > ModelSharedPtr
Definition: model.h:271
std::string getSRDFString()
std::vector< srdf::Model::GroupState > group_states_
Definition: srdf_writer.h:168
std::vector< srdf::Model::PassiveJoint > passive_joints_
Definition: srdf_writer.h:173


srdfdom
Author(s): Ioan Sucan , Guillaume Walck
autogenerated on Mon Feb 28 2022 23:49:16