- Fork the repository
- Create a branch:
git checkout -b feature/your-feature - Make your changes
- Test:
npm run dev(frontend),npm test(unit tests) - Commit with a clear message
- Open a pull request
Add your drone to the simulation by creating a JSON file.
File: DIAMANTS_FRONTEND/Mission_system/physics/profiles/your-drone.json
Schema: Follow drone-profile.schema.json in the same directory.
Required fields:
| Field | Type | Description |
|---|---|---|
id |
string | Unique ID, uppercase with underscores (e.g. X500_V2) |
label |
string | Human-readable name |
physical.mass |
number | Mass in kg |
physical.boundingRadius |
number | Collision sphere radius in meters |
performance.maxSpeed |
number | Maximum horizontal speed in m/s |
performance.maxAlt |
number | Maximum altitude in meters |
performance.cruiseAlt |
number | Default cruising altitude in meters |
pid.pos |
object | Position PID gains: { kp, ki, kd } |
pid.alt |
object | Altitude PID gains: { kp, ki, kd } |
pid.yaw |
object | Yaw PID gains: { kp, ki, kd } |
Optional fields: manufacturer, category (nano/micro/compact/medium/heavy/custom), performance.agility, performance.explorationRadius, performance.endurance_min, visual.scale, visual.color, visual.model.
Example — minimal profile:
{
"id": "X500_V2",
"label": "Holybro X500 V2",
"physical": {
"mass": 1.2,
"boundingRadius": 0.5
},
"performance": {
"maxSpeed": 8.0,
"maxClimb": 3.0,
"cruiseAlt": 10.0,
"maxAlt": 50.0
},
"pid": {
"pos": { "kp": 2.0, "ki": 0.05, "kd": 1.0 },
"alt": { "kp": 3.0, "ki": 0.1, "kd": 1.5 },
"yaw": { "kp": 2.0, "ki": 0.0, "kd": 0.3 }
}
}After adding the file, register it in drone-physics-registry.js or leave it as a standalone file — the registry can load profiles dynamically.
Implement the SwarmIntelligenceInterface abstract class.
File: DIAMANTS_FRONTEND/Mission_system/intelligence/your-algorithm.js
Interface contract:
import { SwarmIntelligenceInterface } from './swarm-intelligence-interface.js';
export class YourAlgorithm extends SwarmIntelligenceInterface {
constructor() {
super();
this.name = 'your-algorithm';
this.version = '1.0.0';
}
initialize(config) {
// config = { droneCount, arena: { width, height }, profiles }
}
computeInfluences(droneStates, dt) {
const influences = new Map();
// Your algorithm here
return influences;
}
}Rules:
computeInfluencesmust return within 1-2ms (it runs every frame)- Return an empty Map if you have no suggestions
- Influences are merged with the PID — you suggest, the PID decides
- You have read-only access to all drone states (position, velocity, target, profile)
How to test: Replace NoopSwarmIntelligence in autonomous-flight-engine.js with your implementation.
Standard open-source workflow:
- Check issues for known bugs
- Run
npm testto verify your changes - Write tests for new features (Vitest)
- Keep comments in English in the code
- ES6 modules (
import/export, norequire) - camelCase for variables and functions
- PascalCase for classes
- File names: kebab-case (e.g.
drone-physics-registry.js) - No global variables (
window.something) — use the event bus - JSDoc comments for public methods
idfield: UPPER_CASE- All physical values in SI units (kg, m, m/s)
- PID gains: use values appropriate for the drone's mass and responsiveness
cd DIAMANTS_FRONTEND/Mission_system
npm install
npm run dev # Dev server with HMR
npm test # Run tests
npm run build # Verify build passes- Code compiles / builds without errors
-
npm run buildpasses - Existing tests pass
- New tests added for new features
- No hardcoded values — use config or profiles
- No console.log left in production code
- Commit message describes what changed and why
Questions: open an issue or email loic.lemasle@gmail.com.