-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Navigation } from './pilot.modules/navigation'; | ||
import { Control } from './pilot.modules/control'; | ||
import { Sensors } from './pilot.modules/sensors'; | ||
import { Actuators } from './pilot.modules/actuators'; | ||
import { Core } from './pilot.modules/core'; | ||
|
||
class Pilot { | ||
constructor() { | ||
this.navigation = new Navigation(); | ||
this.control = new Control(); | ||
this.sensors = new Sensors(); | ||
this.actuators = new Actuators(); | ||
this.core = new Core(); | ||
} | ||
|
||
async init() { | ||
// Initialize the pilot system | ||
await this.navigation.init(); | ||
await this.control.init(); | ||
await this.sensors.init(); | ||
await this.actuators.init(); | ||
await this.core.init(); | ||
} | ||
|
||
async run() { | ||
// Run the pilot system | ||
while (true) { | ||
const sensorData = await this.sensors.read(); | ||
const controlSignal = await this.control.calculate(sensorData); | ||
await this.actuators.write(controlSignal); | ||
await this.core.update(); | ||
} | ||
} | ||
} | ||
|
||
export default Pilot; |