GithubHelp home page GithubHelp logo

gazebo_map_creator's Introduction

ROS2 Gazebo World 2D/3D Map Generator

For realistic navigation utilizing Nav2, maps are typically produced employing SLAM methodologies, which extends to simulations in Gazebo as well. This ensures the incorporation of SLAM-generated maps in the path planning process, thereby facilitating a more accurate verification and behaviour in simulated environments. However, there are instances where the primary focus lies solely on the Nav2 path planning module. In such scenarios, the requirement shifts towards synthetic, yet precise, maps that can be utilized for development, testing in conjunction with simulations, and at times, actual deployment too.

Creating maps for ROS2 Navigation 2 (Nav2) in Gazebo has traditionally been a challenging task. The prevailing method involved employing Simultaneous Localization and Mapping (SLAM) and navigating robots through the environment to create these maps. For ROS1 Kinetic, a plugin was developed to mitigate this issue, enabling map creation without relying on SLAM. However, this solution was limited to ROS1 and generated 2D maps only.

This git repository presents a Gazebo 11 (Classic) plugin, interfaced with a ROS2 service, specifically develop to generate 2D (.pgm) and 3D maps (Point Cloud) directly from the Gazebo world.

Tested on ROS2 (Foxy, Humble & Iron) with Gazebo 11 (Classic).

Some work done for IGN gazebo support. Partial code in gazebo_map_creator_ign directory (build disabled).

Guide:

https://medium.com/@arshad.mehmood/ros2-gazebo-world-map-generator-a103b510a7e5

Dependencies

sudo apt-get install libboost-dev libpcl-dev

Build

source /opt/ros/<humble|foxy>/setup.bash
mkdir -p robot_ws/src
cd robot_ws/src
git clone https://github.com/arshadlab/gazebo_map_creator.git
cd ..
rosdep install --from-paths src --ignore-src -r -y
colcon build --symlink-install
source ./install/setup.bash

Run

Console A

$ source ./install/setup.bash
$ gazebo -s libgazebo_map_creator.so myworld.world

Console B

$ source ./install/setup.bash
$ ros2 run gazebo_map_creator request_map.py -c '(-4.8,-4.5,0.03)(4.8,4.5,8.0)' -r 0.01 -f $PWD/map
$ ls
map.pcd map.bt map.pgm  map.png  map.yaml

Viewing Results

# Open 2D pgm map.
# sudo apt-get install xdg-utils
xdg_open map.pgm

# Open 3D pcd point cloud map
# sudo apt-get install pcl-tools

pcl_viewer map.pcd

Output samples

image

aws

image

image

image

Acknowledgement

Inspiration came from Gazebo Custom Messages

gazebo_map_creator's People

Contributors

arshadlab avatar arshadm78 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gazebo_map_creator's Issues

Issue during build using ROS2 Iron

I really appreciate your effort in building this very useful tool for gazebo. However, I cannot currently get it to build on ROS 2 Iron due to some issue with how the boost libraries and ROS seem to be interacting. My error output is attached below. Did you have this issue? and if so, what did you do to solve it?

If not, what version of ROS 2 are you using so I might be able to see where the issue lies. Thank you.

stderr.log

Build error in Humble

I am following the same instructions, my distro is humble and working on Ubuntu 22.04
Here's the colcon build output:

--- stderr: gazebo_map_creator                               
** WARNING ** io features related to pcap will be disabled
In file included from /usr/include/boost/gil/extension/io/png/detail/read.hpp:16,
                 from /usr/include/boost/gil/extension/io/png/read.hpp:14,
                 from /usr/include/boost/gil/extension/io/png.hpp:11,
                 from /usr/include/boost/gil/extension/io/png/old.hpp:11,
                 from /home/rihanadm/robot_ws/src/gazebo_map_creator/gazebo_map_creator/src/gazbeo_map_creator.cpp:28:
/usr/include/boost/gil/io/detail/dynamic.hpp:21:8: error: redefinition of ‘struct boost::gil::detail::construct_matched_t<N>’
   21 | struct construct_matched_t
      |        ^~~~~~~~~~~~~~~~~~~
