Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Update] gz-sensors7 merge upstream #11

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
32576a8
Fix frame_id for depth camera point cloud (#350)
kvkpraneeth Jun 8, 2023
28089ab
Minor cleanup - lint, typos (#352)
shameekganguly Jun 8, 2023
4f73c0a
Support protobuf >= 22 (#351)
traversaro Jun 10, 2023
3ace7ae
Support protobuf >= 22 (#351)
traversaro Jun 10, 2023
34c2180
Merge branch 'ign-sensors6' into scpeters/garden_protobuf_fix
scpeters Jun 15, 2023
a5a0c34
Merge pull request #355 from gazebosim/scpeters/garden_protobuf_fix
ahcorde Jun 16, 2023
44c67b0
Fix CameraSensor to check if element is null before access (#361)
Levi-Armstrong Jul 21, 2023
4300c17
Expose optical frame in CameraSensor so it can be set in DepthCameraS…
Levi-Armstrong Jul 25, 2023
4881904
Fix Github project automation for new project board (#371)
azeey Aug 1, 2023
7b4387f
Use `pull_request_target` for triage workflow (#372)
azeey Aug 2, 2023
577b03e
Prepare for 6.7.1 release (#376)
azeey Sep 1, 2023
ec52913
7.3.0 release (#386)
azeey Sep 26, 2023
8741b9b
[backport fortress] camera info topic published with the right data (…
ahcorde Oct 6, 2023
86c3e19
Destroy rendering sensors when sensor is removed (#169)
iche033 Nov 12, 2021
6b8b570
clean up rendering resources (#324)
iche033 Feb 23, 2023
3e16fd9
Merge branch 'ign-sensors3' into scpeters/merge_3_6
scpeters Oct 16, 2023
f188748
Merge pull request #398 from gazebosim/scpeters/merge_3_6
iche033 Oct 17, 2023
67b5b6e
Update github action workflows (#401)
azeey Nov 13, 2023
83ccf19
Merge remote-tracking branch 'origin/ign-sensors3' into azeey/3_to_6
azeey Nov 14, 2023
0ddddae
port: 3 to 6 (#402)
mjcarroll Nov 14, 2023
b7148d6
Prepare for 3.6.0 release (#407)
iche033 Jan 5, 2024
ff5bbb1
Allow specifying gz_frame_id as an alternative to ignition_frame_id (…
azeey Jan 12, 2024
9b4d0a0
Merge 3 to 6
azeey Jan 12, 2024
2e9a20c
Merge pull request #410 from azeey/3_to_6
azeey Jan 12, 2024
6d1f163
Prepare for 6.8.0 (#411)
azeey Jan 12, 2024
8f6bce6
Merge 6 into 7
azeey Jan 18, 2024
37db629
Merge pull request #412 from azeey/6_to_7
azeey Jan 19, 2024
fec89fb
Prepare for 7.3.1 release. (#477)
caguero Nov 7, 2024
4fcd8ed
Check camera sensors have non-zero width or height (backport #480) (#…
mergify[bot] Nov 11, 2024
6421728
Merge remote-tracking branch 'upstream/gz-sensors7' into gz-sensors7-…
gabrieltaillon Dec 11, 2024
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
33 changes: 33 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Ubuntu CI

on:
pull_request:
push:
branches:
- 'ign-sensors[0-9]'
- 'gz-sensors[0-9]?'
- 'main'

jobs:
focal-ci:
runs-on: ubuntu-latest
name: Ubuntu Focal CI
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compile and test
id: ci
uses: gazebo-tooling/action-gz-ci@focal
with:
codecov-enabled: true
cppcheck-enabled: true
cpplint-enabled: true
jammy-ci:
runs-on: ubuntu-latest
name: Ubuntu Jammy CI
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Compile and test
id: ci
uses: gazebo-tooling/action-gz-ci@jammy
16 changes: 16 additions & 0 deletions .github/workflows/triage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
on:
issues:
types: [opened]
pull_request_target:
types: [opened]
name: Ticket opened
jobs:
assign:
name: Add ticket to inbox
runs-on: ubuntu-latest
steps:
- name: Add ticket to inbox
uses: actions/[email protected]
with:
project-url: https://github.com/orgs/gazebosim/projects/7
github-token: ${{ secrets.TRIAGE_TOKEN }}
8 changes: 3 additions & 5 deletions 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-sensors7 VERSION 7.2.0)
project(gz-sensors7 VERSION 7.3.1)

#============================================================================
# Find gz-cmake
Expand Down Expand Up @@ -38,11 +38,9 @@ message(STATUS "\n\n-- ====== Finding Dependencies ======")

#--------------------------------------
# Find Protobuf
set(REQ_PROTOBUF_VER 3)
gz_find_package(GzProtobuf
VERSION ${REQ_PROTOBUF_VER}
REQUIRED
PRETTY Protobuf)
REQUIRED
PRETTY Protobuf)

#--------------------------------------
# Find gz-math
Expand Down
106 changes: 105 additions & 1 deletion Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,51 @@
## Gazebo Sensors 7

### Gazebo Sensors 7.X.X
### Gazebo Sensors 7.3.1 (2024-11-07)

1. Update github action workflows
* [Pull request #401](https://github.com/gazebosim/gz-sensors/pull/401)

1. clean up rendering resources
* [Pull request #324](https://github.com/gazebosim/gz-sensors/pull/324)

1. Destroy rendering sensors when sensor is removed
* [Pull request #169](https://github.com/gazebosim/gz-sensors/pull/169)

1. Support protobuf >= 22
* [Pull request #351](https://github.com/gazebosim/gz-sensors/pull/351)


### Gazebo Sensors 7.3.0 (2023-09-26)

1. Infrastructure
* [Pull request #372](https://github.com/gazebosim/gz-sensors/pull/372)
* [Pull request #371](https://github.com/gazebosim/gz-sensors/pull/371)

1. Expose optical frame in CameraSensor so it can be set in DepthCameraSensor
* [Pull request #362](https://github.com/gazebosim/gz-sensors/pull/362)

1. Fix CameraSensor to check if element is null before access
* [Pull request #361](https://github.com/gazebosim/gz-sensors/pull/361)

1. Support protobuf >= 22
* [Pull request #351](https://github.com/gazebosim/gz-sensors/pull/351)

1. Minor cleanup - lint, typos
* [Pull request #352](https://github.com/gazebosim/gz-sensors/pull/352)
* [Pull request #344](https://github.com/gazebosim/gz-sensors/pull/344)

1. Fix frame_id for depth camera point cloud
* [Pull request #350](https://github.com/gazebosim/gz-sensors/pull/350)

1. Add support for bayer images to camera sensor
* [Pull request #336](https://github.com/gazebosim/gz-sensors/pull/336)

1. Fix flaky trigger camera test
* [Pull request #346](https://github.com/gazebosim/gz-sensors/pull/346)

1. Generate default trigger topic name if empty
* [Pull request #343](https://github.com/gazebosim/gz-sensors/pull/343)


### Gazebo Sensors 7.2.0 (2023-04-13)

Expand Down Expand Up @@ -173,6 +218,40 @@

## Gazebo Sensors 6

### Gazebo Sensors 6.8.0 (2024-01-12)

1. Allow specifying gz_frame_id as an alternative to ignition_frame_id
* [Pull request #409](https://github.com/gazebosim/gz-sensors/pull/409)

1. [backport fortress] camera info topic published with the right data
* [Pull request #383](https://github.com/gazebosim/gz-sensors/pull/383)

1. Infrastructure
* [Pull request #401](https://github.com/gazebosim/gz-sensors/pull/401)

### Gazebo Sensors 6.7.1 (2023-09-01)

1. Support protobuf >= 22
* [Pull request #351](https://github.com/gazebosim/gz-sensors/pull/351)

1. Infrastructure
* [Pull request #335](https://github.com/gazebosim/gz-sensors/pull/335)

1. Rename COPYING to LICENSE
* [Pull request #334](https://github.com/gazebosim/gz-sensors/pull/334)

1. Fix links in Changelog
* [Pull request #330](https://github.com/gazebosim/gz-sensors/pull/330)

1. Fix Camera info test
* [Pull request #326](https://github.com/gazebosim/gz-sensors/pull/326)

1. clean up rendering resources
* [Pull request #324](https://github.com/gazebosim/gz-sensors/pull/324)

1. Added Camera Info topic support for cameras
* [Pull request #285](https://github.com/gazebosim/gz-sensors/pull/285)

### Gazebo Sensors 6.7.0 (2023-02-13)

1. Disable thermal camera test on MacOS.
Expand Down Expand Up @@ -440,6 +519,31 @@

## Gazebo Sensors 3

### Gazebo Sensors 3.6.0 (2024-01-05)

1. Update github action workflows
* [Pull request #401](https://github.com/gazebosim/gz-sensors/pull/401)
* [Pull request #335](https://github.com/gazebosim/gz-sensors/pull/335)
* [Pull request #334](https://github.com/gazebosim/gz-sensors/pull/334)

1. Clean up rendering resources
* [Pull request #324](https://github.com/gazebosim/gz-sensors/pull/324)

1. Destroy rendering sensors when sensor is removed
* [Pull request #169](https://github.com/gazebosim/gz-sensors/pull/169)

1. Support protobuf >= 22
* [Pull request #351](https://github.com/gazebosim/gz-sensors/pull/351)

1. Fix links in Changelog
* [Pull request #330](https://github.com/gazebosim/gz-sensors/pull/330)

1. Fix Camera info test
* [Pull request #326](https://github.com/gazebosim/gz-sensors/pull/326)

1. Added Camera Info topic support for cameras
* [Pull request #285](https://github.com/gazebosim/gz-sensors/pull/285)

### Gazebo Sensors 3.5.0 (2022-11-30)

1. Add missing DEPENDS_ON_COMPONENTS parameters.
Expand Down
4 changes: 4 additions & 0 deletions include/gz/sensors/CameraSensor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ namespace gz
/// \todo(iche033) Make this function virtual on Harmonic
public: bool HasInfoConnections() const;

/// \brief Get the camera optical frame
/// \return The camera optical frame
public: const std::string& OpticalFrameId() const;

/// \brief Advertise camera info topic.
/// \return True if successful.
protected: bool AdvertiseInfo();
Expand Down
4 changes: 2 additions & 2 deletions include/gz/sensors/DepthCameraSensor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ namespace gz
const std::string &/*_format*/);

/// \brief Point cloud data callback used to get the data from the sensor
/// \param[in] _data pointer to the data from the sensor
/// \param[in] _scan pointer to the data from the sensor
/// \param[in] _width width of the point cloud image
/// \param[in] _height height of the point cloud image
/// \param[in] _channel bytes used for the point cloud data
/// \param[in] _format string with the format
public: void OnNewRgbPointCloud(const float *_data,
public: void OnNewRgbPointCloud(const float *_scan,
unsigned int _width, unsigned int _height,
unsigned int /*_channels*/,
const std::string &/*_format*/);
Expand Down
7 changes: 7 additions & 0 deletions src/BoundingBoxCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,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
20 changes: 17 additions & 3 deletions src/CameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "gz/sensors/SensorFactory.hh"
#include "gz/sensors/SensorTypes.hh"

#include "gz/rendering/Utils.hh"
#include <gz/rendering/Utils.hh>

using namespace gz;
using namespace sensors;
Expand Down Expand Up @@ -212,6 +212,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 Expand Up @@ -257,7 +264,8 @@ bool CameraSensor::CreateCamera()
this->dataPtr->camera->SetAspectRatio(static_cast<double>(width)/height);
this->dataPtr->camera->SetHFOV(angle);

if (cameraSdf->Element()->HasElement("distortion")) {
if (cameraSdf->Element() != nullptr &&
cameraSdf->Element()->HasElement("distortion")) {
this->dataPtr->distortion =
ImageDistortionFactory::NewDistortionModel(*cameraSdf, "camera");
this->dataPtr->distortion->Load(*cameraSdf);
Expand Down Expand Up @@ -671,7 +679,7 @@ bool CameraSensor::Update(const std::chrono::steady_clock::duration &_now)
}
catch(...)
{
ignerr << "Exception thrown in an image callback.\n";
gzerr << "Exception thrown in an image callback.\n";
}
}

Expand Down Expand Up @@ -920,6 +928,12 @@ bool CameraSensor::HasInfoConnections() const
return this->dataPtr->infoPub && this->dataPtr->infoPub.HasConnections();
}

//////////////////////////////////////////////////
const std::string& CameraSensor::OpticalFrameId() const
{
return this->dataPtr->opticalFrameId;
}

//////////////////////////////////////////////////
math::Matrix4d CameraSensorPrivate::BuildProjectionMatrix(
double _imageWidth, double _imageHeight,
Expand Down
37 changes: 24 additions & 13 deletions src/DepthCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -299,15 +299,6 @@ bool DepthCameraSensor::Load(const sdf::Sensor &_sdf)
gzdbg << "Points for [" << this->Name() << "] advertised on ["
<< this->Topic() << "/points]" << std::endl;

// 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->Name(), true,
{{"xyz", msgs::PointCloudPacked::Field::FLOAT32},
{"rgb", msgs::PointCloudPacked::Field::FLOAT32}});

if (this->Scene())
{
this->CreateCamera();
Expand All @@ -333,8 +324,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 Expand Up @@ -422,6 +420,18 @@ bool DepthCameraSensor::CreateCamera()
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 Expand Up @@ -549,9 +559,10 @@ bool DepthCameraSensor::Update(
rendering::PF_FLOAT32_R));
msg.set_pixel_format_type(msgsFormat);
*msg.mutable_header()->mutable_stamp() = msgs::Convert(_now);
auto frame = msg.mutable_header()->add_data();

auto* frame = msg.mutable_header()->add_data();
frame->set_key("frame_id");
frame->add_value(this->FrameId());
frame->add_value(this->OpticalFrameId());

std::lock_guard<std::mutex> lock(this->dataPtr->mutex);
msg.set_data(this->dataPtr->depthBuffer,
Expand Down
6 changes: 3 additions & 3 deletions src/GpuLidarSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ bool GpuLidarSensor::CreateLidar()
}

/////////////////////////////////////////////////
void GpuLidarSensor::OnNewLidarFrame(const float *_data,
void GpuLidarSensor::OnNewLidarFrame(const float *_scan,
unsigned int _width, unsigned int _height, unsigned int _channels,
const std::string &_format)
{
Expand All @@ -277,11 +277,11 @@ void GpuLidarSensor::OnNewLidarFrame(const float *_data,
if (!this->laserBuffer)
this->laserBuffer = new float[samples];

memcpy(this->laserBuffer, _data, lidarBufferSize);
memcpy(this->laserBuffer, _scan, lidarBufferSize);

if (this->dataPtr->lidarEvent.ConnectionCount() > 0)
{
this->dataPtr->lidarEvent(_data, _width, _height, _channels, _format);
this->dataPtr->lidarEvent(_scan, _width, _height, _channels, _format);
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/NavSatSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*
*/

#include <unordered_map>

#ifdef _WIN32
#pragma warning(push)
#pragma warning(disable: 4005)
Expand Down
Loading
Loading