An Engineer's Blog

Back

Autonomous micro UAV indoor mapping, no GPS, one cameraBlur image

Overview#

This is the first portfolio part of my bachelor thesis project: an autonomous micro UAV that maps a building interior without GPS, using nothing but a camera. The previous post set up the simulator side, PX4 in Gazebo with MAVROS. This stage points that stack at the actual thesis question: if the drone cannot see satellites, where does its position come from, and how does a map get built from a camera alone?

The work split into two stages, both recorded the same day. Stage A is the stress test reel: fly the drone hard in simulation, then test visual localization methods against real footage. Stage B is the payoff: the full flight stack with ORB-SLAM, running in both simulation and real life, handing back a finished map.

Stage A: stability, agility, and the localization shootout#

Stage A: offboard stabilization, circular and lemniscate trajectory tests, the SDVL vs SVO comparison, and dense mapping.

Offboard communication and stabilising#

First things first, and the opening caption says it: offboard communication and stabilising. The drone hovers in a simulated room while RViz tracks its pose axes. This is the MAVROS offboard link from the previous post doing its job: without a stable position estimate and a clean command path, every test after this is meaningless.

Pose agility test: circular trajectory#

RViz tracing a circular trajectory with the drone's pose axes while the drone flies the circle in Gazebo Pose agility test: a full circle in RViz on the left, the drone following it in Gazebo on the right.

The circle test checks how well the drone tracks a smoothly curving path. Circles are gentle, but they never stop accelerating: the drone has to bank continuously, which is exactly the kind of motion that shakes a camera and upsets a visual tracker.

Manoeuvring test: lemniscate trajectory#

RViz tracing a lemniscate, or figure-eight, trajectory with pose axes at each crossing Manoeuvring test: the figure-eight, with the tight turns at the crossing point.

The lemniscate, or figure-eight, is the nastier cousin of the circle. At the crossing point the drone has to flip its turn direction through the tightest curvature on the path. If the controller overshoots there, the error compounds on the way back. Watching the traced line stay clean through the crossing says the whole chain, planner to MAVROS to PX4, is tight.

The localization shootout: SDVL vs SVO#

Split screen comparing SDVL and SVO running on the same real office footage The shootout: semi-direct visual localization on the left, SVO on the right, same flight, same office.

With the drone proven flyable, the video moves to real footage from the office floor and puts two camera-only localization methods head to head. SDVL, semi-direct visual localization ↗, is shown first running on the real feed, building its pink point cloud and camera trail live. Then the split screen runs SDVL and SVO ↗, semi-direct visual odometry, on the same flight. Both work without GPS; the difference shows up in how they hold onto the world as the drone swings past desks and chairs.

Mapping: the dense map#

RViz building a dense white point map slice by slice while the drone sweeps the room in Gazebo Dense mapping: the room accumulating slice by slice from the depth data.

The last leg of Stage A is mapping, dense map, RGB-D only. No loop closures, no landmarks, just depth data piling into a voxel grid until the room is a solid white model in RViz. Localization keeps the drone honest; the dense map is the deliverable.

Stage B: the full stack, simulation and real life#

Stage B: ORB-SLAM and the full flight stack, initialization through to map completion, then the same in SITL at double speed.

Stage B puts ORB-SLAM into the full flight stack and runs it in both worlds at once. The screen is doing four jobs at the same time: the physical drone on the floor, the keyframe trajectory, the camera’s own view with tracked features and the live counter (SLAM MODE | KFs: 24 MPs: 1883 Matches: 250, keyframes, map points, feature matches), and the dense map growing in RViz.

The captioned phases repeat the Stage A discipline with the tracker in the loop:

  • Initialization: the drone sits, the camera finds features, and the first keyframes anchor the map. Nothing moves until the tracker is confident.
  • Diagonal Trajectory: climb plus sideways travel at once, so the camera pitches and rolls while the tracker has to keep its place. The Stage A agility test, now with SLAM online.
  • Back to start: fly the loop home and see where “home” actually lands. The gap between where the drone started and where it thinks it started is the drift, and drift is the tax every visual system pays.
  • Map Completion: the dense map fills in to a recognizable copy of the room, and the trajectory loop closes neatly inside it.

The four panels during initialization: drone on the floor, keyframe trajectory, feature-tracked camera view, and the dense map in RViz Initialization: the tracker anchors the first keyframes before anything moves.

The last third of the video returns to SITL, the same PX4-in-Gazebo setup from the previous post, now wearing this thesis work on top. SITL Mapping, Speed x2.0 flies a simulated house while the dense pipeline rebuilds it, and SITL Planner, Speed x2.0 draws a green path across the finished map from start to goal and flies it. Running the mapping in simulation first is what makes the real flights calm: algorithms get to fail in a house where nobody pays for wall repairs.

The SITL planner drawing a green path across the completed house map while the drone follows in Gazebo Planner at work: start to goal over the dense map, at double speed.

What carried over#

Stage A was the parts check: a controller that tracks circles and figure-eights, and two visual localization methods that survive real footage. Stage B bolted those parts into one stack, ORB-SLAM included, and ran it in simulation and then on the real floor. It ends with a drone that holds itself together on camera alone and hands back a map of the room it just flew. The next stages push toward longer autonomous runs and the hardware lessons that only exist outside the simulator.

Autonomous micro UAV indoor mapping, no GPS, one camera
https://tin.ng/blog/2021-01-20--autonomous-uav-indoor-mapping
Author Tin Nguyen
Published at January 20, 2021
Comment seems to stuck. Try to refresh?✨