Skip to content

Commit 84f9605

Browse files
committed
Added Circular Boundaries to Flight Paths calc.
1 parent 88c761f commit 84f9605

File tree

11 files changed

+111
-15
lines changed

11 files changed

+111
-15
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# CHANGELOG
22

3+
## [Version 1.4.0] - 2025-08-06
4+
5+
### ✨ New Features
6+
- **Circular Flight Boundaries**: Added optional circular boundary constraint centered at takeoff point
7+
- **Boundary Priority System**: Circular boundaries take priority over rectangular boundaries when both are set
8+
- **Enhanced Flight Path Control**: Improved synthetic flight path generation with circular containment options
9+
310
## [Version 1.3.0] - 2025-08-05
411

512
### ✨ New Features
@@ -18,4 +25,4 @@
1825
- Improved flight path realism with boundary enforcement
1926

2027
---
21-
*Added intelligent boundary system for more realistic
28+
*Added intelligent boundary system for more realistic flight path generation*
127 KB
Loading
93.9 KB
Loading
104 KB
Loading
71 KB
Loading
7.2 KB
Loading
19.8 KB
Loading
15.2 KB
Loading

frontend/components/ui/Layout.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ const Layout = ({ children, title, isOpen: externalIsOpen, toggleSidebar: extern
199199
</nav>
200200

201201
<div className="text-center mb-2 text-xs text-gray-500">
202-
Version 1.3.0
202+
Version 1.4.0
203203
</div>
204204

205205
{userName && (

frontend/pages/FlightDetails.jsx

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ const FlightDetails = () => {
226226
const [flightPathParams, setFlightPathParams] = useState({
227227
heading: '',
228228
medianSpeed: '',
229+
circularRadius: '',
229230
boundaryNorth: '',
230231
boundaryEast: '',
231232
boundarySouth: '',
@@ -379,24 +380,28 @@ const FlightDetails = () => {
379380
return;
380381
}
381382

382-
// Parse boundary values (optional)
383+
// Parse circular boundary (optional)
384+
const circularRadius = parseFloat(flightPathParams.circularRadius);
385+
const circularBoundary = !isNaN(circularRadius) && circularRadius > 0 ? { radius: circularRadius } : null;
386+
387+
// Parse rectangular boundaries (optional)
383388
const boundaries = {
384389
north: parseFloat(flightPathParams.boundaryNorth) || 0,
385390
east: parseFloat(flightPathParams.boundaryEast) || 0,
386391
south: parseFloat(flightPathParams.boundarySouth) || 0,
387392
west: parseFloat(flightPathParams.boundaryWest) || 0
388393
};
389394

390-
// Check if any boundary is set
391-
const hasBoundaries = boundaries.north > 0 || boundaries.east > 0 ||
392-
boundaries.south > 0 || boundaries.west > 0;
395+
// Check if any rectangular boundary is set
396+
const hasRectangularBoundaries = boundaries.north > 0 || boundaries.east > 0 ||
397+
boundaries.south > 0 || boundaries.west > 0;
393398

394399
setShowFlightPathModal(false);
395-
processFlightPathCalculation(heading, medianSpeed, hasBoundaries ? boundaries : null);
400+
processFlightPathCalculation(heading, medianSpeed, hasRectangularBoundaries ? boundaries : null, circularBoundary);
396401
};
397402

398403
// Process flight path calculation with user parameters
399-
const processFlightPathCalculation = (heading, medianSpeed, boundaries = null) => {
404+
const processFlightPathCalculation = (heading, medianSpeed, boundaries = null, circularBoundary = null) => {
400405
const fileInput = document.createElement('input');
401406
fileInput.type = 'file';
402407
fileInput.accept = '.csv';
@@ -442,7 +447,8 @@ const FlightDetails = () => {
442447
heading,
443448
medianSpeed,
444449
0.025, // scalingFactor
445-
boundaries
450+
boundaries,
451+
circularBoundary
446452
);
447453

448454
if (!trackPoints.length) {
@@ -464,7 +470,8 @@ const FlightDetails = () => {
464470
throw new Error('Failed to save calculated flight path to database');
465471
}
466472

467-
const boundaryText = boundaries ? ' with boundary constraints' : '';
473+
const boundaryText = circularBoundary ? ` with circular boundary (${circularBoundary.radius}m radius)` :
474+
boundaries ? ' with rectangular boundary constraints' : '';
468475
setAlertMessage({
469476
type: 'success',
470477
message: `Successfully calculated and saved flight path with ${trackPoints.length} points based on telemetry data${boundaryText}.`
@@ -488,6 +495,7 @@ const FlightDetails = () => {
488495
setFlightPathParams({
489496
heading: '',
490497
medianSpeed: '',
498+
circularRadius: '',
491499
boundaryNorth: '',
492500
boundaryEast: '',
493501
boundarySouth: '',
@@ -668,13 +676,38 @@ const FlightDetails = () => {
668676
</div>
669677
</div>
670678

671-
{/* Optional Boundary Parameters */}
679+
{/* Circular Boundary Parameters */}
680+
<div className="border-t pt-4">
681+
<h4 className="text-sm font-medium text-gray-700 mb-2">
682+
Circular Flight Boundary (Optional)
683+
</h4>
684+
<p className="text-xs text-gray-500 mb-3">
685+
Set a circular boundary around the takeoff point. Drone will turn when approaching this limit.
686+
</p>
687+
<div className="w-1/2">
688+
<label className="block text-xs font-medium text-gray-600 mb-1">
689+
Radius from Takeoff Point (meters)
690+
</label>
691+
<input
692+
type="number"
693+
min="0"
694+
step="10"
695+
className="w-full px-2 py-1 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-blue-500"
696+
placeholder="e.g., 500"
697+
value={flightPathParams.circularRadius}
698+
onChange={(e) => setFlightPathParams(prev => ({ ...prev, circularRadius: e.target.value }))}
699+
/>
700+
</div>
701+
</div>
702+
703+
{/* Rectangular Boundary Parameters */}
672704
<div className="border-t pt-4">
673705
<h4 className="text-sm font-medium text-gray-700 mb-2">
674-
Flight Boundaries (Optional)
706+
Rectangular Flight Boundaries (Optional)
675707
</h4>
676708
<p className="text-xs text-gray-500 mb-3">
677709
Set maximum distances in meters from takeoff point. Drone will turn when approaching these limits.
710+
Note: Circular boundary takes priority over rectangular boundaries if both are set.
678711
</p>
679712
<div className="grid grid-cols-2 gap-4">
680713
<div>

0 commit comments

Comments
 (0)