From 63b4294104fed44e4c51ee83c2a92aa9edbb0aa6 Mon Sep 17 00:00:00 2001 From: wojansen Date: Mon, 19 Aug 2019 18:59:27 +0200 Subject: [PATCH 1/5] Fixed Unreal Lidar sensor incorrectly setting start position for the traces by not accounting for the rotation of sensor/vehicle --- .../Plugins/AirSim/Source/UnrealSensors/UnrealLidarSensor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Unreal/Plugins/AirSim/Source/UnrealSensors/UnrealLidarSensor.cpp b/Unreal/Plugins/AirSim/Source/UnrealSensors/UnrealLidarSensor.cpp index f224ebce0a..301819f9d3 100644 --- a/Unreal/Plugins/AirSim/Source/UnrealSensors/UnrealLidarSensor.cpp +++ b/Unreal/Plugins/AirSim/Source/UnrealSensors/UnrealLidarSensor.cpp @@ -110,7 +110,7 @@ bool UnrealLidarSensor::shootLaser(const msr::airlib::Pose& lidar_pose, const ms const msr::airlib::LidarSimpleParams params, Vector3r &point) { // start position - Vector3r start = lidar_pose.position + vehicle_pose.position; + Vector3r start = VectorMath::add(lidar_pose, vehicle_pose).position; // We need to compose rotations here rather than rotate a vector by a quaternion // Hence using coordOrientationAdd(..) rather than rotateQuaternion(..) From 2cd28cf3e9dfd1a50db12b91122804380e446ac1 Mon Sep 17 00:00:00 2001 From: wojansen Date: Wed, 18 Sep 2019 10:18:23 +0200 Subject: [PATCH 2/5] Fixed python client QuaternionR class having bug to correctly invert the quaternion. --- PythonClient/airsim/types.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PythonClient/airsim/types.py b/PythonClient/airsim/types.py index cda3b898e1..461f2077aa 100644 --- a/PythonClient/airsim/types.py +++ b/PythonClient/airsim/types.py @@ -181,7 +181,7 @@ def star(self): return self.conjugate() def inverse(self): - return self.star() / self.dot(self) + return self.from_numpy_array(self.star().to_numpy_array() / self.dot(self)) def sgn(self): return self/self.get_length() @@ -191,6 +191,9 @@ def get_length(self): def to_numpy_array(self): return np.array([self.x_val, self.y_val, self.z_val, self.w_val], dtype=np.float32) + + def from_numpy_array(self, array): + return Quaternionr( array[0], array[1], array[2], array[3] ) class Pose(MsgpackMixin): From b8d076fc34ee7a83c809c1be6ad2254070027c45 Mon Sep 17 00:00:00 2001 From: Wouter J Date: Wed, 18 Sep 2019 10:21:53 +0200 Subject: [PATCH 3/5] Update types.py --- PythonClient/airsim/types.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PythonClient/airsim/types.py b/PythonClient/airsim/types.py index 461f2077aa..f3838828d6 100644 --- a/PythonClient/airsim/types.py +++ b/PythonClient/airsim/types.py @@ -192,7 +192,7 @@ def get_length(self): def to_numpy_array(self): return np.array([self.x_val, self.y_val, self.z_val, self.w_val], dtype=np.float32) - def from_numpy_array(self, array): + def from_numpy_array(self, array): return Quaternionr( array[0], array[1], array[2], array[3] ) @@ -394,4 +394,4 @@ class GnssReport(MsgpackMixin): class GpsData(MsgpackMixin): time_stamp = np.uint64(0) gnss = GnssReport() - is_valid = False \ No newline at end of file + is_valid = False From c92b76ba998e326b7ca475ee3a5c09f284554a19 Mon Sep 17 00:00:00 2001 From: Wouter J Date: Thu, 3 Oct 2019 19:24:49 +0200 Subject: [PATCH 4/5] Revert "Update types.py" This reverts commit b8d076fc34ee7a83c809c1be6ad2254070027c45. --- PythonClient/airsim/types.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PythonClient/airsim/types.py b/PythonClient/airsim/types.py index f3838828d6..461f2077aa 100644 --- a/PythonClient/airsim/types.py +++ b/PythonClient/airsim/types.py @@ -192,7 +192,7 @@ def get_length(self): def to_numpy_array(self): return np.array([self.x_val, self.y_val, self.z_val, self.w_val], dtype=np.float32) - def from_numpy_array(self, array): + def from_numpy_array(self, array): return Quaternionr( array[0], array[1], array[2], array[3] ) @@ -394,4 +394,4 @@ class GnssReport(MsgpackMixin): class GpsData(MsgpackMixin): time_stamp = np.uint64(0) gnss = GnssReport() - is_valid = False + is_valid = False \ No newline at end of file From 02b2a82f34a0dfa2c54d522a7df48aa6da19939d Mon Sep 17 00:00:00 2001 From: Wouter J Date: Thu, 3 Oct 2019 19:24:53 +0200 Subject: [PATCH 5/5] Revert "Fixed python client QuaternionR class having bug to correctly invert the quaternion." This reverts commit 2cd28cf3e9dfd1a50db12b91122804380e446ac1. --- PythonClient/airsim/types.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/PythonClient/airsim/types.py b/PythonClient/airsim/types.py index 461f2077aa..cda3b898e1 100644 --- a/PythonClient/airsim/types.py +++ b/PythonClient/airsim/types.py @@ -181,7 +181,7 @@ def star(self): return self.conjugate() def inverse(self): - return self.from_numpy_array(self.star().to_numpy_array() / self.dot(self)) + return self.star() / self.dot(self) def sgn(self): return self/self.get_length() @@ -191,9 +191,6 @@ def get_length(self): def to_numpy_array(self): return np.array([self.x_val, self.y_val, self.z_val, self.w_val], dtype=np.float32) - - def from_numpy_array(self, array): - return Quaternionr( array[0], array[1], array[2], array[3] ) class Pose(MsgpackMixin):