-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from PisterLab/dev
Brahmos and 1_salvo_4_sfrj_10_brahmos config
- Loading branch information
Showing
9 changed files
with
303 additions
and
28 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
82 changes: 82 additions & 0 deletions
82
Assets/StreamingAssets/Configs/1_salvo_4_sfrj_10_brahmos.json
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,82 @@ | ||
{ | ||
"timeScale": 2, | ||
"interceptor_swarm_configs": [ | ||
{ | ||
"num_agents": 4, | ||
"dynamic_agent_config": { | ||
"agent_model": "sfrj.json", | ||
"initial_state": { | ||
"position": { "x": 0, "y": 20, "z": 0 }, | ||
"rotation": { "x": -85, "y": 0, "z": 0 }, | ||
"velocity": { "x": 0, "y": 50, "z": 10 } | ||
}, | ||
"standard_deviation": { | ||
"position": { "x": 5, "y": 0, "z": 5 }, | ||
"velocity": { "x": 5, "y": 0, "z": 1 } | ||
}, | ||
"dynamic_config": { | ||
"launch_config": { "launch_time": 0 }, | ||
"sensor_config": { | ||
"type": "IDEAL", | ||
"frequency": 100 | ||
} | ||
}, | ||
"submunitions_config": { | ||
"num_submunitions": 7, | ||
"launch_config": { "launch_time": 45 }, | ||
"dynamic_agent_config": { | ||
"agent_model": "micromissile.json", | ||
"initial_state": { | ||
"position": { "x": 0, "y": 0, "z": 0 }, | ||
"rotation": { "x": 0, "y": 0, "z": 0 }, | ||
"velocity": { "x": 0, "y": 0, "z": 0 } | ||
}, | ||
"standard_deviation": { | ||
"position": { "x": 5, "y": 5, "z": 5 }, | ||
"velocity": { "x": 0, "y": 0, "z": 0 } | ||
}, | ||
"dynamic_config": { | ||
"launch_config": { "launch_time": 0 }, | ||
"sensor_config": { | ||
"type": "IDEAL", | ||
"frequency": 100 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"threat_swarm_configs": [ | ||
{ | ||
"num_agents": 10, | ||
"dynamic_agent_config": { | ||
"agent_model": "brahmos.json", | ||
"attack_behavior": "brahmos_direct_attack.json", | ||
"initial_state": { | ||
"position": { "x": 0, "y": 5000, "z": 100000 }, | ||
"rotation": { "x": 90, "y": 0, "z": 0 }, | ||
"velocity": { "x": 0, "y": 0, "z": -800 } | ||
}, | ||
"standard_deviation": { | ||
"position": { "x": 1000, "y": 200, "z": 100 }, | ||
"velocity": { "x": 0, "y": 0, "z": 25 } | ||
}, | ||
"dynamic_config": { | ||
"launch_config": { "launch_time": 0 }, | ||
"sensor_config": { | ||
"type": "IDEAL", | ||
"frequency": 100 | ||
}, | ||
"flight_config": { | ||
"evasionEnabled": true, | ||
"evasionRangeThreshold": 1000 | ||
} | ||
}, | ||
"submunitions_config": { | ||
"num_submunitions": 0 | ||
} | ||
} | ||
} | ||
] | ||
} |
7 changes: 7 additions & 0 deletions
7
Assets/StreamingAssets/Configs/1_salvo_4_sfrj_10_brahmos.json.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
Assets/StreamingAssets/Configs/Behaviors/Attack/brahmos_direct_attack.json
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,44 @@ | ||
{ | ||
"name": "DefaultDirectAttack", | ||
"attackBehaviorType": "DIRECT_ATTACK", | ||
"targetPosition": { | ||
"x": 0.01, | ||
"y": 0.0, | ||
"z": 0.0 | ||
}, | ||
"targetVelocity": { | ||
"x": 0.0001, | ||
"y": 0.0, | ||
"z": 0.0 | ||
}, | ||
"targetColliderSize": { | ||
"x": 20.0, | ||
"y": 20.0, | ||
"z": 20.0 | ||
}, | ||
"flightPlan": { | ||
"type": "DistanceToTarget", | ||
"waypoints": [ | ||
{ | ||
"distance": 100000.0, | ||
"altitude": 10000.0, | ||
"power": "MIL" | ||
}, | ||
{ | ||
"distance": 10000.0, | ||
"altitude": 10000.0, | ||
"power": "MIL" | ||
}, | ||
{ | ||
"distance": 4000.0, | ||
"altitude": 2000.0, | ||
"power": "MIL" | ||
}, | ||
{ | ||
"distance": 2000.0, | ||
"altitude": 0.0, | ||
"power": "MAX" | ||
} | ||
] | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
Assets/StreamingAssets/Configs/Behaviors/Attack/brahmos_direct_attack.json.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
Assets/StreamingAssets/Configs/Models/Threats/brahmos.json
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,34 @@ | ||
{ | ||
"name": "BrahmosCruiseMissile", | ||
"agentClass": "FixedWingThreat", | ||
"accelerationConfig": { | ||
"maxReferenceNormalAcceleration": 70, | ||
"referenceSpeed": 960.4, | ||
"maxForwardAcceleration": 30 | ||
}, | ||
"boostConfig": { | ||
"boostTime": 0 | ||
}, | ||
"liftDragConfig": { | ||
"liftCoefficient": 0.6, | ||
"dragCoefficient": 0.3, | ||
"liftDragRatio": 2 | ||
}, | ||
"bodyConfig": { | ||
"mass": 3000, | ||
"crossSectionalArea": 0.352, | ||
"finArea": 1.2, | ||
"bodyArea": 17.7 | ||
}, | ||
"hitConfig": { | ||
"hitRadius": 4, | ||
"killProbability": 0.9 | ||
}, | ||
"powerTable": { | ||
"IDLE": 0, | ||
"LOW": 480, | ||
"CRUISE": 960.4, | ||
"MIL": 990, | ||
"MAX": 1029 | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
Assets/StreamingAssets/Configs/Models/Threats/brahmos.json.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,75 @@ | ||
using NUnit.Framework; | ||
using UnityEngine; | ||
using System.Collections.Generic; | ||
|
||
public class BehaviorTests : TestBase { | ||
/* | ||
[Test] | ||
public void TestDirectAttackBehaviorWaypoints() | ||
{ | ||
// Create a sample DirectAttackBehavior | ||
DirectAttackBehavior behavior = new DirectAttackBehavior(); | ||
behavior.flightPlan = new DTTFlightPlan | ||
{ | ||
waypoints = new List<DTTWaypoint> | ||
{ | ||
new DTTWaypoint { distance = 1000, altitude = 100, power = PowerSetting.CRUISE }, | ||
new DTTWaypoint { distance = 500, altitude = 50, power = PowerSetting.MIL }, | ||
new DTTWaypoint { distance = 100, altitude = 25, power = PowerSetting.MAX } | ||
} | ||
}; | ||
// Waypoints are already sorted in descending order in the production code | ||
Vector3 targetPosition = new Vector3(1000, 0, 0); | ||
const float epsilon = 0.001f; | ||
// Test waypoint selection based on distance | ||
Vector3 currentPosition = new Vector3(0, 0, 0); | ||
var result = behavior.GetNextWaypoint(currentPosition, targetPosition); | ||
Assert.AreEqual(0, result.waypointPosition.x, epsilon); | ||
Assert.AreEqual(100, result.waypointPosition.y, epsilon); | ||
Assert.AreEqual(0, result.waypointPosition.z, epsilon); | ||
Assert.AreEqual(PowerSetting.CRUISE, result.power); | ||
currentPosition = new Vector3(600, 0, 0); | ||
result = behavior.GetNextWaypoint(currentPosition, targetPosition); | ||
Assert.AreEqual(500, result.waypointPosition.x, epsilon); | ||
Assert.AreEqual(50, result.waypointPosition.y, epsilon); | ||
Assert.AreEqual(0, result.waypointPosition.z, epsilon); | ||
Assert.AreEqual(PowerSetting.MIL, result.power); | ||
currentPosition = new Vector3(920, 0, 0); | ||
result = behavior.GetNextWaypoint(currentPosition, targetPosition); | ||
Assert.AreEqual(900, result.waypointPosition.x, epsilon); | ||
Assert.AreEqual(25, result.waypointPosition.y, epsilon); | ||
Assert.AreEqual(0, result.waypointPosition.z, epsilon); | ||
Assert.AreEqual(PowerSetting.MAX, result.power); | ||
// Test behavior within final distance | ||
currentPosition = new Vector3(950, 0, 0); | ||
result = behavior.GetNextWaypoint(currentPosition, targetPosition); | ||
Assert.AreEqual(targetPosition.x, result.waypointPosition.x, epsilon); | ||
Assert.AreEqual(targetPosition.y, result.waypointPosition.y, epsilon); | ||
Assert.AreEqual(targetPosition.z, result.waypointPosition.z, epsilon); | ||
Assert.AreEqual(PowerSetting.MAX, result.power); // Should use the power of the closest | ||
waypoint | ||
// Test with non-zero Z coordinate | ||
targetPosition = new Vector3(800, 0, 600); | ||
currentPosition = new Vector3(0, 0, 0); | ||
result = behavior.GetNextWaypoint(currentPosition, targetPosition); | ||
Assert.AreEqual(0, result.waypointPosition.x, epsilon); | ||
Assert.AreEqual(100, result.waypointPosition.y, epsilon); | ||
Assert.AreEqual(0, result.waypointPosition.z, epsilon); | ||
Assert.AreEqual(PowerSetting.CRUISE, result.power); | ||
currentPosition = new Vector3(400, 0, 300); | ||
result = behavior.GetNextWaypoint(currentPosition, targetPosition); | ||
Assert.AreEqual(400, result.waypointPosition.x, epsilon); | ||
Assert.AreEqual(50, result.waypointPosition.y, epsilon); | ||
Assert.AreEqual(300, result.waypointPosition.z, epsilon); | ||
Assert.AreEqual(PowerSetting.MIL, result.power); | ||
} | ||
*/ | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.