robot_model_test_utils.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2018, Bryce Willey.
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 MoveIt! 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: Bryce Willey */
38 #ifndef MOVEIT_CORE_UTILS_TEST_
39 #define MOVEIT_CORE_UTILS_TEST_
40 
41 #include <urdf_parser/urdf_parser.h>
42 #include <urdf_model/model.h>
43 #include <urdf_model/joint.h>
44 #include <srdfdom/srdf_writer.h>
45 #include <urdf/model.h>
46 #include <fstream>
47 #include <boost/filesystem/path.hpp>
49 #include <geometry_msgs/Pose.h>
50 
51 namespace moveit
52 {
53 namespace core
54 {
61 moveit::core::RobotModelPtr loadTestingRobotModel(const std::string& robot_name);
62 
69 urdf::ModelInterfaceSharedPtr loadModelInterface(const std::string& robot_name);
70 
77 srdf::ModelSharedPtr loadSRDFModel(const std::string& robot_name);
78 
91 {
92 public:
97  RobotModelBuilder(const std::string& name, const std::string& base_link_name);
98 
111  void addChain(const std::string& section, const std::string& type,
112  const std::vector<geometry_msgs::Pose>& joint_origins = {});
113 
120  void addCollisionMesh(const std::string& link_name, const std::string& filename, geometry_msgs::Pose origin);
126  void addCollisionBox(const std::string& link_name, const std::vector<double>& dims, geometry_msgs::Pose origin);
127 
133  void addVisualBox(const std::string& link_name, const std::vector<double>& size, geometry_msgs::Pose origin);
134 
141  void addInertial(const std::string& link_name, double mass, geometry_msgs::Pose origin, double ixx, double ixy,
142  double ixz, double iyy, double iyz, double izz);
143 
156  void addVirtualJoint(const std::string& parent_frame, const std::string& child_link, const std::string& type,
157  const std::string& name = "");
158 
164  void addGroupChain(const std::string& base_link, const std::string& tip_link, const std::string& name = "");
165 
171  void addGroup(const std::vector<std::string>& links, const std::vector<std::string>& joints, const std::string& name);
172 
176  bool isValid();
177 
180  moveit::core::RobotModelPtr build();
181 
182 private:
184  void addLinkCollision(const std::string& link_name, const urdf::CollisionSharedPtr& coll, geometry_msgs::Pose origin);
185 
187  void addLinkVisual(const std::string& link_name, const urdf::VisualSharedPtr& vis, geometry_msgs::Pose origin);
188 
190  urdf::ModelInterfaceSharedPtr urdf_model_;
193 
195  bool is_valid_ = true;
196 };
197 }
198 }
199 
200 #endif
moveit::core::RobotModelPtr build()
Builds and returns the robot model added to the builder.
bool is_valid_
Whether the current builder state is valid. If any &#39;add&#39; method fails, this becomes false...
filename
moveit::core::RobotModelPtr loadTestingRobotModel(const std::string &robot_name)
Loads a robot from moveit_resources.
void addChain(const std::string &section, const std::string &type, const std::vector< geometry_msgs::Pose > &joint_origins={})
Adds a chain of links and joints to the builder. The joint names are generated automatically as "<par...
RobotModelBuilder(const std::string &name, const std::string &base_link_name)
Constructor, takes the names of the robot and the base link.
void addGroup(const std::vector< std::string > &links, const std::vector< std::string > &joints, const std::string &name)
Adds a new group using a list of links and a list of joints.
urdf::ModelInterfaceSharedPtr urdf_model_
The URDF model, holds all of the URDF components of the robot added so far.
void addVirtualJoint(const std::string &parent_frame, const std::string &child_link, const std::string &type, const std::string &name="")
Adds a virtual joint to the SRDF.
srdf::SRDFWriterPtr srdf_writer_
The SRDF model, holds all of the SRDF components of the robot added so far.
bool isValid()
Returns true if the building process so far has been valid.
std::shared_ptr< SRDFWriter > SRDFWriterPtr
std::shared_ptr< Model > ModelSharedPtr
void addLinkCollision(const std::string &link_name, const urdf::CollisionSharedPtr &coll, geometry_msgs::Pose origin)
Adds different collision geometries to a link.
void addVisualBox(const std::string &link_name, const std::vector< double > &size, geometry_msgs::Pose origin)
Adds a visual box to a specific link.
urdf::ModelInterfaceSharedPtr loadModelInterface(const std::string &robot_name)
Loads a URDF Model Interface from moveit_resources.
srdf::ModelSharedPtr loadSRDFModel(const std::string &robot_name)
Loads an SRDF Model from moveit_resources.
Main namespace for MoveIt!
void addCollisionBox(const std::string &link_name, const std::vector< double > &dims, geometry_msgs::Pose origin)
Adds a collision box to a specific link.
void addCollisionMesh(const std::string &link_name, const std::string &filename, geometry_msgs::Pose origin)
Adds a collision mesh to a specific link.
void addInertial(const std::string &link_name, double mass, geometry_msgs::Pose origin, double ixx, double ixy, double ixz, double iyy, double iyz, double izz)
void addGroupChain(const std::string &base_link, const std::string &tip_link, const std::string &name="")
Adds a new group using a chain of links. The group is the parent joint of each link in the chain...
void addLinkVisual(const std::string &link_name, const urdf::VisualSharedPtr &vis, geometry_msgs::Pose origin)
Adds different visual geometries to a link.
Easily build different robot models for testing. Essentially a programmer-friendly light wrapper arou...


moveit_core
Author(s): Ioan Sucan , Sachin Chitta , Acorn Pooley
autogenerated on Fri Oct 11 2019 03:56:04