octomap  1.9.7
octomap::ScanGraph Class Reference

A ScanGraph is a collection of ScanNodes, connected by ScanEdges. More...

+ Collaboration diagram for octomap::ScanGraph:

Public Types

typedef std::vector< ScanEdge * >::const_iterator const_edge_iterator
 
typedef std::vector< ScanNode * >::const_iterator const_iterator
 
typedef std::vector< ScanEdge * >::iterator edge_iterator
 
typedef std::vector< ScanNode * >::iterator iterator
 

Public Member Functions

ScanEdgeaddEdge (ScanNode *first, ScanNode *second, pose6d constraint)
 Creates an edge between two ScanNodes. More...
 
ScanEdgeaddEdge (unsigned int first_id, unsigned int second_id)
 
ScanNodeaddNode (Pointcloud *scan, pose6d pose)
 Creates a new ScanNode in the graph from a Pointcloud. More...
 
iterator begin ()
 
const_iterator begin () const
 
void clear ()
 Clears all nodes and edges, and will delete the corresponding objects. More...
 
void connectPrevious ()
 Connect previously added ScanNode to the one before that. More...
 
void crop (point3d lowerBound, point3d upperBound)
 Cut graph (all containing Pointclouds) to given BBX in global coords. More...
 
void cropEachScan (point3d lowerBound, point3d upperBound)
 Cut Pointclouds to given BBX in local coords. More...
 
bool edgeExists (unsigned int first_id, unsigned int second_id)
 
edge_iterator edges_begin ()
 
const_edge_iterator edges_begin () const
 
edge_iterator edges_end ()
 
const_edge_iterator edges_end () const
 
iterator end ()
 
const_iterator end () const
 
void exportDot (std::string filename)
 
std::vector< ScanEdge * > getInEdges (ScanNode *node)
 
std::vector< unsigned int > getNeighborIDs (unsigned int id)
 
ScanNodegetNodeByID (unsigned int id)
 will return NULL if node was not found More...
 
size_t getNumPoints (unsigned int max_id=-1) const
 
std::vector< ScanEdge * > getOutEdges (ScanNode *node)
 
bool readBinary (const std::string &filename)
 
std::istream & readBinary (std::ifstream &s)
 
std::istream & readEdgesASCII (std::istream &s)
 
std::istream & readNodePosesASCII (std::istream &s)
 
void readPlainASCII (const std::string &filename)
 
std::istream & readPlainASCII (std::istream &s)
 Reads in a ScanGraph from a "plain" ASCII file of the form NODE x y z R P Y x y z x y z x y z NODE x y z R P Y x y z. More...
 
 ScanGraph ()
 
size_t size () const
 
void transformScans ()
 Transform every scan according to its pose. More...
 
bool writeBinary (const std::string &filename) const
 
std::ostream & writeBinary (std::ostream &s) const
 
std::ostream & writeEdgesASCII (std::ostream &s) const
 
std::ostream & writeNodePosesASCII (std::ostream &s) const
 
 ~ScanGraph ()
 

Protected Attributes

std::vector< ScanEdge * > edges
 
std::vector< ScanNode * > nodes
 

Detailed Description

A ScanGraph is a collection of ScanNodes, connected by ScanEdges.

Each ScanNode contains a 3D scan performed from a pose.

Member Typedef Documentation

◆ const_edge_iterator

◆ const_iterator

◆ edge_iterator

◆ iterator

Constructor & Destructor Documentation

◆ ScanGraph()

octomap::ScanGraph::ScanGraph ( )
inline

◆ ~ScanGraph()

octomap::ScanGraph::~ScanGraph ( )

References clear().

Member Function Documentation

◆ addEdge() [1/2]

ScanEdge * octomap::ScanGraph::addEdge ( ScanNode first,
ScanNode second,
pose6d  constraint 
)

Creates an edge between two ScanNodes.

ScanGraph will delete the object when it's no longer needed, don't delete it yourself.

Parameters
firstScanNode
secondScanNode
constraint6D transform between the two nodes
Returns

References edges, and OCTOMAP_ERROR.

Referenced by addEdge(), and connectPrevious().

◆ addEdge() [2/2]

ScanEdge * octomap::ScanGraph::addEdge ( unsigned int  first_id,
unsigned int  second_id 
)

◆ addNode()

ScanNode * octomap::ScanGraph::addNode ( Pointcloud scan,
pose6d  pose 
)

Creates a new ScanNode in the graph from a Pointcloud.

Parameters
scanPointer to a pointcloud to be added to the ScanGraph. ScanGraph will delete the object when it's no longer needed, don't delete it yourself.
pose6D pose of the origin of the Pointcloud
Returns
Pointer to the new node

References nodes, and OCTOMAP_ERROR.

Referenced by main().

◆ begin() [1/2]

iterator octomap::ScanGraph::begin ( )
inline

◆ begin() [2/2]

const_iterator octomap::ScanGraph::begin ( ) const
inline

References nodes.

◆ clear()

void octomap::ScanGraph::clear ( )

Clears all nodes and edges, and will delete the corresponding objects.

References edges, and nodes.

Referenced by readBinary(), and ~ScanGraph().

◆ connectPrevious()

void octomap::ScanGraph::connectPrevious ( )

Connect previously added ScanNode to the one before that.

