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

WideAngleCameraSensor only supports RGB8 format, not L8 as in Classic #479

Open
ana-GT opened this issue Nov 8, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@ana-GT
Copy link

ana-GT commented Nov 8, 2024

Desired behavior

WideAngleCameraSensor is currently supporting only RGB8 format. The same sensor in Gazebo Classic supported RGB8 and gray (L8) images. I am porting some robot simulation code for Astrobee from Gazebo classic to Gazebo, where one of the robot's sensors is defined as a wideanglecamera of type mono8, which seems not to be supported (line 330 of WideAngleCameraSensor.cc indicates that the L8 type is an unsupported format)

Alternatives considered

The easiest option would be for me to create a custom sensor that is a copy-and-paste of wideanglecamerasensor and just allow both RGB8 and L8 as valid pixel formats. Before doing this however, I wanted to check if there was the possibility of adding support for gray images, as it might be useful for other users with similar setups and it seems as if it might be relatively easy to do (just add a case in the switch (line 324-333 of WideAngleCameraSensor.cc) to allow L8 to be accepted:

  sdf::PixelFormatType pixelFormat = cameraSdf->PixelFormat();
  switch (pixelFormat)
  {
    case sdf::PixelFormatType::RGB_INT8:
      this->dataPtr->camera->SetImageFormat(gz::rendering::PF_R8G8B8);
      break;
    default:
      gzerr << "Unsupported pixel format ["
        << static_cast<int>(pixelFormat) << "]\n";
      break;
  }

Additional context

Test setup: Ubuntu 24.04, gz-sensors 8.8.2. ROS2 Jazzy (the issue is exclusively regarding the sensor, nothing to do with ROS, but adding that piece of info for completeness).

Thanks!

@ana-GT ana-GT added the enhancement New feature or request label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Inbox
Development

No branches or pull requests

1 participant