Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
12 changes: 12 additions & 0 deletions Unity/UnityDemo/Assets/AirSimAssets/Scripts/Vehicles/Vehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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_)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ private static void InitDelegators() {
Marshal.GetFunctionPointerForDelegate(new Func<string, string, CameraInfo>(GetCameraInfo)),
Marshal.GetFunctionPointerForDelegate(new Func<string, AirSimPose, string, bool>(SetCameraPose)),
Marshal.GetFunctionPointerForDelegate(new Func<string, float, string, bool>(SetCameraFoV)),
Marshal.GetFunctionPointerForDelegate(new Func<string, string, float, string, bool>(SetDistortionParam)),
Marshal.GetFunctionPointerForDelegate(new Func<string, string, bool>(GetDistortionParams)),
Marshal.GetFunctionPointerForDelegate(new Func<string, int, bool, bool>(SetSegmentationObjectId)),
Marshal.GetFunctionPointerForDelegate(new Func<string, int>(GetSegmentationObjectId)),
Marshal.GetFunctionPointerForDelegate(new Func<string, string, string, int, bool>(PrintLogMessage)),
Expand Down Expand Up @@ -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) {
Expand Down