References addEdge(), nodes, and octomap::ScanNode::pose.

Referenced by readPlainASCII().

◆ crop()

void octomap::ScanGraph::crop ( point3d  lowerBound,
point3d  upperBound 
)

Cut graph (all containing Pointclouds) to given BBX in global coords.

References begin(), octomap::Pointcloud::crop(), end(), octomath::Pose6D::inv(), octomap::Pointcloud::transform(), and octomap::Pointcloud::transformAbsolute().

Referenced by cropEachScan().

◆ cropEachScan()

void octomap::ScanGraph::cropEachScan ( point3d  lowerBound,
point3d  upperBound 
)

Cut Pointclouds to given BBX in local coords.

References begin(), crop(), and end().

◆ edgeExists()

bool octomap::ScanGraph::edgeExists ( unsigned int  first_id,
unsigned int  second_id 
)
Returns
true when an edge between first_id and second_id exists

References edges.

Referenced by addEdge(), and getNeighborIDs().

◆ edges_begin() [1/2]

edge_iterator octomap::ScanGraph::edges_begin ( )
inline

References edges.

Referenced by readNodePosesASCII(), writeBinary(), and writeEdgesASCII().

◆ edges_begin() [2/2]

const_edge_iterator octomap::ScanGraph::edges_begin ( ) const
inline

References edges.

◆ edges_end() [1/2]

edge_iterator octomap::ScanGraph::edges_end ( )
inline

References edges.

Referenced by readNodePosesASCII(), writeBinary(), and writeEdgesASCII().

◆ edges_end() [2/2]

const_edge_iterator octomap::ScanGraph::edges_end ( ) const
inline

References edges.

◆ end() [1/2]

iterator octomap::ScanGraph::end ( )
inline

◆ end() [2/2]

const_iterator octomap::ScanGraph::end ( ) const
inline

References nodes.

◆ exportDot()

void octomap::ScanGraph::exportDot ( std::string  filename)

References edges.

◆ getInEdges()

std::vector< ScanEdge * > octomap::ScanGraph::getInEdges ( ScanNode node)

References edges.

◆ getNeighborIDs()

std::vector< unsigned int > octomap::ScanGraph::getNeighborIDs ( unsigned int  id)

◆ getNodeByID()

ScanNode * octomap::ScanGraph::getNodeByID ( unsigned int  id)

will return NULL if node was not found

References nodes.

Referenced by addEdge(), getNeighborIDs(), octomap::ScanEdge::readASCII(), and octomap::ScanEdge::readBinary().

◆ getNumPoints()

size_t octomap::ScanGraph::getNumPoints ( unsigned int  max_id = -1) const

References begin(), and end().

Referenced by main().

◆ getOutEdges()

std::vector< ScanEdge * > octomap::ScanGraph::getOutEdges ( ScanNode node)

References edges.

◆ readBinary() [1/2]

bool octomap::ScanGraph::readBinary ( const std::string &  filename)

References OCTOMAP_ERROR_STR, and readBinary().

◆ readBinary() [2/2]

std::istream & octomap::ScanGraph::readBinary ( std::ifstream &  s)

◆ readEdgesASCII()

std::istream & octomap::ScanGraph::readEdgesASCII ( std::istream &  s)

◆ readNodePosesASCII()

std::istream & octomap::ScanGraph::readNodePosesASCII ( std::istream &  s)

◆ readPlainASCII() [1/2]

void octomap::ScanGraph::readPlainASCII ( const std::string &  filename)

◆ readPlainASCII() [2/2]

std::istream & octomap::ScanGraph::readPlainASCII ( std::istream &  s)

Reads in a ScanGraph from a "plain" ASCII file of the form NODE x y z R P Y x y z x y z x y z NODE x y z R P Y x y z.

Lines starting with the NODE keyword contain the 6D pose of a scan node, all 3D point following until the next NODE keyword (or end of file) are inserted into that scan node as pointcloud in its local coordinate frame

Parameters
sinput stream to read from
Returns
read stream

References connectPrevious(), nodes, OCTOMAP_DEBUG_STR, OCTOMAP_ERROR_STR, octomap::ScanNode::pose, octomap::Pointcloud::push_back(), octomap::ScanNode::scan, and octomap::Pointcloud::size().

Referenced by main(), and readPlainASCII().

◆ size()

size_t octomap::ScanGraph::size ( ) const
inline

References nodes.

Referenced by main(), writeBinary(), and writeNodePosesASCII().

◆ transformScans()

void octomap::ScanGraph::transformScans ( )

Transform every scan according to its pose.

References begin(), and end().

◆ writeBinary() [1/2]

bool octomap::ScanGraph::writeBinary ( const std::string &  filename) const

References OCTOMAP_ERROR_STR, and writeBinary().

◆ writeBinary() [2/2]

std::ostream & octomap::ScanGraph::writeBinary ( std::ostream &  s) const

◆ writeEdgesASCII()

std::ostream & octomap::ScanGraph::writeEdgesASCII ( std::ostream &  s) const

◆ writeNodePosesASCII()

std::ostream & octomap::ScanGraph::writeNodePosesASCII ( std::ostream &  s) const

References begin(), end(), OCTOMAP_DEBUG, and size().

Field Documentation

◆ edges

◆ nodes

std::vector<ScanNode*> octomap::ScanGraph::nodes
protected

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