Tesseract
Motion Planning Environment
|
#include <graph.h>
Classes | |
struct | adjacency_detector |
struct | children_detector |
struct | cycle_detector |
struct | tree_detector |
Public Types | |
using | Vertex = SceneGraph::vertex_descriptor |
using | Edge = SceneGraph::edge_descriptor |
using | Ptr = std::shared_ptr< SceneGraph > |
using | ConstPtr = std::shared_ptr< const SceneGraph > |
using | UPtr = std::unique_ptr< SceneGraph > |
using | ConstUPtr = std::unique_ptr< const SceneGraph > |
Public Member Functions | |
SceneGraph (const std::string &name="") | |
~SceneGraph ()=default | |
SceneGraph (const SceneGraph &other)=delete | |
SceneGraph & | operator= (const SceneGraph &other)=delete |
SceneGraph (SceneGraph &&other) noexcept | |
SceneGraph & | operator= (SceneGraph &&other) noexcept |
SceneGraph::UPtr | clone () const |
Clone the scene graph. More... | |
void | clear () |
Clear the scene graph. More... | |
void | setName (const std::string &name) |
Sets the graph name. More... | |
const std::string & | getName () const |
Sets the graph name. More... | |
bool | setRoot (const std::string &name) |
Sets the root link name (aka. World Coordinate Frame) More... | |
const std::string & | getRoot () const |
Gets the root link name (aka. World Coordinate Frame) More... | |
bool | addLink (const Link &link, bool replace_allowed=false) |
Adds a link to the graph. More... | |
bool | addLink (const Link &link, const Joint &joint) |
Adds a link/joint to the graph. More... | |
Link::ConstPtr | getLink (const std::string &name) const |
Get a link in the graph. More... | |
std::vector< Link::ConstPtr > | getLinks () const |
Get a vector links in the scene graph. More... | |
std::vector< Link::ConstPtr > | getLeafLinks () const |
Get a vector leaf links in the scene graph. More... | |
bool | removeLink (const std::string &name, bool recursive=false) |
Removes a link from the graph. More... | |
bool | moveLink (const Joint &joint) |
Move link defined by provided joint This deletes all inbound joints on the parent link defined by the joint. More... | |
void | setLinkVisibility (const std::string &name, bool visibility) |
Set a links visibility. More... | |
bool | getLinkVisibility (const std::string &name) const |
Get a given links visibility setting. More... | |
void | setLinkCollisionEnabled (const std::string &name, bool enabled) |
Set whether a link should be considered during collision checking. More... | |
bool | getLinkCollisionEnabled (const std::string &name) const |
Get whether a link should be considered during collision checking. More... | |
bool | addJoint (const Joint &joint) |
Adds joint to the graph. More... | |
Joint::ConstPtr | getJoint (const std::string &name) const |
Get a joint in the graph. More... | |
bool | removeJoint (const std::string &name, bool recursive=false) |
Removes a joint from the graph. More... | |
bool | moveJoint (const std::string &name, const std::string &parent_link) |
Move joint to new parent link. More... | |
std::vector< Joint::ConstPtr > | getJoints () const |
Get a vector of joints in the scene graph. More... | |
std::vector< Joint::ConstPtr > | getActiveJoints () const |
Get a vector of active joints in the scene graph. More... | |
bool | changeJointOrigin (const std::string &name, const Eigen::Isometry3d &new_origin) |
Changes the "origin" transform of the joint and recomputes the associated edge. More... | |
bool | changeJointLimits (const std::string &name, const JointLimits &limits) |
Changes the limits of a joint. The JointLimits::Ptr remains the same, but the values passed in are assigned. More... | |
bool | changeJointPositionLimits (const std::string &name, double lower, double upper) |
Changes the position limits associated with a joint. More... | |
bool | changeJointVelocityLimits (const std::string &name, double limit) |
Changes the velocity limits associated with a joint. More... | |
bool | changeJointAccelerationLimits (const std::string &name, double limit) |
Changes the acceleration limits associated with a joint. More... | |
JointLimits::ConstPtr | getJointLimits (const std::string &name) |
Gets the limits of the joint specified by name. More... | |
void | addAllowedCollision (const std::string &link_name1, const std::string &link_name2, const std::string &reason) |
Disable collision between two collision objects. More... | |
void | removeAllowedCollision (const std::string &link_name1, const std::string &link_name2) |
Remove disabled collision pair from allowed collision matrix. More... | |
void | removeAllowedCollision (const std::string &link_name) |
Remove disabled collision for any pair with link_name from allowed collision matrix. More... | |
void | clearAllowedCollisions () |
Remove all allowed collisions. More... | |
bool | isCollisionAllowed (const std::string &link_name1, const std::string &link_name2) const |
Check if two links are allowed to be in collision. More... | |
tesseract_common::AllowedCollisionMatrix::ConstPtr | getAllowedCollisionMatrix () const |
Get the allowed collision matrix. More... | |
tesseract_common::AllowedCollisionMatrix::Ptr | getAllowedCollisionMatrix () |
Get the allowed collision matrix. More... | |
Link::ConstPtr | getSourceLink (const std::string &joint_name) const |
Get the source link (parent link) for a joint. More... | |
Link::ConstPtr | getTargetLink (const std::string &joint_name) const |
Get the target link (child link) for a joint. More... | |
std::vector< Joint::ConstPtr > | getInboundJoints (const std::string &link_name) const |
Get inbound joints for a link. More... | |
std::vector< Joint::ConstPtr > | getOutboundJoints (const std::string &link_name) const |
Get outbound joints for a link. More... | |
bool | isAcyclic () const |
Determine if the graph contains cycles. More... | |
bool | isTree () const |
Determine if the graph is a tree. More... | |
bool | isEmpty () const |
Check if the graph is empty. More... | |
std::vector< std::string > | getAdjacentLinkNames (const std::string &name) const |
Get a vector of adjacent link names provided a link name. More... | |
std::vector< std::string > | getInvAdjacentLinkNames (const std::string &name) const |
Geta a vectpr pf inverse adjacent link names provided a link name. More... | |
std::vector< std::string > | getLinkChildrenNames (const std::string &name) const |
Get all children for a given link name. More... | |
std::vector< std::string > | getJointChildrenNames (const std::string &name) const |
Get all children link names for a given joint name. More... | |
std::unordered_map< std::string, std::string > | getAdjacencyMap (const std::vector< std::string > &link_names) const |
Create mapping between links in the scene to the provided links if they are directly affected if the link moves. More... | |
std::vector< std::string > | getJointChildrenNames (const std::vector< std::string > &names) const |
Get all children link names for the given joint names. More... | |
void | saveDOT (const std::string &path) const |
Saves Graph as Graph Description Language (DOT) More... | |
ShortestPath | getShortestPath (const std::string &root, const std::string &tip) const |
Get the shortest path between two links. More... | |
Vertex | getVertex (const std::string &name) const |
Get the graph vertex by name. More... | |
Edge | getEdge (const std::string &name) const |
Get the graph edge by name. More... | |
bool | insertSceneGraph (const tesseract_scene_graph::SceneGraph &scene_graph, const std::string &prefix="") |
Merge a graph into the current graph. More... | |
bool | insertSceneGraph (const tesseract_scene_graph::SceneGraph &scene_graph, const tesseract_scene_graph::Joint &joint, const std::string &prefix="") |
Merge a graph into the current environment. More... | |
bool | operator== (const SceneGraph &rhs) const |
bool | operator!= (const SceneGraph &rhs) const |
Protected Member Functions | |
bool | addLinkHelper (const Link::Ptr &link_ptr, bool replace_allowed=false) |
Adds a link to the graph. More... | |
bool | addJointHelper (const Joint::Ptr &joint_ptr) |
Adds joint to the graph. More... | |
Private Member Functions | |
void | rebuildLinkAndJointMaps () |
The rebuild the link and joint map by extraction information from the graph. More... | |
std::vector< std::string > | getLinkChildrenHelper (Vertex start_vertex) const |
Get the children of a vertex starting with start_vertex. More... | |
template<class Archive > | |
void | save (Archive &ar, const unsigned int version) const |
template<class Archive > | |
void | load (Archive &ar, const unsigned int version) |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Private Attributes | |
std::unordered_map< std::string, std::pair< Link::Ptr, Vertex > > | link_map_ |
std::unordered_map< std::string, std::pair< Joint::Ptr, Edge > > | joint_map_ |
tesseract_common::AllowedCollisionMatrix::Ptr | acm_ |
Friends | |
class | boost::serialization::access |
using tesseract_scene_graph::SceneGraph::ConstPtr = std::shared_ptr<const SceneGraph> |
using tesseract_scene_graph::SceneGraph::ConstUPtr = std::unique_ptr<const SceneGraph> |
using tesseract_scene_graph::SceneGraph::Edge = SceneGraph::edge_descriptor |
using tesseract_scene_graph::SceneGraph::Ptr = std::shared_ptr<SceneGraph> |
using tesseract_scene_graph::SceneGraph::UPtr = std::unique_ptr<SceneGraph> |
using tesseract_scene_graph::SceneGraph::Vertex = SceneGraph::vertex_descriptor |
tesseract_scene_graph::SceneGraph::SceneGraph | ( | const std::string & | name = "" | ) |
|
default |
|
delete |
|
noexcept |
void tesseract_scene_graph::SceneGraph::addAllowedCollision | ( | const std::string & | link_name1, |
const std::string & | link_name2, | ||
const std::string & | reason | ||
) |
bool tesseract_scene_graph::SceneGraph::addJoint | ( | const Joint & | joint | ) |
Adds joint to the graph.
joint | The joint to be added |
|
protected |
Adds joint to the graph.
joint_ptr | Shared pointer to the joint to be added |
bool tesseract_scene_graph::SceneGraph::addLink | ( | const Link & | link, |
bool | replace_allowed = false |
||
) |
Adds a link to the graph.
The first link added to the graph is set as the root by default. Use setRoot to change the root link of the graph.
link | The link to be added to the graph |
replace_allowed | If true and the link exist it will be replaced |
Adds a link/joint to the graph.
The first link added to the graph is set as the root by default. Use setRoot to change the root link of the graph.
link | The link to be added to the graph |
joint | The associated joint to be added to the graph |
|
protected |
Adds a link to the graph.
The first link added to the graph is set as the root by default. Use setRoot to change the root link of the graph.
link_ptr | Shared pointer to the link to be added to the graph |
replace_allowed | If true and the link exist it will be replaced |
bool tesseract_scene_graph::SceneGraph::changeJointAccelerationLimits | ( | const std::string & | name, |
double | limit | ||
) |
Changes the acceleration limits associated with a joint.
joint_name | Name of the joint to be updated |
limits | New acceleration limits to be set as the joint limits |
bool tesseract_scene_graph::SceneGraph::changeJointLimits | ( | const std::string & | name, |
const JointLimits & | limits | ||
) |
Changes the limits of a joint. The JointLimits::Ptr remains the same, but the values passed in are assigned.
name | Name of the joint to be changed |
limits | The new limits associated with the joint |
bool tesseract_scene_graph::SceneGraph::changeJointOrigin | ( | const std::string & | name, |
const Eigen::Isometry3d & | new_origin | ||
) |
Changes the "origin" transform of the joint and recomputes the associated edge.
name | Name of the joint to be changed |
new_origin | The new transform associated with the joint |
bool tesseract_scene_graph::SceneGraph::changeJointPositionLimits | ( | const std::string & | name, |
double | lower, | ||
double | upper | ||
) |
Changes the position limits associated with a joint.
joint_name | Name of the joint to be updated |
limits | New position limits to be set as the joint limits @returnTrue if successful. |
bool tesseract_scene_graph::SceneGraph::changeJointVelocityLimits | ( | const std::string & | name, |
double | limit | ||
) |
Changes the velocity limits associated with a joint.
joint_name | Name of the joint to be updated |
limits | New velocity limits to be set as the joint limits |
void tesseract_scene_graph::SceneGraph::clear | ( | ) |
Clear the scene graph.
void tesseract_scene_graph::SceneGraph::clearAllowedCollisions | ( | ) |
Remove all allowed collisions.
SceneGraph::UPtr tesseract_scene_graph::SceneGraph::clone | ( | ) | const |
Clone the scene graph.
std::vector< Joint::ConstPtr > tesseract_scene_graph::SceneGraph::getActiveJoints | ( | ) | const |
Get a vector of active joints in the scene graph.
std::unordered_map< std::string, std::string > tesseract_scene_graph::SceneGraph::getAdjacencyMap | ( | const std::vector< std::string > & | link_names | ) | const |
Create mapping between links in the scene to the provided links if they are directly affected if the link moves.
link_names | The links to map other links to |
std::vector< std::string > tesseract_scene_graph::SceneGraph::getAdjacentLinkNames | ( | const std::string & | name | ) | const |
Get a vector of adjacent link names provided a link name.
name | Name of link |
tesseract_common::AllowedCollisionMatrix::Ptr tesseract_scene_graph::SceneGraph::getAllowedCollisionMatrix | ( | ) |
Get the allowed collision matrix.
tesseract_common::AllowedCollisionMatrix::ConstPtr tesseract_scene_graph::SceneGraph::getAllowedCollisionMatrix | ( | ) | const |
Get the allowed collision matrix.
SceneGraph::Edge tesseract_scene_graph::SceneGraph::getEdge | ( | const std::string & | name | ) | const |
Get the graph edge by name.
name | The edge/joint name |
std::vector< Joint::ConstPtr > tesseract_scene_graph::SceneGraph::getInboundJoints | ( | const std::string & | link_name | ) | const |
Get inbound joints for a link.
The inbound joints are all joints that have the link identified as the child link
link_name | The name of the link |
std::vector< std::string > tesseract_scene_graph::SceneGraph::getInvAdjacentLinkNames | ( | const std::string & | name | ) | const |
Geta a vectpr pf inverse adjacent link names provided a link name.
name |
Joint::ConstPtr tesseract_scene_graph::SceneGraph::getJoint | ( | const std::string & | name | ) | const |
Get a joint in the graph.
name | The name of the joint |
std::vector< std::string > tesseract_scene_graph::SceneGraph::getJointChildrenNames | ( | const std::string & | name | ) | const |
Get all children link names for a given joint name.
name | Name of joint |
std::vector< std::string > tesseract_scene_graph::SceneGraph::getJointChildrenNames | ( | const std::vector< std::string > & | names | ) | const |
Get all children link names for the given joint names.
names | Name of joints |
JointLimits::ConstPtr tesseract_scene_graph::SceneGraph::getJointLimits | ( | const std::string & | name | ) |
Gets the limits of the joint specified by name.
name | Name of the joint which limits will be retrieved |
std::vector< Joint::ConstPtr > tesseract_scene_graph::SceneGraph::getJoints | ( | ) | const |
Get a vector of joints in the scene graph.
std::vector< Link::ConstPtr > tesseract_scene_graph::SceneGraph::getLeafLinks | ( | ) | const |
Get a vector leaf links in the scene graph.
Link::ConstPtr tesseract_scene_graph::SceneGraph::getLink | ( | const std::string & | name | ) | const |
Get a link in the graph.
name | The name of the link |
|
inlineprivate |
Get the children of a vertex starting with start_vertex.
Note: This list will include the start vertex
start_vertex | The vertex to find childeren for. |
std::vector< std::string > tesseract_scene_graph::SceneGraph::getLinkChildrenNames | ( | const std::string & | name | ) | const |
Get all children for a given link name.
name | Name of Link |
bool tesseract_scene_graph::SceneGraph::getLinkCollisionEnabled | ( | const std::string & | name | ) | const |
Get whether a link should be considered during collision checking.
std::vector< Link::ConstPtr > tesseract_scene_graph::SceneGraph::getLinks | ( | ) | const |
Get a vector links in the scene graph.
bool tesseract_scene_graph::SceneGraph::getLinkVisibility | ( | const std::string & | name | ) | const |
Get a given links visibility setting.
const std::string & tesseract_scene_graph::SceneGraph::getName | ( | ) | const |
Sets the graph name.
name | The name of the graph |
std::vector< Joint::ConstPtr > tesseract_scene_graph::SceneGraph::getOutboundJoints | ( | const std::string & | link_name | ) | const |
Get outbound joints for a link.
The outbound joints are all joins that have the link identified as the parent link
link_name | The name of the link |
const std::string & tesseract_scene_graph::SceneGraph::getRoot | ( | ) | const |
Gets the root link name (aka. World Coordinate Frame)
ShortestPath tesseract_scene_graph::SceneGraph::getShortestPath | ( | const std::string & | root, |
const std::string & | tip | ||
) | const |
Get the shortest path between two links.
root | The base link |
tip | The tip link |
Link::ConstPtr tesseract_scene_graph::SceneGraph::getSourceLink | ( | const std::string & | joint_name | ) | const |
Get the source link (parent link) for a joint.
joint_name | The name of the joint |
Link::ConstPtr tesseract_scene_graph::SceneGraph::getTargetLink | ( | const std::string & | joint_name | ) | const |
Get the target link (child link) for a joint.
joint_name | The name of the joint |
SceneGraph::Vertex tesseract_scene_graph::SceneGraph::getVertex | ( | const std::string & | name | ) | const |
Get the graph vertex by name.
name | The vertex/link name |
bool tesseract_scene_graph::SceneGraph::insertSceneGraph | ( | const tesseract_scene_graph::SceneGraph & | scene_graph, |
const std::string & | prefix = "" |
||
) |
Merge a graph into the current graph.
scene_graph | Const ref to the graph to be merged (said graph will be copied) |
prefix | string Will prepend to every link and joint of the merged graph |
bool tesseract_scene_graph::SceneGraph::insertSceneGraph | ( | const tesseract_scene_graph::SceneGraph & | scene_graph, |
const tesseract_scene_graph::Joint & | joint, | ||
const std::string & | prefix = "" |
||
) |
Merge a graph into the current environment.
scene_graph | Const ref to the graph to be merged (said graph will be copied) |
joint | The joint that connects current environment with the inserted graph |
prefix | string Will prepend to every link and joint of the merged graph |
bool tesseract_scene_graph::SceneGraph::isAcyclic | ( | ) | const |
Determine if the graph contains cycles.
bool tesseract_scene_graph::SceneGraph::isCollisionAllowed | ( | const std::string & | link_name1, |
const std::string & | link_name2 | ||
) | const |
Check if two links are allowed to be in collision.
link_name1 | link name |
link_name2 | link name |
bool tesseract_scene_graph::SceneGraph::isEmpty | ( | ) | const |
Check if the graph is empty.
bool tesseract_scene_graph::SceneGraph::isTree | ( | ) | const |
Determine if the graph is a tree.
|
private |
bool tesseract_scene_graph::SceneGraph::moveJoint | ( | const std::string & | name, |
const std::string & | parent_link | ||
) |
Move joint to new parent link.
name | Name of the joint to move |
parent_link | Name of parent link to move to |
bool tesseract_scene_graph::SceneGraph::moveLink | ( | const Joint & | joint | ) |
Move link defined by provided joint This deletes all inbound joints on the parent link defined by the joint.
joint | The joint defining the link move |
bool tesseract_scene_graph::SceneGraph::operator!= | ( | const SceneGraph & | rhs | ) | const |
|
delete |
|
noexcept |
bool tesseract_scene_graph::SceneGraph::operator== | ( | const SceneGraph & | rhs | ) | const |
|
private |
The rebuild the link and joint map by extraction information from the graph.
void tesseract_scene_graph::SceneGraph::removeAllowedCollision | ( | const std::string & | link_name | ) |
Remove disabled collision for any pair with link_name from allowed collision matrix.
link_name | Collision object name |
void tesseract_scene_graph::SceneGraph::removeAllowedCollision | ( | const std::string & | link_name1, |
const std::string & | link_name2 | ||
) |
bool tesseract_scene_graph::SceneGraph::removeJoint | ( | const std::string & | name, |
bool | recursive = false |
||
) |
Removes a joint from the graph.
name | Name of the joint to be removed |
recursive | If true all children are removed if this this is the only joint of the child link |
bool tesseract_scene_graph::SceneGraph::removeLink | ( | const std::string & | name, |
bool | recursive = false |
||
) |
Removes a link from the graph.
Note: this will remove all inbound and outbound edges
name | Name of the link to be removed |
recursive | If true all children are removed if it only has a single joint |
|
private |
void tesseract_scene_graph::SceneGraph::saveDOT | ( | const std::string & | path | ) | const |
Saves Graph as Graph Description Language (DOT)
path | The file path |
|
private |
void tesseract_scene_graph::SceneGraph::setLinkCollisionEnabled | ( | const std::string & | name, |
bool | enabled | ||
) |
Set whether a link should be considered during collision checking.
enabled | True if should be considered during collision checking, otherwise false |
void tesseract_scene_graph::SceneGraph::setLinkVisibility | ( | const std::string & | name, |
bool | visibility | ||
) |
Set a links visibility.
visibility | True if should be visible, otherwise false |
void tesseract_scene_graph::SceneGraph::setName | ( | const std::string & | name | ) |
Sets the graph name.
name | The name of the graph |
bool tesseract_scene_graph::SceneGraph::setRoot | ( | const std::string & | name | ) |
Sets the root link name (aka. World Coordinate Frame)
name | The name of the link |
|
friend |
|
private |
|
private |
|
private |