Commit 8d4dc72b authored by Gill Lumer-Klabbers's avatar Gill Lumer-Klabbers
Browse files

Remove ros bridge, ros1_ws and related scripts

parent 709e54d2
ros1_bridge @ 3209bc77
Subproject commit 3209bc77c77b072013b05bcc6690a24a6bd16aeb
#!/bin/bash
source /opt/ros/noetic/setup.bash
cd ros1_ws
catkin_make #hector slam build
catkin_make #The first one failes..
eval "$(exec /usr/bin/env -i "${SHELL}" -l -c "export")" # reset vars
#bridge build
source /opt/ros/foxy/setup.bash
cd ../ros2_ws
colcon build --symlink-install #build ros2 ws
source /opt/ros/noetic/setup.bash
source install/local_setup.bash
source ../ros1_ws/local_setup.bash
cd ../bridge_ws
colcon build --symlink-install --packages-select ros1_bridge --cmake-force-configure
eval "$(exec /usr/bin/env -i "${SHELL}" -l -c "export")" # reset vars in terminal
# This file currently only serves to mark the location of a catkin workspace for tool integration
/opt/ros/noetic/share/catkin/cmake/toplevel.cmake
\ No newline at end of file
bin/
build/
lib/
msg_gen/
srv_gen/
hector_mapping/src/hector_mapping/
hector_nav_msgs/src/hector_nav_msgs/
.idea/
.vscode/
cmake-build-*/
# hector_slam
See the ROS Wiki for documentation: http://wiki.ros.org/hector_slam
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package hector_compressed_map_transport
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.5.2 (2021-04-08)
------------------
* Fix out of bounds access
Fixes `#52 <https://github.com/tu-darmstadt-ros-pkg/hector_slam/issues/52>`_ and `#70 <https://github.com/tu-darmstadt-ros-pkg/hector_slam/issues/70>`_
* Contributors: Stefan Fabian
0.5.1 (2021-01-15)
------------------
0.5.0 (2020-12-17)
------------------
* Moved hector_geotiff launch files to separate package to solve cyclic dependency.
Clean up for noetic release.
* Bump CMake version to avoid CMP0048 warning
* Contributors: Marius Schnaubelt, Stefan Fabian
0.4.1 (2020-05-15)
------------------
0.3.6 (2019-10-31)
------------------
0.3.5 (2016-06-24)
------------------
* Use the FindEigen3.cmake module provided by Eigen
* Contributors: Johannes Meyer
0.3.4 (2015-11-07)
------------------
0.3.3 (2014-06-15)
------------------
* fixed cmake find for eigen in indigo
* fixed libopencv-dev rosdep key
* Contributors: Alexander Stumpf, Johannes Meyer
0.3.2 (2014-03-30)
------------------
0.3.1 (2013-10-09)
------------------
* added changelogs
0.3.0 (2013-08-08)
------------------
* catkinized hector_slam
cmake_minimum_required(VERSION 3.0.2)
project(hector_compressed_map_transport)
find_package(catkin REQUIRED COMPONENTS cv_bridge geometry_msgs hector_map_tools image_transport nav_msgs sensor_msgs)
find_package(Eigen3 REQUIRED)
find_package(OpenCV REQUIRED)
catkin_package(
CATKIN_DEPENDS geometry_msgs nav_msgs sensor_msgs
)
###########
## Build ##
###########
include_directories(
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
)
add_executable(map_to_image_node src/map_to_image_node.cpp)
target_link_libraries(map_to_image_node
${catkin_LIBRARIES}
${OpenCV_LIBRARIES}
)
#############
## Install ##
#############
# all install targets should use catkin DESTINATION variables
# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html
install(TARGETS map_to_image_node
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)
<?xml version="1.0"?>
<package>
<name>hector_compressed_map_transport</name>
<version>0.5.2</version>
<description>
hector_compressed_map_transport provides means for transporting compressed map data through the use of image_transport.
</description>
<!-- One maintainer tag required, multiple allowed, one person per tag -->
<maintainer email="meyer@fsr.tu-darmstadt.de">Johannes Meyer</maintainer>
<!-- One license tag required, multiple allowed, one license per tag -->
<!-- Commonly used license strings: -->
<!-- BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 -->
<license>BSD</license>
<!-- Url tags are optional, but mutiple are allowed, one per tag -->
<!-- Optional attribute type can be: website, bugtracker, or repository -->
<!-- Example: -->
<url type="website">http://ros.org/wiki/hector_compressed_map_transport</url>
<!-- Author tags are optional, mutiple are allowed, one per tag -->
<!-- Authors do not have to be maintianers, but could be -->
<author email="kohlbrecher@sim.tu-darmstadt.de">Stefan Kohlbrecher</author>
<!-- The *_depend tags are used to specify dependencies -->
<!-- Dependencies can be catkin packages or system dependencies -->
<!-- Examples: -->
<!-- Use build_depend for packages you need at compile time: -->
<!-- <build_depend>message_generation</build_depend> -->
<!-- Use buildtool_depend for build tool packages: -->
<!-- <buildtool_depend>catkin</buildtool_depend> -->
<!-- Use run_depend for packages you need at runtime: -->
<!-- <run_depend>message_runtime</run_depend> -->
<!-- Use test_depend for packages you need only for testing: -->
<!-- <test_depend>gtest</test_depend> -->
<buildtool_depend>catkin</buildtool_depend>
<build_depend>cv_bridge</build_depend>
<build_depend>geometry_msgs</build_depend>
<build_depend>hector_map_tools</build_depend>
<build_depend>image_transport</build_depend>
<build_depend>nav_msgs</build_depend>
<build_depend>sensor_msgs</build_depend>
<build_depend>eigen</build_depend>
<run_depend>cv_bridge</run_depend>
<run_depend>geometry_msgs</run_depend>
<run_depend>hector_map_tools</run_depend>
<run_depend>image_transport</run_depend>
<run_depend>nav_msgs</run_depend>
<run_depend>sensor_msgs</run_depend>
<run_depend>eigen</run_depend>
<!-- The export tag contains other, unspecified, tags -->
<export>
<!-- You can specify that this package is a metapackage here: -->
<!-- <metapackage/> -->
<!-- Other tools can request additional information be placed here -->
</export>
</package>
//=================================================================================================
// Copyright (c) 2011, Stefan Kohlbrecher, TU Darmstadt
// 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 Simulation, Systems Optimization and Robotics
// group, TU Darmstadt 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 ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
// DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
// ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//=================================================================================================
#include "ros/ros.h"
#include <nav_msgs/GetMap.h>
#include <geometry_msgs/Quaternion.h>
#include <geometry_msgs/PoseStamped.h>
#include <sensor_msgs/image_encodings.h>
#include <cv_bridge/cv_bridge.h>
#include <image_transport/image_transport.h>
#include <Eigen/Geometry>
#include <hector_map_tools/HectorMapTools.h>
using namespace std;
/**
* @brief This node provides occupancy grid maps as images via image_transport, so the transmission consumes less bandwidth.
* The provided code is a incomplete proof of concept.
*/
class MapAsImageProvider
{
public:
MapAsImageProvider()
: pn_("~")
{
image_transport_ = new image_transport::ImageTransport(n_);
image_transport_publisher_full_ = image_transport_->advertise("map_image/full", 1);
image_transport_publisher_tile_ = image_transport_->advertise("map_image/tile", 1);
pose_sub_ = n_.subscribe("pose", 1, &MapAsImageProvider::poseCallback, this);
map_sub_ = n_.subscribe("map", 1, &MapAsImageProvider::mapCallback, this);
//Which frame_id makes sense?
cv_img_full_.header.frame_id = "map_image";
cv_img_full_.encoding = sensor_msgs::image_encodings::MONO8;
cv_img_tile_.header.frame_id = "map_image";
cv_img_tile_.encoding = sensor_msgs::image_encodings::MONO8;
//Fixed cell width for tile based image, use dynamic_reconfigure for this later
p_size_tiled_map_image_x_ = 64;
p_size_tiled_map_image_y_ = 64;
ROS_INFO("Map to Image node started.");
}
~MapAsImageProvider()
{
delete image_transport_;
}
//We assume the robot position is available as a PoseStamped here (querying tf would be the more general option)
void poseCallback(const geometry_msgs::PoseStampedConstPtr& pose)
{
pose_ptr_ = pose;
}
//The map->image conversion runs every time a new map is received at the moment
void mapCallback(const nav_msgs::OccupancyGridConstPtr& map)
{
int size_x = map->info.width;
int size_y = map->info.height;
if ((size_x < 3) || (size_y < 3) ){
ROS_INFO("Map size is only x: %d, y: %d . Not running map to image conversion", size_x, size_y);
return;
}
// Only if someone is subscribed to it, do work and publish full map image
if (image_transport_publisher_full_.getNumSubscribers() > 0){
cv::Mat* map_mat = &cv_img_full_.image;
// resize cv image if it doesn't have the same dimensions as the map
if ( (map_mat->rows != size_y) && (map_mat->cols != size_x)){
*map_mat = cv::Mat(size_y, size_x, CV_8U);
}
const std::vector<int8_t>& map_data (map->data);
unsigned char *map_mat_data_p=(unsigned char*) map_mat->data;
//We have to flip around the y axis, y for image starts at the top and y for map at the bottom
int size_y_rev = size_y-1;
for (int y = size_y_rev; y >= 0; --y){
int idx_map_y = size_x * (size_y_rev - y);
int idx_img_y = size_x * y;
for (int x = 0; x < size_x; ++x){
int idx = idx_img_y + x;
switch (map_data[idx_map_y + x])
{
case -1:
map_mat_data_p[idx] = 127;
break;
case 0:
map_mat_data_p[idx] = 255;
break;
case 100:
map_mat_data_p[idx] = 0;
break;
}
}
}
image_transport_publisher_full_.publish(cv_img_full_.toImageMsg());
}
// Only if someone is subscribed to it, do work and publish tile-based map image Also check if pose_ptr_ is valid
if ((image_transport_publisher_tile_.getNumSubscribers() > 0) && (pose_ptr_)){
world_map_transformer_.setTransforms(*map);
Eigen::Vector2f rob_position_world (pose_ptr_->pose.position.x, pose_ptr_->pose.position.y);
Eigen::Vector2f rob_position_map (world_map_transformer_.getC2Coords(rob_position_world));
Eigen::Vector2i rob_position_mapi (rob_position_map.cast<int>());
Eigen::Vector2i tile_size_lower_halfi (p_size_tiled_map_image_x_ / 2, p_size_tiled_map_image_y_ / 2);
Eigen::Vector2i min_coords_map (rob_position_mapi - tile_size_lower_halfi);
//Clamp to lower map coords
if (min_coords_map[0] < 0){
min_coords_map[0] = 0;
}
if (min_coords_map[1] < 0){
min_coords_map[1] = 0;
}
Eigen::Vector2i max_coords_map (min_coords_map + Eigen::Vector2i(p_size_tiled_map_image_x_,p_size_tiled_map_image_y_));
//Clamp to upper map coords
if (max_coords_map[0] > size_x){
int diff = max_coords_map[0] - size_x;
min_coords_map[0] -= diff;
max_coords_map[0] = size_x;
}
if (max_coords_map[1] > size_y){
int diff = max_coords_map[1] - size_y;
min_coords_map[1] -= diff;
max_coords_map[1] = size_y;
}
//Clamp lower again (in case the map is smaller than the selected visualization window)
if (min_coords_map[0] < 0){
min_coords_map[0] = 0;
}
if (min_coords_map[1] < 0){
min_coords_map[1] = 0;
}
Eigen::Vector2i actual_map_dimensions(max_coords_map - min_coords_map);
cv::Mat* map_mat = &cv_img_tile_.image;
// resize cv image if it doesn't have the same dimensions as the selected visualization window
if ( (map_mat->rows != actual_map_dimensions[0]) || (map_mat->cols != actual_map_dimensions[1])){
*map_mat = cv::Mat(actual_map_dimensions[0], actual_map_dimensions[1], CV_8U);
}
const std::vector<int8_t>& map_data (map->data);
unsigned char *map_mat_data_p=(unsigned char*) map_mat->data;
//We have to flip around the y axis, y for image starts at the top and y for map at the bottom
int y_img = max_coords_map[1]-1;
for (int y = min_coords_map[1]; y < max_coords_map[1];++y){
int idx_map_y = y_img-- * size_x;
int idx_img_y = (y-min_coords_map[1]) * actual_map_dimensions.x();
for (int x = min_coords_map[0]; x < max_coords_map[0];++x){
int img_index = idx_img_y + (x-min_coords_map[0]);
switch (map_data[idx_map_y+x])
{
case 0:
map_mat_data_p[img_index] = 255;
break;
case -1:
map_mat_data_p[img_index] = 127;
break;
case 100:
map_mat_data_p[img_index] = 0;
break;
}
}
}
image_transport_publisher_tile_.publish(cv_img_tile_.toImageMsg());
}
}
ros::Subscriber map_sub_;
ros::Subscriber pose_sub_;
image_transport::Publisher image_transport_publisher_full_;
image_transport::Publisher image_transport_publisher_tile_;
image_transport::ImageTransport* image_transport_;
geometry_msgs::PoseStampedConstPtr pose_ptr_;
cv_bridge::CvImage cv_img_full_;
cv_bridge::CvImage cv_img_tile_;
ros::NodeHandle n_;
ros::NodeHandle pn_;
int p_size_tiled_map_image_x_;
int p_size_tiled_map_image_y_;
HectorMapTools::CoordinateTransformer<float> world_map_transformer_;
};
int main(int argc, char** argv)
{
ros::init(argc, argv, "map_to_image_node");
MapAsImageProvider map_image_provider;
ros::spin();
return 0;
}
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package hector_geotiff
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.5.2 (2021-04-08)
------------------
* Refactored hector_geotiff dependencies.
* Contributors: Stefan Fabian
0.5.1 (2021-01-15)
------------------
* Fixed "SEVERE WARNING" by pluginloader when killing geotiff node.
Some minor cleanup.
* Contributors: Stefan Fabian
0.5.0 (2020-12-17)
------------------
* Added missing dependency for Qt5 cmake.
* Moved hector_geotiff launch files to separate package to solve cyclic dependency.
Clean up for noetic release.
* Qt5 support for hector geotiff on headless systems.
* Updated platform args. Test on robot.
* Experiments with platform argument.
* Renamed depends for (hopefully soon) rosdep compatibility.
* Moved to Qt5.
* Contributors: Stefan Fabian
0.4.1 (2020-05-15)
------------------
0.3.6 (2019-10-31)
------------------
* Update geotiff draw interface to support different shapes
* Contributors: Stefan Kohlbrecher
0.3.5 (2016-06-24)
------------------
* Use the FindEigen3.cmake module provided by Eigen
* hector_geotiff/hector_geotiff_plugins: added possibility to specify Color of robot path in the geotiff file in order to allow multiple color robot paths
* Contributors: Dorothea Koert, Johannes Meyer
0.3.4 (2015-11-07)
------------------
* Removes trailing spaces and fixes indents
* Contributors: YuK_Ota
0.3.3 (2014-06-15)
------------------
* fixed cmake find for eigen in indigo
* added launchfile to restart geotiff node
* Contributors: Alexander Stumpf
0.3.2 (2014-03-30)
------------------
* Add TrajectoryMapWriter to geotiff_mapper.launch per default
* Add arguments to launch files for specifying geotiff file path
* Contributors: Stefan Kohlbrecher
0.3.1 (2013-10-09)
------------------
* added missing install rule for launch files
* moved header files from include/geotiff_writer to include/hector_geotiff
* fixed warnings for deprecated pluginlib method/macro calls
* added changelogs
0.3.0 (2013-08-08)
------------------
* catkinized hector_slam
cmake_minimum_required(VERSION 3.0.2)
project(hector_geotiff)
set(CMAKE_CXX_STANDARD 14)
find_package(catkin REQUIRED COMPONENTS hector_map_tools hector_nav_msgs nav_msgs pluginlib roscpp std_msgs)
find_package(Qt5 COMPONENTS Widgets REQUIRED)
find_package(Eigen3 REQUIRED)
catkin_package(
INCLUDE_DIRS include
LIBRARIES geotiff_writer
CATKIN_DEPENDS hector_map_tools hector_nav_msgs nav_msgs pluginlib roscpp std_msgs
DEPENDS EIGEN3 Qt5Widgets
)
###########
## Build ##
###########
include_directories(
include
${catkin_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
)
add_library(geotiff_writer src/geotiff_writer/geotiff_writer.cpp)
target_link_libraries(geotiff_writer ${catkin_LIBRARIES} Qt5::Widgets)
add_dependencies(geotiff_writer ${catkin_EXPORTED_TARGETS})
add_executable(geotiff_saver src/geotiff_saver.cpp)
target_link_libraries(geotiff_saver geotiff_writer)
add_dependencies(geotiff_saver ${catkin_EXPORTED_TARGETS})
add_executable(geotiff_node src/geotiff_node.cpp)
target_link_libraries(geotiff_node geotiff_writer)
add_dependencies(geotiff_node ${catkin_EXPORTED_TARGETS})
#############
## Install ##
#############
# all install targets should use catkin DESTINATION variables