1. Real-Time Control & Wall-Following Navigation of a Mobile Robot
Intermediate
Simulink, Simulink Real-Time, Robotics System
Model .slx, Code .m, Report
Implement real-time wall-following navigation controllers for a 2-wheel differential drive mobile robot using 8 sonar range sensors on a real-time target platform.
π― Problem & Objective: Maintain a stable standoff distance alongside unknown wall contours while mitigating sonar measurement noise and non-holonomic kinematic wheel constraints.
βοΈ Key MATLAB Functions: controllerDifferentialDrive differentialDriveKinematics sim plot
π Expected Output & Metrics: Wall standoff distance tracking error (<2 cm), smooth trajectory curvature plots, real-time loop execution rate (100 Hz), and sonar noise filtering response.
robot = differentialDriveKinematics("TrackWidth", 0.3, "VehicleInputs", "VehicleSpeedHeadingRate");
controller = controllerDifferentialDrive("DesiredLinearVelocity", 0.5, "MaxAngularVelocity", 1.5);
target_dist = 0.4;
dt = 0.05;
t_vec = 0:dt:5;
fprintf('=== Starting Real-Time Mobile Robot Wall-Follower Simulation ===\n');
for t = t_vec
sonar_reading = 0.38 + 0.02*randn();
dist_error = sonar_reading - target_dist;
w_cmd = -2.5 * dist_error;
v_cmd = 0.45 * exp(-abs(w_cmd));
[v_l, v_r] = forward(robot, [v_cmd, w_cmd]);
if mod(t, 1.0) == 0
fprintf('t=%.1fs | Sonar=%.3fm | Error=%.3fm | v_cmd=%.2fm/s | w_cmd=%.2frad/s\n', ...
t, sonar_reading, dist_error, v_cmd, w_cmd);
end
end
2. Autonomous Mobile Robot Kinematic Simulation & A*/PRM Path Planning
Beginner
Robotics System, Navigation Toolbox
Code .m, Live Script .mlx, Report
Develop a 2D kinematic indoor mobile robot simulator in MATLAB to benchmark path planning algorithms (A*, PRM, RRT) and obstacle avoidance behavior in user-defined maps.
π― Problem & Objective: Generate shortest-distance collision-free path trajectories across complex cluttered 2D indoor occupancy grids with robot radius inflation.
βοΈ Key MATLAB Functions: binaryOccupancyMap plannerAStar plannerPRM inflate show
π Expected Output & Metrics: 2D indoor grid map plot with planned path overlays, path computation time (ms), total trajectory length (m), and collision-free clearance margin.
map = binaryOccupancyMap(10, 10, 2);
setOccupancy(map, [3:7; 4*ones(1,5)]', 1);
setOccupancy(map, [5*ones(1,4); 6:9]', 1);
inflate(map, 0.25);
planner = plannerAStar(map);
start_pos = [1.0, 1.0]; goal_pos = [8.5, 8.5];
tic;
[path_coords, path_cost] = plan(planner, start_pos, goal_pos);
t_calc = toc;
fprintf('A* Path Planning Finished in %.3f ms | Path Length: %.2f m\n', t_calc*1000, path_cost);
figure; show(map); hold on;
plot(path_coords(:,1), path_coords(:,2), 'b-o', 'LineWidth', 2, 'MarkerFaceColor', 'r');
title(sprintf('A* Planned Robot Path (Length: %.2f m)', path_cost));
3. 2-DOF & 3-DOF Planar Robot Arm Analytical Inverse Kinematics & Trajectory Generation
Beginner
Robotics System, Symbolic Math
Code .m, Live Script .mlx, Report
Solve geometric and analytical closed-form inverse kinematics for planar articulated manipulators, deriving joint configurations and minimum-jerk trajectory profiles.
π― Problem & Objective: Compute exact joint angle coordinates (θ1, θ2) for arbitrary Cartesian end-effector targets and interpolate smooth quintic trajectories without joint velocity spikes.
βοΈ Key MATLAB Functions: atan2 acos quinticpolytraj rigidBodyTree plot
π Expected Output & Metrics: Joint angle profiles (θ1, θ2), end-effector position tracking error (<0.1 mm), singularity avoidance checks, and animated 2D arm workspace plot.
L1 = 0.50; L2 = 0.40;
target = [0.55, 0.35];
r_sq = target(1)^2 + target(2)^2;
cos_q2 = (r_sq - L1^2 - L2^2) / (2 * L1 * L2);
q2 = atan2(sqrt(1 - cos_q2^2), cos_q2);
q1 = atan2(target(2), target(1)) - atan2(L2*sin(q2), L1 + L2*cos(q2));
fprintf('Joint Solutions: Theta1 = %.2f deg | Theta2 = %.2f deg\n', rad2deg(q1), rad2deg(q2));
t_span = linspace(0, 2, 100);
[q_traj, qd_traj, qdd_traj] = quinticpolytraj([0 0; q1 q2]', [0 2], t_span);
fprintf('Generated %d trajectory waypoints with zero boundary velocity.\n', size(q_traj, 2));
4. 6-DOF Industrial Manipulator (UR5 / Puma 560) Trajectory & Computed Torque Control
Advanced
Robotics System Toolbox, Control System
Code .m, Model .slx, Report
Implement inverse dynamics, geometric Jacobian computations, and computed torque nonlinear feedback control for high-precision trajectory tracking on a 6-DOF industrial robot.
π― Problem & Objective: Decouple highly nonlinear Coriolis, centrifugal, gravitational, and inertial joint dynamics to achieve sub-millimeter trajectory tracking at high speeds.
βοΈ Key MATLAB Functions: loadrobot massMatrix velocityProduct gravityTorque geometricJacobian
π Expected Output & Metrics: Joint torque control profiles (NΒ·m), Cartesian tracking error (<0.5 mm), dynamic overshoot elimination, and 3D rigid body animation.
robot = loadrobot('universalUR5', 'DataFormat', 'column');
q_home = homeConfiguration(robot);
q_target = [0; -pi/3; pi/4; -pi/6; pi/2; 0];
t = linspace(0, 3, 150);
[q_des, qd_des, qdd_des] = quinticpolytraj([q_home, q_target], [0 3], t);
Kp = diag([100 100 100 80 80 50]); Kd = diag([20 20 20 15 15 10]);
q_act = q_home + [0.03; -0.02; 0.01; 0; 0; 0]; qd_act = zeros(6,1);
M = massMatrix(robot, q_act);
C = velocityProduct(robot, q_act, qd_act);
G = gravityTorque(robot, q_act);
e = q_des(:,1) - q_act; ed = qd_des(:,1) - qd_act;
tau = M * (qdd_des(:,1) + Kd*ed + Kp*e) + C + G;
fprintf('Computed Torque Commands: [J1=%.2f, J2=%.2f, J3=%.2f, J4=%.2f, J5=%.2f, J6=%.2f] N*m\n', ...
tau(1), tau(2), tau(3), tau(4), tau(5), tau(6));
5. Robot-Guided High Dose Rate (HDR) Brachytherapy Needle Insertion
Advanced
Robotics System, Optimization Toolbox
Code .m, Report
Solve inverse kinematics and trajectory planning for a 7-DOF surgical robotic arm guiding skew-line needle insertion for high dose rate brachytherapy tumor targeting.
π― Problem & Objective: Accurately orient and insert flexible biopsy needles into simulated soft tissue targets while avoiding critical anatomical structures and joint mechanical limits.
βοΈ Key MATLAB Functions: rigidBodyTree inverseKinematics fmincon trvec2tform show
π Expected Output & Metrics: Target needle placement RMS accuracy (<1.0 mm), 3D needle trajectory plot, joint limit avoidance verification, and tissue force profile.
robot = rigidBodyTree('DataFormat', 'column');
body1 = rigidBody('link1'); jnt1 = rigidBodyJoint('jnt1', 'revolute');
setFixedTransform(jnt1, trvec2tform([0 0 0.2])); addBody(robot, body1, 'base');
body2 = rigidBody('needle'); jnt2 = rigidBodyJoint('jnt2', 'prismatic');
setFixedTransform(jnt2, trvec2tform([0.4 0 0.1])); addBody(robot, body2, 'link1');
ik = inverseKinematics('RigidBodyTree', robot);
weights = [0.25 0.25 0.25 1 1 1]; initial_guess = robot.homeConfiguration;
target_pose = trvec2tform([0.4, 0.2, 0.35]) * eul2tform([0, pi/4, 0]);
[q_sol, solInfo] = ik('needle', target_pose, weights, initial_guess);
fprintf('IK Solver Status: %s | Iterations: %d | Pos Error: %.4f mm\n', ...
solInfo.Status, solInfo.Iterations, norm(solInfo.PoseError(4:6))*1000);
6. Cryogenic Liquid Nitrogen Pneumatic Muscle Actuator Simulation
Advanced
Simscape Fluids, Simscape Electrical, Control System
Model .slx, Code .m, Report
Model thermodynamic phase expansion dynamics of liquid nitrogen pressurized vessels powering artificial pneumatic muscle actuators in mobile field robotics.
π― Problem & Objective: Characterize liquid-to-gas phase expansion pressures, temperature drops, and rapid contractive forces of McKibben artificial muscles without heavy compressors.
βοΈ Key MATLAB Functions: sim simscape.Value step plot
π Expected Output & Metrics: Actuator force-contraction characteristics, pressure vessel temperature/pressure curves, energy density comparison (J/kg), and force control bandwidth.
V_tank = 0.005;
m_LN2 = 2.5;
R_N2 = 296.8;
T_env = 293.15;
t = linspace(0, 60, 500);
h_evap = 199.1e3;
q_heat = 150;
m_gas = min(m_LN2, (q_heat .* t) ./ h_evap);
P_tank = (m_gas .* R_N2 .* T_env) ./ V_tank ./ 1e5;
fprintf('Peak Vapor Pressure Generated: %.2f Bar | Mass Evaporated: %.2f kg\n', max(P_tank), max(m_gas));
7. Wall-Climbing Robot with Telemetry & App Designer GUI Dashboard
Intermediate
Simulink, App Designer, Control System
Model .slx, Code .m, Report
Develop an integrated telemetry and control GUI dashboard for a wireless vacuum-adhesion wall-climbing robot to monitor motor currents, tilt angles, and suction pressure.
π― Problem & Objective: Guarantee continuous adhesion safety factor (>1.5x) against gravitational shear while driving dual DC motor tracks across vertical concrete walls.
βοΈ Key MATLAB Functions: uifigure sim pidtune uialert drawnow
π Expected Output & Metrics: Real-time sensor readout GUI dashboard, motor speed step response curves, safety adhesion loss alert trigger, and telemetry latency.
suction_pressure = 45.2;
seal_area = 0.025;
m_robot = 4.2; g = 9.81; mu = 0.6;
F_adhesion = suction_pressure * 1000 * seal_area;
F_gravity = m_robot * g;
F_holding = mu * F_adhesion;
safety_factor = F_holding / F_gravity;
fprintf('Vacuum Force: %.2f N | Max Holding Shear: %.2f N | Safety Factor: %.2f\n', ...
F_adhesion, F_holding, safety_factor);
if safety_factor < 1.5
warning('CRITICAL: Suction safety margin degraded below 1.5x threshold!');
else
disp('STATUS: Adhesion nominal for vertical surface locomotion.');
end
8. Remote Control & Tele-Robotics Lab for LEGO MINDSTORMS Mobile Robots
Beginner
LEGO MINDSTORMS EV3, Simulink, MATLAB Support Package
Model .slx, Code .m, Report
Create a web-accessible MATLAB tele-laboratory framework allowing remote engineering students to compile and execute motion control models on physical Lego mobile robots.
π― Problem & Objective: Implement low-latency TCP/IP command streaming and optical encoder odometry feedback for remote educational robotics labs.
βοΈ Key MATLAB Functions: legoev3 motor readRotation start stop
π Expected Output & Metrics: Web interface control responsiveness, robot encoder trajectory tracking error, live video stream frame rate, and remote command latency.
try
myaev3 = legoev3('usb');
motorLeft = motor(myaev3, 'B'); motorRight = motor(myaev3, 'C');
motorLeft.Speed = 40; motorRight.Speed = 40;
start(motorLeft); start(motorRight);
pause(2.0);
stop(motorLeft); stop(motorRight);
rotL = readRotation(motorLeft); rotR = readRotation(motorRight);
fprintf('Run Complete: Left Motor = %d deg | Right Motor = %d deg\n', rotL, rotR);
catch
disp('Simulation Mode: Commanded Left/Right Motor Speeds at 40% PWM for 2.0s.');
end
9. 18-DOF Hexapod Walking Robot Simulation & Tripod Gait in Simscape Multibody
Advanced
Simscape Multibody, Control System Toolbox
Model .slx, Code .m, Report
Build an 18-DOF dynamic hexapod robot walking model in Simscape Multibody, designing tripod/wave gait pattern generators and joint servo PID torque controllers.
π― Problem & Objective: Coordinate 6 kinematic limbs (coxa, femur, tibia) with Central Pattern Generator (CPG) rhythmic equations to achieve stable tripod walking over uneven terrain.
βοΈ Key MATLAB Functions: smimport sim pidtune smwrite eul2rotm
π Expected Output & Metrics: 3D multibody animation of tripod gait, leg joint torque profiles (NΒ·m), center-of-mass trajectory stability, and walking speed (m/s).
t = linspace(0, 4*pi, 200);
stride_len = 0.08; step_height = 0.04;
x_leg_grp1 = stride_len/2 * cos(t);
z_leg_grp1 = step_height * max(0, sin(t));
x_leg_grp2 = stride_len/2 * cos(t + pi);
z_leg_grp2 = step_height * max(0, sin(t + pi));
fprintf('Tripod Gait Step Frequency: %.2f Hz | Stride Velocity: %.2f m/s\n', ...
1/(2*pi), stride_len * (1/(2*pi)));
10. Dexterous Multi-Fingered Robot Hand Grasping & Impedance Force Control
Intermediate
Robotics System, Simscape Multibody
Model .slx, Code .m, Report
Model multi-fingered dexterous robot hand grasp dynamics, tuning impedance/force controllers to accomplish stable object manipulation in simulation and hardware.
π― Problem & Objective: Formulate the grasp matrix G and solve friction cone constraints to achieve force-closure grasping on cylindrical and spherical objects without slipping.
βοΈ Key MATLAB Functions: rigidBodyTree simscape sim solveIK rank
π Expected Output & Metrics: Finger contact force trajectories (N), object grasp stability region, joint angle kinematics plots, and grasp success rate (>95%).
p1 = [0.03, 0, 0]; p2 = [-0.015, 0.026, 0]; p3 = [-0.015, -0.026, 0];
G = [eye(3) eye(3) eye(3);
0 -p1(3) p1(2) 0 -p2(3) p2(2) 0 -p3(3) p3(2);
p1(3) 0 -p1(1) p2(3) 0 -p2(1) p3(3) 0 -p3(1);
-p1(2) p1(1) 0 -p2(2) p2(1) 0 -p3(2) p3(1) 0];
rank_G = rank(G);
fprintf('Grasp Matrix Rank: %d/6 | Force Closure Capability: %s\n', ...
rank_G, string(rank_G >= 6));
11. Autonomous Agricultural Field Robot with Computer Vision Weed Detection
Intermediate
Navigation, Computer Vision, Image Processing
Code .m, Report
Implement autonomous crop-row navigation, weed detection image segmentation, and Bluetooth telemetry steering control for a mobile farming robot.
π― Problem & Objective: Segment green foliage in real-time under variable outdoor lighting conditions and guide Pure Pursuit path tracking down narrow crop rows.
βοΈ Key MATLAB Functions: imbinarize controllerPurePursuit rgb2hsv regionprops
π Expected Output & Metrics: Crop-row detection centerline extraction mask, vehicle heading error (<2 degrees), weed detection recall (>92%), and row-following accuracy.
synthetic_field = zeros(100, 100, 3);
synthetic_field(40:60, :, 2) = 0.8;
hsv = rgb2hsv(synthetic_field);
green_mask = (hsv(:,:,1) > 0.2) & (hsv(:,:,1) < 0.45) & (hsv(:,:,2) > 0.3);
stats = regionprops(green_mask, 'Centroid', 'Area');
pp = controllerPurePursuit('DesiredLinearVelocity', 0.8, 'LookaheadDistance', 1.2);
pp.Waypoints = [0 0; 2 0.1; 4 -0.05; 6 0; 8 0.2];
[v_cmd, w_cmd] = pp([1.5, 0.05, 0.02]);
fprintf('Detected %d Vegetation Regions | Commanded Steer Rate: %.3f rad/s\n', ...
length(stats), w_cmd);
12. Multirotor UAV Endpoint Package Delivery & Wind Disturbance Trajectory Planning
Advanced
UAV Toolbox, Navigation, Control System
Model .slx, Code .m, Report
Simulate multirotor UAV package delivery mission profiles incorporating wind disturbance rejection, battery energy constraints, and 3D waypoints obstacle avoidance.
π― Problem & Objective: Synthesize 3D minimum-snap flight trajectories that accommodate variable payload masses and heavy horizontal wind gusts during autonomous parcel landing.
βοΈ Key MATLAB Functions: uavScenario waypointTrajectory lookupPose plot3
π Expected Output & Metrics: 3D flight trajectory plot, delivery time latency, battery SOC energy consumption (Wh/km), and landing accuracy (<0.5m).
waypoints = [0 0 0; 0 0 10; 25 30 15; 50 60 12; 50 60 0];
time_of_arrival = [0; 5; 15; 25; 30];
traj = waypointTrajectory(waypoints, 'TimeOfArrival', time_of_arrival, 'SampleRate', 20);
[pos, orient, vel, acc, angvel] = lookupPose(traj, 10.5);
wind_gust = [2.5; -1.8; 0.5];
apparent_vel = vel - wind_gust';
fprintf('At t=10.5s: Altitude = %.2fm | Groundspeed = %.2fm/s | True Airspeed = %.2fm/s\n', ...
pos(3), norm(vel), norm(apparent_vel));
13. 2D Lidar SLAM & Occupancy Grid Mapping with Pose Graph Optimization
Advanced
Navigation Toolbox, ROS Toolbox, Lidar Toolbox
Code .m, Report
Build real-time 2D Simultaneous Localization and Mapping (SLAM) with scan matching and loop closure detection for indoor warehouse AGVs.
π― Problem & Objective: Eliminate cumulative dead-reckoning odometry drift by aligning laser range scans and solving non-linear pose graph optimization constraints.
βοΈ Key MATLAB Functions: lidarSLAM matchScans addScan buildMap show
π Expected Output & Metrics: Metric-accurate global occupancy grid map, optimized robot trajectory, loop closure correction count, and positional drift reduction (<3 cm).
slamObj = lidarSLAM(20, 15);
slamObj.LoopClosureThreshold = 180;
slamObj.LoopClosureSearchRadius = 3.0;
for step = 1:15
ranges = 3 + 0.05*randn(1, 360);
angles = linspace(-pi, pi, 360);
scan = lidarScan(ranges, angles);
[isAccepted, loopClosureInfo] = addScan(slamObj, scan);
end
fprintf('Total SLAM Nodes: %d | Graph Edges: %d\n', ...
slamObj.PoseGraph.NumNodes, slamObj.PoseGraph.NumEdges);
14. Pure Pursuit & Adaptive Stanley Steering Control for Autonomous Ground Vehicles
Intermediate
Navigation, Automated Driving Toolbox
Code .m, Live Script .mlx, Report
Benchmark lateral tracking performance of Pure Pursuit versus Stanley kinematic path tracking controllers on sharp curve tracks with slip compensation.
π― Problem & Objective: Minimize cross-track error and yaw heading deviations under high forward velocities while enforcing physical steering rate limits.
βοΈ Key MATLAB Functions: controllerPurePursuit controllerStanley binaryOccupancyMap
π Expected Output & Metrics: Cross-track error (RMS < 0.05m), heading error convergence rate, steering actuator command limits, and comparative tracking error plots.
ref_path = [0:0.5:20; sin((0:0.5:20)/2)*3]';
stanley = controllerStanley('Waypoints', ref_path, 'DesiredLinearVelocity', 2.0, 'PositionGain', 1.2);
current_pose = [5.0, 1.2, 0.1];
current_speed = 2.0;
[steer_cmd, x_err, yaw_err] = stanley(current_pose, current_speed);
fprintf('Stanley Controller: Steering Angle = %.2f deg | Cross-Track Error = %.3fm\n', ...
rad2deg(steer_cmd), x_err);
15. ROS 2 & MATLAB Co-Simulation for Mobile Manipulator Pick-and-Place
Advanced
ROS Toolbox, Robotics System Toolbox
Code .m, Model .slx, Report
Establish high-speed ROS 2 DDS middleware bridge between MATLAB/Simulink and Gazebo/Ignition to command a mobile manipulator for automated pick-and-place tasks.
π― Problem & Objective: Synchronize base locomotion with multi-link arm manipulation across distributed ROS 2 topics and action servers.
βοΈ Key MATLAB Functions: ros2node ros2publisher ros2subscriber importrobot
π Expected Output & Metrics: Joint trajectory command stream (50 Hz), Gazebo state synchronization, grasping success validation, and end-to-end task execution timeline.
try
r2node = ros2node("/matlab_manipulator_controller");
joint_pub = ros2publisher(r2node, "/arm_controller/joint_trajectory", "trajectory_msgs/JointTrajectory");
msg = ros2message(joint_pub);
msg.joint_names = {'joint1', 'joint2', 'joint3', 'joint4', 'joint5', 'joint6'};
disp('ROS 2 Node successfully initialized and connected to DDS domain.');
catch
disp('ROS 2 Emulation Mode: Initialized ROS 2 DDS Topic: /arm_controller/joint_trajectory');
end
16. Non-Linear Model Predictive Control (NMPC) for Obstacle Avoidance
Advanced
Model Predictive Control Toolbox, Optimization
Code .m, Model .slx, Report
Formulate non-linear MPC with state constraints and obstacle avoidance potential fields for unicycle mobile robot navigation in high-density dynamic clutter.
π― Problem & Objective: Optimize control inputs (linear velocity, yaw rate) over receding finite horizons while respecting hard kinematic and obstacle clearance boundaries.
βοΈ Key MATLAB Functions: nlmpc nlmpcmove validateFcns createParamBus
π Expected Output & Metrics: Receding horizon state trajectories, solver execution time (<10 ms/step), collision clearance margin (>0.3m), and control input saturation adherence.
nx = 3; ny = 3; nu = 2;
nlobj = nlmpc(nx, ny, nu);
nlobj.Ts = 0.1; nlobj.PredictionHorizon = 10; nlobj.ControlHorizon = 3;
nlobj.MV(1).Min = 0; nlobj.MV(1).Max = 1.5;
nlobj.MV(2).Min = -pi/2; nlobj.MV(2).Max = pi/2;
nlobj.Weights.OutputVariables = [1 1 0.1];
fprintf('NMPC Configured: Horizon=%d steps (%.1fs) | Speed bounds=[0, 1.5] m/s\n', ...
nlobj.PredictionHorizon, nlobj.PredictionHorizon * nlobj.Ts);
17. Bipedal Humanoid Robot Dynamic Walking & Zero Moment Point (ZMP) Stabilization
Advanced
Robotics System, Simscape Multibody, Control System
Code .m, Model .slx, Report
Implement preview control for linear inverted pendulum model (LIPM) to compute Center of Mass (CoM) trajectories maintaining Zero Moment Point (ZMP) inside the support polygon.
π― Problem & Objective: Prevent dynamic tipping during single and double support phases of bipedal locomotion using preview optimal control.
βοΈ Key MATLAB Functions: dlqr ss lsim conv plot
π Expected Output & Metrics: CoM and ZMP trajectories, support polygon footprint tracking, roll/pitch stabilization error (<1 degree), and dynamic stability margin.
z_c = 0.8; g = 9.81;
omega = sqrt(g / z_c);
dt = 0.01; t = 0:dt:4;
zmp_ref = 0.15 * sign(sin(pi * t));
A = [0 1; omega^2 0]; B = [0; -omega^2]; C = [1 0];
sys = ss(A, B, C, 0);
[y_com, t_out, x_state] = lsim(sys, zmp_ref, t);
fprintf('LIPM Characteristic Frequency: omega = %.2f rad/s | Walking Cycle: %.2f s\n', omega, 2.0);
18. Image-Based Visual Servoing (IBVS) for Robotic Arm Target Tracking
Intermediate
Computer Vision, Robotics System, Image Processing
Code .m, Report
Design closed-loop Image-Based Visual Servoing (IBVS) using the interaction matrix (image Jacobian) to control camera end-effector alignment with visual fiducial markers.
π― Problem & Objective: Formulate the Moore-Penrose pseudo-inverse of the 2D image Jacobian to regulate 6-DOF camera velocities directly from 2D pixel error vectors.
βοΈ Key MATLAB Functions: detectCheckerboardPoints estimateCameraParameters pinv plot
π Expected Output & Metrics: Feature error convergence plot (pixel space), camera Cartesian velocity commands, optical axis alignment error (<2 mm), and settling time (<1.5s).
f = 800; u0 = 320; v0 = 240;
Z = 0.5;
s_des = [200 200; 440 200; 440 380; 200 380];
s_cur = [220 210; 455 195; 430 365; 190 375];
e = reshape((s_des - s_cur)', [], 1);
lambda = 1.2;
L_s = repmat([-f/Z 0 0 0 -f 0; 0 -f/Z 0 f 0 0], 4, 1);
v_cam = lambda * pinv(L_s) * e;
fprintf('Camera Commanded Velocities: [vx=%.3f, vy=%.3f, vz=%.3f] m/s\n', v_cam(1), v_cam(2), v_cam(3));
19. Self-Balancing Two-Wheeled Robot (Inverted Pendulum) LQR Control
Intermediate
Control System Toolbox, Simulink
Model .slx, Code .m, Report
Derive nonlinear equations of motion for a two-wheeled inverted pendulum self-balancing robot and synthesize Linear Quadratic Regulator (LQR) state-feedback controllers.
π― Problem & Objective: Maintain upright chassis pitch angle (θ = 0) and position stabilization under sudden impulsive external force disturbances.
βοΈ Key MATLAB Functions: lqr ss step initial bode
π Expected Output & Metrics: Tilt angle recovery time (<0.6s), maximum tilt recovery angle (±25 degrees), motor torque saturation handling, and state response plots.
M = 1.2; m = 0.4; l = 0.25; J = 0.015; g = 9.81;
p = J*(M+m) + M*m*l^2;
A = [0 1 0 0;
0 0 -m^2*g*l^2/p 0;
0 0 0 1;
0 0 (M+m)*m*g*l/p 0];
B = [0; (J + m*l^2)/p; 0; -m*l/p];
Q = diag([10, 1, 100, 10]); R = 0.01;
K = lqr(A, B, Q, R);
fprintf('LQR Feedback Gain Matrix: K = [%.2f, %.2f, %.2f, %.2f]\n', K(1), K(2), K(3), K(4));
20. Swarm Robotics Flocking, Formation Control & Consensus Algorithms
Intermediate
Robotics System, Control System Toolbox
Code .m, Live Script .mlx, Report
Simulate decentralized multi-robot swarm rendezvous, Reynolds flocking behaviors (cohesion, separation, alignment), and graph Laplacian consensus algorithms.
π― Problem & Objective: Achieve geometric formation consensus across N decentralized autonomous agents subject to sparse, dynamic communication network topologies.
βοΈ Key MATLAB Functions: graph laplacian ode45 scatter quiver
π Expected Output & Metrics: Dynamic swarm trajectory plots, consensus convergence rate, collision-free inter-agent distance maintenance (>0.25m), and flocking alignment index.
N = 6;
A_adj = [0 1 0 0 0 1; 1 0 1 0 0 0; 0 1 0 1 0 0; 0 0 1 0 1 0; 0 0 0 1 0 1; 1 0 0 0 1 0];
D = diag(sum(A_adj, 2)); L = D - A_adj;
pos = rand(N, 2) * 10;
dt = 0.05;
for step = 1:50
dx = -L * pos;
pos = pos + dx * dt;
end
centroid = mean(pos);
fprintf('Swarm Consensus Converged! Final Centroid: (X=%.2f, Y=%.2f)\n', centroid(1), centroid(2));