Skip to content

Commit

Permalink
Merge branch 'gazebosim:gz-sensors8' into gz-sensors8
Browse files Browse the repository at this point in the history
  • Loading branch information
BA-Utkarsh authored Nov 21, 2024
2 parents cc02fd0 + 5b106e4 commit d3ec2d4
Show file tree
Hide file tree
Showing 12 changed files with 93 additions and 20 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
#============================================================================
# Initialize the project
#============================================================================
project(gz-sensors8 VERSION 8.2.0)
project(gz-sensors8 VERSION 8.2.1)

#============================================================================
# Find gz-cmake
Expand Down
23 changes: 23 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
## Gazebo Sensors 8

### Gazebo Sensors 8.2.1 (2024-11-08)

1. RgbdCameraSensor: add missing include
* [Pull request #464](https://github.com/gazebosim/gz-sensors/pull/464)

1. Fix frame_id in rgbd_camera
* [Pull request #458](https://github.com/gazebosim/gz-sensors/pull/458)

1. Remove unused variable in DopplerVelocityLog
* [Pull request #453](https://github.com/gazebosim/gz-sensors/pull/453)

1. Skip apply noise / distortion if parameters are 0s
* [Pull request #450](https://github.com/gazebosim/gz-sensors/pull/450)

1. Publish lidar scan only if there are lidar scan connections
* [Pull request #447](https://github.com/gazebosim/gz-sensors/pull/447)

1. Backport frame id fixes
* [Pull request #446](https://github.com/gazebosim/gz-sensors/pull/446)

1. Fix boundingbox_camera integration test
* [Pull request #443](https://github.com/gazebosim/gz-sensors/pull/443)

### Gazebo Sensors 8.2.0 (2024-06-14)

1. Add API to check if sensor is in trigger mode
Expand Down
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="2">
<name>gz-sensors8</name>
<version>8.2.0</version>
<version>8.2.1</version>
<description>Gazebo Sensors : Sensor models for simulation</description>
<maintainer email="ichen@openrobotics.org">Ian Chen</maintainer>
<license>Apache License 2.0</license>
Expand Down
7 changes: 7 additions & 0 deletions src/BoundingBoxCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,13 @@ bool BoundingBoxCameraSensor::CreateCamera()
auto width = sdfCamera->ImageWidth();
auto height = sdfCamera->ImageHeight();

if (width == 0u || height == 0u)
{
gzerr << "Unable to create a bounding box camera sensor with 0 width or "
<< "height. " << std::endl;
return false;
}

// Set Camera Properties
this->dataPtr->rgbCamera->SetImageFormat(rendering::PF_R8G8B8);
this->dataPtr->rgbCamera->SetImageWidth(width);
Expand Down
7 changes: 7 additions & 0 deletions src/CameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ bool CameraSensor::CreateCamera()
unsigned int width = cameraSdf->ImageWidth();
unsigned int height = cameraSdf->ImageHeight();

if (width == 0u || height == 0u)
{
gzerr << "Unable to create a camera sensor with 0 width or height."
<< std::endl;
return false;
}

this->dataPtr->camera = this->Scene()->CreateCamera(this->Name());
this->dataPtr->camera->SetImageWidth(width);
this->dataPtr->camera->SetImageHeight(height);
Expand Down
12 changes: 10 additions & 2 deletions src/DepthCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <gz/math/Angle.hh>
#include <gz/math/Helpers.hh>

#include <gz/msgs/PointCloudPackedUtils.hh>
#include <gz/msgs/Utility.hh>
#include <gz/transport/Node.hh>

Expand Down Expand Up @@ -335,8 +336,15 @@ bool DepthCameraSensor::CreateCamera()
return false;
}

int width = cameraSdf->ImageWidth();
int height = cameraSdf->ImageHeight();
unsigned int width = cameraSdf->ImageWidth();
unsigned int height = cameraSdf->ImageHeight();

if (width == 0u || height == 0u)
{
gzerr << "Unable to create a depth camera sensor with 0 width or height."
<< std::endl;
return false;
}

double far = cameraSdf->FarClip();
double near = cameraSdf->NearClip();
Expand Down
3 changes: 0 additions & 3 deletions src/DopplerVelocityLog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1682,9 +1682,6 @@ namespace gz
}
}

const gz::math::Vector3d beamAxisInWorldFrame =
sensorStateInWorldFrame.pose.Rot() * beamAxisInSensorFrame;

const gz::math::Vector3d beamAxisInReferenceFrame =
this->referenceFrameRotation * beamAxisInSensorFrame;

Expand Down
1 change: 1 addition & 0 deletions src/GpuLidarSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#include <gz/common/Console.hh>
#include <gz/common/Profiler.hh>
#include <gz/msgs/PointCloudPackedUtils.hh>
#include <gz/msgs/Utility.hh>
#include <gz/transport/Node.hh>

Expand Down
31 changes: 20 additions & 11 deletions src/RgbdCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <gz/rendering/Camera.hh>
#include <gz/rendering/DepthCamera.hh>

#include <gz/msgs/PointCloudPackedUtils.hh>
#include <gz/msgs/Utility.hh>
#include <gz/transport/Node.hh>

Expand Down Expand Up @@ -251,15 +252,6 @@ bool RgbdCameraSensor::Load(const sdf::Sensor &_sdf)
if (!this->AdvertiseInfo(this->Topic() + "/camera_info"))
return false;

// Initialize the point message.
// \todo(anyone) The true value in the following function call forces
// 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->FrameId(), true,
{{"xyz", msgs::PointCloudPacked::Field::FLOAT32},
{"rgb", msgs::PointCloudPacked::Field::FLOAT32}});

if (this->Scene())
{
this->CreateCameras();
Expand All @@ -285,8 +277,15 @@ bool RgbdCameraSensor::CreateCameras()
return false;
}

int width = cameraSdf->ImageWidth();
int height = cameraSdf->ImageHeight();
unsigned int width = cameraSdf->ImageWidth();
unsigned int height = cameraSdf->ImageHeight();

if (width == 0u || height == 0u)
{
gzerr << "Unable to create an RGBD camera sensor with 0 width or height."
<< std::endl;
return false;
}

this->dataPtr->depthCamera =
this->Scene()->CreateDepthCamera(this->Name());
Expand Down Expand Up @@ -390,6 +389,16 @@ bool RgbdCameraSensor::CreateCameras()
std::placeholders::_1, std::placeholders::_2, std::placeholders::_3,
std::placeholders::_4, std::placeholders::_5));

// Initialize the point message.
// \todo(anyone) The true value in the following function call forces
// 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->OpticalFrameId(),
true,
{{"xyz", msgs::PointCloudPacked::Field::FLOAT32},
{"rgb", msgs::PointCloudPacked::Field::FLOAT32}});

