diff --git a/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Utilities/PInvokeWrapper.cs b/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Utilities/PInvokeWrapper.cs index 8f156909ce..60fd57dbf4 100644 --- a/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Utilities/PInvokeWrapper.cs +++ b/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Utilities/PInvokeWrapper.cs @@ -13,8 +13,9 @@ public static class PInvokeWrapper { [DllImport(DLL_NAME)] public static extern void InitVehicleManager(IntPtr SetPose, IntPtr GetPose, IntPtr GetCollisionInfo, IntPtr GetRCData, IntPtr GetSimImages, IntPtr SetRotorSpeed, IntPtr SetEnableApi, IntPtr SetCarApiControls, IntPtr GetCarState, - IntPtr GetCameraInfo, IntPtr SetCameraPose, IntPtr SetCameraFoV, IntPtr SetSegmentationObjectid, IntPtr GetSegmentationObjectId, - IntPtr PrintLogMessage, IntPtr GetTransformFromUnity, IntPtr Reset, IntPtr GetVelocity, IntPtr GetRayCastHit, IntPtr Pause); + IntPtr GetCameraInfo, IntPtr SetCameraPose, IntPtr SetCameraFoV, IntPtr SetDistortionParam, IntPtr GetDistortionParams, + IntPtr SetSegmentationObjectId, IntPtr GetSegmentationObjectId, IntPtr PrintLogMessage, IntPtr GetTransformFromUnity, + IntPtr Reset, IntPtr GetVelocity, IntPtr GetRayCastHit, IntPtr Pause); [DllImport(DLL_NAME)] public static extern KinemticState GetKinematicState(string vehicleName); diff --git a/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Vehicles/IVehicleInterface.cs b/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Vehicles/IVehicleInterface.cs index 2809319985..0ec4deec3b 100644 --- a/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Vehicles/IVehicleInterface.cs +++ b/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Vehicles/IVehicleInterface.cs @@ -37,6 +37,10 @@ public interface IVehicleInterface { bool SetCameraFoV(string cameraName, float fov_degrees); + bool SetDistortionParam(string cameraName, string paramName, float value); + + bool GetDistortionParams(string cameraName); + bool PrintLogMessage(string message, string messageParams, string vehicleName, int severity); void ResetVehicle(); diff --git a/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Vehicles/Vehicle.cs b/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Vehicles/Vehicle.cs index 2049d2eecd..56d5ef9af6 100644 --- a/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Vehicles/Vehicle.cs +++ b/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Vehicles/Vehicle.cs @@ -284,6 +284,18 @@ public bool SetCameraFoV(string cameraName, float fov_degrees) { return false; } + public bool SetDistortionParam(string cameraName, string paramName, float value) + { + // not implemented + return false; + } + + public bool GetDistortionParams(string cameraName) + { + // not implemented + return false; + } + public bool PrintLogMessage(string message, string messageParams, string vehicleName, int severity) { if (!print_log_messages_) diff --git a/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Vehicles/VehicleCompanion.cs b/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Vehicles/VehicleCompanion.cs index d7b788ca48..c83787d8d5 100644 --- a/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Vehicles/VehicleCompanion.cs +++ b/Unity/UnityDemo/Assets/AirSimAssets/Scripts/Vehicles/VehicleCompanion.cs @@ -95,6 +95,8 @@ private static void InitDelegators() { Marshal.GetFunctionPointerForDelegate(new Func(GetCameraInfo)), Marshal.GetFunctionPointerForDelegate(new Func(SetCameraPose)), Marshal.GetFunctionPointerForDelegate(new Func(SetCameraFoV)), + Marshal.GetFunctionPointerForDelegate(new Func(SetDistortionParam)), + Marshal.GetFunctionPointerForDelegate(new Func(GetDistortionParams)), Marshal.GetFunctionPointerForDelegate(new Func(SetSegmentationObjectId)), Marshal.GetFunctionPointerForDelegate(new Func(GetSegmentationObjectId)), Marshal.GetFunctionPointerForDelegate(new Func(PrintLogMessage)), @@ -196,7 +198,13 @@ private static bool SetCameraFoV(string cameraName, float fov_degrees, string ve private static bool SetDistortionParam(string cameraName, string paramName, float value, string vehicleName) { var vehicle = Vehicles.Find(element => element.vehicleName == vehicleName); - return vehicle.VehicleInterface.SetDistortionParam(cameraName, fov_degrees); + return vehicle.VehicleInterface.SetDistortionParam(cameraName, paramName, value); + } + + private static bool GetDistortionParams(string cameraName, string vehicleName) + { + var vehicle = Vehicles.Find(element => element.vehicleName == vehicleName); + return vehicle.VehicleInterface.GetDistortionParams(cameraName); } private static bool PrintLogMessage(string message, string messageParams, string vehicleName, int severity) {