Skip to content

7. Localization ​

7.1 No map: the start spot and the tags ​

The X30 patrols without a map. The robot starts on its dock; FAST-LIO’s start is the origin of the map frame, and every route is taught and repeated in that frame. Odometry drifts with every metre; tags (printed ArUco markers on walls and posts, recorded once in the site) correct the drift wherever the robot sees one.

localization_node estimates mapTodom, the correction between the map and the odometry frame, with an extended Kalman filter on SE(2):

7.2 The filter ​

7.2.1 State and prediction ​

The state is x=(x,y,ψ) of mapTodom with its covariance P. Between corrections, odometry carries the robot and x stays; only the uncertainty grows, and only with motion. Motion is counted in steps (motion_step_m 5 cm, motion_step_deg 2°) so that the sway of a standing robot adds nothing. For a step of Δs metres and Δθ radians, the process noise in the robot frame is

(7.1)Qbase=diag(σxy2Δs, σxy2Δs, σψ,m2Δs+σψ,rad2|Δθ|)

mapped into the state through the inverse of the measurement Jacobian, P←P+H−1QbaseH−⊤. With the defaults (σxy=0.03m/m, σψ,m=0.1∘/m) a 50 m walk without a tag leaves σxy=0.0350=0.21m and σψ=0.71∘.

7.2.2 Correction ​

A tag seen from the robot gives a measurement z of mapTbase with covariance R. The innovation against the prediction h(x)=mapTodomodomTbase, its covariance and the squared Mahalanobis distance are

(7.2)ν=z⊖h(x),S=HPH⊤+R,d2=ν⊤S−1ν

A measurement with d2 above the χ32 gate is rejected as an outlier (a tag recorded wrong, a tag moved, a false detection). Otherwise

(7.3)K=PH⊤S−1,x←x+Kν,P←(I−KH)P(I−KH)⊤+KRK⊤

The Joseph form keeps P symmetric and positive definite. After the update the uncertainty is floored at min_sigma_xy (1 cm) and min_sigma_yaw_deg (0.25°): the filter never becomes so sure of itself that it rejects the next tag.

gate_confidence0.950.990.999
χ32 gate7.8111.3416.27

7.2.3 How much a tag is trusted ​

A tag’s pose is less certain the farther and the more obliquely it is seen. For a tag at distance d seen at angle θ off its normal:

(7.4)σp=σp,1d2cos⁡θ,σψ=σψ,1dcos⁡θ

with σp,1 2 cm and σψ,1 1° at one metre (sigma_xy_at_1m, sigma_yaw_deg_at_1m). A heading error also moves the robot about the tag, so R couples position and heading through the lever arm to the tag. Tags farther than max_distance_m (4 m) or seen beyond max_view_angle_deg (60°) are ignored: at 4 m a tag’s position is already worth 32 cm.

7.3 The states ​

  • NONE no mapTodom yet: navigation does not start.
  • LOCALIZED the robot knows where it is: on the start spot (origin_sigma_xy 5 cm, origin_sigma_yaw_deg 2°), or from a tag.
  • UNCERTAIN σxy above max_sigma_xy or σψ above max_sigma_yaw_deg.

The follower pauses only at NONE. UNCERTAIN is reported on localization/status and by the health monitor, and the patrol goes on: without a map the robot has nothing better than its odometry between tags. The defaults (100 m, 180°) never leave LOCALIZED; lower them to make a long walk without tags visible in NETRA and the health report.

7.4 Tags ​

  • Recording localization/record_tags averages each visible tag over record_duration_sec (2 s) and keeps it only with record_min_samples detections within record_max_std_m and record_max_std_deg. Record from where the robot will see the tag on its routes, 1 m–2.5 m away, as square-on as possible.
  • Automatic auto_localize: while not localized, any visible recorded tag localizes the robot. auto_correct: while localized, visible tags are fused through the gate.
  • Placement one tag every 20 m–40 m of route, at the camera’s height, where the robot looks at it while walking (the start of a straight, a stop point), never on something that moves (a gate, a door).

A restarted odometry

FAST-LIO restarting (Chapter 6) resets the odom frame: the old mapTodom means nothing. The localization drops to NONE and the patrol pauses. Show the robot a recorded tag (localization/start, the app’s Localize), or bring it back to its start spot and restart the navigation host’s service: the start spot becomes the origin again. (localization/assume_origin takes the current odom frame as the map: right only when FAST-LIO restarted on the start spot.)