Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to set up the environment and carry out the mapping test

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

How to achieve environment establishment and mapping testing, in view of this problem, this article introduces the corresponding analysis and solutions in detail, hoping to help more partners who want to solve this problem to find an easier way.

At present, SLAM mapping is needed in the use of robots, because the core of mobile robots to achieve autonomous walking is to achieve autonomous positioning and navigation, which will involve positioning, mapping, path planning and other issues in autonomous positioning and navigation technology, and the quality of map construction will directly affect the walking path of the robot. If a robot wants to reach a certain destination, it needs to be the same as human beings in drawing maps. The process of describing and understanding the environment mainly depends on maps.

At present, the methods of mapping include lidar, visual mapping, deep learning and so on. Cartographer introduced today belongs to laser slam. The mainstream laser SLAM algorithms are hector, gmapping, karto, cartographer and so on.

Here is a brief introduction to several SLAM algorithms:

1. Hector is a combination of robust scanning matching method 2D_SLAM method and navigation technology using inertial sensing system. Laser scanners with high sensor requirements, high update frequency and small measurement noise do not need odometer. It is possible to make aerial drones and ground cars run in uneven areas. The author uses the high update rate and low range measurement noise of modern lidar to estimate the motion of the robot in real time by scanning matching. Therefore, when there are only laser sensors with low update rate, even if the ranging estimation is very accurate, there will be some problems with the system.

Hector is based on the optimized algorithm (solving the least square problem). Its advantages and disadvantages: it does not need odometer, but it requires high 40Hz for radar frame rate. It can estimate the posture of 6 degrees of freedom and can adapt to the uneven situation in the air or on the ground. The selection of the initial value has a great influence on the result, so the radar frame rate is required to be high.

2. Gmapping is a laser SLAM algorithm based on particle filter, which has been integrated into ROS and is the most widely used SLAM algorithm in mobile robots. The algorithm based on particle filter uses many weighted particles to represent the posterior probability of the path, and each particle gives an importance factor. However, they usually need a large number of particles to get better results, thus increasing the computational complexity of the algorithm. In addition, the particle degradation depletion problem related to the PF resampling process also reduces the accuracy of the algorithm.

Disadvantages: heavily rely on odometer, can not adapt to UAV and uneven areas of the ground, no loop (laser SLAM is difficult to do loop detection), large scenes, in the case of more particles, especially consume resources.

3. Karto is a graph-based SLAM algorithm, which uses highly optimized and non-iterative cholesky matrices to decouple sparse systems as solutions. The graph optimization method uses the mean of the graph to represent the map, each node represents a location point of the robot trajectory and the sensor measurement data set, the connection of the arrow represents the motion of the continuous robot location point, and each new node joins. The map will be calculated and updated according to the constraints of the node arrows in the space. The more the landmark landmark, the greater the memory requirement. However, the graph optimization method has more advantages than other methods in mapping in the general environment.

Karto adopts spa (karto_slam) or G2o (nav2d), and the front end and back end of karto are carried out by single thread.

4.LagoSLAM is a linear approximate graph optimization and does not require initial assumptions. The basic method of graph optimization of slam is to minimize the nonlinear nonconvex cost function. In each iteration, the initial problem of local convexity is solved to update the graph configuration, and the process iterates a certain number of times until the local minimum cost function is reached. Suppose that the starting point minimizes the local cost function after many iterations. . Assuming that the relative position and direction of each node in the graph are independent, the author solves a system of equations equivalent to the non-convex cost function. For this reason, a program based on graph theory is proposed, and the first-order approximation of the nonlinear system is obtained by linear positioning and linear position estimation.

5. Cartographer is a real-time indoor SLAM project developed by google. Cartographer adopts the method of nonlinear optimization based on ceres developed by google. The highlight of cartographer lies in code specification and engineering, which is very suitable for commercial applications and redevelopment. And cartographer's idea of building a global map based on submap subgraph can effectively avoid the interference of moving objects in the process of mapping. And cartographer supports multi-sensor data (odometry, IMU, LaserScan, etc.) mapping, supporting 2D_SLAM and 3D_SLAM mapping.

Can naturally output covariance matrix, back-end optimized input. Low-cost radar can also produce good results. Cartographer is a set of SLAM algorithm based on graph optimization developed by google.

The cartographer algorithm does not give people an amazing feeling, but the main goal of the algorithm is to achieve low computing resource consumption and achieve the purpose of real-time SLAM, so it is very suitable for embedded end use.

This article is an introduction to cartographer source code download and demo testing in linuxPC environment (Ubuntu16). The prerequisite for this article is that you have installed any of the following versions of ROS on your computer: Noetic, Kinetic, Melodic.

Algorithm analysis

The algorithm is mainly divided into two parts, the first part is called Local SLAM, this part establishes and maintains a series of Submap through a frame of Laser Scan, and the so-called submap is a series of Grid Map. When there is a new Laser Scan, it will be inserted into the best position in the subgraph by Ceres Scan Matching. But submap will cause the problem of error accumulation, so the second part of the algorithm, called Global SLAM, is to eliminate the cumulative error through Loop Closure closed-loop detection: when a submap is built, that is, no new laser scan will be inserted into the submap, the algorithm will add the submap to the closed-loop detection. The essence of closed-loop detection is also an optimization problem, which is expressed in the form of a pixel-accurate match, and the method to solve the optimization problem is Branch-and-Bound Approach.

