コード例 #1
0
        //Ensure to call this method as the first statement, from derived class `Start()` method.
        protected void Start()
        {
            isDrone = this is Drone ? true : false;
            if (isDrone)
            {
                GetComponent <Rigidbody>().useGravity = false;
            }

            InitializeVehicle();

            airsimInterface = VehicleCompanion.GetVehicleCompanion(this, vehicle_name);
            isServerStarted = airsimInterface.StartVehicleServer(AirSimSettings.GetSettings().LocalHostIP);

            if (isServerStarted == false)
            {
#if UNITY_EDITOR
                EditorUtility.DisplayDialog("Problem in starting AirSim server!!!", "Please check logs for more information.", "Exit");
                EditorApplication.Exit(1);
#else
                Application.Quit();
#endif
            }

            AirSimGlobal.Instance.Weather.AttachToVehicle(this);
            count = UnityEngine.Random.Range(0, 10);
        }
コード例 #2
0
    /*    AirSimServer()
        {
        }*/

        void Start()
        {
            vehicleList = new List<Transform>();
            pedestrianList = new List<Transform>();

            comp = new ServerCompanion();
            VehicleCompanion.InitDelegators();
            var settings = AirSimSettings.GetSettings();
                        
            if (IP == "")
                IP = settings.LocalHostIP;
            
            
            if (Port == -1)
                Port = settings.GetPort(AirSimSettings.AgentType.Server);

                // Start server
            bool status = PInvokeWrapper.StartMainServer(Port);
            Debug.LogWarning("Main server started on port " + Port.ToString());
            if(!status)
            {
#if UNITY_EDITOR
                EditorUtility.DisplayDialog("AirSim main failed to start on port " + Port.ToString() + "!!!", "Please check logs for more information.", "Exit");
                EditorApplication.Exit(1);
#else
                Application.Quit();
#endif
            }

        }
コード例 #3
0
        public static VehicleCompanion GetVehicleCompanion(string vehicleName, IVehicleInterface vehicleInterface)
        {
            var companion = new VehicleCompanion(vehicleInterface);

            companion.vehicleName = vehicleName;

            Vehicles.Add(companion);
            return(companion);
        }
コード例 #4
0
        //Ensure to call this method as the first statement, from derived class `Start()` method.
        protected void Start()
        {
            isDrone = this is Drone ? true : false;
            if (isDrone)
            {
                GetComponent <Rigidbody>().useGravity = false;
            }

            InitializeVehicle();

            airsimInterface = VehicleCompanion.GetVehicleCompanion(vehicleName, this);
            isServerStarted = true;
        }
コード例 #5
0
ファイル: Vehicle.cs プロジェクト: zivzone/UrdfSim
        //Ensure to call this method as the first statement, from derived class `Start()` method.
        protected void Start()
        {
            isDrone = this is Drone ? true : false;
            if (isDrone)
            {
                GetComponent <Rigidbody>().useGravity = false;
            }

            InitializeVehicle();

            airsimInterface = VehicleCompanion.GetVehicleCompanion(this);
            isServerStarted = airsimInterface.StartVehicleServer(AirSimSettings.GetSettings().LocalHostIP);
        }
コード例 #6
0
ファイル: Vehicle.cs プロジェクト: xiang-zhe/AirSim
        //Ensure to call this method as the first statement, from derived class `Start()` method.
        protected void Start()
        {
            isDrone = this is Drone ? true : false;
            if (isDrone)
            {
                GetComponent <Rigidbody>().useGravity = false;
            }

            InitializeVehicle();

            airsimInterface = VehicleCompanion.GetVehicleCompanion(vehicleName, this);
            isServerStarted = true;
            AirSimGlobal.Instance.Weather.AttachToVehicle(this);
        }
コード例 #7
0
        public static VehicleCompanion GetVehicleCompanion(IVehicleInterface vehicleInterface)
        {
            var companion = new VehicleCompanion(vehicleInterface);

            if (AirSimSettings.GetSettings().SimMode == "Car")
            {
                companion.vehicleName = "PhysXCar";
            }
            else if (AirSimSettings.GetSettings().SimMode == "Multirotor")
            {
                companion.vehicleName = "SimpleFlight";
            }

            Vehicles.Add(companion);
            return(companion);
        }
コード例 #8
0
ファイル: Vehicle.cs プロジェクト: shkim3220/Microsoft_Airsim
        //Ensure to call this method as the first statement, from derived class `Start()` method.
        protected void Start()
        {
            isDrone = this is Drone ? true : false;
            if (isDrone)
            {
                GetComponent <Rigidbody>().useGravity = false;
            }

            InitializeVehicle();

            airsimInterface = VehicleCompanion.GetVehicleCompanion(this);
            isServerStarted = airsimInterface.StartVehicleServer(AirSimSettings.GetSettings().LocalHostIP);

            if (isServerStarted == false)
            {
                EditorUtility.DisplayDialog("Problem in starting AirSim server!!!", "Please check logs for more information.", "Exit");
                EditorApplication.Exit(1);
            }
        }
コード例 #9
0
ファイル: DataCaptureScript.cs プロジェクト: iosp/citybobcat
        //Thread to capture the images and save them to documents. This will be started by pressing the Record button on HUD.
        private IEnumerator CaptureFrames()
        {
            AirSimSettings.CamerasSettings recordCamSettings = AirSimSettings.GetSettings().Recording.Cameras[0];
            SetUpRenderType((ImageType)recordCamSettings.ImageType);
            SetUpRenderTextureForCapture((ImageType)recordCamSettings.ImageType);
            while (isCapturing)
            {
                yield return(waitForEndOfFrame);

                RenderTexture.active = renderTexture;
                screenShot.ReadPixels(captureRect, 0, 0);
                screenShot.Apply();
                byte[] bytes = screenShot.EncodeToPNG();
                RenderTexture.active = null;
                DataRecorder.ImageData data = VehicleCompanion.GetRecordingData();
                data.image = bytes;
                recorder.AddImageDataToQueue(data);
                yield return(waitUntilNext);
            }
        }
コード例 #10
0
        public static VehicleCompanion GetVehicleCompanion(IVehicleInterface vehicleInterface, string vehicleName)
        {
            var companion = new VehicleCompanion(vehicleInterface);

            if (AirSimSettings.GetSettings().SimMode == "Car")
            {
                companion.vehicleType = "PhysXCar";
                companion.vehicleName = vehicleName;
            }

            else if (AirSimSettings.GetSettings().SimMode == "Multirotor")
            {
                companion.vehicleType = "SimpleFlight";
            }


            Vehicles.Add(companion);
            Debug.LogWarning("Number of cars: " + Vehicles.Count.ToString() + "Sim mode - " + AirSimSettings.GetSettings().SimMode + ". Added - " + companion.vehicleName);

            return(companion);
        }
コード例 #11
0
ファイル: AirSimHUDScript.cs プロジェクト: zivzone/UrdfSim
 //This method is linked through OnClick for RecordButton in AirSimHUD prefab.
 public void ToggleRecording()
 {
     VehicleCompanion.GetCameraCaptureForRecording().ToggleRecording();
 }
コード例 #12
0
 // Remove vehicle
 private static bool RemoveVehicle(string vehicle_name, string vehicle_type) // Take in init pose and path?
 {
     VehicleCompanion.DestroyVehicle(vehicle_name);
     return true;
 }