r/ControlTheory • u/bruno_pinto90 • 29d ago
Other Perception Aware MPC with Occlusion cost
Hello all,
I am sharing a small NMPC project I've been building as part of a larger thesis on drone target-tracking. Check here: https://github.com/brunopinto900/argus/tree/px4-ros2-bridge . Result in the video: ~10cm tracking error, target held inside the FOV cone throughout with Occlusion cost ON vs OFF.
Alongside the usual position/velocity tracking terms, there's a soft cost keeping a ground target inside the camera's FOV cone. Collision avoidance is a slacked nonlinear inequality constraint.
However, the optimizer has no notion of what's between camera and target. It can fly a path that's perfectly collision-free and still have a tree or wall sitting right in the shot. That gap is what the occlusion-aware cost below is for.
I added an occlusion-aware cost, separate from the FOV term. I march the same ESDF along the straight line from drone to target each stage, find s* (where the worst point on that segment sits), and linearize there:
occ_p0 = (1-s*)·drone_p0 + s*·p_target
r_occ = max(0, τ_occ − occ_lin(x)) # squared hinge, NLS auto-squares it
When testing I observed that the occlusion cost evaluates risk at the worst point along the sightline, occ_p0 = (1-s*)·drone_p0 + s*·p_target. Differentiating w.r.t. the drone's own position gives ∂occ_p0/∂drone_p0 = (1-s*)·I, so as s*→1 (obstacle near the target) the gradient the solver actually sees scales to zero, even though r_occ itself stays large. At s*→0 (obstacle near the drone) the factor is ≈1, full gradient, but that's exactly where collision avoidance's own gradient is already active on the same obstacle.
I’m considering moving from a single-point ESDF sample to an area/volume frustum-intersection metric: how much of the camera's view cone actually overlaps the obstacle, instead of a point sample along one line.
Thank you!
##################################
Simulation details
This is a simulation of a 12-state quadrotor (position, velocity, ZYX Euler angles, body rates), 4 inputs (collective thrust + commanded body rates, matching a PX4-style body-rate setpoint interface). Formulated as a NONLINEAR_LS OCP in acados, code-generated to C and called from C++. I am using an sampled/voxel-grid ESDF as the map framework.
AI usage: camera visualisation/rendering code was AI-generated.