Author: conscience still exists

Reprint authorization and onlookers: welcome to add Wechat official account: Yu Linjun

Installation introduction

The installation of cartographer mainly includes three parts: cartographer, cartographer-ros, and ceres-solver. Cartographer is the computing part, cartographer-ros is the part of the algorithm to communicate and interact with data in ROS. Ceres-solver Google developed a library for nonlinear optimization, which is widely used in Google's open source lidar slam project cartographer.

There are two methods of installation, one is the integrated download configuration of the official website, and the other is to install and configure the dependent parts needed by cartographer separately.

The difference between the two ways is that the first one is convenient, but the download of related files in Google will fail due to network problems (you know), so there is a separate download and compilation of the dependency, and finally download cartographer to compile.

Official website:

1. Install the wstool download tool, rosdep, and ninja compilation tools (ninja is a new compilation gadget that replaces complex make for fast compilation)

Sudo apt-get update

Sudo apt-get install-y python-wstool python-rosdep ninja-build

two。 Establish a two-in-one environment of wstool download and ROS basic compilation

Mkdir catkin_wscd catkin_wswstool init srcwstool merge-t src https://raw.githubusercontent.com/googlecartographer/cartographer_ros/master/cartographer_ros.rosinstall

This is the contents of the file where the wstool command generates .rosinstall, and you can see that the cartographer and cartographer-ros download links are set.

Wstool update-t src

Wait for the download quietly, and the speed depends on your perception of Google.

3. Install proto3.

Protocol Buffers (Protobuf for short) is a serialization framework produced by Google, which has nothing to do with development language and platform, and has good scalability. Protobuf, like all serialization frameworks, can be used for data storage and communication protocols.

Src/cartographer/scripts/install_proto3.sh

In addition, in addition to Protobuf, we can also configure other dependencies, these scripts are in this directory, if you encounter dependency problems in the compilation process, you can use the script to download.

4.rosdep init was installed when installing ROS, but there are often problems with this. I have written a file about ROS installation before, so if you are interested, you can take a look at it.

There are two ways to solve this problem: visit the DNS parsing link to solve the problem or switch the software source directly.

The solution of DNS parsing:

Switch linux software sources:

Sudo rosdep initrosdep updaterosdep install-from-paths src-ignore-src-rosdistro=$ {ROS_DISTRO}-y

5. The last step of compilation

Catkin_make_isolated-install-use-ninjasource install_isolated/setup.bash

But many times because of download problems, there will be problems of one kind or another, so the following method appears, download the package separately, and then compile and install it.

Note! In the process of compiling cartographer, contrary to what I wrote in this article, I compiled many times before compiling successfully, and there were all kinds of compilation problems, mostly version problems. So please pay attention to download the versions of each subpackage and remember ~

Just look at the download record of my probuf version.

Subcontract compilation method:

Cartographer is divided into six parts, namely, cartographer eigen3.2.9,ceres1.13.0,protobuf greater than 3.0. 0. Compile separately:

1.eigen

Eigen is an advanced C + + template header library for linear algebra, matrix and vector operations, geometric transformations, numerical solvers and related algorithms. Since version 3.1.1, Eigen is open source software licensed under Mozilla Public License 2.0. Earlier versions were licensed under the GNU lesser General Public license.

Note warning: cartographer has strict version restrictions on eigen,ceres,protobuf, the version must be strict!

# Select a version of 3.2.9git clone https://gitlab.com/libeigen/eigen.gitmkdir buildcd buildcmake.. sudo make install

Installation completed

2.ceres

Ceres solver is a library developed by Google for nonlinear optimization, which is widely used in Google's open source lidar slam project cartographer.

Note: ceres version must be 1.13.0, other versions do not match eigen3.2.9

# Select the version 1.13.0git clone https://github.com/ceres-solver/ceres-solver.gitmkdir buildcd buildcmake.. make-j8sudo make install

If this compilation problem occurs during compilation:

Failed to find glog

-- Failed to find installed glog CMake configuration, searching for glog build directories exported with CMake.

-- Failed to find an installed/exported CMake configuration for glog, will perform search for installed glog components.

-Failed to find glog-Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h

The reason for this is the lack of the glog library (glog is a C++ log library that provides API in C++ streaming style. We need to install gflags before installing glog so that glog can use gflags to parse command line arguments). We can install it with apt-get install or download the source code to compile and install.

Apt-get install installation:

Sudo apt-get install libgoogle-glog-dev

Download the source code for compilation and installation:

Git clone https://github.com/google/glog.gitcd glogmkdir buildcmake.. makesudo make install

Then re-compile and install cere, and pass another pass.

3. Protobuf

Protocol Buffers (Protobuf for short) is a serialization framework produced by Google, which has nothing to do with development language and platform, and has good scalability. Protobuf, like all serialization frameworks, can be used for data storage and communication protocols.

