Skip to menu

Robotics with Object Pascal

Rover written with RUST

Fifth : Visual Odometry

2025.10.28 22:59

me Views:0

Visual Odometry

 

Now that we have a filtered 3D point cloud from a single stereo frame, the next stage is Visual Odometry (VO). This is the process of estimating the rover's movement (translation and rotation) by comparing consecutive point clouds or images.

The basic idea is:

  1. Capture Frame 1: Get the filtered point cloud (like the point_cloud_filtered_full.txt you just saved).

  2. Capture Frame 2: Move the rover slightly, capture a new stereo pair, and generate its filtered point cloud.

  3. Find the Transformation: Use algorithms (like ICP - Iterative Closest Point, or feature matching) to find the 3D rotation and translation that best aligns Point Cloud 1 with Point Cloud 2. This transformation represents the rover's movement between the two frames.

  4. Update Position & Map: Add the estimated movement to the rover's overall pose (position and orientation) and optionally add the new 3D points to a growing map of the environment.

  5. Repeat: Continue capturing frames and estimating motion.


This VO step is significantly more complex than the previous stages. It involves tracking features or aligning point clouds between frames.

 

// New project folder : ~/RUST/rover_odometry  by  cargo new rover_odometry @ ~/RUST folder.

~/RUST/rover_odometry/Cargo.toml file:

[package]
name = "rover_odometry"
version = "0.1.0"
edition = "2024"

[dependencies]
# For linear algebra (points, vectors, matrices) - good practice for VO
nalgebra = "0.32"
# Error handling simplification
anyhow = "1.0"

 

//============================================

Plan for src/main.rs

 

The first step in visual odometry is to load the 3D point cloud data from the file I created.

I'll write code in src/main.rs to:

  1. Define a simple struct to hold an (x, y, z) point.

  2. Open and read the point_cloud_filtered_full.txt file line by line.

  3. Parse each line to extract the X, Y, and Z coordinates.

  4. Store these points in a Vec (vector) of our point structs.

  5. Print out how many points were loaded to confirm it works.

//============================================