1. -- 
  2. -- Jan & Uwe R. Zimmer, Australia, 2013 
  3. -- 
  4.  
  5. with Ada.Task_Identification;  use Ada.Task_Identification; 
  6. with Barrier_Type;             use Barrier_Type; 
  7. with Real_Type;                use Real_Type; 
  8. with Swarm_Configuration;      use Swarm_Configuration; 
  9. with Swarm_Structures;         use Swarm_Structures; 
  10. with Swarm_Structures_Base;    use Swarm_Structures_Base; 
  11. with Vectors_3D;               use Vectors_3D; 
  12.  
  13. package Swarm_Control is 
  14.  
  15.    pragma Elaborate_Body; 
  16.  
  17.    protected Swarm_Monitor is 
  18.  
  19.       function Id_Task                return Swarm_Element_Index; 
  20.       function Id_Task (Id : Task_Id) return Swarm_Element_Index; 
  21.  
  22.       function Position      (Id : Task_Id) return Protected_Point_3D.Monitor_Ptr; 
  23.       function Velocity      (Id : Task_Id) return Protected_Vector_3D.Monitor_Ptr; 
  24.       function Acceleration  (Id : Task_Id) return Protected_Vector_3D.Monitor_Ptr; 
  25.       function Controls      (Id : Task_Id) return Vehicle_Controls_P; 
  26.       function Comms         (Id : Task_Id) return Vehicle_Comms_P; 
  27.       function Charge        (Id : Task_Id) return Charge_Info; 
  28.       function Process_abort                return Barrier_Ptr; 
  29.  
  30.       procedure Append_Random_Swarm (No_Of_Swarm_Elements : Positive  := Initial_No_of_Elements; 
  31.                                      Centre               : Positions := Initial_Swarm_Position; 
  32.                                      Volume_Edge_Length   : Real      := Initual_Edge_Length); 
  33.  
  34.       procedure Remove_Vehicle (Element_Ix : Swarm_Element_Index); 
  35.  
  36.       function Centre_Of_Gravity     return Vector_3D; 
  37.       function Mean_Velocity         return Vector_3D; 
  38.       function Mean_Velocity         return Real; 
  39.       function Maximal_Radius        return Real; 
  40.       function Mean_Radius           return Real; 
  41.       function Mean_Closest_Distance return Real; 
  42.  
  43.    private 
  44.       Last_Vehicle_Id : Natural := 0; 
  45.  
  46.    end Swarm_Monitor; 
  47.  
  48.    Vehicle_could_not_be_created, 
  49.    Task_did_not_repond_to_Identfiy_Call, 
  50.    No_Such_Task : exception; 
  51.  
  52.    procedure Remove_Vehicles (No_Of_Swarm_Elements : Positive  := 1); 
  53.  
  54.    procedure Set_Acceleration (Element_Index : Swarm_Element_Index); 
  55.    procedure Set_All_Accelerations; 
  56.  
  57.    procedure Forward_Messages (Element_Index : Swarm_Element_Index); 
  58.    procedure Forward_All_Messages; 
  59.  
  60.    procedure Move_Element (Element_Index : Swarm_Element_Index); 
  61.    procedure Move_All_Elements; 
  62.  
  63.    procedure Update_Rotation (Element_Index : Swarm_Element_Index); 
  64.    procedure Update_All_Rotations; 
  65.  
  66.    procedure Remove_Empties; 
  67.  
  68. end Swarm_Control;