This is a simple receeding horizon controller for tracking a non-evasive target. We assume that when the evader in view we are recieving rollout trajectories from the PWM.
MacOS set up with Homebrew.
brew info pkg-config
brew install ipopt
python3.11 -m venv env
source env/bin/activate
brew install ipopt, pyYou can also use conda: See cyipopt docs: https://cyipopt.readthedocs.io/en/stable/install.html
conda install -c conda-forge cyipoptTo run solver
python SimpleTracker/ipopt_sim.py- We want to minimize the distance between the expected pursuer trajectory and pursuer trajectories over a look ahead horizon of  time steps.
- When the target is in the field of view we will use PWM provided trajectories to do planning with receding horizon control with out of the box solvers.
- We will formulate the problem as a non-linear program.
- We assume discrete time trajectories but continuous state space.
- We can solve this online with an IPOPT solver or something similar i.e Gurobi.
We will minimize expected squared distance between pursuer and evader over a horizon of
-
$p_j$ Prob of jth evader trajectory. We can let$p_j=1$ if we assume all paths are equally likely. -
$w_k$ This weighs the trajaectory at different time steps. We can either prioritize near or shortterm interception depending on how reliable we believe rollouts are. -
$x_k$ : Puruser position at timestep$k$ -
$y_k$ : Evader position at timestep$k$ -
$M$ : Total pursuer trajectories -
$T$ : Look ahead horizon where each timespte is of size$\Delta t$ -
$d$ : Min allowable distance between evader and pursuer.
For each timestep
The pursuer is forbidden from entering specified convex polygonal regions (Keep-Out Zones). A convex polygon can be represented by a set of linear inequalities, known as half-planes. For a point
This is equivalent to satisfying
To remain outside the polygon, a point max function:
Because the max function is not smoothly differentiable, which is required by gradient-based optimizers like IPOPT, we use the LogSumExp function as a smooth approximation. This yields a single, non-linear inequality constraint for each point
Distance covered in one time step is bounded by max velocity, i.e
for
SimpleTracker/
│
├── README.md Project explanation, setup, and usage instructions
│
├── simulate.py # Main script to run the pursuit-evasion simulation and save the results
├── animator.py # Creates a GIF animation from the simulation history data
│
├── track.py # Trajectory optimization solver using SLSQP from SciPy
│
├─- dummy_pwm.py # Contains PWM code: Evader kinematic model and functions to generate predicted trajectories
|-- ipopt_sim.py # Simulation script for ipopt solver
|-- track_ipopt.py # Trajectory optimizatio sovler using IPOPT solver.
|-- utils.py # load gridworld, do coordinate transfroms, plot stuff.
has the helper functions to grab road network grid world from segmenation map and obstacles from obstacle map. See bottom of utils file for example usage.
is the segmentation map array where each index is a object label.
is the obstacle map where each cell value is the onstacle height.