[Fawkes Git] branch/fzwilling/sub_process: colli: renamed AStar class to avoid conflict with utils/search/astar

Frederik Zwilling zwilling at kbsg.rwth-aachen.de
Tue Oct 11 22:07:23 CEST 2016


Changes have been pushed for the project "Fawkes Robotics Software Framework".

Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, fzwilling/sub_process has been updated
        to  b5129ebacf6dce2c52b1e6483a8e55648f76fb1c (commit)
      from  eda2a2b2116e9d1baf13c8364ef2d703d7911f26 (commit)

http://git.fawkesrobotics.org/fawkes.git/fzwilling/sub_process

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- *Log* ---------------------------------------------------------------
commit b5129ebacf6dce2c52b1e6483a8e55648f76fb1c
Author:     Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
AuthorDate: Tue Oct 11 21:51:46 2016 +0200
Commit:     Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
CommitDate: Tue Oct 11 22:07:19 2016 +0200

    colli: renamed AStar class to avoid conflict with utils/search/astar
    
    Since we compiled the utils with C++11, the linker mixes up the colli
    astar and utils astar classes. They are implemented differently, but
    have the same name and namespace. This lead to a segfault when suddenly
    the search function of the utils was executed in a colli astar instance.
    This is a fist hotfix that just renames the colli astar class.

http://git.fawkesrobotics.org/fawkes.git/commit/b5129eb
http://trac.fawkesrobotics.org/changeset/b5129eb

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------
 src/plugins/colli/search/astar.cpp        |   20 ++++++++++----------
 src/plugins/colli/search/astar.h          |    6 +++---
 src/plugins/colli/search/astar_search.cpp |    2 +-
 src/plugins/colli/search/astar_search.h   |    4 ++--
 4 files changed, 16 insertions(+), 16 deletions(-)


- *Diffs* -------------------------------------------------------------

- *commit* b5129ebacf6dce2c52b1e6483a8e55648f76fb1c - - - - - - - - - -
Author:  Frederik Zwilling <zwilling at kbsg.rwth-aachen.de>
Date:    Tue Oct 11 21:51:46 2016 +0200
Subject: colli: renamed AStar class to avoid conflict with utils/search/astar

 src/plugins/colli/search/astar.cpp        |   20 ++++++++++----------
 src/plugins/colli/search/astar.h          |    6 +++---
 src/plugins/colli/search/astar_search.cpp |    2 +-
 src/plugins/colli/search/astar_search.h   |    4 ++--
 4 files changed, 16 insertions(+), 16 deletions(-)

_Diff for modified files_:
diff --git a/src/plugins/colli/search/astar.cpp b/src/plugins/colli/search/astar.cpp
index 8038016..75be545 100644
--- a/src/plugins/colli/search/astar.cpp
+++ b/src/plugins/colli/search/astar.cpp
@@ -52,7 +52,7 @@ namespace fawkes
  * @param logger The fawkes logger
  * @param config The fawkes configuration
  */
