Skip to content

Commit

Permalink
Fix some issues
Browse files Browse the repository at this point in the history
also format some code files with clang format
  • Loading branch information
RainerKuemmerle committed May 3, 2020
1 parent 8189a90 commit 61ffd24
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 88 deletions.
5 changes: 0 additions & 5 deletions g2o/apps/g2o_hierarchical/simple_star_ops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ void computeSimpleStars(StarSet& stars, SparseOptimizer* optimizer, EdgeLabeler*
int starOptResult = s->optimizer()->optimize(starIterations);
// cerr << starOptResult << "(" << starIterations << ") " << endl;

int vKept = 0, vDropped = 0;
if (!starIterations || starOptResult > 0) {
optimizer->computeActiveErrors();

Expand Down Expand Up @@ -344,10 +343,6 @@ void computeSimpleStars(StarSet& stars, SparseOptimizer* optimizer, EdgeLabeler*
if (otherEdges.find(e) != otherEdges.end()) prunedStarEdges.insert(e);
}
// cerr << "K( " << v->id() << "," << d << ")" ;
vKept++;
} else {
vDropped++;
// cerr << "R( " << v->id() << "," << d << ")" ;
}
}
s->_lowLevelEdges = prunedStarEdges;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,62 +27,64 @@
#ifndef ABSTRACT_SLAM_INTERFACE_H
#define ABSTRACT_SLAM_INTERFACE_H

#include <vector>
#include <string>
#include <vector>

namespace SlamParser {


/**
* \brief interface for communicating with the SLAM algorithm
*
* This interface allows the parser to communicate with the SLAM algorithm.
*/
class AbstractSlamInterface {
public:
/**
* \brief interface for communicating with the SLAM algorithm
*
* This interface allows the parser to communicate with the SLAM algorithm.
* adding a node to the SLAM engine.
* @param tag: the tag specifying the type of the vertex
* @param id: the unique id of the node.
* @param dimension: the dimension of the node.
* @param values: the pose of the node, may be empty (i.e., the engine should initialize the node itself)
* @return true, if adding was successful
*/
class AbstractSlamInterface {
public:
/**
* adding a node to the SLAM engine.
* @param tag: the tag specifying the type of the vertex
* @param id: the unique id of the node.
* @param dimension: the dimension of the node.
* @param values: the pose of the node, may be empty (i.e., the engine should initialize the node itself)
* @return true, if adding was successful
*/
virtual bool addNode(const std::string& tag, int id, int dimension, const std::vector<double>& values) = 0;
virtual bool addNode(const std::string& tag, int id, int dimension, const std::vector<double>& values) = 0;

/**
* adding an edge to the SLAM engine.
* @param tag: the tag specifying the type of the vertex
* @param id: the unique id of the edge.
* @param dimension: the dimension of the edge.
* @param v1: the unique id of the edge of the first vertex
* @param v2: the unique id of the edge of the second vertex
* @param measurement: the measurement of the constraint
* @param information: the information matrix (inverse of the covariance) representing the uncertainty of the measurement (row-major upper triangular and diagonal)
* @return true, if adding was successful
*/
virtual bool addEdge(const std::string& tag, int id, int dimension, int v1, int v2, const std::vector<double>& measurement, const std::vector<double>& information) = 0;
/**
* adding an edge to the SLAM engine.
* @param tag: the tag specifying the type of the vertex
* @param id: the unique id of the edge.
* @param dimension: the dimension of the edge.
* @param v1: the unique id of the edge of the first vertex
* @param v2: the unique id of the edge of the second vertex
* @param measurement: the measurement of the constraint
* @param information: the information matrix (inverse of the covariance) representing the uncertainty of the
* measurement (row-major upper triangular and diagonal)
* @return true, if adding was successful
*/
virtual bool addEdge(const std::string& tag, int id, int dimension, int v1, int v2,
const std::vector<double>& measurement, const std::vector<double>& information) = 0;

/**
* set some nodes to a fixed position
* @param nodes: the list of vertex IDs to fix
* @return true, if successful
*/
virtual bool fixNode(const std::vector<int>& nodes) = 0;
/**
* set some nodes to a fixed position
* @param nodes: the list of vertex IDs to fix
* @return true, if successful
*/
virtual bool fixNode(const std::vector<int>& nodes) = 0;

/**
* Ask the SLAM engine to print the current estimate of the variables
* @param nodes: the list of vertex IDs to print, if empty print all variables
* @return true, if successful
*/
virtual bool queryState(const std::vector<int>& nodes) = 0;
/**
* Ask the SLAM engine to print the current estimate of the variables
* @param nodes: the list of vertex IDs to print, if empty print all variables
* @return true, if successful
*/
virtual bool queryState(const std::vector<int>& nodes) = 0;

/**
* ask the engine to solve
* @return true, if successful
*/
virtual bool solveState() = 0;
};
/**
* ask the engine to solve
* @return true, if successful
*/
virtual bool solveState() = 0;
};

}
} // namespace SlamParser

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -27,41 +27,40 @@
#ifndef PARSER_INTERFACE_H
#define PARSER_INTERFACE_H

#include "abstract_slam_interface.h"

#include <iosfwd>
#include <sstream>

#include "abstract_slam_interface.h"

namespace SlamParser {

class SlamContextInterface;
class Driver;
class SlamContextInterface;
class Driver;

/**
* \brief top-level interface to the parser
*/
class ParserInterface {
public:
/**
* \brief top-level interface to the parser
* construct a parser and use the given AbstractSlamInterface to communicate with the SLAM algorithm.
*/
class ParserInterface
{
public:
/**
* construct a parser and use the given AbstractSlamInterface to communicate with the SLAM algorithm.
*/
explicit ParserInterface(AbstractSlamInterface* slamInterface);
ParserInterface & operator=(const ParserInterface&) = delete;
ParserInterface(const ParserInterface&) = delete;
virtual ~ParserInterface();
explicit ParserInterface(AbstractSlamInterface* slamInterface);
ParserInterface& operator=(const ParserInterface&) = delete;
ParserInterface(const ParserInterface&) = delete;
virtual ~ParserInterface();

/**
* parse a single command and forward to the SLAM engine
*/
bool parseCommand(std::istream& input);
/**
* parse a single command and forward to the SLAM engine
*/
bool parseCommand(std::istream& input);

protected:
SlamContextInterface* _slamContextInterface;
Driver* _driver;
std::stringstream _buffer;
};
protected:
SlamContextInterface* _slamContextInterface;
Driver* _driver;
std::stringstream _buffer;
};

} // end namespace
} // namespace SlamParser

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,21 @@

namespace SlamParser {

class AbstractSlamInterface;
class AbstractSlamInterface;

class SlamContextInterface : public SlamContext
{
public:
SlamContextInterface(AbstractSlamInterface* slam);
~SlamContextInterface();
class SlamContextInterface : public SlamContext {
public:
explicit SlamContextInterface(AbstractSlamInterface* slam);
SlamContextInterface& operator=(const SlamContextInterface&) = delete;
SlamContextInterface(const SlamContextInterface&) = delete;
~SlamContextInterface();

bool process(CommandNode* commandNode);
bool process(CommandNode* commandNode);

protected:
AbstractSlamInterface* _slam;
};
protected:
AbstractSlamInterface* _slam;
};

} // end namespace
} // namespace SlamParser

#endif

0 comments on commit 61ffd24

Please sign in to comment.