// Set the values of the point message based on the camera information.
this->dataPtr->pointMsg.set_width(this->ImageWidth());
this->dataPtr->pointMsg.set_height(this->ImageHeight());
Expand Down
7 changes: 7 additions & 0 deletions src/SegmentationCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,13 @@ bool SegmentationCameraSensor::CreateCamera()
auto width = sdfCamera->ImageWidth();
auto height = sdfCamera->ImageHeight();

if (width == 0u || height == 0u)
{
gzerr << "Unable to create a segmentation camera sensor with 0 width or "
<< "height." << std::endl;
return false;
}

math::Angle angle = sdfCamera->HorizontalFov();
if (angle < 0.01 || angle > GZ_PI*2)
{
Expand Down
11 changes: 9 additions & 2 deletions src/ThermalCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,15 @@ bool ThermalCameraSensor::CreateCamera()
return false;
}

int width = cameraSdf->ImageWidth();
int height = cameraSdf->ImageHeight();
unsigned int width = cameraSdf->ImageWidth();
unsigned int height = cameraSdf->ImageHeight();

if (width == 0u || height == 0u)
{
gzerr << "Unable to create a thermal camera sensor with 0 width or height."
<< std::endl;
return false;
}

sdf::PixelFormatType pixelFormat = cameraSdf->PixelFormat();

Expand Down
7 changes: 7 additions & 0 deletions src/WideAngleCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,13 @@ bool WideAngleCameraSensor::CreateCamera()
unsigned int width = cameraSdf->ImageWidth();
unsigned int height = cameraSdf->ImageHeight();

if (width == 0u || height == 0u)
{
gzerr << "Unable to create a wide angle camera sensor with 0 width or "
<< "height." << std::endl;
return false;
}

this->dataPtr->camera = this->Scene()->CreateWideAngleCamera(this->Name());

if (!this->dataPtr->camera)
Expand Down

0 comments on commit d3ec2d4

Please sign in to comment.