40 #include <boost/math/constants/constants.hpp> 46 #include "order_robot_model_items.inc" 52 const std::string
LOGNAME =
"robot_model";
94 if (urdf_model.getRoot())
96 const urdf::Link* root_link_ptr = urdf_model.getRoot().get();
110 ROS_WARN_NAMED(LOGNAME,
"No geometry is associated to any robot links");
129 typedef std::map<const JointModel*, std::pair<std::set<const LinkModel*, OrderLinksByIndex>,
130 std::set<const JointModel*, OrderJointsByIndex> > >
133 void computeDescendantsHelper(
const JointModel* joint, std::vector<const JointModel*>& parents,
134 std::set<const JointModel*>& seen, DescMap& descendants)
138 if (seen.find(joint) != seen.end())
142 for (std::size_t i = 0; i < parents.size(); ++i)
143 descendants[parents[i]].second.insert(joint);
149 for (std::size_t i = 0; i < parents.size(); ++i)
150 descendants[parents[i]].first.insert(lm);
151 descendants[joint].first.insert(lm);
153 parents.push_back(joint);
155 for (std::size_t i = 0; i < ch.size(); ++i)
156 computeDescendantsHelper(ch[i], parents, seen, descendants);
158 for (std::size_t i = 0; i < mim.size(); ++i)
159 computeDescendantsHelper(mim[i], parents, seen, descendants);
163 void computeCommonRootsHelper(
const JointModel* joint, std::vector<int>& common_roots,
int size)
172 for (std::size_t i = 0; i < ch.size(); ++i)
174 const std::vector<const JointModel*>& a = ch[i]->getDescendantJointModels();
175 for (std::size_t j = i + 1; j < ch.size(); ++j)
177 const std::vector<const JointModel*>& b = ch[j]->getDescendantJointModels();
178 for (std::size_t m = 0; m < b.size(); ++m)
179 common_roots[ch[i]->getJointIndex() * size + b[m]->getJointIndex()] =
180 common_roots[ch[i]->getJointIndex() + b[m]->getJointIndex() * size] = joint->
getJointIndex();
181 for (std::size_t k = 0; k < a.size(); ++k)
183 common_roots[a[k]->getJointIndex() * size + ch[j]->getJointIndex()] =
184 common_roots[a[k]->getJointIndex() + ch[j]->getJointIndex() * size] = joint->
getJointIndex();
185 for (std::size_t m = 0; m < b.size(); ++m)
186 common_roots[a[k]->getJointIndex() * size + b[m]->getJointIndex()] =
187 common_roots[a[k]->getJointIndex() + b[m]->getJointIndex() * size] = joint->
getJointIndex();
190 computeCommonRootsHelper(ch[i], common_roots, size);
219 for (std::size_t j = 0; j < d.size(); ++j)
230 std::vector<const JointModel*> parents;
231 std::set<const JointModel*> seen;
234 computeDescendantsHelper(
root_joint_, parents, seen, descendants);
235 for (DescMap::iterator it = descendants.begin(); it != descendants.end(); ++it)
238 for (std::set<const JointModel*>::const_iterator jt = it->second.second.begin(); jt != it->second.second.end(); ++jt)
240 for (std::set<const LinkModel*>::const_iterator jt = it->second.first.begin(); jt != it->second.first.end(); ++jt)
262 if (!name_order.empty())
264 for (std::size_t j = 0; j < name_order.size(); ++j)
286 std::size_t vc = joint_model_vector_[i]->getVariableCount();
298 if (link_considered[link->getLinkIndex()])
303 for (
auto& tf_base : associated_transforms)
305 link_considered[tf_base.first->getLinkIndex()] =
true;
306 for (
auto& tf_target : associated_transforms)
308 if (&tf_base != &tf_target)
310 ->addAssociatedFixedTransform(tf_target.first, tf_base.second.inverse() * tf_target.second);
322 const std::vector<srdf::Model::GroupState>& ds = srdf_model.
getGroupStates();
323 for (std::size_t i = 0; i < ds.size(); ++i)
329 std::map<std::string, double> state;
330 for (std::map<std::string, std::vector<double> >::const_iterator jt = ds[i].joint_values_.begin();
331 jt != ds[i].joint_values_.end(); ++jt)
338 auto it_found = std::find(remaining_joints.begin(), remaining_joints.end(), jm);
339 if (it_found != remaining_joints.end())
340 remaining_joints.erase(it_found);
341 if (vn.size() == jt->second.size())
342 for (std::size_t j = 0; j < vn.size(); ++j)
343 state[vn[j]] = jt->second[j];
346 "The model for joint '%s' requires %d variable values, " 347 "but only %d variable values were supplied in default state '%s' for group '%s'",
348 jt->first.c_str(), (int)vn.size(), (int)jt->second.size(), ds[i].name_.c_str(),
353 "Group state '%s' specifies value for joint '%s', " 354 "but that joint is not part of group '%s'",
355 ds[i].name_.c_str(), jt->first.c_str(), jmg->
getName().c_str());
357 if (!remaining_joints.empty())
359 std::stringstream missing;
360 missing << (*remaining_joints.begin())->
getName();
361 for (
auto j = ++remaining_joints.begin(); j != remaining_joints.end(); j++)
363 missing <<
", " << (*j)->getName();
365 ROS_WARN_STREAM_NAMED(LOGNAME,
"Group state '" << ds[i].name_ <<
"' doesn't specify all group joints in group '" 366 << ds[i].group_ <<
"'. " << missing.str() <<
" " 367 << (remaining_joints.size() > 1 ?
"are" :
"is") <<
" missing.");
373 ROS_ERROR_NAMED(LOGNAME,
"Group state '%s' specified for group '%s', but that group does not exist",
374 ds[i].name_.c_str(), ds[i].group_.c_str());
387 JointModelMap::const_iterator jit =
joint_model_map_.find(jm->mimic->joint_name);
393 ROS_ERROR_NAMED(LOGNAME,
"Join '%s' cannot mimic joint '%s' because they have different number of DOF",
421 ROS_ERROR_NAMED(LOGNAME,
"Cycle found in joint that mimic each other. Ignoring all mimic joints.");
500 const std::vector<srdf::Model::Group>& group_configs = srdf_model.
getGroups();
503 std::vector<bool> processed(group_configs.size(),
false);
511 for (std::size_t i = 0; i < group_configs.size(); ++i)
515 bool all_subgroups_added =
true;
516 for (std::size_t j = 0; j < group_configs[i].subgroups_.size(); ++j)
519 all_subgroups_added =
false;
522 if (all_subgroups_added)
527 ROS_WARN_NAMED(LOGNAME,
"Failed to add group '%s'", group_configs[i].name_.c_str());
532 for (std::size_t i = 0; i < processed.size(); ++i)
534 ROS_WARN_NAMED(LOGNAME,
"Could not process group '%s' due to unmet subgroup dependencies",
535 group_configs[i].name_.c_str());
556 std::vector<std::string> subgroup_names;
560 if (jt->first != it->first)
564 const std::vector<const JointModel*>& sub_joints = sub_jmg->
getJointModels();
565 for (std::size_t k = 0; k < sub_joints.size(); ++k)
566 if (joints.find(sub_joints[k]) == joints.end())
572 subgroup_names.push_back(sub_jmg->
getName());
574 if (!subgroup_names.empty())
582 const std::vector<srdf::Model::EndEffector>& eefs = srdf_model.
getEndEffectors();
586 for (std::size_t k = 0; k < eefs.size(); ++k)
587 if (eefs[k].component_group_ == it->first)
590 it->second->setEndEffectorName(eefs[k].name_);
596 std::vector<JointModelGroup*> possible_parent_groups;
599 if (jt->first != it->first)
601 if (jt->second->hasLinkModel(eefs[k].parent_link_))
603 jt->second->attachEndEffector(eefs[k].name_);
604 possible_parent_groups.push_back(jt->second);
610 if (!eefs[k].parent_group_.empty())
615 if (jt->second->hasLinkModel(eefs[k].parent_link_))
617 if (jt->second != it->second)
618 eef_parent_group = jt->second;
620 ROS_ERROR_NAMED(LOGNAME,
"Group '%s' for end-effector '%s' cannot be its own parent",
621 eefs[k].parent_group_.c_str(), eefs[k].name_.c_str());
625 "Group '%s' was specified as parent group for end-effector '%s' " 626 "but it does not include the parent link '%s'",
627 eefs[k].parent_group_.c_str(), eefs[k].name_.c_str(), eefs[k].parent_link_.c_str());
630 ROS_ERROR_NAMED(LOGNAME,
"Group name '%s' not found (specified as parent group for end-effector '%s')",
631 eefs[k].parent_group_.c_str(), eefs[k].name_.c_str());
635 if (eef_parent_group ==
nullptr)
636 if (!possible_parent_groups.empty())
640 std::size_t best = 0;
641 for (std::size_t g = 1; g < possible_parent_groups.size(); ++g)
643 possible_parent_groups[best]->getJointModels().size())
645 eef_parent_group = possible_parent_groups[best];
648 if (eef_parent_group)
654 ROS_WARN_NAMED(LOGNAME,
"Could not identify parent group for end-effector '%s'", eefs[k].name_.c_str());
655 it->second->setEndEffectorParent(
"", eefs[k].parent_link_);
666 ROS_WARN_NAMED(LOGNAME,
"A group named '%s' already exists. Not adding.", gc.
name_.c_str());
670 std::set<const JointModel*> jset;
673 for (std::size_t i = 0; i < gc.
chains_.size(); ++i)
677 if (base_link && tip_link)
681 std::vector<const JointModel*> cj;
695 std::size_t
index = 0;
696 std::vector<const JointModel*> cj2;
699 for (std::size_t j = 0; j < cj.size(); ++j)
712 jset.insert(cj.begin(), cj.begin() + index);
713 jset.insert(cj2.begin(), cj2.end());
718 jset.insert(cj.begin(), cj.end());
723 for (std::size_t i = 0; i < gc.
joints_.size(); ++i)
731 for (std::size_t i = 0; i < gc.
links_.size(); ++i)
739 for (std::size_t i = 0; i < gc.
subgroups_.size(); ++i)
746 for (std::size_t j = 0; j < js.size(); ++j)
751 for (std::size_t j = 0; j < fs.size(); ++j)
756 for (std::size_t j = 0; j < ms.size(); ++j)
763 ROS_WARN_NAMED(LOGNAME,
"Group '%s' must have at least one valid joint", gc.
name_.c_str());
767 std::vector<const JointModel*> joints;
768 for (std::set<const JointModel*>::iterator it = jset.begin(); it != jset.end(); ++it)
769 joints.push_back(*it);
783 if (joint ==
nullptr)
815 for (std::size_t i = 0; i < urdf_link->child_links.size(); ++i)
827 static inline VariableBounds jointBoundsFromURDF(
const urdf::Joint* urdf_joint)
830 if (urdf_joint->safety)
835 if (urdf_joint->limits)
845 if (urdf_joint->limits)
852 if (urdf_joint->limits)
870 switch (urdf_joint->type)
872 case urdf::Joint::REVOLUTE:
881 case urdf::Joint::CONTINUOUS:
890 case urdf::Joint::PRISMATIC:
898 case urdf::Joint::FLOATING:
901 case urdf::Joint::PLANAR:
904 case urdf::Joint::FIXED:
908 ROS_ERROR_NAMED(LOGNAME,
"Unknown joint type: %d", (
int)urdf_joint->type);
914 const std::vector<srdf::Model::VirtualJoint>& virtual_joints = srdf_model.
getVirtualJoints();
915 for (std::size_t i = 0; i < virtual_joints.size(); ++i)
917 if (virtual_joints[i].child_link_ != child_link->name)
920 "Skipping virtual joint '%s' because its child frame '%s' " 921 "does not match the URDF frame '%s'",
922 virtual_joints[i].name_.c_str(), virtual_joints[i].child_link_.c_str(),
923 child_link->name.c_str());
925 else if (virtual_joints[i].parent_frame_.empty())
927 ROS_WARN_NAMED(LOGNAME,
"Skipping virtual joint '%s' because its parent frame is empty",
928 virtual_joints[i].name_.c_str());
932 if (virtual_joints[i].type_ ==
"fixed")
934 else if (virtual_joints[i].type_ ==
"planar")
936 else if (virtual_joints[i].type_ ==
"floating")
941 if (virtual_joints[i].type_ !=
"fixed")
951 ROS_INFO_NAMED(LOGNAME,
"No root/virtual joint specified in SRDF. Assuming fixed joint");
959 const std::vector<srdf::Model::PassiveJoint>& pjoints = srdf_model.
getPassiveJoints();
960 for (std::size_t i = 0; i < pjoints.size(); ++i)
962 if (result->
getName() == pjoints[i].name_)
975 static inline Eigen::Isometry3d urdfPose2Isometry3d(
const urdf::Pose& pose)
977 Eigen::Quaterniond q(pose.rotation.w, pose.rotation.x, pose.rotation.y, pose.rotation.z);
978 Eigen::Isometry3d af(Eigen::Translation3d(pose.position.x, pose.position.y, pose.position.z) * q);
987 const std::vector<urdf::CollisionSharedPtr>& col_array =
988 urdf_link->collision_array.empty() ? std::vector<urdf::CollisionSharedPtr>(1, urdf_link->collision) :
989 urdf_link->collision_array;
991 std::vector<shapes::ShapeConstPtr>
shapes;
994 for (std::size_t i = 0; i < col_array.size(); ++i)
995 if (col_array[i] && col_array[i]->geometry)
1001 poses.push_back(urdfPose2Isometry3d(col_array[i]->origin));
1006 const std::vector<urdf::VisualSharedPtr>& vis_array = urdf_link->visual_array.empty() ?
1007 std::vector<urdf::VisualSharedPtr>(1, urdf_link->visual) :
1008 urdf_link->visual_array;
1009 for (std::size_t i = 0; i < vis_array.size(); ++i)
1010 if (vis_array[i] && vis_array[i]->geometry)
1016 poses.push_back(urdfPose2Isometry3d(vis_array[i]->origin));
1024 if (urdf_link->visual && urdf_link->visual->geometry)
1026 if (urdf_link->visual->geometry->type == urdf::Geometry::MESH)
1028 const urdf::Mesh* mesh =
static_cast<const urdf::Mesh*
>(urdf_link->visual->geometry.get());
1029 if (!mesh->filename.empty())
1030 result->
setVisualMesh(mesh->filename, urdfPose2Isometry3d(urdf_link->visual->origin),
1034 else if (urdf_link->collision && urdf_link->collision->geometry)
1036 if (urdf_link->collision->geometry->type == urdf::Geometry::MESH)
1038 const urdf::Mesh* mesh =
static_cast<const urdf::Mesh*
>(urdf_link->collision->geometry.get());
1039 if (!mesh->filename.empty())
1040 result->
setVisualMesh(mesh->filename, urdfPose2Isometry3d(urdf_link->collision->origin),
1045 if (urdf_link->parent_joint)
1046 result->
setJointOriginTransform(urdfPose2Isometry3d(urdf_link->parent_joint->parent_to_joint_origin_transform));
1058 case urdf::Geometry::SPHERE:
1059 result =
new shapes::Sphere(static_cast<const urdf::Sphere*>(geom)->radius);
1061 case urdf::Geometry::BOX:
1063 urdf::Vector3 dim =
static_cast<const urdf::Box*
>(geom)->dim;
1067 case urdf::Geometry::CYLINDER:
1068 result =
new shapes::Cylinder(static_cast<const urdf::Cylinder*>(geom)->radius,
1069 static_cast<const urdf::Cylinder*>(geom)->
length);
1071 case urdf::Geometry::MESH:
1073 const urdf::Mesh* mesh =
static_cast<const urdf::Mesh*
>(geom);
1074 if (!mesh->filename.empty())
1083 ROS_ERROR_NAMED(LOGNAME,
"Unknown geometry type: %d", (
int)geom->type);
1174 int src =
mimic_joints_[i]->getMimic()->getFirstVariableIndex();
1188 std::map<std::string, double>& values)
const 1214 std::vector<std::string>& missing_variables)
const 1216 missing_variables.clear();
1217 std::set<std::string> keys(variables.begin(), variables.end());
1234 double max_distance = 0.0;
1238 return max_distance;
1242 double margin)
const 1247 *active_joint_bounds[i], margin))
1255 bool change =
false;
1258 *active_joint_bounds[i]))
1291 std::map<std::string, SolverAllocatorFn>::const_iterator jt = allocators.find(jmg->getName());
1292 if (jt != allocators.end())
1294 std::pair<SolverAllocatorFn, SolverAllocatorMapFn> result;
1295 result.first = jt->second;
1296 jmg->setSolverAllocators(result);
1304 std::pair<SolverAllocatorFn, SolverAllocatorMapFn> result;
1305 std::map<std::string, SolverAllocatorFn>::const_iterator jt = allocators.find(jmg->getName());
1306 if (jt == allocators.end())
1309 std::set<const JointModel*> joints;
1310 joints.insert(jmg->getJointModels().begin(), jmg->getJointModels().end());
1312 std::vector<const JointModelGroup*> subs;
1315 for (std::map<std::string, SolverAllocatorFn>::const_iterator kt = allocators.begin(); kt != allocators.end();
1324 std::set<const JointModel*> sub_joints;
1327 if (std::includes(joints.begin(), joints.end(), sub_joints.begin(), sub_joints.end()))
1329 std::set<const JointModel*> resultj;
1330 std::set_difference(joints.begin(), joints.end(), sub_joints.begin(), sub_joints.end(),
1331 std::inserter(resultj, resultj.end()));
1337 subs.push_back(sub);
1338 joints.swap(resultj);
1345 std::stringstream ss;
1346 for (std::size_t i = 0; i < subs.size(); ++i)
1348 ss << subs[i]->getName() <<
" ";
1349 result.second[subs[i]] = allocators.find(subs[i]->
getName())->second;
1351 ROS_DEBUG_NAMED(LOGNAME,
"Added sub-group IK allocators for group '%s': [ %s]", jmg->getName().c_str(),
1354 jmg->setSolverAllocators(result);
1364 std::ios_base::fmtflags old_flags = out.flags();
1365 out.setf(std::ios::fixed, std::ios::floatfield);
1366 std::streamsize old_prec = out.precision();
1368 out <<
"Joints: " << std::endl;
1375 out <<
" * " << vn.size() << (vn.size() > 1 ?
" variables:" : (vn.empty() ?
" variables" :
" variable:"))
1378 for (std::vector<std::string>::const_iterator it = vn.begin(); it != vn.end(); ++it)
1380 out <<
" * '" << *it <<
"', index " << idx++ <<
" in full state";
1390 out.precision(old_prec);
1391 out.flags(old_flags);
1392 out <<
"Links: " << std::endl;
1396 <<
" geoms" << std::endl;
1399 <<
"parent joint is fixed" << std::endl;
1402 <<
"joint origin transform is identity" << std::endl;
1405 out <<
"Available groups: " << std::endl;
std::vector< const JointModel * > mimic_joints_
The set of mimic joints this model contains.
void setVisualMesh(const std::string &visual_mesh, const Eigen::Isometry3d &origin, const Eigen::Vector3d &scale)
bool hasJointModelGroup(const std::string &group) const
Check if the JointModelGroup group exists.
void setChildLinkModel(const LinkModel *link)
std::vector< std::string > subgroups_
bool satisfiesPositionBounds(const double *state, double margin=0.0) const
const std::vector< PassiveJoint > & getPassiveJoints() const
void setContinuous(bool flag)
const std::vector< shapes::ShapeConstPtr > & getShapes() const
Get shape associated to the collision geometry for this link.
std::vector< LinkModel * > link_model_vector_
The vector of links that are updated when computeTransforms() is called, in the order they are update...
JointModel * constructJointModel(const urdf::Joint *urdf_joint_model, const urdf::Link *child_link, const srdf::Model &srdf_model)
Given a urdf joint model, a child link and a set of virtual joints, build up the corresponding JointM...
std::vector< const JointModel * > joints_of_variable_
The joints that correspond to each variable index.
std::vector< std::string > link_model_names_vector_
The vector of link names that corresponds to link_model_vector_.
void setEndEffectorParent(const std::string &group, const std::string &link)
If this group is an end-effector, specify the parent group (e.g., the arm holding the eef) and the li...
void computeFixedTransforms(const LinkModel *link, const Eigen::Isometry3d &transform, LinkTransformMap &associated_transforms)
Get the transforms between link and all its rigidly attached descendants.
std::map< const LinkModel *, Eigen::Isometry3d, std::less< const LinkModel * >, Eigen::aligned_allocator< std::pair< const LinkModel *const, Eigen::Isometry3d > > > LinkTransformMap
Map from link model instances to Eigen transforms.
#define ROS_INFO_NAMED(name,...)
const Eigen::Isometry3d & getJointOriginTransform() const
When transforms are computed for this link, they are usually applied to the link's origin...
const JointModel * getJointOfVariable(int variable_index) const
std::vector< const LinkModel * > link_model_vector_const_
The vector of links that are updated when computeTransforms() is called, in the order they are update...
void buildGroupsInfoSubgroups(const srdf::Model &srdf_model)
Compute helpful information about groups (that can be queried later)
Vec3fX< details::Vec3Data< double > > Vector3d
const std::vector< const JointModel * > & getMimicRequests() const
The joint models whose values would be modified if the value of this joint changed.
#define ROS_WARN_NAMED(name,...)
const std::vector< VirtualJoint > & getVirtualJoints() const
JointBoundsVector active_joint_models_bounds_
The bounds for all the active joint models.
static const moveit::core::LinkModel * getRigidlyConnectedParentLinkModel(const LinkModel *link)
Get the latest link upwards the kinematic tree, which is only connected via fixed joints...
void getMissingVariableNames(const std::vector< std::string > &variables, std::vector< std::string > &missing_variables) const
LinkModelMap link_model_map_
A map from link names to their instances.
std::vector< std::pair< std::string, std::string > > chains_
bool hasJointModel(const std::string &joint) const
Check if a joint is part of this group.
int getJointIndex() const
Get the index of this joint within the robot model.
const JointModel * getParentJointModel() const
Get the joint model whose child this link is. There will always be a parent joint.
RobotModel(const urdf::ModelInterfaceSharedPtr &urdf_model, const srdf::ModelConstSharedPtr &srdf_model)
Construct a kinematic model from a parsed description and a list of planning groups.
void buildJointInfo()
Compute helpful information about joints.
void buildGroupsInfoEndEffectors(const srdf::Model &srdf_model)
Compute helpful information about groups (that can be queried later)
void setJointOriginTransform(const Eigen::Isometry3d &transform)
void setJointIndex(int index)
Set the index of this joint within the robot model.
int getVariableIndex(const std::string &variable) const
Get the index of a variable in the robot state.
void addDescendantJointModel(const JointModel *joint)
void setAxis(const Eigen::Vector3d &axis)
Set the axis of translation.
const LinkModel * root_link_
The first physical link for the robot.
JointModelGroupMap end_effectors_map_
The known end effectors.
double distance(const double *state1, const double *state2) const
~RobotModel()
Destructor. Clear all memory.
std::shared_ptr< Shape > ShapePtr
void setFirstCollisionBodyTransformIndex(int index)
Definition of a kinematic model. This class is not thread safe, however multiple instances can be cre...
const JointModel * getJointModel(const std::string &joint) const
Get a joint by its name. Output error and return NULL when the joint is missing.
void buildGroups(const srdf::Model &srdf_model)
Given a SRDF model describing the groups, build up the groups in this kinematic model.
const JointModel * getJointModel(const std::string &joint) const
Get a joint by its name. Throw an exception if the joint is not part of this group.
void setKinematicsAllocators(const std::map< std::string, SolverAllocatorFn > &allocators)
A map of known kinematics solvers (associated to their group name)
void addDefaultState(const std::string &name, const std::map< std::string, double > &default_state)
void addChildJointModel(const JointModel *joint)
const LinkModel * getRootLink() const
Get the physical root link of the robot.
void buildModel(const urdf::ModelInterface &urdf_model, const srdf::Model &srdf_model)
Given an URDF model and a SRDF model, build a full kinematic model.
bool hasLinkModel(const std::string &name) const
Check if a link exists. Return true if it does.
const std::vector< std::string > & getVariableNames() const
Get the names of the variables that make up this joint, in the order they appear in corresponding sta...
std::string model_name_
The name of the robot.
void updateMimicJoints(double *values) const
Update the variable values for the state of a group with respect to the mimic joints.
void getVariableDefaultPositions(double *values) const
Compute the default values for a RobotState.
LinkModel * constructLinkModel(const urdf::Link *urdf_link)
Given a urdf link, build the corresponding LinkModel object.
#define ROS_DEBUG_NAMED(name,...)
shapes::ShapePtr constructShape(const urdf::Geometry *geom)
Given a geometry spec from the URDF and a filename (for a mesh), construct the corresponding shape ob...
VariableIndexMap joint_variables_index_map_
The state includes all the joint variables that make up the joints the state consists of...
TF2SIMD_FORCE_INLINE tf2Scalar length(const Quaternion &q)
void getVariableRandomPositions(random_numbers::RandomNumberGenerator &rng, double *values) const
Compute the random values for a RobotState.
const LinkModel * getParentLinkModel() const
Get the link model whose child this link is (through some joint). There may not always be a parent li...
void computeDescendants()
For every joint, pre-compute the list of descendant joints & links.
void printModelInfo(std::ostream &out) const
Print information about the constructed model.
const JointModel * getRootJoint() const
Get the root joint. There will be one root joint unless the model is empty. This is either extracted ...
std::shared_ptr< const Model > ModelConstSharedPtr
void setSubgroupNames(const std::vector< std::string > &subgroups)
Set the names of the subgroups for this group.
JointModelGroupMap joint_model_group_map_
A map from group names to joint groups.
const JointModelGroup * getEndEffector(const std::string &name) const
Get the joint group that corresponds to a given end-effector name.
bool hasJointModel(const std::string &name) const
Check if a joint exists. Return true if it does.
const std::vector< const JointModel * > & getMimicJointModels() const
Get the mimic joints that are part of this group.
std::vector< const JointModel::Bounds * > JointBoundsVector
const std::vector< const JointModel * > & getFixedJointModels() const
Get the fixed joints that are part of this group.
const std::string & getName() const
Get the name of the joint group.
void setAxis(const Eigen::Vector3d &axis)
Set the axis of rotation.
std::size_t variable_count_
Get the number of variables necessary to describe this model.
This may be thrown if unrecoverable errors occur.
const JointModel * root_joint_
The root joint.
std::vector< const JointModel * > joint_model_vector_const_
The vector of joints in the model, in the order they appear in the state vector.
void setGeometry(const std::vector< shapes::ShapeConstPtr > &shapes, const EigenSTL::vector_Isometry3d &origins)
const LinkModel * getChildLinkModel() const
Get the link that this joint connects to. There will always be such a link.
const std::vector< const JointModel * > & getJointModels() const
Get the array of joints, in the order they appear in the robot state.
srdf::ModelConstSharedPtr srdf_
void addDescendantLinkModel(const LinkModel *link)
const std::string & getName() const
The name of this link.
std::vector< const JointModelGroup * > joint_model_groups_const_
The array of joint model groups, in alphabetical order.
A joint from the robot. Models the transform that this joint applies in the kinematic chain...
const std::vector< const JointModel * > & getActiveJointModels() const
Get the active joints in this group (that have controllable DOF). This does not include mimic joints...
void setLinkIndex(int index)
std::vector< const JointModel * > continuous_joint_model_vector_
The set of continuous joints this model contains.
void setParentLinkModel(const LinkModel *link)
std::vector< const JointModel * > single_dof_joints_
std::vector< std::string > links_
const std::string LOGNAME
const std::vector< Group > & getGroups() const
std::vector< const JointModelGroup * > end_effectors_
The array of end-effectors, in alphabetical order.
const std::vector< const JointModel * > & getChildJointModels() const
A link may have 0 or more child joints. From those joints there will certainly be other descendant li...
void computeCommonRoots()
For every pair of joints, pre-compute the common roots of the joints.
std::vector< JointModel * > active_joint_model_vector_
The vector of joints in the model, in the order they appear in the state vector.
std::size_t link_geometry_count_
Total number of geometric shapes in this model.
JointModelMap joint_model_map_
A map from joint names to their instances.
Mesh * createMeshFromResource(const std::string &resource)
const JointModelGroup * getJointModelGroup(const std::string &name) const
Get a joint group from this model (by name)
std::vector< std::string > joint_model_names_vector_
The vector of joint names that corresponds to joint_model_vector_.
urdf::ModelInterfaceSharedPtr urdf_
const std::vector< GroupState > & getGroupStates() const
std::string model_frame_
The reference (base) frame for this model. The frame is either extracted from the SRDF as a virtual j...
std::vector< std::string > joints_
#define ROS_ERROR_NAMED(name,...)
void interpolate(const double *from, const double *to, double t, double *state) const
std::vector< JointModel * > joint_model_vector_
The vector of joints in the model, in the order they appear in the state vector.
std::vector< std::string > variable_names_
The names of the DOF that make up this state (this is just a sequence of joint variable names; not ne...
const std::vector< EndEffector > & getEndEffectors() const
bool addJointModelGroup(const srdf::Model::Group &group)
Construct a JointModelGroup given a SRDF description group.
A link from the robot. Contains the constant transform applied to the link and its geometry...
std::vector< int > active_joint_model_start_index_
std::vector< Eigen::Isometry3d, Eigen::aligned_allocator< Eigen::Isometry3d > > vector_Isometry3d
std::vector< const JointModel * > multi_dof_joints_
std::size_t getVariableCount() const
Get the number of variables that describe this model.
void buildMimic(const urdf::ModelInterface &urdf_model)
Given the URDF model, build up the mimic joints (mutually constrained joints)
bool enforcePositionBounds(double *state) const
bool hasEndEffector(const std::string &eef) const
Check if an end effector exists.
const LinkModel * getLinkModel(const std::string &link) const
Get a link by its name. Output error and return NULL when the link is missing.
void setParentJointModel(const JointModel *joint)
std::vector< JointModelGroup * > joint_model_groups_
The array of joint model groups, in alphabetical order.
Main namespace for MoveIt!
std::vector< std::string > joint_model_group_names_
A vector of all group names, in alphabetical order.
const std::vector< const JointModel * > & getJointModels() const
Get all the joints in this group (including fixed and mimic joints).
void setParentLinkModel(const LinkModel *link)
std::vector< const JointModel * > active_joint_model_vector_const_
The vector of joints in the model, in the order they appear in the state vector.
void buildGroupStates(const srdf::Model &srdf_model)
Given a SRDF model describing the groups, build the default states defined in the SRDF...
std::vector< const LinkModel * > link_models_with_collision_geometry_vector_
Only links that have collision geometry specified.
std::vector< int > common_joint_roots_
For every two joints, the index of the common root for thw joints is stored.
JointModel * buildRecursive(LinkModel *parent, const urdf::Link *link, const srdf::Model &srdf_model)
(This function is mostly intended for internal use). Given a parent link, build up (recursively)...
void setVariableBounds(const std::string &variable, const VariableBounds &bounds)
Set the lower and upper bounds for a variable. Throw an exception if the variable was not found...
const LinkModel * getParentLinkModel() const
Get the link that this joint connects to. The robot is assumed to start with a joint, so the root joint will return a NULL pointer here.
JointType getType() const
Get the type of joint.
const VariableBounds & getVariableBounds(const std::string &variable) const
Get the bounds for a specific variable. Throw an exception of variable is not found.
void setPassive(bool flag)
virtual unsigned int getStateSpaceDimension() const =0
Get the dimension of the state space that corresponds to this joint.
void setDistanceFactor(double factor)
Set the factor that should be applied to the value returned by distance() when that value is used in ...
std::vector< std::string > link_model_names_with_collision_geometry_vector_
The vector of link names that corresponds to link_models_with_collision_geometry_vector_.
const JointModel * getMimic() const
Get the joint this one is mimicking.
double getMaximumExtent() const
#define ROS_WARN_STREAM_NAMED(name, args)
const std::string & getName() const
Get the model name.
std::shared_ptr< const Shape > ShapeConstPtr
const std::string & getName() const
Get the name of the joint.