diff --git a/Changelog.md b/Changelog.md index fa8bb897..aab6676c 100644 --- a/Changelog.md +++ b/Changelog.md @@ -327,7 +327,22 @@ ## Gazebo Sensors 3 -### Gazebo Sensors 3.X.X (202X-XX-XX) +### Gazebo Sensors 3.4.0 (2022-08-16) + +1. Remove redundant namespace references + * [Pull request #258](https://github.com/gazebosim/gz-sensors/pull/258) + +1. Ignition -> Gazebo + * [Pull request #245](https://github.com/gazebosim/gz-sensors/pull/245) + +1. Conform to ros format for header field `frame_id` of sensor msgs + * [Pull request #195](https://github.com/gazebosim/gz-sensors/pull/195) + +1. Fix compiler warnings (`CMP0072` and copy elision) + * [Pull request #188](https://github.com/gazebosim/gz-sensors/pull/188) + +1. Require ign-transport >= 8.2 + * [Pull request #167](https://github.com/gazebosim/gz-sensors/pull/167) ### Gazebo Sensors 3.3.0 (2021-08-26) diff --git a/src/AirPressureSensor.cc b/src/AirPressureSensor.cc index 6cb2637d..8266f7a1 100644 --- a/src/AirPressureSensor.cc +++ b/src/AirPressureSensor.cc @@ -15,14 +15,14 @@ * */ -#ifdef _WIN32 -#pragma warning(push) -#pragma warning(disable: 4005) -#pragma warning(disable: 4251) +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4005) + #pragma warning(disable: 4251) #endif #include -#ifdef _WIN32 -#pragma warning(pop) +#if defined(_MSC_VER) + #pragma warning(pop) #endif #include @@ -114,7 +114,7 @@ bool AirPressureSensor::Load(const sdf::Sensor &_sdf) this->SetTopic("/air_pressure"); this->dataPtr->pub = - this->dataPtr->node.Advertise( + this->dataPtr->node.Advertise( this->Topic()); if (!this->dataPtr->pub) @@ -194,7 +194,7 @@ bool AirPressureSensor::Update( NoiseType::GAUSSIAN) { GaussianNoiseModelPtr gaussian = - std::dynamic_pointer_cast( + std::dynamic_pointer_cast( this->dataPtr->noises[AIR_PRESSURE_NOISE_PASCALS]); msg.set_variance(sqrt(gaussian->StdDev())); } diff --git a/src/AltimeterSensor.cc b/src/AltimeterSensor.cc index 7bf7fb45..e89d2f31 100644 --- a/src/AltimeterSensor.cc +++ b/src/AltimeterSensor.cc @@ -15,14 +15,14 @@ * */ -#ifdef _WIN32 -#pragma warning(push) -#pragma warning(disable: 4005) -#pragma warning(disable: 4251) +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4005) + #pragma warning(disable: 4251) #endif #include -#ifdef _WIN32 -#pragma warning(pop) +#if defined(_MSC_VER) + #pragma warning(pop) #endif #include @@ -103,7 +103,7 @@ bool AltimeterSensor::Load(const sdf::Sensor &_sdf) this->SetTopic("/altimeter"); this->dataPtr->pub = - this->dataPtr->node.Advertise(this->Topic()); + this->dataPtr->node.Advertise(this->Topic()); if (!this->dataPtr->pub) { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 196461c2..e7d771f6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,11 +1,11 @@ set (sources + BrownDistortionModel.cc + Distortion.cc + GaussianNoiseModel.cc Manager.cc - Sensor.cc Noise.cc - GaussianNoiseModel.cc - Distortion.cc - BrownDistortionModel.cc PointCloudUtil.cc + Sensor.cc SensorFactory.cc SensorTypes.cc Util.cc @@ -14,10 +14,10 @@ set (sources set(rendering_sources RenderingSensor.cc RenderingEvents.cc - ImageGaussianNoiseModel.cc - ImageNoise.cc ImageBrownDistortionModel.cc ImageDistortion.cc + ImageGaussianNoiseModel.cc + ImageNoise.cc ) set (gtest_sources @@ -58,7 +58,11 @@ target_link_libraries(${rendering_target} ) set(camera_sources CameraSensor.cc) -gz_add_component(camera SOURCES ${camera_sources} GET_TARGET_NAME camera_target) +gz_add_component(camera + SOURCES ${camera_sources} + DEPENDS_ON_COMPONENTS rendering + GET_TARGET_NAME camera_target +) # custom compile definitions since the one provided automatically is versioned and will # make the code need to change with every major version target_compile_definitions(${camera_target} PUBLIC CameraSensor_EXPORTS) @@ -71,7 +75,11 @@ target_link_libraries(${camera_target} ) set(depth_camera_sources DepthCameraSensor.cc) -gz_add_component(depth_camera SOURCES ${depth_camera_sources} GET_TARGET_NAME depth_camera_target) +gz_add_component(depth_camera + SOURCES ${depth_camera_sources} + DEPENDS_ON_COMPONENTS camera + GET_TARGET_NAME depth_camera_target +) target_compile_definitions(${depth_camera_target} PUBLIC DepthCameraSensor_EXPORTS) target_link_libraries(${depth_camera_target} PRIVATE @@ -81,7 +89,11 @@ target_link_libraries(${depth_camera_target} ) set(lidar_sources Lidar.cc) -gz_add_component(lidar SOURCES ${lidar_sources} GET_TARGET_NAME lidar_target) +gz_add_component(lidar + SOURCES ${lidar_sources} + DEPENDS_ON_COMPONENTS rendering + GET_TARGET_NAME lidar_target +) target_compile_definitions(${lidar_target} PUBLIC Lidar_EXPORTS) target_link_libraries(${lidar_target} PUBLIC @@ -92,7 +104,11 @@ target_link_libraries(${lidar_target} ) set(gpu_lidar_sources GpuLidarSensor.cc) -gz_add_component(gpu_lidar SOURCES ${gpu_lidar_sources} GET_TARGET_NAME gpu_lidar_target) +gz_add_component(gpu_lidar + DEPENDS_ON_COMPONENTS lidar + SOURCES ${gpu_lidar_sources} + GET_TARGET_NAME gpu_lidar_target +) target_compile_definitions(${gpu_lidar_target} PUBLIC GpuLidarSensor_EXPORTS) target_link_libraries(${gpu_lidar_target} PRIVATE @@ -116,20 +132,23 @@ gz_add_component(magnetometer SOURCES ${magnetometer_sources} GET_TARGET_NAME ma set(imu_sources ImuSensor.cc) gz_add_component(imu SOURCES ${imu_sources} GET_TARGET_NAME imu_target) -set(force_torque_sources ForceTorqueSensor.cc) -gz_add_component(force_torque SOURCES ${force_torque_sources} GET_TARGET_NAME force_torque_target) - set(altimeter_sources AltimeterSensor.cc) gz_add_component(altimeter SOURCES ${altimeter_sources} GET_TARGET_NAME altimeter_target) set(air_pressure_sources AirPressureSensor.cc) gz_add_component(air_pressure SOURCES ${air_pressure_sources} GET_TARGET_NAME air_pressure_target) +set(force_torque_sources ForceTorqueSensor.cc) +gz_add_component(force_torque SOURCES ${force_torque_sources} GET_TARGET_NAME force_torque_target) set(navsat_sources NavSatSensor.cc) gz_add_component(navsat SOURCES ${navsat_sources} GET_TARGET_NAME navsat_target) set(rgbd_camera_sources RgbdCameraSensor.cc) -gz_add_component(rgbd_camera SOURCES ${rgbd_camera_sources} GET_TARGET_NAME rgbd_camera_target) +gz_add_component(rgbd_camera + SOURCES ${rgbd_camera_sources} + DEPENDS_ON_COMPONENTS camera + GET_TARGET_NAME rgbd_camera_target +) target_compile_definitions(${rgbd_camera_target} PUBLIC RgbdCameraSensor_EXPORTS) target_link_libraries(${rgbd_camera_target} PRIVATE @@ -139,7 +158,11 @@ target_link_libraries(${rgbd_camera_target} ) set(thermal_camera_sources ThermalCameraSensor.cc) -gz_add_component(thermal_camera SOURCES ${thermal_camera_sources} GET_TARGET_NAME thermal_camera_target) +gz_add_component(thermal_camera + SOURCES ${thermal_camera_sources} + DEPENDS_ON_COMPONENTS camera + GET_TARGET_NAME thermal_camera_target +) target_link_libraries(${thermal_camera_target} PRIVATE ${camera_target} diff --git a/src/CameraSensor.cc b/src/CameraSensor.cc index 86272582..63d29b46 100644 --- a/src/CameraSensor.cc +++ b/src/CameraSensor.cc @@ -49,7 +49,7 @@ class gz::sensors::CameraSensorPrivate { /// \brief Callback for triggered subscription /// \param[in] _msg Boolean message - public: void OnTrigger(const gz::msgs::Boolean &_msg); + public: void OnTrigger(const msgs::Boolean &_msg); /// \brief Save an image /// \param[in] _data the image data to be saved @@ -125,6 +125,9 @@ class gz::sensors::CameraSensorPrivate /// \brief Camera information message. public: msgs::CameraInfo infoMsg; + /// \brief The frame this camera uses in its camera_info topic. + public: std::string opticalFrameId{""}; + /// \brief Topic for info message. public: std::string infoTopic{""}; @@ -208,13 +211,13 @@ bool CameraSensor::CreateCamera() switch (pixelFormat) { case sdf::PixelFormatType::RGB_INT8: - this->dataPtr->camera->SetImageFormat(gz::rendering::PF_R8G8B8); + this->dataPtr->camera->SetImageFormat(rendering::PF_R8G8B8); break; case sdf::PixelFormatType::L_INT8: - this->dataPtr->camera->SetImageFormat(gz::rendering::PF_L8); + this->dataPtr->camera->SetImageFormat(rendering::PF_L8); break; case sdf::PixelFormatType::L_INT16: - this->dataPtr->camera->SetImageFormat(gz::rendering::PF_L16); + this->dataPtr->camera->SetImageFormat(rendering::PF_L16); break; default: gzerr << "Unsupported pixel format [" @@ -435,16 +438,16 @@ bool CameraSensor::Update(const std::chrono::steady_clock::duration &_now) switch (this->dataPtr->camera->ImageFormat()) { - case gz::rendering::PF_R8G8B8: - format = gz::common::Image::RGB_INT8; + case rendering::PF_R8G8B8: + format = common::Image::RGB_INT8; msgsPixelFormat = msgs::PixelFormatType::RGB_INT8; break; - case gz::rendering::PF_L8: - format = gz::common::Image::L_INT8; + case rendering::PF_L8: + format = common::Image::L_INT8; msgsPixelFormat = msgs::PixelFormatType::L_INT8; break; - case gz::rendering::PF_L16: - format = gz::common::Image::L_INT16; + case rendering::PF_L16: + format = common::Image::L_INT16; msgsPixelFormat = msgs::PixelFormatType::L_INT16; break; default: @@ -454,7 +457,7 @@ bool CameraSensor::Update(const std::chrono::steady_clock::duration &_now) } // create message - gz::msgs::Image msg; + msgs::Image msg; { GZ_PROFILE("CameraSensor::Update Message"); msg.set_width(width); @@ -465,7 +468,7 @@ bool CameraSensor::Update(const std::chrono::steady_clock::duration &_now) *msg.mutable_header()->mutable_stamp() = msgs::Convert(_now); auto frame = msg.mutable_header()->add_data(); frame->set_key("frame_id"); - frame->add_value(this->FrameId()); + frame->add_value(this->dataPtr->opticalFrameId); msg.set_data(data, this->dataPtr->camera->ImageMemorySize()); } @@ -645,19 +648,18 @@ void CameraSensor::PopulateInfo(const sdf::Camera *_cameraSdf) intrinsics->add_k(0.0); intrinsics->add_k(1.0); - // TODO(anyone) Get tx and ty from SDF msgs::CameraInfo::Projection *proj = this->dataPtr->infoMsg.mutable_projection(); - proj->add_p(_cameraSdf->LensIntrinsicsFx()); + proj->add_p(_cameraSdf->LensProjectionFx()); proj->add_p(0.0); - proj->add_p(_cameraSdf->LensIntrinsicsCx()); - proj->add_p(-_cameraSdf->LensIntrinsicsFx() * this->dataPtr->baseline); + proj->add_p(_cameraSdf->LensProjectionCx()); + proj->add_p(_cameraSdf->LensProjectionTx()); proj->add_p(0.0); - proj->add_p(_cameraSdf->LensIntrinsicsFy()); - proj->add_p(_cameraSdf->LensIntrinsicsCy()); - proj->add_p(0.0); + proj->add_p(_cameraSdf->LensProjectionFy()); + proj->add_p(_cameraSdf->LensProjectionCy()); + proj->add_p(_cameraSdf->LensProjectionTy()); proj->add_p(0.0); proj->add_p(0.0); @@ -679,11 +681,20 @@ void CameraSensor::PopulateInfo(const sdf::Camera *_cameraSdf) // Note: while Gazebo interprets the camera frame to be looking towards +X, // other tools, such as ROS, may interpret this frame as looking towards +Z. - // TODO(anyone) Expose the `frame_id` as an SDF parameter so downstream users - // can populate it with arbitrary frames. + // To make this configurable the user has the option to set an optical frame. + // If the user has set in the cameraSdf use it, + // otherwise fall back to the sensor frame. + if (_cameraSdf->OpticalFrameId().empty()) + { + this->dataPtr->opticalFrameId = this->FrameId(); + } + else + { + this->dataPtr->opticalFrameId = _cameraSdf->OpticalFrameId(); + } auto infoFrame = this->dataPtr->infoMsg.mutable_header()->add_data(); infoFrame->set_key("frame_id"); - infoFrame->add_value(this->FrameId()); + infoFrame->add_value(this->dataPtr->opticalFrameId); this->dataPtr->infoMsg.set_width(width); this->dataPtr->infoMsg.set_height(height); diff --git a/src/Camera_TEST.cc b/src/Camera_TEST.cc index 6bea0ce5..89cc5751 100644 --- a/src/Camera_TEST.cc +++ b/src/Camera_TEST.cc @@ -107,6 +107,14 @@ sdf::ElementPtr CameraToSdf(const std::string &_type, << " 124" << " 1.2" << " " + << " " + << " 282" + << " 283" + << " 163" + << " 125" + << " 1" + << " 2" + << " " << " " << " " << " " diff --git a/src/DepthCameraSensor.cc b/src/DepthCameraSensor.cc index ae352597..5cc03856 100644 --- a/src/DepthCameraSensor.cc +++ b/src/DepthCameraSensor.cc @@ -173,19 +173,19 @@ bool DepthCameraSensorPrivate::ConvertDepthToImage( ////////////////////////////////////////////////// bool DepthCameraSensorPrivate::SaveImage(const float *_data, unsigned int _width, unsigned int _height, - gz::common::Image::PixelFormatType /*_format*/) + common::Image::PixelFormatType /*_format*/) { // Attempt to create the directory if it doesn't exist - if (!gz::common::isDirectory(this->saveImagePath)) + if (!common::isDirectory(this->saveImagePath)) { - if (!gz::common::createDirectories(this->saveImagePath)) + if (!common::createDirectories(this->saveImagePath)) return false; } if (_width == 0 || _height == 0) return false; - gz::common::Image localImage; + common::Image localImage; unsigned int depthSamples = _width * _height; unsigned int depthBufferSize = depthSamples * 3; @@ -201,7 +201,7 @@ bool DepthCameraSensorPrivate::SaveImage(const float *_data, localImage.SetFromData(imgDepthBuffer, _width, _height, common::Image::RGB_INT8); localImage.SavePNG( - gz::common::joinPaths(this->saveImagePath, filename)); + common::joinPaths(this->saveImagePath, filename)); delete[] imgDepthBuffer; return true; @@ -270,7 +270,7 @@ bool DepthCameraSensor::Load(const sdf::Sensor &_sdf) this->SetTopic("/camera/depth"); this->dataPtr->pub = - this->dataPtr->node.Advertise( + this->dataPtr->node.Advertise( this->Topic()); if (!this->dataPtr->pub) { @@ -287,7 +287,7 @@ bool DepthCameraSensor::Load(const sdf::Sensor &_sdf) // Create the point cloud publisher this->dataPtr->pointPub = - this->dataPtr->node.Advertise( + this->dataPtr->node.Advertise( this->Topic() + "/points"); if (!this->dataPtr->pointPub) { @@ -442,8 +442,8 @@ void DepthCameraSensor::OnNewDepthFrame(const float *_scan, unsigned int depthSamples = _width * _height; unsigned int depthBufferSize = depthSamples * sizeof(float); - gz::common::Image::PixelFormatType format = - gz::common::Image::ConvertPixelFormat(_format); + common::Image::PixelFormatType format = + common::Image::ConvertPixelFormat(_format); if (!this->dataPtr->depthBuffer) this->dataPtr->depthBuffer = new float[depthSamples]; @@ -477,20 +477,20 @@ void DepthCameraSensor::OnNewRgbPointCloud(const float *_scan, } ///////////////////////////////////////////////// -gz::rendering::DepthCameraPtr DepthCameraSensor::DepthCamera() const +rendering::DepthCameraPtr DepthCameraSensor::DepthCamera() const { return this->dataPtr->depthCamera; } ///////////////////////////////////////////////// -gz::common::ConnectionPtr DepthCameraSensor::ConnectImageCallback( - std::function _callback) +common::ConnectionPtr DepthCameraSensor::ConnectImageCallback( + std::function _callback) { return this->dataPtr->imageEvent.Connect(_callback); } ///////////////////////////////////////////////// -void DepthCameraSensor::SetScene(gz::rendering::ScenePtr _scene) +void DepthCameraSensor::SetScene(rendering::ScenePtr _scene) { std::lock_guard lock(this->dataPtr->mutex); // APIs make it possible for the scene pointer to change @@ -531,7 +531,7 @@ bool DepthCameraSensor::Update( auto msgsFormat = msgs::PixelFormatType::R_FLOAT32; // create message - gz::msgs::Image msg; + msgs::Image msg; msg.set_width(width); msg.set_height(height); msg.set_step(width * rendering::PixelUtil::BytesPerPixel( diff --git a/src/GaussianNoiseModel.cc b/src/GaussianNoiseModel.cc index 7740f3f4..b82684a4 100644 --- a/src/GaussianNoiseModel.cc +++ b/src/GaussianNoiseModel.cc @@ -87,12 +87,12 @@ void GaussianNoiseModel::Load(const sdf::Noise &_sdf) double biasStdDev = 0; biasMean = _sdf.BiasMean(); biasStdDev = _sdf.BiasStdDev(); - this->dataPtr->bias = gz::math::Rand::DblNormal(biasMean, biasStdDev); + this->dataPtr->bias = math::Rand::DblNormal(biasMean, biasStdDev); // With equal probability, we pick a negative bias (by convention, // rateBiasMean should be positive, though it would work fine if // negative). - if (gz::math::Rand::DblUniform() < 0.5) + if (math::Rand::DblUniform() < 0.5) this->dataPtr->bias = -this->dataPtr->bias; this->Print(out); @@ -100,7 +100,7 @@ void GaussianNoiseModel::Load(const sdf::Noise &_sdf) this->dataPtr->precision = _sdf.Precision(); if (this->dataPtr->precision < 0) gzerr << "Noise precision cannot be less than 0" << std::endl; - else if (!gz::math::equal(this->dataPtr->precision, 0.0, 1e-6)) + else if (!math::equal(this->dataPtr->precision, 0.0, 1e-6)) this->dataPtr->quantized = true; } @@ -108,7 +108,7 @@ void GaussianNoiseModel::Load(const sdf::Noise &_sdf) double GaussianNoiseModel::ApplyImpl(double _in, double _dt) { // Generate independent (uncorrelated) Gaussian noise to each input value. - double whiteNoise = gz::math::Rand::DblNormal( + double whiteNoise = math::Rand::DblNormal( this->dataPtr->mean, this->dataPtr->stdDev); // Generate varying (correlated) bias to each input value. @@ -132,7 +132,7 @@ double GaussianNoiseModel::ApplyImpl(double _in, double _dt) tau / 2 * expm1(-2 * _dt / tau)); double phi_d = exp(-_dt / tau); this->dataPtr->bias = phi_d * this->dataPtr->bias + - gz::math::Rand::DblNormal(0, sigma_b_d); + math::Rand::DblNormal(0, sigma_b_d); } double output = _in + this->dataPtr->bias + whiteNoise; @@ -140,7 +140,7 @@ double GaussianNoiseModel::ApplyImpl(double _in, double _dt) if (this->dataPtr->quantized) { // Apply this->dataPtr->precision - if (!gz::math::equal(this->dataPtr->precision, 0.0, 1e-6)) + if (!math::equal(this->dataPtr->precision, 0.0, 1e-6)) { output = std::round(output / this->dataPtr->precision) * this->dataPtr->precision; diff --git a/src/GpuLidarSensor.cc b/src/GpuLidarSensor.cc index 05c26a82..941fce96 100644 --- a/src/GpuLidarSensor.cc +++ b/src/GpuLidarSensor.cc @@ -14,15 +14,14 @@ * limitations under the License. * */ - -#ifdef _WIN32 -#pragma warning(push) -#pragma warning(disable: 4005) -#pragma warning(disable: 4251) +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4005) + #pragma warning(disable: 4251) #endif #include -#ifdef _WIN32 -#pragma warning(pop) +#if defined(_MSC_VER) + #pragma warning(pop) #endif #include diff --git a/src/ImageGaussianNoiseModel.cc b/src/ImageGaussianNoiseModel.cc index 45f60ae8..58d03cd7 100644 --- a/src/ImageGaussianNoiseModel.cc +++ b/src/ImageGaussianNoiseModel.cc @@ -22,19 +22,10 @@ #include -// TODO(louise) Remove these pragmas once gz-rendering is disabling the -// warnings -#ifdef _WIN32 -#pragma warning(push) -#pragma warning(disable: 4251) -#endif #include #include #include #include -#ifdef _WIN32 -#pragma warning(pop) -#endif #include "gz/sensors/ImageGaussianNoiseModel.hh" diff --git a/src/ImuSensor.cc b/src/ImuSensor.cc index 58c6e816..766212d2 100644 --- a/src/ImuSensor.cc +++ b/src/ImuSensor.cc @@ -15,14 +15,14 @@ * */ -#ifdef _WIN32 -#pragma warning(push) -#pragma warning(disable: 4005) -#pragma warning(disable: 4251) +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4005) + #pragma warning(disable: 4251) #endif #include -#ifdef _WIN32 -#pragma warning(pop) +#if defined(_MSC_VER) + #pragma warning(pop) #endif #include @@ -50,31 +50,31 @@ class gz::sensors::ImuSensorPrivate public: bool initialized = false; /// \brief Noise free linear acceleration - public: gz::math::Vector3d linearAcc; + public: math::Vector3d linearAcc; /// \brief Noise free angular velocity. - public: gz::math::Vector3d angularVel; + public: math::Vector3d angularVel; /// \brief transform to Imu orientation reference frame. - public: gz::math::Quaterniond orientationReference; + public: math::Quaterniond orientationReference; /// \brief transform to Imu frame from Imu reference frame. - public: gz::math::Quaterniond orientation; + public: math::Quaterniond orientation; /// \brief True to publish orientation data. public: bool orientationEnabled = true; /// \brief store gravity vector to be added to the IMU output. - public: gz::math::Vector3d gravity; + public: math::Vector3d gravity; /// \brief World pose of the imu sensor - public: gz::math::Pose3d worldPose; + public: math::Pose3d worldPose; /// \brief Flag for if time has been initialized public: bool timeInitialized = false; /// \brief Orientation of world frame relative to a specified frame - public: gz::math::Quaterniond worldRelativeOrientation; + public: math::Quaterniond worldRelativeOrientation; /// \brief Frame relative-to which the worldRelativeOrientation // is defined @@ -88,7 +88,7 @@ class gz::sensors::ImuSensorPrivate public: std::string customRpyParentFrame; /// \brief Quaternion for to store custom_rpy - public: gz::math::Quaterniond customRpyQuaternion; + public: math::Quaterniond customRpyQuaternion; /// \brief Previous update time step. public: std::chrono::steady_clock::duration prevStep @@ -139,7 +139,7 @@ bool ImuSensor::Load(const sdf::Sensor &_sdf) this->SetTopic("/imu"); this->dataPtr->pub = - this->dataPtr->node.Advertise(this->Topic()); + this->dataPtr->node.Advertise(this->Topic()); if (!this->dataPtr->pub) { @@ -184,7 +184,7 @@ bool ImuSensor::Load(const sdf::Sensor &_sdf) this->dataPtr->customRpyParentFrame = _sdf.ImuSensor()->CustomRpyParentFrame(); - this->dataPtr->customRpyQuaternion = gz::math::Quaterniond( + this->dataPtr->customRpyQuaternion = math::Quaterniond( _sdf.ImuSensor()->CustomRpy()); this->dataPtr->initialized = true; @@ -339,33 +339,33 @@ void ImuSensor::SetWorldFrameOrientation( // Table to hold frame transformations static const std::map> + std::map> transformTable = { {WorldFrameEnumType::ENU, { - {WorldFrameEnumType::ENU, gz::math::Quaterniond(0, 0, 0)}, - {WorldFrameEnumType::NED, gz::math::Quaterniond( + {WorldFrameEnumType::ENU, math::Quaterniond(0, 0, 0)}, + {WorldFrameEnumType::NED, math::Quaterniond( GZ_PI, 0, GZ_PI/2)}, - {WorldFrameEnumType::NWU, gz::math::Quaterniond( + {WorldFrameEnumType::NWU, math::Quaterniond( 0, 0, GZ_PI/2)}, } }, {WorldFrameEnumType::NED, { - {WorldFrameEnumType::ENU, gz::math::Quaterniond( + {WorldFrameEnumType::ENU, math::Quaterniond( GZ_PI, 0, GZ_PI/2).Inverse()}, - {WorldFrameEnumType::NED, gz::math::Quaterniond(0, 0, 0)}, - {WorldFrameEnumType::NWU, gz::math::Quaterniond( + {WorldFrameEnumType::NED, math::Quaterniond(0, 0, 0)}, + {WorldFrameEnumType::NWU, math::Quaterniond( -GZ_PI, 0, 0)}, } }, {WorldFrameEnumType::NWU, { - {WorldFrameEnumType::ENU, gz::math::Quaterniond( + {WorldFrameEnumType::ENU, math::Quaterniond( 0, 0, -GZ_PI/2)}, - {WorldFrameEnumType::NED, gz::math::Quaterniond(GZ_PI, 0, 0)}, - {WorldFrameEnumType::NWU, gz::math::Quaterniond(0, 0, 0)}, + {WorldFrameEnumType::NED, math::Quaterniond(GZ_PI, 0, 0)}, + {WorldFrameEnumType::NWU, math::Quaterniond(0, 0, 0)}, } } }; diff --git a/src/ImuSensor_TEST.cc b/src/ImuSensor_TEST.cc index 0118fbf4..2b8aab4b 100644 --- a/src/ImuSensor_TEST.cc +++ b/src/ImuSensor_TEST.cc @@ -179,7 +179,7 @@ class ImuSensor_TEST : public ::testing::Test // Documentation inherited protected: void SetUp() override { - gz::common::Console::SetVerbosity(3); + common::Console::SetVerbosity(3); } }; @@ -187,7 +187,7 @@ class ImuSensor_TEST : public ::testing::Test TEST(ImuSensor_TEST, CreateImuSensor) { // Create a sensor manager - gz::sensors::Manager mgr; + sensors::Manager mgr; const std::string name = "TestImu"; const std::string topic = "/gz/sensors/test/imu"; @@ -201,7 +201,7 @@ TEST(ImuSensor_TEST, CreateImuSensor) accelNoise, gyroNoise, always_on, visualize); // Create an ImuSensor - auto sensor = mgr.CreateSensor(imuSDF); + auto sensor = mgr.CreateSensor(imuSDF); // Make sure the above dynamic cast worked. EXPECT_TRUE(sensor != nullptr); @@ -211,7 +211,7 @@ TEST(ImuSensor_TEST, CreateImuSensor) TEST(ImuSensor_TEST, ComputeNoise) { // Create a sensor manager - gz::sensors::Manager mgr; + sensors::Manager mgr; sdf::ElementPtr imuSDF, imuSDF_truth; @@ -245,9 +245,9 @@ TEST(ImuSensor_TEST, ComputeNoise) } // Create an ImuSensor - auto sensor_truth = mgr.CreateSensor( + auto sensor_truth = mgr.CreateSensor( imuSDF_truth); - auto sensor = mgr.CreateSensor(imuSDF); + auto sensor = mgr.CreateSensor(imuSDF); // Make sure the above dynamic cast worked. ASSERT_NE(nullptr, sensor); @@ -307,7 +307,7 @@ TEST(ImuSensor_TEST, ComputeNoise) TEST(ImuSensor_TEST, Orientation) { // Create a sensor manager - gz::sensors::Manager mgr; + sensors::Manager mgr; sdf::ElementPtr imuSDF; @@ -325,7 +325,7 @@ TEST(ImuSensor_TEST, Orientation) } // Create an ImuSensor - auto sensor = mgr.CreateSensor( + auto sensor = mgr.CreateSensor( imuSDF); // Make sure the above dynamic cast worked. @@ -386,7 +386,7 @@ TEST(ImuSensor_TEST, Orientation) TEST(ImuSensor_TEST, OrientationReference) { // Create a sensor manager - gz::sensors::Manager mgr; + sensors::Manager mgr; sdf::ElementPtr imuSDF; @@ -425,7 +425,7 @@ TEST(ImuSensor_TEST, OrientationReference) } // Create an ImuSensor - auto sensor = mgr.CreateSensor( + auto sensor = mgr.CreateSensor( imuSDF); sensor->SetWorldFrameOrientation(math::Quaterniond(0, 0, 0), sensors::WorldFrameEnumType::ENU); @@ -445,7 +445,7 @@ TEST(ImuSensor_TEST, OrientationReference) TEST(ImuSensor_TEST, CustomRpyParentFrame) { // Create a sensor manager - gz::sensors::Manager mgr; + sensors::Manager mgr; sdf::ElementPtr imuSDF; @@ -486,7 +486,7 @@ TEST(ImuSensor_TEST, CustomRpyParentFrame) } // Create an ImuSensor - auto sensor = mgr.CreateSensor( + auto sensor = mgr.CreateSensor( imuSDF); sensor->SetWorldFrameOrientation(math::Quaterniond(0, 0, 0), @@ -548,11 +548,11 @@ sdf::ElementPtr sensorWithLocalization( TEST(ImuSensor_TEST, NamedFrameOrientationReference) { // Create a sensor manager - gz::sensors::Manager mgr; + sensors::Manager mgr; // A. Localization tag is set to ENU // --------------------------------- - auto sensorENU = mgr.CreateSensor( + auto sensorENU = mgr.CreateSensor( sensorWithLocalization("ENU")); ASSERT_NE(nullptr, sensorENU); @@ -617,7 +617,7 @@ TEST(ImuSensor_TEST, NamedFrameOrientationReference) // B. Localization tag is set to NWU // --------------------------------- - auto sensorNWU = mgr.CreateSensor( + auto sensorNWU = mgr.CreateSensor( sensorWithLocalization("NWU")); ASSERT_NE(nullptr, sensorNWU); @@ -682,7 +682,7 @@ TEST(ImuSensor_TEST, NamedFrameOrientationReference) // C. Localization tag is set to NED // --------------------------------- - auto sensorNED = mgr.CreateSensor( + auto sensorNED = mgr.CreateSensor( sensorWithLocalization("NED")); ASSERT_NE(nullptr, sensorNED); @@ -750,7 +750,7 @@ TEST(ImuSensor_TEST, NamedFrameOrientationReference) TEST(ImuSensor_TEST, LocalizationTagInvalid) { // Create a sensor manager - gz::sensors::Manager mgr; + sensors::Manager mgr; sdf::ElementPtr imuSDF; @@ -788,7 +788,7 @@ TEST(ImuSensor_TEST, LocalizationTagInvalid) } // Create an ImuSensor - auto sensor = mgr.CreateSensor( + auto sensor = mgr.CreateSensor( imuSDF); sensor->SetWorldFrameOrientation(math::Quaterniond(0, 0, 0), sensors::WorldFrameEnumType::ENU); diff --git a/src/Lidar.cc b/src/Lidar.cc index 93cf05f9..3b9833d8 100644 --- a/src/Lidar.cc +++ b/src/Lidar.cc @@ -15,14 +15,14 @@ * */ -#ifdef _WIN32 -#pragma warning(push) -#pragma warning(disable: 4005) -#pragma warning(disable: 4251) +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4005) + #pragma warning(disable: 4251) #endif #include -#ifdef _WIN32 -#pragma warning(pop) +#if defined(_MSC_VER) + #pragma warning(pop) #endif #include diff --git a/src/Lidar_TEST.cc b/src/Lidar_TEST.cc index b697cbf0..6c971fef 100644 --- a/src/Lidar_TEST.cc +++ b/src/Lidar_TEST.cc @@ -134,6 +134,8 @@ TEST(Lidar_TEST, CreateLaser) gz::sensors::Lidar *sensor = mgr.CreateSensor( lidarSDF); + EXPECT_FALSE(sensor->CreateLidar()); + // Make sure the above dynamic cast worked. ASSERT_NE(nullptr, sensor); @@ -156,3 +158,69 @@ TEST(Lidar_TEST, CreateLaser) EXPECT_TRUE(sensor->IsActive()); } + +TEST(Lidar_TEST, CreateLaserFailures) +{ + sdf::Sensor sdfSensor; + sdfSensor.SetName("camera"); + sdfSensor.SetType(sdf::SensorType::CAMERA); + sdf::Lidar sdfLidarSensor; + + gz::sensors::Lidar sensor; + EXPECT_FALSE(sensor.Load(sdfSensor)); + + EXPECT_DOUBLE_EQ(0.0, sensor.Range(-1)); + EXPECT_DOUBLE_EQ(0.0, sensor.Range(0)); + + EXPECT_FALSE(sensor.IsHorizontal()); + EXPECT_DOUBLE_EQ(640, sensor.RangeCountRatio()); + sensor.SetAngleMax(0.707); + sensor.SetAngleMin(-0.707); + EXPECT_DOUBLE_EQ(-0.707, sensor.AngleMin().Radian()); + EXPECT_DOUBLE_EQ(0.707, sensor.AngleMax().Radian()); + + sensor.SetVerticalAngleMax(0.707); + sensor.SetVerticalAngleMin(-0.707); + EXPECT_DOUBLE_EQ(-0.707, sensor.VerticalAngleMin().Radian()); + EXPECT_DOUBLE_EQ(0.707, sensor.VerticalAngleMax().Radian()); + + sensor.ApplyNoise(); + + sdfSensor.SetType(sdf::SensorType::LIDAR); + sdfSensor.SetLidarSensor(sdfLidarSensor); + + gz::sensors::Lidar sensor2; + + EXPECT_TRUE(sensor2.Load(sdfSensor)); + EXPECT_FALSE(sensor2.Load(sdfSensor)); + + gz::sensors::Lidar sensor3; + + sdfLidarSensor.SetHorizontalScanSamples(0); + sdfSensor.SetLidarSensor(sdfLidarSensor); + EXPECT_TRUE(sensor3.Load(sdfSensor)); + + sdfLidarSensor.SetHorizontalScanSamples(20); + + sdf::Noise noise; + noise.SetType(sdf::NoiseType::GAUSSIAN); + noise.SetMean(1.2); + noise.SetStdDev(2.3); + noise.SetBiasMean(4.5); + noise.SetBiasStdDev(6.7); + noise.SetPrecision(8.9); + + sdfLidarSensor.SetLidarNoise(noise); + sdfSensor.SetLidarSensor(sdfLidarSensor); + gz::sensors::Lidar sensor4; + EXPECT_TRUE(sensor4.Load(sdfSensor)); + + noise.SetType(sdf::NoiseType::GAUSSIAN_QUANTIZED); + sdfLidarSensor.SetLidarNoise(noise); + sdfSensor.SetLidarSensor(sdfLidarSensor); + gz::sensors::Lidar sensor5; + EXPECT_TRUE(sensor5.Load(sdfSensor)); + + sensor.Update(std::chrono::steady_clock::duration( + std::chrono::milliseconds(100))); +} diff --git a/src/LogicalCameraSensor.cc b/src/LogicalCameraSensor.cc index 4df42fd8..6aab67ce 100644 --- a/src/LogicalCameraSensor.cc +++ b/src/LogicalCameraSensor.cc @@ -46,7 +46,7 @@ class gz::sensors::LogicalCameraSensorPrivate public: std::mutex mutex; /// \brief Camera frustum. - public: gz::math::Frustum frustum; + public: math::Frustum frustum; /// \brief Set world pose. public: math::Pose3d worldPose; @@ -55,7 +55,7 @@ class gz::sensors::LogicalCameraSensorPrivate public: std::map models; /// \brief Msg containg info on models detected by logical camera - gz::msgs::LogicalCameraImage msg; + msgs::LogicalCameraImage msg; }; ////////////////////////////////////////////////// @@ -86,7 +86,7 @@ bool LogicalCameraSensor::Load(sdf::ElementPtr _sdf) if (!_sdf->HasElement("logical_camera")) { gzerr << " SDF element not found while attempting to " - << "load a gz::sensors::LogicalCameraSensor\n"; + << "load a LogicalCameraSensor\n"; return false; } cameraSdf = _sdf->GetElement("logical_camera"); @@ -107,7 +107,7 @@ bool LogicalCameraSensor::Load(sdf::ElementPtr _sdf) this->SetTopic("/logical_camera"); this->dataPtr->pub = - this->dataPtr->node.Advertise( + this->dataPtr->node.Advertise( this->Topic()); if (!this->dataPtr->pub) @@ -186,7 +186,7 @@ double LogicalCameraSensor::Far() const } ////////////////////////////////////////////////// -gz::math::Angle LogicalCameraSensor::HorizontalFOV() const +math::Angle LogicalCameraSensor::HorizontalFOV() const { return this->dataPtr->frustum.FOV(); } diff --git a/src/MagnetometerSensor.cc b/src/MagnetometerSensor.cc index def94f19..11a512cd 100644 --- a/src/MagnetometerSensor.cc +++ b/src/MagnetometerSensor.cc @@ -14,15 +14,14 @@ * limitations under the License. * */ - -#ifdef _WIN32 -#pragma warning(push) -#pragma warning(disable: 4005) -#pragma warning(disable: 4251) +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4005) + #pragma warning(disable: 4251) #endif #include -#ifdef _WIN32 -#pragma warning(pop) +#if defined(_MSC_VER) + #pragma warning(pop) #endif #include @@ -52,14 +51,14 @@ class gz::sensors::MagnetometerSensorPrivate /// \brief The latest field reading from the sensor, based on the world /// field and the sensor's current pose. - public: gz::math::Vector3d localField; + public: math::Vector3d localField; /// \brief Store world magnetic field vector. We assume it is uniform /// everywhere in the world, and that it doesn't change during the simulation. - public: gz::math::Vector3d worldField; + public: math::Vector3d worldField; /// \brief World pose of the magnetometer - public: gz::math::Pose3d worldPose; + public: math::Pose3d worldPose; /// \brief Noise added to sensor data public: std::map noises; @@ -106,7 +105,7 @@ bool MagnetometerSensor::Load(const sdf::Sensor &_sdf) this->SetTopic("/magnetometer"); this->dataPtr->pub = - this->dataPtr->node.Advertise( + this->dataPtr->node.Advertise( this->Topic()); if (!this->dataPtr->pub) diff --git a/src/Manager.cc b/src/Manager.cc index 2c39df69..84052c0f 100644 --- a/src/Manager.cc +++ b/src/Manager.cc @@ -83,8 +83,8 @@ void Manager::RunOnce( } ///////////////////////////////////////////////// -gz::sensors::SensorId Manager::AddSensor( - std::unique_ptr _sensor) +SensorId Manager::AddSensor( + std::unique_ptr _sensor) { if (!_sensor) return NO_SENSOR; diff --git a/src/Noise_TEST.cc b/src/Noise_TEST.cc index 7a787dc5..1a646d71 100644 --- a/src/Noise_TEST.cc +++ b/src/Noise_TEST.cc @@ -22,6 +22,8 @@ #include #include +#include + #include "gz/sensors/Noise.hh" #include "gz/sensors/GaussianNoiseModel.hh" @@ -61,7 +63,7 @@ class NoiseTest : public ::testing::Test // Documentation inherited protected: void SetUp() override { - gz::common::Console::SetVerbosity(4); + common::Console::SetVerbosity(4); } }; @@ -132,7 +134,7 @@ void NoNoise(sensors::NoisePtr _noise, unsigned int _count) // Expect no change in input value for (unsigned int i = 0; i < _count; ++i) { - double x = gz::math::Rand::DblUniform(-1e6, 1e6); + double x = math::Rand::DblUniform(-1e6, 1e6); EXPECT_NEAR(x, _noise->Apply(x), 1e-6); } } @@ -413,3 +415,28 @@ TEST(NoiseTest, OnApplyNoise) EXPECT_DOUBLE_EQ(value, i*2); } } + +///////////////////////////////////////////////// +TEST(NoiseTest, NoiseFailures) +{ + sensors::Noise noise(sensors::NoiseType::CUSTOM); + + EXPECT_DOUBLE_EQ(9, noise.Apply(9, 0.1)); + EXPECT_DOUBLE_EQ(9, noise.ApplyImpl(9, 0.1)); + std::ostringstream out; + noise.Print(out); + EXPECT_EQ("Noise with type[1] does not have an overloaded Print function. " + "No more information is available.", out.str()); + + sensors::Noise noiseGaussian(sensors::NoiseType::GAUSSIAN); + + sensors::NoisePtr noiseFactory = + sensors::NoiseFactory::NewNoiseModel( + NoiseSdf("gaussian", 0, 0, 0, 0, 0), "camera"); + + sdf::Noise sdfNoise; + sdfNoise.SetType(static_cast(99)); + sensors::NoisePtr noiseFactory2 = + sensors::NoiseFactory::NewNoiseModel( + sdfNoise, "camera"); +} diff --git a/src/PointCloudUtil.hh b/src/PointCloudUtil.hh index d95e78ab..ca4e30ae 100644 --- a/src/PointCloudUtil.hh +++ b/src/PointCloudUtil.hh @@ -18,14 +18,14 @@ #ifndef GZ_SENSORS_POINTCLOUDUTIL_HH_ #define GZ_SENSORS_POINTCLOUDUTIL_HH_ -#ifdef _WIN32 -#pragma warning(push) -#pragma warning(disable: 4005) -#pragma warning(disable: 4251) +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4005) + #pragma warning(disable: 4251) #endif #include -#ifdef _WIN32 -#pragma warning(pop) +#if defined(_MSC_VER) + #pragma warning(pop) #endif #include diff --git a/src/RenderingSensor.cc b/src/RenderingSensor.cc index 21e450ab..29e1fa47 100644 --- a/src/RenderingSensor.cc +++ b/src/RenderingSensor.cc @@ -17,16 +17,7 @@ #include -// TODO(louise) Remove these pragmas once gz-rendering is disabling the -// warnings -#ifdef _WIN32 -#pragma warning(push) -#pragma warning(disable: 4251) -#endif #include -#ifdef _WIN32 -#pragma warning(pop) -#endif #include "gz/sensors/RenderingSensor.hh" diff --git a/src/RgbdCameraSensor.cc b/src/RgbdCameraSensor.cc index 186ac9ab..3f7a03a1 100644 --- a/src/RgbdCameraSensor.cc +++ b/src/RgbdCameraSensor.cc @@ -22,17 +22,8 @@ #include #include -// TODO(louise) Remove these pragmas once gz-rendering is disabling the -// warnings -#ifdef _WIN32 -#pragma warning(push) -#pragma warning(disable: 4251) -#endif #include #include -#ifdef _WIN32 -#pragma warning(pop) -#endif #include #include @@ -112,6 +103,9 @@ class gz::sensors::RgbdCameraSensorPrivate /// point cloud. public: unsigned int channels = 4; + /// \brief Frame ID the camera_info message header is expressed. + public: std::string opticalFrameId{""}; + /// \brief Pointer to an image to be published public: gz::rendering::Image image; @@ -203,7 +197,7 @@ bool RgbdCameraSensor::Load(const sdf::Sensor &_sdf) // Create the 2d image publisher this->dataPtr->imagePub = - this->dataPtr->node.Advertise( + this->dataPtr->node.Advertise( this->Topic() + "/image"); if (!this->dataPtr->imagePub) { @@ -217,7 +211,7 @@ bool RgbdCameraSensor::Load(const sdf::Sensor &_sdf) // Create the depth image publisher this->dataPtr->depthPub = - this->dataPtr->node.Advertise( + this->dataPtr->node.Advertise( this->Topic() + "/depth_image"); if (!this->dataPtr->depthPub) { @@ -231,7 +225,7 @@ bool RgbdCameraSensor::Load(const sdf::Sensor &_sdf) // Create the point cloud publisher this->dataPtr->pointPub = - this->dataPtr->node.Advertise( + this->dataPtr->node.Advertise( this->Topic() + "/points"); if (!this->dataPtr->pointPub) { @@ -251,7 +245,7 @@ bool RgbdCameraSensor::Load(const sdf::Sensor &_sdf) // the xyz and rgb fields to be aligned to memory boundaries. This is need // by ROS1: https://github.com/ros/common_msgs/pull/77. Ideally, memory // alignment should be configured. - msgs::InitPointCloudPacked(this->dataPtr->pointMsg, this->Name(), true, + msgs::InitPointCloudPacked(this->dataPtr->pointMsg, this->FrameId(), true, {{"xyz", msgs::PointCloudPacked::Field::FLOAT32}, {"rgb", msgs::PointCloudPacked::Field::FLOAT32}}); @@ -292,6 +286,20 @@ bool RgbdCameraSensor::CreateCameras() this->dataPtr->depthCamera->SetNearClipPlane(cameraSdf->NearClip()); this->dataPtr->depthCamera->SetFarClipPlane(cameraSdf->FarClip()); + // Note: while Gazebo interprets the camera frame to be looking towards +X, + // other tools, such as ROS, may interpret this frame as looking towards +Z. + // To make this configurable the user has the option to set an optical frame. + // If the user has set in the cameraSdf use it, + // otherwise fall back to the sensor frame. + if (cameraSdf->OpticalFrameId().empty()) + { + this->dataPtr->opticalFrameId = this->FrameId(); + } + else + { + this->dataPtr->opticalFrameId = cameraSdf->OpticalFrameId(); + } + // Depth camera clip params are new and only override the camera clip // params if specified. if (cameraSdf->HasDepthCamera()) @@ -384,7 +392,7 @@ bool RgbdCameraSensor::CreateCameras() } ///////////////////////////////////////////////// -void RgbdCameraSensor::SetScene(gz::rendering::ScenePtr _scene) +void RgbdCameraSensor::SetScene(rendering::ScenePtr _scene) { std::lock_guard lock(this->dataPtr->mutex); // APIs make it possible for the scene pointer to change @@ -461,7 +469,7 @@ bool RgbdCameraSensor::Update(const std::chrono::steady_clock::duration &_now) // create and publish the depthmessage if (this->dataPtr->depthPub.HasConnections()) { - gz::msgs::Image msg; + msgs::Image msg; msg.set_width(width); msg.set_height(height); msg.set_step(width * rendering::PixelUtil::BytesPerPixel( @@ -470,7 +478,7 @@ bool RgbdCameraSensor::Update(const std::chrono::steady_clock::duration &_now) *msg.mutable_header()->mutable_stamp() = msgs::Convert(_now); auto frame = msg.mutable_header()->add_data(); frame->set_key("frame_id"); - frame->add_value(this->FrameId()); + frame->add_value(this->dataPtr->opticalFrameId); std::lock_guard lock(this->dataPtr->mutex); @@ -485,12 +493,12 @@ bool RgbdCameraSensor::Update(const std::chrono::steady_clock::duration &_now) if (this->dataPtr->hasDepthFarClip && (this->dataPtr->depthBuffer[i] > this->dataPtr->depthFarClip)) { - this->dataPtr->depthBuffer[i] = gz::math::INF_D; + this->dataPtr->depthBuffer[i] = math::INF_D; } if (this->dataPtr->hasDepthNearClip && (this->dataPtr->depthBuffer[i] < this->dataPtr->depthNearClip)) { - this->dataPtr->depthBuffer[i] = -gz::math::INF_D; + this->dataPtr->depthBuffer[i] = -math::INF_D; } } } @@ -519,9 +527,9 @@ bool RgbdCameraSensor::Update(const std::chrono::steady_clock::duration &_now) // publish point cloud msg if (this->dataPtr->pointPub.HasConnections()) { + // Set the time stamp *this->dataPtr->pointMsg.mutable_header()->mutable_stamp() = msgs::Convert(_now); - // Set the time stamp this->dataPtr->pointMsg.set_is_dense(true); if ((this->dataPtr->hasDepthNearClip || this->dataPtr->hasDepthFarClip) @@ -573,7 +581,7 @@ bool RgbdCameraSensor::Update(const std::chrono::steady_clock::duration &_now) unsigned char *data = this->dataPtr->image.Data(); - gz::msgs::Image msg; + msgs::Image msg; msg.set_width(width); msg.set_height(height); msg.set_step(width * rendering::PixelUtil::BytesPerPixel( @@ -582,7 +590,7 @@ bool RgbdCameraSensor::Update(const std::chrono::steady_clock::duration &_now) *msg.mutable_header()->mutable_stamp() = msgs::Convert(_now); auto frame = msg.mutable_header()->add_data(); frame->set_key("frame_id"); - frame->add_value(this->FrameId()); + frame->add_value(this->dataPtr->opticalFrameId); msg.set_data(data, rendering::PixelUtil::MemorySize(rendering::PF_R8G8B8, width, height)); diff --git a/src/SensorTypes.cc b/src/SensorTypes.cc index 5e9df4ca..a09c4172 100644 --- a/src/SensorTypes.cc +++ b/src/SensorTypes.cc @@ -21,9 +21,9 @@ using namespace gz; using namespace sensors; // Initialize enum iterator, and string converter -GZ_ENUM(sensorNoiseIface, sensors::SensorNoiseType, - sensors::SENSOR_NOISE_TYPE_BEGIN, - sensors::SENSOR_NOISE_TYPE_END, +GZ_ENUM(sensorNoiseIface, SensorNoiseType, + SENSOR_NOISE_TYPE_BEGIN, + SENSOR_NOISE_TYPE_END, "NO_NOISE", "CAMERA_NOISE", "SENSOR_NOISE_TYPE_END") diff --git a/src/Sensor_TEST.cc b/src/Sensor_TEST.cc index cfbbc416..73e012e1 100644 --- a/src/Sensor_TEST.cc +++ b/src/Sensor_TEST.cc @@ -14,22 +14,21 @@ * limitations under the License. * */ +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable: 4005) + #pragma warning(disable: 4251) +#endif +#include +#if defined(_MSC_VER) + #pragma warning(pop) +#endif #include #include #include -#ifdef _WIN32 -#pragma warning(push) -#pragma warning(disable: 4005) -#pragma warning(disable: 4251) -#endif -#include -#ifdef _WIN32 -#pragma warning(pop) -#endif - #include #include #include @@ -55,7 +54,7 @@ class Sensor_TEST : public ::testing::Test // Documentation inherited protected: void SetUp() override { - gz::common::Console::SetVerbosity(4); + common::Console::SetVerbosity(4); } }; @@ -101,7 +100,7 @@ TEST(Sensor_TEST, Sensor) TEST(Sensor_TEST, AddSequence) { TestSensor sensor; - gz::msgs::Header header; + msgs::Header header; sensor.AddSequence(&header); EXPECT_EQ("seq", header.data(0).key()); EXPECT_EQ("0", header.data(0).value(0)); @@ -120,7 +119,7 @@ TEST(Sensor_TEST, AddSequence) EXPECT_EQ("101", header.data(0).value(0)); // Add another sequence for this sensor. - gz::msgs::Header header2; + msgs::Header header2; sensor.AddSequence(&header2, "other"); // The original header shouldn't change EXPECT_EQ(1, header.data_size()); @@ -152,14 +151,14 @@ class SensorUpdate : public ::testing::Test // Documentation inherited protected: void SetUp() override { - gz::common::Console::SetVerbosity(4); + common::Console::SetVerbosity(4); node.Subscribe(kPerformanceMetricTopic, &SensorUpdate::OnPerformanceMetric, this); } // Callback function for the performance metric topic. protected: void OnPerformanceMetric( - const gz::msgs::PerformanceSensorMetrics &_msg) + const msgs::PerformanceSensorMetrics &_msg) { EXPECT_EQ(kSensorName, _msg.name()); performanceMetricsMsgsCount++; @@ -246,7 +245,7 @@ TEST(Sensor_TEST, SetRateService) EXPECT_EQ("test_topic", sensor.Topic()); EXPECT_FLOAT_EQ(10.0, sensor.UpdateRate()); - gz::transport::Node node; + transport::Node node; std::vector services; node.ServiceList(services); @@ -256,13 +255,13 @@ TEST(Sensor_TEST, SetRateService) std::find(services.begin(), services.end(), "/test_topic/set_rate"); ASSERT_NE(services.end(), serviceIt); - std::vector publishers; + std::vector publishers; ASSERT_TRUE(node.ServiceInfo("/test_topic/set_rate", publishers)); ASSERT_LT(0u, publishers.size()); - gz::msgs::Double msg; - gz::msgs::Empty rep; + msgs::Double msg; + msgs::Empty rep; bool res; // can set value lower than in SDF @@ -319,10 +318,10 @@ TEST(Sensor_TEST, SetRateZeroService) EXPECT_EQ("test_topic2", sensor.Topic()); EXPECT_FLOAT_EQ(0.0, sensor.UpdateRate()); - gz::transport::Node node; + transport::Node node; - gz::msgs::Double msg; - gz::msgs::Empty rep; + msgs::Double msg; + msgs::Empty rep; bool res; // can set any value if SDF has 0 diff --git a/src/ThermalCameraSensor.cc b/src/ThermalCameraSensor.cc index 66ffbc9e..7b336e61 100644 --- a/src/ThermalCameraSensor.cc +++ b/src/ThermalCameraSensor.cc @@ -203,7 +203,7 @@ bool ThermalCameraSensor::Load(const sdf::Sensor &_sdf) // Create the thermal image publisher this->dataPtr->thermalPub = - this->dataPtr->node.Advertise( + this->dataPtr->node.Advertise( this->Topic()); if (!this->dataPtr->thermalPub) @@ -377,13 +377,13 @@ rendering::ThermalCameraPtr ThermalCameraSensor::ThermalCamera() const ///////////////////////////////////////////////// common::ConnectionPtr ThermalCameraSensor::ConnectImageCallback( - std::function _callback) + std::function _callback) { return this->dataPtr->imageEvent.Connect(_callback); } ///////////////////////////////////////////////// -void ThermalCameraSensor::SetScene(gz::rendering::ScenePtr _scene) +void ThermalCameraSensor::SetScene(rendering::ScenePtr _scene) { std::lock_guard lock(this->dataPtr->mutex); // APIs make it possible for the scene pointer to change @@ -606,19 +606,19 @@ bool ThermalCameraSensorPrivate::ConvertTemperatureToImage( ////////////////////////////////////////////////// bool ThermalCameraSensorPrivate::SaveImage(const uint16_t *_data, unsigned int _width, unsigned int _height, - gz::common::Image::PixelFormatType /*_format*/) + common::Image::PixelFormatType /*_format*/) { // Attempt to create the directory if it doesn't exist - if (!gz::common::isDirectory(this->saveImagePath)) + if (!common::isDirectory(this->saveImagePath)) { - if (!gz::common::createDirectories(this->saveImagePath)) + if (!common::createDirectories(this->saveImagePath)) return false; } if (_width == 0 || _height == 0) return false; - gz::common::Image localImage; + common::Image localImage; if (static_cast(_width) != this->imgThermalBufferSize.X() || static_cast(_height) != this->imgThermalBufferSize.Y()) @@ -639,7 +639,7 @@ bool ThermalCameraSensorPrivate::SaveImage(const uint16_t *_data, localImage.SetFromData(this->imgThermalBuffer, _width, _height, common::Image::RGB_INT8); localImage.SavePNG( - gz::common::joinPaths(this->saveImagePath, filename)); + common::joinPaths(this->saveImagePath, filename)); return true; } diff --git a/test/integration/CMakeLists.txt b/test/integration/CMakeLists.txt index 8dec6fc6..7702174b 100644 --- a/test/integration/CMakeLists.txt +++ b/test/integration/CMakeLists.txt @@ -17,10 +17,10 @@ set(tests air_pressure.cc altimeter.cc force_torque.cc + imu.cc logical_camera.cc magnetometer.cc navsat.cc - imu.cc ) link_directories(${PROJECT_BINARY_DIR}/test) @@ -46,8 +46,8 @@ if (DRI_TESTS) ${PROJECT_LIBRARY_TARGET_NAME}-lidar ${PROJECT_LIBRARY_TARGET_NAME}-gpu_lidar ${PROJECT_LIBRARY_TARGET_NAME}-rgbd_camera - ${PROJECT_LIBRARY_TARGET_NAME}-thermal_camera ${PROJECT_LIBRARY_TARGET_NAME}-segmentation_camera + ${PROJECT_LIBRARY_TARGET_NAME}-thermal_camera ${PROJECT_LIBRARY_TARGET_NAME}-wide_angle_camera ) endif() @@ -58,10 +58,10 @@ gz_build_tests(TYPE INTEGRATION LIB_DEPS ${PROJECT_LIBRARY_TARGET_NAME}-air_pressure ${PROJECT_LIBRARY_TARGET_NAME}-altimeter + ${PROJECT_LIBRARY_TARGET_NAME}-force_torque + ${PROJECT_LIBRARY_TARGET_NAME}-imu ${PROJECT_LIBRARY_TARGET_NAME}-logical_camera ${PROJECT_LIBRARY_TARGET_NAME}-magnetometer - ${PROJECT_LIBRARY_TARGET_NAME}-imu - ${PROJECT_LIBRARY_TARGET_NAME}-force_torque ${PROJECT_LIBRARY_TARGET_NAME}-navsat ) diff --git a/test/integration/camera.cc b/test/integration/camera.cc index 3683e459..93787406 100644 --- a/test/integration/camera.cc +++ b/test/integration/camera.cc @@ -279,7 +279,7 @@ void CameraSensorTest::ImageFormatLInt8LInt16(const std::string &_renderEngine) } ////////////////////////////////////////////////// -TEST_P(CameraSensorTest, LInt8ImagesWithBuiltinSDF) +TEST_P(CameraSensorTest, LInt8LInt16ImagesWithBuiltinSDF) { gz::common::Console::SetVerbosity(4); ImageFormatLInt8LInt16(GetParam()); diff --git a/test/integration/rgbd_camera.cc b/test/integration/rgbd_camera.cc index 01fb4ccc..0b6f5c70 100644 --- a/test/integration/rgbd_camera.cc +++ b/test/integration/rgbd_camera.cc @@ -66,9 +66,9 @@ unsigned char *g_pointsRGBBuffer = nullptr; std::mutex g_infoMutex; unsigned int g_infoCounter = 0; -gz::msgs::CameraInfo g_infoMsg; +msgs::CameraInfo g_infoMsg; -void UnpackPointCloudMsg(const gz::msgs::PointCloudPacked &_msg, +void UnpackPointCloudMsg(const msgs::PointCloudPacked &_msg, float *_xyzBuffer, unsigned char *_rgbBuffer) { std::string msgBuffer = _msg.data(); @@ -107,7 +107,7 @@ void UnpackPointCloudMsg(const gz::msgs::PointCloudPacked &_msg, } -void OnCameraInfo(const gz::msgs::CameraInfo & _msg) +void OnCameraInfo(const msgs::CameraInfo & _msg) { g_infoMutex.lock(); g_infoCounter++; @@ -115,7 +115,7 @@ void OnCameraInfo(const gz::msgs::CameraInfo & _msg) g_infoMutex.unlock(); } -void OnDepthImage(const gz::msgs::Image &_msg) +void OnDepthImage(const msgs::Image &_msg) { g_mutex.lock(); unsigned int depthSamples = _msg.width() * _msg.height(); @@ -127,7 +127,7 @@ void OnDepthImage(const gz::msgs::Image &_msg) g_mutex.unlock(); } -void OnImage(const gz::msgs::Image &_msg) +void OnImage(const msgs::Image &_msg) { g_imgMutex.lock(); unsigned int imgSize = _msg.width() * _msg.height() * 3; @@ -138,7 +138,7 @@ void OnImage(const gz::msgs::Image &_msg) g_imgMutex.unlock(); } -void OnPointCloud(const gz::msgs::PointCloudPacked &_msg) +void OnPointCloud(const msgs::PointCloudPacked &_msg) { g_pcMutex.lock(); @@ -166,7 +166,7 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( const std::string &_renderEngine) { // get the darn test data - std::string path = gz::common::joinPaths(PROJECT_SOURCE_PATH, "test", + std::string path = common::joinPaths(PROJECT_SOURCE_PATH, "test", "sdf", "rgbd_camera_sensor_builtin.sdf"); sdf::SDFPtr doc(new sdf::SDF()); sdf::init(doc); @@ -191,7 +191,7 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( double near_ = clipPtr->Get("near"); double unitBoxSize = 1.0; - gz::math::Vector3d boxPosition(3.0, 0.0, 0.0); + math::Vector3d boxPosition(3.0, 0.0, 0.0); // If ogre is not the engine, don't run the test if ((_renderEngine.compare("ogre") != 0) && @@ -203,7 +203,7 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( } // Setup gz-rendering with an empty scene - auto *engine = gz::rendering::engine(_renderEngine); + auto *engine = rendering::engine(_renderEngine); if (!engine) { gzdbg << "Engine '" << _renderEngine @@ -211,23 +211,23 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( return; } - gz::rendering::ScenePtr scene = engine->CreateScene("scene"); + rendering::ScenePtr scene = engine->CreateScene("scene"); // Create an scene with a box in it scene->SetAmbientLight(0.0, 0.0, 1.0); - gz::rendering::VisualPtr root = scene->RootVisual(); + rendering::VisualPtr root = scene->RootVisual(); // red background scene->SetBackgroundColor(1.0, 0.0, 0.0); // create blue material - gz::rendering::MaterialPtr blue = scene->CreateMaterial(); + rendering::MaterialPtr blue = scene->CreateMaterial(); blue->SetAmbient(0.0, 0.0, 1.0); blue->SetDiffuse(0.0, 0.0, 1.0); blue->SetSpecular(0.0, 0.0, 1.0); // create box visual - gz::rendering::VisualPtr box = scene->CreateVisual(); + rendering::VisualPtr box = scene->CreateVisual(); box->AddGeometry(scene->CreateBox()); box->SetOrigin(0.0, 0.0, 0.0); box->SetLocalPosition(boxPosition); @@ -237,10 +237,10 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( root->AddChild(box); // do the test - gz::sensors::Manager mgr; + sensors::Manager mgr; - gz::sensors::RgbdCameraSensor *rgbdSensor = - mgr.CreateSensor(sensorPtr); + sensors::RgbdCameraSensor *rgbdSensor = + mgr.CreateSensor(sensorPtr); ASSERT_NE(rgbdSensor, nullptr); EXPECT_FALSE(rgbdSensor->HasConnections()); rgbdSensor->SetScene(scene); @@ -250,21 +250,21 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( std::string depthTopic = "/test/integration/RgbdCameraPlugin_imagesWithBuiltinSDF/depth_image"; - WaitForMessageTestHelper depthHelper(depthTopic); + WaitForMessageTestHelper depthHelper(depthTopic); EXPECT_TRUE(rgbdSensor->HasConnections()); std::string imageTopic = "/test/integration/RgbdCameraPlugin_imagesWithBuiltinSDF/image"; - WaitForMessageTestHelper imageHelper(imageTopic); + WaitForMessageTestHelper imageHelper(imageTopic); std::string pointsTopic = "/test/integration/RgbdCameraPlugin_imagesWithBuiltinSDF/points"; - WaitForMessageTestHelper + WaitForMessageTestHelper pointsHelper(pointsTopic); std::string infoTopic = "/test/integration/RgbdCameraPlugin_imagesWithBuiltinSDF/camera_info"; - WaitForMessageTestHelper infoHelper(infoTopic); + WaitForMessageTestHelper infoHelper(infoTopic); // Update once to create image mgr.RunOnce(std::chrono::steady_clock::duration::zero()); @@ -274,7 +274,7 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( EXPECT_TRUE(pointsHelper.WaitForMessage()) << pointsHelper; // subscribe to the depth camera topic - gz::transport::Node node; + transport::Node node; node.Subscribe(depthTopic, &OnDepthImage); // subscribe to the image topic @@ -296,7 +296,7 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( int infoCounter = 0; int imgCounter = 0; int pcCounter = 0; - gz::msgs::CameraInfo infoMsg; + msgs::CameraInfo infoMsg; for (int sleep = 0; sleep < 300 && (counter == 0 || infoCounter == 0 || imgCounter == 0 || pcCounter == 0); ++sleep) @@ -357,8 +357,8 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( EXPECT_NEAR(g_depthBuffer[mid], expectedRangeAtMidPoint, DEPTH_TOL); // The left and right side of the depth frame should be inf - EXPECT_DOUBLE_EQ(g_depthBuffer[left], gz::math::INF_D); - EXPECT_DOUBLE_EQ(g_depthBuffer[right], gz::math::INF_D); + EXPECT_DOUBLE_EQ(g_depthBuffer[left], math::INF_D); + EXPECT_DOUBLE_EQ(g_depthBuffer[right], math::INF_D); } // check color @@ -400,16 +400,16 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( float lx = g_pointsXYZBuffer[imgLeft]; float ly = g_pointsXYZBuffer[imgLeft + 1]; float lz = g_pointsXYZBuffer[imgLeft + 2]; - EXPECT_FLOAT_EQ(gz::math::INF_D, lx); - EXPECT_FLOAT_EQ(gz::math::INF_D, ly); - EXPECT_FLOAT_EQ(gz::math::INF_D, lz); + EXPECT_FLOAT_EQ(math::INF_D, lx); + EXPECT_FLOAT_EQ(math::INF_D, ly); + EXPECT_FLOAT_EQ(math::INF_D, lz); float rx = g_pointsXYZBuffer[imgRight]; float ry = g_pointsXYZBuffer[imgRight + 1]; float rz = g_pointsXYZBuffer[imgRight + 2]; - EXPECT_FLOAT_EQ(gz::math::INF_D, rx); - EXPECT_FLOAT_EQ(gz::math::INF_D, ry); - EXPECT_FLOAT_EQ(gz::math::INF_D, rz); + EXPECT_FLOAT_EQ(math::INF_D, rx); + EXPECT_FLOAT_EQ(math::INF_D, ry); + EXPECT_FLOAT_EQ(math::INF_D, rz); // point to the left of mid point should have larger y value than mid // point, which in turn should have large y value than point to the @@ -459,7 +459,7 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( // result against actual point cloud data { // init the point cloud msg to be filled - gz::msgs::PointCloudPacked pointsMsg; + msgs::PointCloudPacked pointsMsg; msgs::InitPointCloudPacked(pointsMsg, "depth2Image", true, {{"xyz", msgs::PointCloudPacked::Field::FLOAT32}, {"rgb", msgs::PointCloudPacked::Field::FLOAT32}}); @@ -468,7 +468,7 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( pointsMsg.set_row_step(pointsMsg.point_step() * rgbdSensor->ImageWidth()); // fill msg does the conversion from depth to points - gz::sensors::PointCloudUtil pointsUtil; + sensors::PointCloudUtil pointsUtil; pointsUtil.FillMsg(pointsMsg, 1.05, g_pointsRGBBuffer, g_depthBuffer); // Unpack the point cloud msg into separate rgb and xyz buffers @@ -522,7 +522,7 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( // Check that for a box really close it returns -inf root->RemoveChild(box); - gz::math::Vector3d boxPositionNear( + math::Vector3d boxPositionNear( unitBoxSize * 0.5 + near_ * 0.5, 0.0, 0.0); box->SetLocalPosition(boxPositionNear); root->AddChild(box); @@ -573,7 +573,7 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( for (unsigned int j = 0; j < rgbdSensor->ImageWidth(); ++j) { unsigned int index = step + j; - EXPECT_FLOAT_EQ(-gz::math::INF_D, g_depthBuffer[index]); + EXPECT_FLOAT_EQ(-math::INF_D, g_depthBuffer[index]); } } } @@ -607,9 +607,9 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( float x = g_pointsXYZBuffer[index]; float y = g_pointsXYZBuffer[index + 1]; float z = g_pointsXYZBuffer[index + 2]; - EXPECT_FLOAT_EQ(-gz::math::INF_D, x); - EXPECT_FLOAT_EQ(-gz::math::INF_D, y); - EXPECT_FLOAT_EQ(-gz::math::INF_D, z); + EXPECT_FLOAT_EQ(-math::INF_D, x); + EXPECT_FLOAT_EQ(-math::INF_D, y); + EXPECT_FLOAT_EQ(-math::INF_D, z); unsigned int r = g_pointsRGBBuffer[index]; unsigned int g = g_pointsRGBBuffer[index + 1]; @@ -628,7 +628,7 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( // Check that for a box really far it returns inf root->RemoveChild(box); - gz::math::Vector3d boxPositionFar( + math::Vector3d boxPositionFar( unitBoxSize * 0.5 + far_ * 1.5, 0.0, 0.0); box->SetLocalPosition(boxPositionFar); root->AddChild(box); @@ -679,7 +679,7 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( for (unsigned int j = 0; j < rgbdSensor->ImageWidth(); ++j) { unsigned int index = step + j; - EXPECT_FLOAT_EQ(gz::math::INF_D, g_depthBuffer[index]); + EXPECT_FLOAT_EQ(math::INF_D, g_depthBuffer[index]); } } } @@ -713,9 +713,9 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( float x = g_pointsXYZBuffer[index]; float y = g_pointsXYZBuffer[index + 1]; float z = g_pointsXYZBuffer[index + 2]; - EXPECT_FLOAT_EQ(gz::math::INF_D, x); - EXPECT_FLOAT_EQ(gz::math::INF_D, y); - EXPECT_FLOAT_EQ(gz::math::INF_D, z); + EXPECT_FLOAT_EQ(math::INF_D, x); + EXPECT_FLOAT_EQ(math::INF_D, y); + EXPECT_FLOAT_EQ(math::INF_D, z); unsigned int r = g_pointsRGBBuffer[index]; unsigned int g = g_pointsRGBBuffer[index + 1]; @@ -734,15 +734,15 @@ void RgbdCameraSensorTest::ImagesWithBuiltinSDF( // Clean up engine->DestroyScene(scene); - gz::rendering::unloadEngine(engine->Name()); + rendering::unloadEngine(engine->Name()); } ////////////////////////////////////////////////// TEST_P(RgbdCameraSensorTest, ImagesWithBuiltinSDF) { - gz::common::Console::SetVerbosity(4); + common::Console::SetVerbosity(4); ImagesWithBuiltinSDF(GetParam()); } INSTANTIATE_TEST_SUITE_P(RgbdCameraSensor, RgbdCameraSensorTest, - RENDER_ENGINE_VALUES, gz::rendering::PrintToStringParam()); + RENDER_ENGINE_VALUES, rendering::PrintToStringParam()); diff --git a/test/sdf/camera_sensor_builtin.sdf b/test/sdf/camera_sensor_builtin.sdf index 532ed003..12662eba 100644 --- a/test/sdf/camera_sensor_builtin.sdf +++ b/test/sdf/camera_sensor_builtin.sdf @@ -21,6 +21,34 @@ 0.0 0.007 + + custom + false + + 1.1 + 2.2 + 3.3 + 1.2 + sin + + 0.7505 + 128 + + 280 + 281 + 162 + 124 + 1.2 + + + 282 + 283 + 163 + 125 + 1 + 2 + + diff --git a/test/sdf/camera_sensor_l16_builtin.sdf b/test/sdf/camera_sensor_l16_builtin.sdf new file mode 100644 index 00000000..8b812bce --- /dev/null +++ b/test/sdf/camera_sensor_l16_builtin.sdf @@ -0,0 +1,29 @@ + + + + + + 10 + base_camera + /images_l16 + + 1.05 + + 256 + 256 + L_INT16 + + + 0.1 + 10.0 + + + gaussian + 0.0 + 0.007 + + + + + +