Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial draft of changes for online map / planner updates #12

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
745d2d0
Add functionality to update map (and the planner state space boundari…
meychr Apr 5, 2021
51f0bac
Make class member of StateValidator private
meychr May 13, 2021
c8ad75d
Make some class functions constant
meychr May 13, 2021
0d0bcc0
Unify name of state space boundaries to StateSpaceBoundaries
meychr May 13, 2021
07efb89
Reorder member variables
meychr May 13, 2021
b492b7f
Implement getStartingState and getGoalState for OmplReedsSheppPlanner
meychr May 14, 2021
85723b8
Move ROS publishers and services to base class PlannerRos, use Planne…
meychr May 14, 2021
f24ce13
Make isStateValid constant
meychr May 14, 2021
11075fe
Fix typo
meychr May 14, 2021
8c0bc04
Move StateValidator functions to Planner interface
meychr May 14, 2021
0072859
Adapt se2_grid_map_generator config and add TODOs to fix frames
meychr May 19, 2021
db4a618
Set state space bounds changes
meychr May 19, 2021
2735940
Fix formatting
meychr May 19, 2021
6b3863b
Move getStateSpaceBoundaries to OmplPlanner
meychr May 19, 2021
4704095
Remove comment
meychr May 19, 2021
808bd65
Reorder code and remove TODO
meychr May 29, 2021
21e3385
Fix format
meychr Jun 7, 2021
5c1afb2
Implement map interface and occupancy map & adapt height map
meychr Jun 7, 2021
fc57077
Add ROS class for occupancy map
meychr Jun 7, 2021
632a7f6
Integrate new map for state space boundaries update, adapt tests
meychr Jun 7, 2021
db5da4d
Uncomment isTraversable again
meychr Jun 7, 2021
80db121
Make GridMapLazyStateValidatorRos similar to OccupancyMapRos
meychr Jun 7, 2021
ad3095d
Change config file to use elevation for collision checking in state v…
meychr Jun 7, 2021
d07c579
Increase footprint size in car_demo
meychr Jun 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Implement map interface and occupancy map & adapt height map
  • Loading branch information
meychr committed Jun 7, 2021
commit 5c1afb2f8dea6532679662f597e303021031e19d
11 changes: 7 additions & 4 deletions se2_planning/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ add_compile_options(-Wall -Wextra -Wpedantic)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(SRC_FILES
src/ompl_planner_creators.cpp
src/Bounds.cpp
src/GridMapLazyStateValidator.cpp
src/GridMapStateValidator.cpp
src/HeightMap.cpp
src/Map.cpp
src/OccupancyMap.cpp
src/OmplPlanner.cpp
src/OmplReedsSheppPlanner.cpp
src/State.cpp
src/StateValidator.cpp
src/HeightMap.cpp
src/ompl_planner_creators.cpp
)

set(CATKIN_PACKAGE_DEPENDENCIES
Expand All @@ -32,7 +35,7 @@ if(NOT EIGEN3_FOUND)
set(EIGEN3_INCLUDE_DIR ${EIGEN3_INCLUDE_DIRS})
endif()

find_package(Boost REQUIRED)
find_package(Boost REQUIRED COMPONENTS thread)
find_package(ompl REQUIRED)

catkin_package(
Expand Down Expand Up @@ -88,8 +91,8 @@ add_executable(planning_benchmark
src/planning_benchmark.cpp
)
target_link_libraries(planning_benchmark
${catkin_LIBRARIES}
${PROJECT_NAME}
${catkin_LIBRARIES}
${OMPL_LIBRARIES}
test_helpers
)
Expand Down
22 changes: 22 additions & 0 deletions se2_planning/include/se2_planning/Bounds.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Bounds.hpp
*
* Created on: May 29, 2021
* Author: meyerc
*/

#pragma once
#include <boost/concept_check.hpp>
#include <se2_planning/State.hpp>

namespace se2_planning {

struct Bounds {
Bounds() = default;
Bounds(XYstate low, XYstate high);
~Bounds() = default;
XYstate low_ = {0.0, 0.0};
XYstate high_ = {0.0, 0.0};
};

} // namespace se2_planning
15 changes: 7 additions & 8 deletions se2_planning/include/se2_planning/HeightMap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@

#pragma once
#include "grid_map_core/GridMap.hpp"
#include "se2_planning/Map.hpp"

namespace se2_planning {

class HeightMap {
class HeightMap : public Map {
public:
HeightMap() = default;
virtual ~HeightMap() = default;

bool isInitialized() const;

double getHeightAt(double x, double y) const;
~HeightMap() override = default;

bool isInitialized() const override;
void initializeBounds(const Bounds& bounds) override;
Bounds getBounds() const override;
double getValueAt(double x, double y) const override;
void setGridMap(const grid_map::GridMap& gm, const std::string& heightLayer);

const grid_map::GridMap& getGridMap() const;

private:
grid_map::GridMap impl_;
std::string heightLayer_ = "";
Expand Down
33 changes: 33 additions & 0 deletions se2_planning/include/se2_planning/Map.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Map.hpp
*
* Created on: May 16, 2021
* Author: meyerc
*/

#pragma once

#include "se2_planning/Bounds.hpp"
#include "se2_planning/State.hpp"

#include <boost/thread/mutex.hpp>

namespace se2_planning {

class Map {
public:
Map() = default;
virtual ~Map() = default;

virtual bool isInitialized() const = 0;
virtual void initializeBounds(const Bounds& bounds) = 0;
virtual Bounds getBounds() const = 0;
virtual double getValueAt(double x, double y) const = 0;
virtual void lock();
virtual void unlock();

private:
boost::mutex mtx_;
};

} /* namespace se2_planning */
32 changes: 32 additions & 0 deletions se2_planning/include/se2_planning/OccupancyMap.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* OccupancyMap.hpp
*
* Created on: May 16, 2021
* Author: meyerc
*/

#pragma once

#include "grid_map_core/GridMap.hpp"
#include "se2_planning/Map.hpp"

namespace se2_planning {

class OccupancyMap : public Map {
public:
OccupancyMap() = default;
~OccupancyMap() override = default;

bool isInitialized() const override;
void initializeBounds(const Bounds& bounds) override;
Bounds getBounds() const override;
double getValueAt(double x, double y) const override;
void setGridMap(const grid_map::GridMap& gm, const std::string& occupancyLayer);

private:
grid_map::GridMap impl_;
std::string occupancyLayer_ = "";
bool isInitialized_ = false;
};

} /* namespace se2_planning */
16 changes: 16 additions & 0 deletions se2_planning/src/Bounds.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Bounds.cpp
*
* Created on: May 29, 2021
* Author: meyerc
*/

#include "se2_planning/Bounds.hpp"

#include <cmath>

namespace se2_planning {

Bounds::Bounds(XYstate low, XYstate high) : low_(low), high_(high) {}

} /* namespace se2_planning */
21 changes: 9 additions & 12 deletions se2_planning/src/HeightMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
* Author: jelavice
*/

/*
* HeightMap.hpp
*
* Created on: Feb 17, 2021
* Author: jelavice
*/

#include "se2_planning/HeightMap.hpp"

namespace se2_planning {
Expand All @@ -20,7 +13,15 @@ bool HeightMap::isInitialized() const {
return isInitialized_;
}

double HeightMap::getHeightAt(double x, double y) const {
void HeightMap::initializeBounds(const Bounds& bounds) {
(void)bounds;
}

Bounds HeightMap::getBounds() const {
return Bounds{};
}

double HeightMap::getValueAt(double x, double y) const {
return impl_.atPosition(heightLayer_, grid_map::Position(x, y));
}

Expand All @@ -30,8 +31,4 @@ void HeightMap::setGridMap(const grid_map::GridMap& gm, const std::string& heigh
isInitialized_ = true;
}

const grid_map::GridMap& HeightMap::getGridMap() const {
return impl_;
}

} /* namespace se2_planning*/
38 changes: 38 additions & 0 deletions se2_planning/src/Map.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Map.cpp
*
* Created on: May 30, 2021
* Author: meyerc
*/

#include "se2_planning/Map.hpp"

namespace se2_planning {

bool Map::isInitialized() const {
return true;
}

void Map::initializeBounds(const Bounds& bounds) {
(void)bounds;
throw std::runtime_error("Planner: initializeBounds() not implemented");
}

Bounds Map::getBounds() const {
throw std::runtime_error("Planner: getBounds() not implemented");
}

double Map::getValueAt(double x, double y) const {
(void)x;
(void)y;
throw std::runtime_error("Planner: getValueAt() not implemented");
}

void Map::lock() {
mtx_.lock();
}

void Map::unlock() {
mtx_.unlock();
}
} // namespace se2_planning
40 changes: 40 additions & 0 deletions se2_planning/src/OccupancyMap.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* OccupancyMap.cpp
*
* Created on: May 16, 2021
* Author: meyerc
*/

#include "se2_planning/OccupancyMap.hpp"

namespace se2_planning {

bool OccupancyMap::isInitialized() const {
return isInitialized_;
}

void OccupancyMap::initializeBounds(const Bounds& bounds) {
// TODO(christoph): When grid map is set, bounds are set anyways, do we need a separate init option? Can lead to
// mismatch between bounds and map.
(void)bounds;
}

Bounds OccupancyMap::getBounds() const {
const auto position = impl_.getPosition();
const auto length = impl_.getLength();
const Bounds bounds = {{position.x() - length.x() / 2.0, position.y() - length.y() / 2.0},
{position.x() + length.x() / 2.0, position.y() + length.y() / 2.0}};
return bounds;
}

double OccupancyMap::getValueAt(double x, double y) const {
return impl_.atPosition(occupancyLayer_, grid_map::Position(x, y));
}

void OccupancyMap::setGridMap(const grid_map::GridMap& gm, const std::string& occupancyLayer) {
occupancyLayer_ = occupancyLayer;
impl_ = gm;
isInitialized_ = true;
}

} /* namespace se2_planning*/