Public Member Functions | Private Member Functions | Private Attributes | List of all members
moveit::core::RobotModelBuilder Class Reference

Easily build different robot models for testing. Essentially a programmer-friendly light wrapper around URDF and SRDF. Best shown by an example: More...

#include <robot_model_test_utils.h>

Public Member Functions

moveit::core::RobotModelPtr build ()
 Builds and returns the robot model added to the builder. More...
 
bool isValid ()
 Returns true if the building process so far has been valid. More...
 
 RobotModelBuilder (const std::string &name, const std::string &base_link_name)
 Constructor, takes the names of the robot and the base link. More...
 
URDF Functions
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 "<parent>-<child>-joint". More...
 
void addCollisionMesh (const std::string &link_name, const std::string &filename, geometry_msgs::Pose origin)
 Adds a collision mesh to a specific link. More...
 
void addCollisionBox (const std::string &link_name, const std::vector< double > &dims, geometry_msgs::Pose origin)
 Adds a collision box to a specific link. More...
 
void addVisualBox (const std::string &link_name, const std::vector< double > &size, geometry_msgs::Pose origin)
 Adds a visual box to a specific link. More...
 
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)
 
SRDF functions
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. More...
 
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. More...
 
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. More...
 

Private Member Functions

void addLinkCollision (const std::string &link_name, const urdf::CollisionSharedPtr &coll, geometry_msgs::Pose origin)
 Adds different collision geometries to a link. More...
 
void addLinkVisual (const std::string &link_name, const urdf::VisualSharedPtr &vis, geometry_msgs::Pose origin)
 Adds different visual geometries to a link. More...
 

Private Attributes

bool is_valid_ = true
 Whether the current builder state is valid. If any 'add' method fails, this becomes false. More...
 
srdf::SRDFWriterPtr srdf_writer_
 The SRDF model, holds all of the SRDF components of the robot added so far. More...
 
urdf::ModelInterfaceSharedPtr urdf_model_
 The URDF model, holds all of the URDF components of the robot added so far. More...
 

Detailed Description

Easily build different robot models for testing. Essentially a programmer-friendly light wrapper around URDF and SRDF. Best shown by an example:

RobotModelBuilder builder("my_robot", "base_link");
builder.addChain("a->b->c", "continuous");
builder.addGroup({"a", "b"}, {}, "example_group");
ASSERT_TRUE(builder.isValid());
RobotModelPtr model = builder.build();

Definition at line 90 of file robot_model_test_utils.h.

Constructor & Destructor Documentation

◆ RobotModelBuilder()

moveit::core::RobotModelBuilder::RobotModelBuilder ( const std::string &  name,
const std::string &  base_link_name 
)

Constructor, takes the names of the robot and the base link.

Parameters
[in]nameThe name of the robot, i.e. the 'name' attribute of the robot tag in URDF
[in]base_link_nameThe name of the root link of the robot. All other links should be descendants of this

Definition at line 98 of file robot_model_test_utils.cpp.

Member Function Documentation

◆ addChain()

void moveit::core::RobotModelBuilder::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 "<parent>-<child>-joint".

Parameters
[in]sectionA list of link names separated by "->". The first link should already be added to the build by the time this function is called
[in]typeThe type of the joints connecting all of the given links, e.g. "revolute" or "continuous". All of the joints will be given this type. To add multiple types of joints, call this method multiple times
[in]joint_originsThe "parent to joint" origins for the joints connecting the links. If not used, all origins will default to the identity transform

Definition at line 111 of file robot_model_test_utils.cpp.

◆ addCollisionBox()

void moveit::core::RobotModelBuilder::addCollisionBox ( const std::string &  link_name,
const std::vector< double > &  dims,
geometry_msgs::Pose  origin 
)

Adds a collision box to a specific link.

Parameters
[in]link_nameThe name of the link to which the box will be added. Must already be in the builder.
[in]sizeThe dimensions of the box
[in]originThe origin pose of this collision box relative to the link origin

Definition at line 234 of file robot_model_test_utils.cpp.

◆ addCollisionMesh()

void moveit::core::RobotModelBuilder::addCollisionMesh ( const std::string &  link_name,
const std::string &  filename,
geometry_msgs::Pose  origin 
)

Adds a collision mesh to a specific link.

