//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); }
/* 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 } }
public static VehicleCompanion GetVehicleCompanion(string vehicleName, IVehicleInterface vehicleInterface) { var companion = new VehicleCompanion(vehicleInterface); companion.vehicleName = vehicleName; Vehicles.Add(companion); return(companion); }
//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; }
//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); }
//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); }
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); }
//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); } }
//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); } }
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); }
//This method is linked through OnClick for RecordButton in AirSimHUD prefab. public void ToggleRecording() { VehicleCompanion.GetCameraCaptureForRecording().ToggleRecording(); }
// Remove vehicle private static bool RemoveVehicle(string vehicle_name, string vehicle_type) // Take in init pose and path? { VehicleCompanion.DestroyVehicle(vehicle_name); return true; }