예제 #1
0
    public void startChoregraphy()
    {
        if (_sceneManager.isInitialized() == false)
        {
            return;
        }

        IEnumerable <TrajectoryManager> drones = _dronesManager.GetDrones().Select(d => d.GetComponent <TrajectoryManager>());

        foreach (TrajectoryManager drone in drones)
        {
            //drone.setTrajectory(TrajectoryManager.TrajectoryType.HOVER);
            //drone.getTrajectory().setVariable("position", new Vector3(10f, 10f, 10f));

            //drone.setTrajectory(TrajectoryManager.TrajectoryType.MULTI_LINES);
            //drone.getTrajectory().setVariable("positions", new List<Vector3> {
            //    new Vector3 (1f, 1f, 1f),
            //    new Vector3 (3f, 1f, 1f),
            //    new Vector3 (2f, 3f, 1f),
            //});
            //drone.getTrajectory().setVariable("time", 5.0f);
            //drone.getTrajectory().setVariable("loop", true);
            ////drone.getTrajectory().setVariable<Trajectory.SpeedFunction>("speed_function", x => 3 * Mathf.Pow(x, 2));
            //drone.getTrajectory().startTrajectory();

            //drone.setTrajectory(TrajectoryManager.TrajectoryType.JUGGLE_3D);
            //drone.getTrajectory().setVariable("base_x_vector", new Vector3(1f, 0f, 0f));
            //drone.getTrajectory().setVariable("hand_vector", new Vector3(1f, 5f, 10f));
            //drone.getTrajectory().setVariable("time_multiplier", 0.5f);
            //drone.getTrajectory().startTrajectory();

            //            drone.setTrajectory(TrajectoryManager.TrajectoryType.CIRCLE);
            //            drone.getTrajectory().setVariable("center", new Vector3(2f, 2f, 2f));
            //            drone.getTrajectory().setVariable("normal_vector", new Vector3(0f, 1f, 0f));
            //            drone.getTrajectory().setVariable("radius", 0.75f);
            //            drone.getTrajectory().setVariable("time", 5.0f);
            ////            drone.getTrajectory().setVariable<Trajectory.SpeedFunction>("speed_function", x => 3 * Mathf.Pow(x, 2));
            //            drone.getTrajectory().startTrajectory();

            drone.setTrajectory(TrajectoryManager.TrajectoryType.TAKEOFF);
            drone.getTrajectory().startTrajectory();

            //drone.setTrajectory(TrajectoryManager.TrajectoryType.JUGGLE_HORIZONTAL);
            //drone.getTrajectory().setVariable("hand_vector", new Vector3(1f, 5f, 10f));
            //drone.getTrajectory().setVariable("time_multiplier", 0.5f);
            //drone.getTrajectory().startTrajectory();
        }
    }
예제 #2
0
    private void Start()
    {
        // retrieve objects from the scene
        _oscManager    = GameObject.Find("OscManager").GetComponent <OscManager>();
        _dronesManager = GameObject.Find("DronesManager").GetComponent <DronesManager>();

        Debug.Assert(_handDroneID >= 0, "hand drone ID not set");
        _handDrone = _dronesManager.GetDroneGameObjectById(_handDroneID);
        Debug.Assert(_bodyDroneID >= 0, "body drone ID not set");
        _bodyDrone = _dronesManager.GetDroneGameObjectById(_bodyDroneID);

        _dronesIds = new List <int>(_dronesManager
                                    .GetDrones()
                                    .Select(d_go => d_go.Id)
                                    .Where(id => id != _handDroneID && id != _bodyDroneID));

        // soft "emergency" : do not need to reboot the drone nor the server
        _handDrone.GetComponent <Drone>().UseAsInput = true;
        _bodyDrone.GetComponent <Drone>().UseAsInput = true;

        // Subscribe to the specktr OSC topic
        _oscManager.OscSubscribe(specktrOscTopic, this.onButtons);
    }