-AStar::AStar( LaserOccupancyGrid * occGrid, Logger* logger, Configuration* config )
+AStarColli::AStarColli( LaserOccupancyGrid * occGrid, Logger* logger, Configuration* config )
  : logger_( logger )
 {
   logger_->log_debug("AStar", "(Constructor): Initializing AStar");
@@ -86,7 +86,7 @@ AStar::AStar( LaserOccupancyGrid * occGrid, Logger* logger, Configuration* confi
 /** Destructor.
  *  This destructor deletes all the states allocated during construction.
  */
-AStar::~AStar()
+AStarColli::~AStarColli()
 {
   logger_->log_debug("AStar", "(Destructor): Destroying AStar");
   for( int i = 0; i < max_states_; i++ )
@@ -106,7 +106,7 @@ AStar::~AStar()
  * @param solution a vector that will be filled with the found path
  */
 void
-AStar::solve( const point_t &robo_pos, const point_t &target_pos, vector<point_t> &solution )
+AStarColli::solve( const point_t &robo_pos, const point_t &target_pos, vector<point_t> &solution )
 {
   // initialize counter, vectors/lists/queues
   astar_state_count_ = 0;
@@ -146,7 +146,7 @@ AStar::solve( const point_t &robo_pos, const point_t &target_pos, vector<point_t
  *  Its really easy, you can find it like this everywhere.
  */
 AStarState*
-AStar::search( )
+AStarColli::search( )
 {
   AStarState * best = 0;
 
@@ -197,7 +197,7 @@ AStar::search( )
  *    afterwards a number that is smaller tham 14 bits!
  */
 int
-AStar::calculate_key( int x, int y )
+AStarColli::calculate_key( int x, int y )
 {
   return (x << 15) | y;  // This line is a crime! But fast ;-)
 }
@@ -209,7 +209,7 @@ AStar::calculate_key( int x, int y )
  *   Afterwards these children are put on the openlist.
  */
 void
-AStar::generate_children( AStarState * father )
+AStarColli::generate_children( AStarState * father )
 {
   AStarState * child;
   int key;
@@ -301,7 +301,7 @@ AStar::generate_children( AStarState * father )
  *    because we are calculating on a grid...
  */
 int
-AStar::heuristic( AStarState * state )
+AStarColli::heuristic( AStarState * state )
 {
   //  return (int)( abs( state->x_ - target_state_.x_ ));
   return (int)( abs( state->x_ - target_state_.x_ ) +
@@ -313,7 +313,7 @@ AStar::heuristic( AStarState * state )
  *  This method checks, if a state is a goal state.
  */
 bool
-AStar::is_goal( AStarState * state )
+AStarColli::is_goal( AStarState * state )
 {
   return ( (target_state_.x_ == state->x_) &&
            (target_state_.y_ == state->y_) );
@@ -325,7 +325,7 @@ AStar::is_goal( AStarState * state )
  *    tree into the solution/plan vector.
  */
 void
-AStar::get_solution_sequence( AStarState * node, vector<point_t> &solution )
+AStarColli::get_solution_sequence( AStarState * node, vector<point_t> &solution )
 {
   AStarState * state = node;
   while ( state != 0 ) {
@@ -350,7 +350,7 @@ AStar::get_solution_sequence( AStarState * node, vector<point_t> &solution )
  * @return a new modified point.
  */
 point_t
-AStar::remove_target_from_obstacle( int target_x, int target_y, int step_x, int step_y  )
+AStarColli::remove_target_from_obstacle( int target_x, int target_y, int step_x, int step_y  )
 {
   // initializing lists...
   while ( open_list_.size() > 0 )
diff --git a/src/plugins/colli/search/astar.h b/src/plugins/colli/search/astar.h
index b984e1e..588c248 100644
--- a/src/plugins/colli/search/astar.h
+++ b/src/plugins/colli/search/astar.h
@@ -46,11 +46,11 @@ typedef struct point_struct point_t;
  *  This is an implementation of the A* search algorithm in a
  *    highly efficient way (I hope ;-).
  */
-class AStar
+class AStarColli
 {
  public:
-  AStar( LaserOccupancyGrid * occGrid, Logger* logger, Configuration* config );
-  ~AStar();
+  AStarColli( LaserOccupancyGrid * occGrid, Logger* logger, Configuration* config );
+  ~AStarColli();
 
   /* =========================================== */
   /* ************* PUBLIC METHODS ************** */
diff --git a/src/plugins/colli/search/astar_search.cpp b/src/plugins/colli/search/astar_search.cpp
index 9b20a31..70c282a 100644
--- a/src/plugins/colli/search/astar_search.cpp
+++ b/src/plugins/colli/search/astar_search.cpp
@@ -52,7 +52,7 @@ Search::Search( LaserOccupancyGrid * occ_grid, Logger* logger, Configuration* co
   logger_->log_debug("search", "(Constructor): Entering");
   std::string cfg_prefix = "/plugins/colli/search/";
   cfg_search_line_allowed_cost_max_  = config->get_int((cfg_prefix + "line/cost_max").c_str());
-  astar_ = new AStar( occ_grid, logger, config );
+  astar_ = new AStarColli( occ_grid, logger, config );
   logger_->log_debug("search", "(Constructor): Exiting");
 }
 
diff --git a/src/plugins/colli/search/astar_search.h b/src/plugins/colli/search/astar_search.h
index 14ff889..bed2fee 100644
--- a/src/plugins/colli/search/astar_search.h
+++ b/src/plugins/colli/search/astar_search.h
@@ -34,7 +34,7 @@ namespace fawkes
 #endif
 
 class LaserOccupancyGrid;
-class AStar;
+class AStarColli;
 class Logger;
 class Configuration;
 
@@ -77,7 +77,7 @@ class Search: public AbstractSearch
   bool is_obstacle_between( const point_t &a, const point_t &b, const int maxcount );
 
 
-  AStar * astar_;              /**< the A* search algorithm */
+  AStarColli * astar_;              /**< the A* search algorithm */
   std::vector< point_t > plan_; /**< the local representation of the plan */
 
   point_t robo_position_, target_position_;




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org


More information about the fawkes-commits mailing list