cartographer-project / cartographer

Cartographer is a system that provides real-time simultaneous localization and mapping (SLAM) in 2D and 3D across multiple platforms and sensor configurations.
Apache License 2.0
7.09k stars 2.25k forks source link

Using cartographer without ROS #1797

Closed Juliocasta5 closed 3 years ago

Juliocasta5 commented 3 years ago

HI, I've been using Cartographer in ros melodic during some weeks, but I really need to use it without Ros. If someone could guide me or give me some tips to do it, I'll be very pleased.

Thanks.

MichaelGrupp commented 3 years ago

Related: https://github.com/cartographer-project/cartographer/issues/1229

From a library perspective, the MapBuilder is the central entity for SLAM in cartographer. Looking at what cartographer_ros does internally (e.g. map_builder_bridge) surely helps even if you don't want to use ROS yourself.

JakeInit commented 3 years ago

As Michael said, "MapBuilder" is the center piece of running cartograppher. If you look in cartographer/mapping, there is a file called map_builder_test.cc. There are multiple scenarios, both 2d and 3d that can help show how to run cartographer without ros. This test creates dummy data, that you would just replace with either bag data or real data. Start with using lidar data only to begin with. It is easy and good enough for getting your first maps. Look at how they import their configurations so you can have your own file to edit when changing cartographer parameters. After importing parameters, set up your trajectory. Just use one trajectory to start (I have always only needed one so far) and hold onto that trajectory id. You will use it to insert the data you get from lidar. Once you start inserting data, you can start pulling local poses and then use the local to global transform to get your global poses. Also, go ahead and use the slam call back they create, or you can look at what ROS does.