Commit 3b9a478b authored by Projekt Robbie's avatar Projekt Robbie
Browse files

Trimmed the branch to only the homer_mapnav_msgs sub directory

parent 2a70f695
This diff is collapsed.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package homer_map_manager
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.1.18 (2017-02-28)
-------------------
0.1.17 (2017-02-26)
-------------------
* Eigen3 INCLUDE_DIR fix
* Contributors: Niklas Yann Wettengel
0.1.16 (2017-02-23)
-------------------
* changed maintainer
* Contributors: Raphael Memmesheimer
0.1.15 (2017-02-16)
-------------------
* map_manager without laser scans
* Contributors: Lisa
0.1.14 (2017-02-10)
-------------------
0.1.13 (2017-02-10)
-------------------
* best changelog ever
* Contributors: Florian Polster
0.1.12 (2017-02-09)
-------------------
* map manager crash
* latching enabled
* Contributors: Florian Polster, Lisa
0.1.11 (2017-01-19)
-------------------
* cool changelogs
* dynamic masking map
* masking manager dynamic map
* reworking map_manager to use dynamic map sizes
* Contributors: Florian Polster, Lisa
* dynamic masking map
* masking manager dynamic map
* reworking map_manager to use dynamic map sizes
* Contributors: Florian Polster, Lisa
0.1.10 (2016-12-08)
-------------------
0.1.9 (2016-11-23)
------------------
0.1.8 (2016-11-21)
------------------
0.1.7 (2016-11-17)
------------------
0.1.6 (2016-11-04)
------------------
0.1.5 (2016-11-04)
------------------
0.1.4 (2016-11-03)
------------------
* updated changelog
* Contributors: Niklas Yann Wettengel
0.1.3 (2016-11-03)
------------------
0.1.2 (2016-11-03)
------------------
0.1.1 (2016-11-03)
------------------
* fixes
* initial commit
* Contributors: Niklas Yann Wettengel
cmake_minimum_required(VERSION 2.8.3)
project(homer_map_manager)
find_package(catkin REQUIRED COMPONENTS roscpp roslib tf homer_mapnav_msgs homer_nav_libs cmake_modules std_srvs)
find_package( Eigen3 REQUIRED )
# eigen 3.2 (wily) only provdies EIGEN3_INCLUDE_DIR, not EIGEN3_INCLUDE_DIRS
if(NOT EIGEN3_INCLUDE_DIRS)
set(EIGEN3_INCLUDE_DIRS ${EIGEN3_INCLUDE_DIR})
endif()
set(CMAKE_BUILD_TYPE Release)
find_package(OpenMP)
if (OPENMP_FOUND)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
include_directories(
include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
)
set(Managers_SRC
src/Managers/MapManager.cpp
src/Managers/MaskingManager.cpp
src/Managers/PoiManager.cpp
src/Managers/RoiManager.cpp
)
add_library(homerManagers ${Managers_SRC})
target_link_libraries(homerManagers homerImage_io)
add_dependencies(homerManagers ${catkin_EXPORTED_TARGETS})
add_library(homerImage_io
src/MapIO/image_loader.cpp
src/MapIO/map_saver.cpp
src/MapIO/map_loader.cpp
)
target_link_libraries(homerImage_io SDL SDL_image yaml-cpp)
add_dependencies(homerImage_io ${catkin_EXPORTED_TARGETS})
catkin_package(
INCLUDE_DIRS include
CATKIN_DEPENDS
roscpp
roslib
tf
homer_mapnav_msgs
homer_nav_libs
std_srvs
LIBRARIES homerImage_io homerManagers
)
add_executable(map_manager src/map_manager_node.cpp)
target_link_libraries(
map_manager
${catkin_LIBRARIES}
homerManagers
homerImage_io
)
add_dependencies(
map_manager
${catkin_EXPORTED_TARGETS}
)
install(DIRECTORY include/${PROJECT_NAME}/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
)
install(TARGETS homerManagers homerImage_io map_manager
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
# map_manager
## Known Issues / Todo's
Aus bisher ungeklärten Gründen kann es in seltenen Fällen passieren, dass der map_manager die Verbindung zum roscore verliert. In diesem Fall muss er durch rosrun map_manager map_manager neugestartet werden.
## Introduction
Der map_manager ist der Mittelpunkt der Kommunikation zwischen homer_mapping, homer_navigation, GUI und die Spiel-Nodes.
Das Zusammenspiel dieser Nodes ist im Screenshot des rqt_graphs zu sehen.
![rqt_graph](images/rosgraph.png)
Er verwaltet die aktuell durch das mapping erstellte Karte sowie weitere Kartebenen. Aktuell sind das die SLAM-Karte, die aktuellen Laserdaten in einer weiteren Ebene und eine Masking-Ebene, in der mit Hilfe der GUI Hindernisse oder freie Flächen in die Karte gezeichnet werden können.
Jedes mal, wenn eine SLAM-Karte von der mapping-Node geschickt wird, wird diese mit allen anderen Karteneben überschrieben (in der Reihenfolge SLAM, Masking, Laserdaten) und als eine zusammengefügte Karte versendet.
Zudem verwaltet der map_manager alle erstellten Points Of Interest (POIs), die z.B. als Ziele für die Navigation verwendet werden.
Die Node ist außerdem zuständig für das Speichern und Laden der Kartenebenen und der POIs. Dabei wird die SLAM-Ebene sowie die Masking-Ebene berücksichtigt.
## Topics
#### Publisher
* `/map`: Die aktuelle Karte, die aus allen aktivierten Kartenebenen zusammengesetzt ist. Diese wird in der GUI angezeigt und für die Navigation verwendet.
* `/map_manager/poi_list`: Verschickt einen Vektor mit allen aktuellen POIs. Dieser Publisher wird immer ausgelöst, sobald sich ein POI ändert oder ein neuer hinzugefügt wird.
* `/map_manager/loaded_map`: Wenn eine Karte geladen wird, wird über dieses Topic die geladene SLAM-Ebene an die homer_mapping-Node verschickt.
* `/map_manager/mask_slam`: Über die GUI kann die SLAM-Map verändert werden. Diese Modifizierungen werden über dieses Topic vom map_manager an das homer_mapping versendet.
#### Subscriber
* `/homer_mapping/slam_map (nav_msgs/OccupancyGrid)`: Hierüber wird die aktuelle SLAM-Map empfangen.
* `/map_manager/save_map (map_messages/SaveMap)`: Hierüber wird der Befehl zum Speichern der Karte inklusive des Dateinamens empfangen.
* `/map_manager/load_map (map_messages/SaveMap)`: Hiermit wird eine Karte geladen und alle bisherigen Kartenebenen durch die geladenen ersetzt.
* `/map_manager/toggle_map_visibility (map_messages/MapLayers)`: Hierüber können einzelne Kartenebenen aktiviert beziehungsweise deaktiviert werden. Deaktivierte werden nicht mehr beim Zusammenfügen der Karte berücksichtigt und dementsprechend auch nicht in der GUI angezeigt sowie für die Navigation verwendet.
* `/scan (nav_msgs/LaserScan)`: Der aktuelle Laserscan, der in die Laserscan-Ebene gezeichnet wird.
* `/map_manager/add_POI (map_messages/PointOfInterest)`: Hierüber kann ein POI hinzugefügt werden.
* `/map_manager/modify_POI (map_messages/ModifyPOI)`: Hierüber kann ein vorhandener POI verändert werden (Name, Position,...)
* `/map_manager/delete_POI (map_messages/DeletePointOfInterest)`: Hierüber kann ein vorhander POI gelöscht werden.
* `/map_manager/modify_map (map_messages/ModifyMap)`: Über dieses Topic werden die Koordinaten der Polygone verschickt, die über die GUI maskiert wurden. Außerdem wird die Kartenebene mitgeteilt, die verändet werden soll (SLAM oder Masking-Ebene).
* `/map_manager/reset_maps (std_msgs/Empty)`: Hierüber werden alle Kartenebenen zurückgesetzt.
\ No newline at end of file
This diff is collapsed.
#ifndef MAPMANAGER_H
#define MAPMANAGER_H
#include <string>
#include <map>
#include <list>
#include <stdio.h>
#include <stdlib.h>
#include <sstream>
#include <string>
#include <vector>
#include <nav_msgs/OccupancyGrid.h>
#include <geometry_msgs/Pose.h>
#include <nav_msgs/OccupancyGrid.h>
#include <homer_mapnav_msgs/ModifyMap.h>
#include <homer_mapnav_msgs/MapLayers.h>
#include <sensor_msgs/LaserScan.h>
#include <homer_nav_libs/tools.h>
#include <tf/tf.h>
#include "ros/ros.h"
/** @class MapManager
* @author Malte Knauf, David Gossow (RX), Susanne Maur
* @brief This class holds all current map layers, updates them and publishes them in one merged map.
*/
class MapManager
{
public:
/**
* @brief Constructor
* @param nh node handle
*/
MapManager(ros::NodeHandle* nh);
/**
* @brief getMapLayer search for map layer of given type and return it
* @param type type of map layer to search for
* @return map layer
*/
nav_msgs::OccupancyGrid::ConstPtr getMapLayer(int type);
/**
* @brief updateMapLayer replaces map layer of given type
* @param type type of map layer
* @param layer new map layer
*/
void updateMapLayer(int type, nav_msgs::OccupancyGrid::ConstPtr layer);
/**
* @brief toggleMapVisibility toggles visibility of each map layer
* @param type type of map layer to toggle
* @param state visible or not
*/
void toggleMapVisibility(int type, bool state );
/**
* @brief clearMapLayers Clear all map layers
*/
void clearMapLayers();
void updateLaser(int layer, const sensor_msgs::LaserScan::ConstPtr& msg );
/** merges all map layers and publishes the merged map */
void sendMergedMap();
void updatePose(const geometry_msgs::PoseStamped::ConstPtr& msg){m_pose = msg;}
/** destructor */
virtual ~MapManager();
private:
/**
* The map data of each available map layer ist stored in this map
*/
std::map< int, nav_msgs::OccupancyGrid::ConstPtr > m_MapLayers;
std::map< int, sensor_msgs::LaserScan::ConstPtr > m_laserLayers;
std::vector< int > m_map_layers;
std::vector< int > m_laser_layers;
tf::TransformListener m_TransformListener;
/**
* This map stores which map layers are enabled and which are disabled
*/
std::map<int, bool> m_MapVisibility;
//sizes of the last slam map
bool m_got_transform;
geometry_msgs::PoseStamped::ConstPtr m_pose;
tf::StampedTransform m_sick_transform;
tf::StampedTransform m_hokuyo_transform;
/** map publisher */
ros::Publisher m_MapPublisher;
};
#endif
#ifndef MaskingManager_H
#define MaskingManager_H
#include <ros/ros.h>
#include <homer_mapnav_msgs/ModifyMap.h>
#include <nav_msgs/MapMetaData.h>
#include <nav_msgs/OccupancyGrid.h>
#include <sstream>
/**
* @class MaskingManager
* @brief Manages a map that can overwrite values in the SLAM map or store it
* in a separate layer
* @author Malte Knauf, David Gossow
*/
class MaskingManager {
public:
/** @brief The constructor. */
MaskingManager(nav_msgs::MapMetaData mapInfo);
/** @brief The destructor. */
virtual ~MaskingManager();
nav_msgs::OccupancyGrid::ConstPtr updateMapInfo(const nav_msgs::MapMetaData &mapInfo);
/** modifies either the masking layer or the slam layer (accordingly to the
* given map layer in the msg */
nav_msgs::OccupancyGrid::ConstPtr modifyMap(
homer_mapnav_msgs::ModifyMap::ConstPtr msg);
/** resets the masking map layer */
nav_msgs::OccupancyGrid::ConstPtr resetMap();
/** replaces the masking map layer */
void replaceMap(nav_msgs::OccupancyGrid map);
private:
/** stores the masking values in the dedicated masking map */
nav_msgs::OccupancyGrid m_MaskingMap;
/** stores the masking values that are afterwards sent to the slam map */
nav_msgs::OccupancyGrid m_SlamMap;
/** tools to draw masking polygons */
void drawPolygon(std::vector<geometry_msgs::Point> vertices, int value,
int mapLayer);
void drawLine(std::vector<int> &data, int startX, int startY, int endX,
int endY, int value);
void fillPolygon(std::vector<int> &data, int x, int y, int value);
};
#endif
#ifndef POI_MANAGER_H
#define POI_MANAGER_H
#include <list>
#include <homer_mapnav_msgs/PointOfInterest.h>
#include <homer_mapnav_msgs/ModifyPOI.h>
#include <ros/ros.h>
/** @class PoiManager
* @author Malte Knauf, David Gossow
* @brief This class manages the List of points of interest (POIs)
*
* This class keeps a list of all POIs within the current map. It provides the usual functions
* to edit the list.
*/
class PoiManager {
public:
/** The constructor of the class. */
PoiManager(ros::NodeHandle* nh);
/** constructor initializing the poi list */
PoiManager( std::vector< homer_mapnav_msgs::PointOfInterest > pois );
/** Does nothing. */
~PoiManager() {}
/** Adds a new POI to the list if no POI with the same name exists
* @param poi pointer to the PointOfInterest message with the POI to be added
* @return true if successful, false otherwise
*/
bool addPointOfInterest( const homer_mapnav_msgs::PointOfInterest::ConstPtr& poi );
/** Replaces a POI with a new one
* @param poi pointer with the PointOfInterest to be inserted
* the POI with the same ID as the new one is first deleted
* @return true if the old POI was found and could be deleted
* false otherwise
*/
bool modifyPointOfInterest( const homer_mapnav_msgs::ModifyPOI::ConstPtr& poi );
/** Deletes a POI with a certain name from the list
* @param name Name of the POI to be deleted
* @return true if the POI was found and could be deleted
* false otherwise
*/
bool deletePointOfInterest( std::string name );
/**
* @brief place the current poi list
* @param poilist new poi list
*/
void replacePOIList(std::vector<homer_mapnav_msgs::PointOfInterest> poilist);
/**
* @brief Publishes a PointsOfInterest Message with current POIs
*/
void broadcastPoiList();
/** Returns current POI list
* @return the POI list
*/
std::vector< homer_mapnav_msgs::PointOfInterest > getList();
private:
/** Looks for POI with name in the list
* @param name Name of the POI
*/
bool poiExists( std::string name );
/** The copy constructor of the class.
* It's kept private, because it will never be used.
*/
PoiManager( const PoiManager& instance );
/** Holds the POI vector */
std::vector< homer_mapnav_msgs::PointOfInterest > m_Pois;
/** publisher that publishes the current poi list */
ros::Publisher m_POIsPublisher;
};
#endif
#ifndef ROI_MANAGER_H
#define ROI_MANAGER_H
#include <ros/ros.h>
#include <homer_mapnav_msgs/RegionOfInterest.h>
#include <homer_mapnav_msgs/RegionsOfInterest.h>
#include <geometry_msgs/PointStamped.h>
#include <sstream>
#include <Eigen/Geometry>
#include <tf/transform_listener.h>
/**
* @class RoiManager (Roi = Region of interest)
* @author Viktor Seib (R23)
* @brief This class manages the List of regions of interest (ROIs)
*
* This class keeps a list of all ROIs within the current map. It provides the usual functions
* to edit the list.
*/
class RoiManager
{
public:
/** The constructor of the class. */
RoiManager(ros::NodeHandle* nh);
/** constructor initializing the roi list */
RoiManager( std::vector< homer_mapnav_msgs::RegionOfInterest > rois );
/** Does nothing. */
~RoiManager() {}
/** Adds a new ROI to the list, in contrast to POIs, several ROIs with the same name are allowed
* @param roi RegionOfInterest message with the ROI to be added
* @return true if successful, false otherwise
*/
bool addRegionOfInterest( const homer_mapnav_msgs::RegionOfInterest::ConstPtr& roi );
/** Tests all Rois and returns a vector of ids in which the pose is
* @param pose Pose which is tested to be inside the Rois
* @return vector of ids in which the pose is
*/
std::vector<homer_mapnav_msgs::RegionOfInterest> pointInsideRegionOfInterest( const geometry_msgs::PointStamped point );
/** Replaces a ROI with a new one
* @param roi RegionOfInterest to be inserted
* the ROI with the same ID as the new one is first deleted
* @return true if the old ROI was found and could be deleted
* false otherwise
*/
bool modifyRegionOfInterest( const homer_mapnav_msgs::RegionOfInterest::ConstPtr& roi );
/** Deletes all ROIs with a certain name from the list
* @param name Name of the ROIs to be deleted
* @return true if the ROI was found and could be deleted
* false otherwise
*/
bool deleteRegionOfInterest( std::string name );
/** Deltes ROI with the given id
* @param id ID of ROI to be deleted
* @return true if the ROI was found and could be deleted
* false otherwise
*/
bool deleteRegionOfInterest( int id );
/**
* @brief place the current roi list
* @param roilist new roi list
*/
void replaceROIList(std::vector<homer_mapnav_msgs::RegionOfInterest> roilist);
/** Returns current ROI list
* @return the ROI list
*/
std::vector< homer_mapnav_msgs::RegionOfInterest > getList();
/**
* @brief Publishes a RegionsOfInterest Message with current ROIs
*/
void broadcastRoiList();
/** Returns name of ROI
* @param id of ROI
* @return ROI name
*/
std::string getROIName(int id);
private:
/** Looks for ROI with name in the list
* @param id ID of the ROI
*/
bool roiExists(int id );
/** Looks for ROI with name in the list
* @param name Name of the ROI
*/
bool roiExists( std::string name );
/**
* @brief gets the highest id of all ROIs and save it into m_highest_id
*/
void setHighestId();
/** The copy constructor of the class.
* It's kept private, because it will never be used.
*/
RoiManager( const RoiManager& instance );
/** Holds the ROI vector */
std::vector< homer_mapnav_msgs::RegionOfInterest > m_Rois;
/** publisher that publishes the current roi list */
ros::Publisher m_ROIsPublisher;
/** to set a new id, the current highest id is needed */
int m_highest_id;
tf::TransformListener tf_listener;
};
#endif
/*
* Copyright (c) 2008, Willow Garage, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Willow Garage, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE