From 4aae1603cef6ea589aaf4af844b2d51ebd7d9f08 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Tue, 10 Oct 2023 21:00:29 +0000 Subject: [PATCH 1/5] fixing windows Signed-off-by: Ian Chen --- src/CameraSensor.cc | 4 ++-- src/DepthCameraSensor.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/CameraSensor.cc b/src/CameraSensor.cc index 0b231067..36e5a040 100644 --- a/src/CameraSensor.cc +++ b/src/CameraSensor.cc @@ -259,7 +259,7 @@ bool CameraSensor::CreateCamera() double cx = cameraSdf->LensIntrinsicsCx(); double cy = cameraSdf->LensIntrinsicsCy(); double s = cameraSdf->LensIntrinsicsSkew(); - auto projectionMatrix = buildProjectionMatrix( + auto projectionMatrix = gz::sensors::buildProjectionMatrix( this->dataPtr->camera->ImageWidth(), this->dataPtr->camera->ImageHeight(), fx, fy, cx, cy, s, @@ -313,7 +313,7 @@ bool CameraSensor::CreateCamera() double cy = cameraSdf->LensProjectionCy(); double s = 0; - auto projectionMatrix = buildProjectionMatrix( + auto projectionMatrix = gz::sensors::buildProjectionMatrix( this->dataPtr->camera->ImageWidth(), this->dataPtr->camera->ImageHeight(), fx, fy, cx, cy, s, diff --git a/src/DepthCameraSensor.cc b/src/DepthCameraSensor.cc index 590bba79..49295bf3 100644 --- a/src/DepthCameraSensor.cc +++ b/src/DepthCameraSensor.cc @@ -405,7 +405,7 @@ bool DepthCameraSensor::CreateCamera() double cx = cameraSdf->LensIntrinsicsCx(); double cy = cameraSdf->LensIntrinsicsCy(); double s = cameraSdf->LensIntrinsicsSkew(); - auto projectionMatrix = buildProjectionMatrix( + auto projectionMatrix = gz::sensors::buildProjectionMatrix( this->dataPtr->depthCamera->ImageWidth(), this->dataPtr->depthCamera->ImageHeight(), fx, fy, cx, cy, s, this->dataPtr->depthCamera->NearClipPlane(), @@ -446,7 +446,7 @@ bool DepthCameraSensor::CreateCamera() double cy = cameraSdf->LensProjectionCy(); double s = 0; - auto projectionMatrix = buildProjectionMatrix( + auto projectionMatrix = gz::sensors::buildProjectionMatrix( this->dataPtr->depthCamera->ImageWidth(), this->dataPtr->depthCamera->ImageHeight(), fx, fy, cx, cy, s, From 7eb44ce654f646a55bafe002ea9c705803ca9d10 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Tue, 10 Oct 2023 21:18:19 +0000 Subject: [PATCH 2/5] test visibility Signed-off-by: Ian Chen --- src/CameraSensorUtil.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CameraSensorUtil.hh b/src/CameraSensorUtil.hh index ed76c986..ada51048 100644 --- a/src/CameraSensorUtil.hh +++ b/src/CameraSensorUtil.hh @@ -82,7 +82,7 @@ math::Matrix4d buildPerspectiveMatrix( /// This value is negative if the plane is to be behind /// the camera /// \return OpenGL projection matrix -math::Matrix4d buildProjectionMatrix(double _imageWidth, double _imageHeight, +math::Matrix4d GZ_SENSORS_VISIBLE buildProjectionMatrix(double _imageWidth, double _imageHeight, double _intrinsicsFx, double _intrinsicsFy, double _intrinsicsCx, double _intrinsicsCy, double _intrinsicsS, double _clipNear, From 7657f251088e4161ddfb74df2a867c7ee32dd731 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Tue, 10 Oct 2023 22:31:35 +0000 Subject: [PATCH 3/5] style Signed-off-by: Ian Chen --- src/CameraSensorUtil.hh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/CameraSensorUtil.hh b/src/CameraSensorUtil.hh index ada51048..9b267066 100644 --- a/src/CameraSensorUtil.hh +++ b/src/CameraSensorUtil.hh @@ -82,11 +82,12 @@ math::Matrix4d buildPerspectiveMatrix( /// This value is negative if the plane is to be behind /// the camera /// \return OpenGL projection matrix -math::Matrix4d GZ_SENSORS_VISIBLE buildProjectionMatrix(double _imageWidth, double _imageHeight, - double _intrinsicsFx, double _intrinsicsFy, - double _intrinsicsCx, double _intrinsicsCy, - double _intrinsicsS, double _clipNear, - double _clipFar); +math::Matrix4d GZ_SENSORS_VISIBLE buildProjectionMatrix( + double _imageWidth, double _imageHeight, + double _intrinsicsFx, double _intrinsicsFy, + double _intrinsicsCx, double _intrinsicsCy, + double _intrinsicsS, double _clipNear, + double _clipFar); } } } From d5b64efa57665c0fab01964297b6af1a0f739aff Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Wed, 11 Oct 2023 19:02:27 +0000 Subject: [PATCH 4/5] test alternative fix Signed-off-by: Ian Chen --- src/CMakeLists.txt | 5 ++--- src/CameraSensorUtil.hh | 11 +++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 23e52bb0..95bd42a7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,5 @@ set (sources BrownDistortionModel.cc - CameraSensorUtil.cc Distortion.cc EnvironmentalData.cc GaussianNoiseModel.cc @@ -59,7 +58,7 @@ target_link_libraries(${rendering_target} gz-rendering${GZ_RENDERING_VER}::gz-rendering${GZ_RENDERING_VER} ) -set(camera_sources CameraSensor.cc) +set(camera_sources CameraSensor.cc CameraSensorUtil.cc) gz_add_component(camera SOURCES ${camera_sources} DEPENDS_ON_COMPONENTS rendering @@ -76,7 +75,7 @@ target_link_libraries(${camera_target} gz-transport${GZ_TRANSPORT_VER}::gz-transport${GZ_TRANSPORT_VER} ) -set(depth_camera_sources DepthCameraSensor.cc) +set(depth_camera_sources DepthCameraSensor.cc CameraSensorUtil.cc) gz_add_component(depth_camera SOURCES ${depth_camera_sources} DEPENDS_ON_COMPONENTS camera diff --git a/src/CameraSensorUtil.hh b/src/CameraSensorUtil.hh index 9b267066..ed76c986 100644 --- a/src/CameraSensorUtil.hh +++ b/src/CameraSensorUtil.hh @@ -82,12 +82,11 @@ math::Matrix4d buildPerspectiveMatrix( /// This value is negative if the plane is to be behind /// the camera /// \return OpenGL projection matrix -math::Matrix4d GZ_SENSORS_VISIBLE buildProjectionMatrix( - double _imageWidth, double _imageHeight, - double _intrinsicsFx, double _intrinsicsFy, - double _intrinsicsCx, double _intrinsicsCy, - double _intrinsicsS, double _clipNear, - double _clipFar); +math::Matrix4d buildProjectionMatrix(double _imageWidth, double _imageHeight, + double _intrinsicsFx, double _intrinsicsFy, + double _intrinsicsCx, double _intrinsicsCy, + double _intrinsicsS, double _clipNear, + double _clipFar); } } } From c875f5ecd0e471407218eac27d22c177753129a7 Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Wed, 11 Oct 2023 20:38:56 +0000 Subject: [PATCH 5/5] update camke Signed-off-by: Ian Chen --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 95bd42a7..842cd4ed 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -164,7 +164,7 @@ gz_add_component(force_torque SOURCES ${force_torque_sources} GET_TARGET_NAME fo set(navsat_sources NavSatSensor.cc) gz_add_component(navsat SOURCES ${navsat_sources} GET_TARGET_NAME navsat_target) -set(rgbd_camera_sources RgbdCameraSensor.cc) +set(rgbd_camera_sources RgbdCameraSensor.cc CameraSensorUtil.cc) gz_add_component(rgbd_camera SOURCES ${rgbd_camera_sources} DEPENDS_ON_COMPONENTS camera