コード例 #1
0
    public override void OnInspectorGUI()
    {
        DronesManager dronesManager = (DronesManager)target;

        MonitorArray.monitor(target, "arrayone", dronesManager.dronesConfigs, (int i) => {
            dronesManager.dronesConfigs[i]       = new DroneConfig(i);
            dronesManager.dronesConfigs[i].color = UnityEngine.Random.ColorHSV(0f, 1f, 1f, 1f, 0.5f, 1f);
        });

        DrawDefaultInspector();

        if (GUILayout.Button("Recreate drones"))
        {
            dronesManager.RecreateDrones();
        }

        if (GUILayout.Button("Remove drones"))
        {
            dronesManager.DestroyDrones();
        }

        // OSC actions

        if (GUILayout.Button("OSC - Connect - all"))
        {
            dronesManager.ConnectDrones();
        }

        if (GUILayout.Button("OSC - Start Position Sync"))
        {
            dronesManager.StartPositionSync();
        }
        if (GUILayout.Button("OSC - Stop Position Sync"))
        {
            dronesManager.StopPositionSync();
        }

        if (GUILayout.Button("OSC - Reset Kalman Filter - all"))
        {
            dronesManager.ResetKalmanFilters();
        }

        if (GUILayout.Button("OSC - EMERGENCY - all"))
        {
            dronesManager.SendEmergencySignals();
        }
    }
コード例 #2
0
    IEnumerator StartingCoroutine()
    {
        yield return(new WaitForSeconds(0.1f));

        if (this.shouldInitialize == false) // DEBUG PURPOSE ONLY : I dont like waiting
        {
            this.system_initialized = true;
            yield break;
        }

        this._drones_osc_client      = this._oscManager.CreateClient("drones");
        this._drones_meta_osc_client = this._oscManager.CreateClient("drones_meta");
        this._oscManager.SendOscMessage(this._drones_meta_osc_client,
                                        "/server/restart",
                                        1);

        yield return(new WaitForSeconds(5));

        ConnectClientToDroneServer();

        print("Waiting for LPS and Drones managers init");
        yield return(new WaitForSeconds(0.1f));

        print("Connecting drones");
        _dronesManager.ConnectDrones();

        yield return(new WaitForSeconds(5));

        print("Sending LPS configs");
        _lpsManager.SendConfigOsc();
        yield return(new WaitForSeconds(1));

        print("Reseting kalman filters");
        _dronesManager.ResetKalmanFilters();
        print("Waiting for kalman filters to converge");
        yield return(new WaitForSeconds(1)); // It may not be enough. TODO : compute real position variance and wait for it to converge

        //this._oscManager.SendOscMessage(this._drones_osc_client,
        //    "/log/*/send_toc");
        print("SYSTEM OK");
        this.system_initialized = true;
    }