Parameters
[in]link_nameThe name of the link to which the mesh will be added. Must already be in the builder
[in]filenameThe path to the mesh file, e.g. "package://moveit_resources/pr2_description/urdf/meshes/base_v0/base_L.stl"
[in]originThe origin pose of this collision mesh relative to the link origin

Definition at line 250 of file robot_model_test_utils.cpp.

◆ addGroup()

void moveit::core::RobotModelBuilder::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.

Parameters
[in]linksThe links (really their parent joints) to include in the group
[in]jointsThe joints to include in the group
[in]nameThe name of the group, required

Definition at line 335 of file robot_model_test_utils.cpp.

◆ addGroupChain()

void moveit::core::RobotModelBuilder::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.

Parameters
[in]base_linkThe starting link of the chain
[in]tip_linkThe ending link of the chain.
[in]nameThe name of the group, if not given it's set as "<base>-<tip>-chain-group"

Definition at line 323 of file robot_model_test_utils.cpp.

◆ addInertial()

void moveit::core::RobotModelBuilder::addInertial ( const std::string &  link_name,
double  mass,
geometry_msgs::Pose  origin,
double  ixx,
double  ixy,
double  ixz,
double  iyy,
double  iyz,
double  izz 
)

Adds an inertial component to a link.

Parameters
[in]link_nameThe name of the link for this inertial information
[in]massThe mass of the link
[in]originThe origin center pose of the center of mass of this link

Definition at line 197 of file robot_model_test_utils.cpp.

◆ addLinkCollision()

void moveit::core::RobotModelBuilder::addLinkCollision ( const std::string &  link_name,
const urdf::CollisionSharedPtr &  coll,
geometry_msgs::Pose  origin 
)
private

Adds different collision geometries to a link.

Definition at line 260 of file robot_model_test_utils.cpp.

◆ addLinkVisual()

void moveit::core::RobotModelBuilder::addLinkVisual ( const std::string &  link_name,
const urdf::VisualSharedPtr &  vis,
geometry_msgs::Pose  origin 
)
private

Adds different visual geometries to a link.

Definition at line 278 of file robot_model_test_utils.cpp.

◆ addVirtualJoint()

void moveit::core::RobotModelBuilder::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.

Parameters
[in]parent_frameThe parent, e.g. "odom"
[in]child_linkThe child link of this virtual joint, usually the base link
[in]typeThe type of joint, can be "fixed", "floating", or "planar"
[in]nameThe name of the virtual joint, if not given it's automatically made to be "<parent_frame>-<child>-virtual-joint"

Definition at line 309 of file robot_model_test_utils.cpp.

◆ addVisualBox()

void moveit::core::RobotModelBuilder::addVisualBox ( const std::string &  link_name,
const std::vector< double > &  size,
geometry_msgs::Pose  origin 
)

Adds a visual box to a specific link.

Parameters
[in]link_nameThe name of the link to which the box will be added. Must already be in the builder.
[in]sizeThe dimensions of the box
[in]originThe origin pose of this visual box relative to the link origin

Definition at line 224 of file robot_model_test_utils.cpp.

◆ build()

moveit::core::RobotModelPtr moveit::core::RobotModelBuilder::build ( )

Builds and returns the robot model added to the builder.

Definition at line 350 of file robot_model_test_utils.cpp.

◆ isValid()

bool moveit::core::RobotModelBuilder::isValid ( )

Returns true if the building process so far has been valid.

Definition at line 345 of file robot_model_test_utils.cpp.

Member Data Documentation

◆ is_valid_

bool moveit::core::RobotModelBuilder::is_valid_ = true
private

Whether the current builder state is valid. If any 'add' method fails, this becomes false.

Definition at line 195 of file robot_model_test_utils.h.

◆ srdf_writer_

srdf::SRDFWriterPtr moveit::core::RobotModelBuilder::srdf_writer_
private

The SRDF model, holds all of the SRDF components of the robot added so far.

Definition at line 192 of file robot_model_test_utils.h.

◆ urdf_model_

urdf::ModelInterfaceSharedPtr moveit::core::RobotModelBuilder::urdf_model_
private

The URDF model, holds all of the URDF components of the robot added so far.

Definition at line 190 of file robot_model_test_utils.h.


The documentation for this class was generated from the following files:


moveit_core
Author(s): Ioan Sucan , Sachin Chitta , Acorn Pooley
autogenerated on Sat Jul 11 2020 03:51:22