Note: protobuf installation method is special, script installation

Select the version of 3.0.0git clone https://github.com/protocolbuffers/protobuf.git./autogen.sh

We will also encounter error problems this time.

First error 48: autoreconf: not found

Autogen.sh generation is performed under different versions of tslib. The reason for them is the same, because there is no automake tool installed, just install it with the following command.

Sudo apt-get install autoconf automake libtool

The second error may be a download problem. You will be prompted here that the download failed. You can choose to comment out or use the second compilation method I provide:

# if you encounter Error,prot:443, comment on line 34 of the autogen.sh script. / configuremake-j8sudo make installsudo ldconfig# to test protobufprotoc-- version# will display libprotoc 3.0.0 without accident

The second compilation method:

As mentioned above, we can find the download scripts of cartographer dependent files in the cartographer/scripts directory, and there are compilation options in these scripts. At this time, we can take a look at the install_proto3.sh file, where you can see the following:

Mkdir buildcd buildcmake-G Ninja\-DCMAKE_POSITION_INDEPENDENT_CODE=ON\-DCMAKE_BUILD_TYPE=Release\-Dprotobuf_BUILD_TESTS=OFF\.. / cmakeninjasudo ninja install

We can copy and compile directly.

4.abseil

Abseil is google's open source C++ universal library, which is intended to complement the standard library. Abseil not only provides functions that the standard library does not have but is very commonly used, but also enhances some functions of the standard library. The use of abseil library can improve the program performance and development efficiency.

Cartographer does not require a version of abseil, but it must be.

Git clone https://github.com/abseil/abseil-cpp.gitmkdir buildcd buildcmake.. -DCMAKE_CXX_STANDARD=11make-j8sudo make install

However, after compiling abseil, you may encounter this problem.

CMake Error at CMakeLists.txt:49 (find_package):

By not providing "FindAbseil.cmake" in CMAKE_MODULE_PATH this project has

Asked CMake to find a package configuration file provided by "Abseil", but

CMake did not find one.

Could not find a package configuration file provided by "Abseil" with any

Of the following names:

AbseilConfig.cmake

Abseil-config.cmake

Add the installation prefix of "Abseil" to CMAKE_PREFIX_PATH or set

"Abseil_DIR" to a directory containing one of the above files. If "Abseil"

Provides a separate development package or SDK, be sure it has been

Installed.

But it's okay, because when CMakeLists.txt searches for absil, the name defined is different from your compiled abseil name. CMakeLists.txt is uppercase, while the actual package name you compiled and installed is lowercase.

The modification is shown above: Abseil is changed to absl

5.carographer

Note: carographer and cartographer _ ros versions must correspond

Mkdir cartographercd cartographer & mkdir srccd src

Git clone https://github.com/cartographer-project/cartographer.gitgit clone https://github.com/cartographer-project/cartographer_ros.git

Catkin_make_isolated / * can also use * / catkin_make_isolated-- install-- use-ninja

Compiled successfully:

Map building and development

Now I have installed the ROS integration of Cartographer and Cartographer, and officially provide some datasets, Deutsches Museum (Deutsche Museum), so I can easily test Cartographer to generate maps and other functions.

Download the sample package (such as the German Museum's 2D and 3D backpack series) to a known location

The example is located in ~ / Downloads and uses roslaunch to call up the demo:

# Download the 2D backpack example bag.wget-P ~ / Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_2d/cartographer_paper_deutsches_museum.bag

# Launch the 2D backpack demo.roslaunch cartographer_ros demo_backpack_2d.launch bag_filename:=$ {HOME} / Downloads/cartographer_paper_deutsches_museum.bag# Download the 3D backpack example bag.wget-P ~ / Downloads https://storage.googleapis.com/cartographer-public-data/bags/backpack_3d/with_intensities/b3-2016-04-05-14-14-00.bag# Launch the 3D backpack demo.roslaunch cartographer_ros demo_backpack_3d.launch bag_filename:=$ {HOME} / Downloads/b3-2016-04-05-14-14-00.bag

It will be the problem of downloading again. These files are big, slow and often fail. I also tried my best to download them.

In order to facilitate everyone's testing, you can use the official account backstage to private me, or add my WeChat account, and I will send you the files I downloaded.

The screenshot is limited. I forgot to take the screenshot before, so there is only one now. We made do with it.

Generate a .pdstream map (wait until cartographer_offline_node is complete)

Roslaunch cartographer_ros offline_backpack_2d.launch bag_filenames:=$ {HOME} / Downloads/cartographer_paper_deutsches_museum.bag

Then run pure positioning:

Roslaunch cartographer_ros demo_backpack_2d_localization.launch load_state_filename:=$ {HOME} / Download/cartographer_paper_deutsches_museum.bag.pbstream bag_filename:=$ {HOME} / Downloads/cartographer_paper_deutsches_museum.bag 's answers to the questions on how to build the environment and carry out mapping testing are shared here. I hope the above content can be of some help to you, if you still have a lot of questions to solve. You can follow the industry information channel for more related knowledge.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report