MATLAB implementations of classic robot perception and planning algorithms
Final project: "Pinhole Camera Tracking and Path Planning Based on a Two-Wheeled Vehicle Differential Steering Model" — a pan-tilt pinhole camera model that tracks a target, combined with a differential-steering vehicle model for trajectory tracking and A* path planning in obstacle fields.
A PT camera in 3D space is modeled with a pinhole projection: the image sensor (a × b), focal parameter λ, and pan/tilt angles (ψ, φ) define a field-of-view (FOV) quadrilateral on the ground plane. The FOV vertices are obtained by rotating the sensor corner vectors with the pan/tilt Euler rotation matrices and scaling them onto the target plane, and inpolygon decides whether a target is visible.
- N1 — static camera, static target: FOV construction and visibility check
- N2 — moving camera on a trajectory, visibility over time
- N3 — camera with adjustable pan and/or tilt (interactive case selection), plus an
inpolygontest harness - N4 — moving target with a state-space pan/tilt model
- N5 — PID control of pan/tilt angles to keep a moving target inside the FOV
- Two-camera detection — two PT cameras watching the same target
two_wheel_vehiclemodel_tracking_twoloop.m— differential-steering kinematics for a two-wheeled vehicle (vₗ,vᵣ→ center speedv_cand yaw ratew_c, discretized with sample timeT), wrapped in a two-loop trajectory-tracking controller driven by the pinhole camera modelAstar_path_planning.m— A* heuristic search on a 20×20 grid with obstacles, producing a collision-free path for the vehicle to follow
| File | Description |
|---|---|
Matlab Code/Astar_path_planning.m |
A* grid search with obstacles |
Matlab Code/two_wheel_vehiclemodel_tracking_twoloop.m |
Differential steering + camera-based tracking (final project) |
Matlab Code/Midterm_N1_Static.m |
Static camera FOV & target detection |
Matlab Code/Midterm_N2_cammoving.m |
Moving camera |
Matlab Code/Midterm_N3_cam_moving_case_selection.m |
Pan / tilt / pan-tilt adjustment cases |
Matlab Code/Midterm_N3_detection_judge.m |
Detection decision with adjustable camera |
Matlab Code/Midterm_N3_inpolygon_test.m |
Point-in-FOV polygon test |
Matlab Code/Midterm_N4_target_moving_detection_judge.m |
Moving-target detection |
Matlab Code/Midterm_N5_PID_target_moving_detection_judge.m |
PID pan/tilt tracking of a moving target |
Matlab Code/Midterm_twocamera_detection.m |
Two-camera detection |
Matlab Code/Pics/ |
Figures used in the report |
Everything is plain MATLAB scripts — open the Matlab Code folder in MATLAB and run a file directly:
run('Matlab Code/Astar_path_planning.m')The N3–N5 scripts prompt in the console for a case (1 = pan adjust, 2 = tilt adjust, 3 = pan & tilt adjust) and then animate the camera FOV and target in 3D.
Released under the Apache License 2.0.