In file included from /home/rihanadm/robot_ws/src/gazebo_map_creator/gazebo_map_creator/src/gazbeo_map_creator.cpp:27:
/usr/include/boost/gil/io/dynamic_io_new.hpp:23:8: note: previous definition of ‘struct boost::gil::detail::construct_matched_t<N>’
   23 | struct construct_matched_t
      |        ^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/gil/extension/io/png/detail/read.hpp:16,
                 from /usr/include/boost/gil/extension/io/png/read.hpp:14,
                 from /usr/include/boost/gil/extension/io/png.hpp:11,
                 from /usr/include/boost/gil/extension/io/png/old.hpp:11,
                 from /home/rihanadm/robot_ws/src/gazebo_map_creator/gazebo_map_creator/src/gazbeo_map_creator.cpp:28:
/usr/include/boost/gil/io/detail/dynamic.hpp:38:8: error: redefinition of ‘struct boost::gil::detail::construct_matched_t<0>’
   38 | struct construct_matched_t<0>
      |        ^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/rihanadm/robot_ws/src/gazebo_map_creator/gazebo_map_creator/src/gazbeo_map_creator.cpp:27:
/usr/include/boost/gil/io/dynamic_io_new.hpp:40:8: note: previous definition of ‘struct boost::gil::detail::construct_matched_t<0>’
   40 | struct construct_matched_t<0>
      |        ^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/gil/extension/io/png/detail/read.hpp:16,
                 from /usr/include/boost/gil/extension/io/png/read.hpp:14,
                 from /usr/include/boost/gil/extension/io/png.hpp:11,
                 from /usr/include/boost/gil/extension/io/png/old.hpp:11,
                 from /home/rihanadm/robot_ws/src/gazebo_map_creator/gazebo_map_creator/src/gazbeo_map_creator.cpp:28:
/usr/include/boost/gil/io/detail/dynamic.hpp:48:7: error: redefinition of ‘class boost::gil::detail::dynamic_io_fnobj<IsSupported, OpClass>’
   48 | class dynamic_io_fnobj
      |       ^~~~~~~~~~~~~~~~
In file included from /home/rihanadm/robot_ws/src/gazebo_map_creator/gazebo_map_creator/src/gazbeo_map_creator.cpp:27:
/usr/include/boost/gil/io/dynamic_io_new.hpp:50:7: note: previous definition of ‘class boost::gil::detail::dynamic_io_fnobj<IsSupported, OpClass>’
   50 | class dynamic_io_fnobj
      |       ^~~~~~~~~~~~~~~~
In file included from /usr/include/boost/algorithm/string/finder.hpp:23,
                 from /usr/include/boost/algorithm/string/find.hpp:22,
                 from /usr/include/boost/algorithm/string/predicate.hpp:24,
                 from /usr/include/pcl-1.12/pcl/io/file_io.h:47,
                 from /usr/include/pcl-1.12/pcl/io/pcd_io.h:45,
                 from /home/rihanadm/robot_ws/src/gazebo_map_creator/gazebo_map_creator/src/gazbeo_map_creator.cpp:30:
/usr/include/boost/algorithm/string/detail/finder.hpp: In member function ‘boost::iterator_range<Iterator> boost::algorithm::detail::first_finderF<SearchIteratorT, PredicateT>::operator()(ForwardIteratorT, ForwardIteratorT) const’:
/usr/include/boost/algorithm/string/detail/finder.hpp:67: note: ‘-Wmisleading-indentation’ is disabled from this point onwards, since column-tracking was disabled due to the size of the code/headers
   67 |                         if( boost::empty(m_Search) )
      | 
/usr/include/boost/algorithm/string/detail/finder.hpp:67: note: adding ‘-flarge-source-files’ will allow for more column-tracking support, at the expense of compilation time and memory
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-inconsistent-missing-override’ may have been intended to silence earlier diagnostics
gmake[2]: *** [CMakeFiles/gazebo_map_creator.dir/build.make:76: CMakeFiles/gazebo_map_creator.dir/src/gazbeo_map_creator.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:137: CMakeFiles/gazebo_map_creator.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< gazebo_map_creator [14.8s, exited with code 2]

gazebo not opening with the .so file

gzserver: symbol lookup error: /home/madhu/work/gazebo_map_creator_ws/install/gazebo_map_creator/lib/libgazebo_map_creator.so: undefined symbol: _ZN10gazebo_ros4Node3GetEv

When I try to run gazebo -s libgazebo_map_creator.so myworld.world command I get the above issue.
What could be the issue here?

No point cloud of ground plane

Hi,

Thanks for your great work and effort! I built a simple Gazebo world, and the conversion to .pcd file was smooth. However, I found that there's no point cloud for the ground plane, which is necessary for my use case. Could you please let me know if there's any way to include ground plane into the conversion as well?

Thanks in advance!
WX20240401-121337@2x
WX20240401-121409@2x

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.