Deployment on Mars: mapping and location tutorial


This is the fourth in a sequence of blog about the open source Mars Rover. Most of the concepts discussed here apply to other wheeled robots as well. You can read part 1, 2 and 3 at these relations.

walk in the street

When I send my Mars Rover on a mission to the grocery store or to drop off another robot at a co-worker's house during quarantine and my cellular connection is not good or I don't want to interfere it, I need the robot to drive autonomously . To do this, the robot must understand where it is in the world and where the obstacles are. In recent years, it has gotten pretty straightforward. We will follow the steps to configure the two most used packages for 2D SLAM and localization, gmapping and amcl, in order to produce high fidelity maps of the robot setting. Use SLAM to make a map, then use location to continually update the robot's location after that map is created.

Don't go anywhere without a rock solid odometry

The package that we will see is designed to work with lidar and any type of odometry. There are other robust solutions when you don't have LIDAR data, but since LIDAR is fast becoming a default in many mobile databases, we will focus on gmapping, which is robust and has a simple interface. More advanced tracking packages exist, but the reality is that poor quality maps are often the result of poor odometry or uncalibrated sensors, and gmapping actually works very well and takes up less space. It's tempting to set SLAM, but you'll save a lot of time if you enter your odometry first. Learn how to do this in the previous episode, Deployment on Mars: Rock-Solid Odometry for Wheeled Robots.

Mapping the Mars Rover blog on a mobile robot

Before setting up the mapping, make sure your odometry is working properly. On the left, an odometry error causes an occasional skid severe enough to devastation the whole map.

Create a map with Gmapping

Below the hood, gmapping uses a Rao Blackwellized particulate filter. Simply put, the algorithm generates a series of robot positions (called particles) in successive time steps based on the odometry provided, which are then assigned a weight based on the correspondence between their position and the LIDAR scan. really perceived. Rao Blackwell's theorem means that the filter minimizes the root mean square error.

Let's put it in its place:

Verify that your lidar is operational and that you can view the scan data at a rate of at least 3 Hz.

Make sure your tf2 tree is configured correctly. There must be a static link between base_link and the lidar framework. Check that the LIDAR is in the correct position in relation to the base_link. A good way to settle this is to rotate your robot in place and verify that the LIDAR scans of nearby substances remain in place. Your trees should look like odom -> base_link -> lidar_frame.

Install gmapping: `sudo apt install ros-melodic-slam-gmapping`, replacing melodic with your distribution (kinetic or noetic)

Edit the analysis theme to match your LIDAR output theme. I added an example parameter (odometry error in translation) and set it as default.

On Freedom, make sure to enable the theme / map on bandwidth. Then go to SETUP> PILOT> ENVIRONMENT and make sure the map theme is set to / map. Switch back to the PILOT view and you should start to see a map theme! Drive the robot and see if the map updates with new landmarks. Don't worry if it doesn't look perfect the first time! For now, please download the map at a frequency of 1Hz or higher so that we can see the changes, but once the map stops changing you can shrink it down to every 30 seconds or download it only. just once.

Mapping the Mars Rover blog on a mobile robot (2)

Map view from the Pilot tab of the Freedom Robotics web application. Camera view and LIDAR inserts let you create a map from anywhere in the world.

Save the card for later

Gmapping does not automatically save the map file for you, so you will need to save it while running gmapping. To do this, we will use map_server (`sudo apt install ros-melodic-map-server`).

Open your .pgm file in any graphics editor and correct any errors or add prohibited areas by coloring it. It is also useful when objects have changed.

Localization using AMCL

Gmapping will always start from scratch, but you'll probably want to reuse the map you created earlier instead of creating a new one each time. This is where localization comes in with amcl (Monte Carlo adaptive localization). It works the same as SLAM, except that it locates and does not create a map.

 

First, let's load the map you just created into ROS, again using map_server. Create a new startup file, amcl.launch, and add the following:

The interface and internal components of amcl are very similar to those of gmapping. Now run this file, move your robot and verify that you are improving the location estimate provided by the odometry.

Beyond gmapping and amcl

I have found that a properly fitted particulate filter works just as well as an extended or unscented Kalman filter. Pick packages that you understand, review outstanding issues, questions people are asking about them on answer.ros.org, and if there is still activity in the package repository, which are good indicators of support. from the community.

Outdoors, with GPS: robot_localisation

Using an IMU

For 3D mapping, I recommend RTABmap. It is well compatible, powerful and works with various sensors out of the box. It is inherently more complex and computationally intensive than any 2D mapping software, so I would only suggest it if 3D mapping and localization is absolutely necessary. With many fine adjustments, I got millimeter accuracy before using depth cameras, lidar, and wheel odometry.

Rather than investing effort in creating high fidelity maps and precise locations, you can also consider “going to the light of the map”. Rather than blindly relying on global location, it may be a good idea to program your robot to react to ad hoc sensory input. If you're building a pallet-moving robot, use the map to bring the robot to the approximate location, then switch to a feature-based or marker-based local controller on the pallets. Either way, having an accurate location and mapping makes navigation a lot easier.

 

Comments

Popular posts from this blog

Freedom Robotics Guide to Cellular Routers for Robot Connectivity

Revitalization Amid Tech