-
Notifications
You must be signed in to change notification settings - Fork 486
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
Bugfix on the color channel of point clouds from DepthCamera #2853
Bugfix on the color channel of point clouds from DepthCamera #2853
Conversation
I wrote a test for this change in 7bca2ed. It places a green box in front of the camera and expects that for every point cloud that has a z value equal to the distance of the box, the color value should be some shade of green. It's currently passing. One weird issue is that when no objects are detected, i.e. z > box distance, the blue pixel value after unpacking the color component always returns 1 (small as it's out of 255). I think that's minor since the color component should not be used in that case. Can you take a look and apply the test to your branch if it looks good to you? We should also add some documentation here on how to unpack the floating point color value into r, g, b. One place to add the documentation is here |
Hello @iche033, I ran the test in my local branch and it passed. I applied the change to the Regarding the documentation, I agree that it should be made clear how the RGB values can be extracted from the 4th channel. In my last commit, I added some comments above the function declaration you suggested. At first, I pondered explaining how to unpack with text only, but I ended up adding a small fragment of code to the comment. This will make it much clearer and remove ambiguity for anyone using the API. What do you think? Is it too much verbose? If so, feel free to make a suggestion for improvement. |
Build finished. 15 tests run, 0 skipped, 2 failed. |
Build finished. No test results found. |
Build finished. 1439 tests run, 0 skipped, 19 failed. |
Build finished. 2098 tests run, 0 skipped, 24 failed. |
Build finished. 15 tests run, 0 skipped, 2 failed. |
Build finished. 2145 tests run, 0 skipped, 32 failed. |
Build finished. No test results found. |
Build finished. 2091 tests run, 0 skipped, 22 failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor coding style suggestion otherwise the changes and the documentation look good.
Wrapped documentation lines to 80 chars. Co-authored-by: Ian Chen <ichen@osrfoundation.org>
Wrapped a minus sign to next line for the documentation of ConnectNewRGBPointCloud.
@GoncaloLeao could you please pull changes in gazebo11 branch into your branch to get latest CI before merging? |
Signed-off-by: Louise Poubel <louise@openrobotics.org>
I applied the changes from gazebo11. |
@GoncaloLeao , it looks like there are still conflicts preventing this from being merged. |
I just resolved conflicts and pushed to restart CI |
Thanks for submitting the fix and sorry for the delay in merging! If you are able to make a matching gazebo_ros_pkgs pull request I will be happy to review it. |
Fixes #1865.
This PR fixes a bug on the fragment shader associated with the depth camera so that the color of each point in the point cloud is correct.
In order to test this in ROS, the depth camera plugin (which extends Gazebo's
DepthCameraPlugin
class) must correctly extract the colors from theconst unsigned char *_image
on the callback functionvirtual void OnNewImageFrame(const unsigned char *_image, unsigned int _width, unsigned int _height, unsigned int _depth, const std::string &_format)
. I created a fork of the gazebo_ros_pkgs repository where I corrected theGazeboRosDepthCamera
class (https://github.com/GoncaloLeao/gazebo_ros_pkgs/blob/bugfix-rgb-on-depth-camera-cloud/gazebo_plugins/src/gazebo_ros_depth_camera.cpp). When this pull request is accepted, I will create a PR to correct the gazebo_ros_depth_camera plugin of the gazebo_ros_pkgs repository.In order to test this bugfix, you can use the files I provide in attachment.
test_sensor.zip contains all the files needed for the model. It is a modified version of the model of this tutorial: http://gazebosim.org/tutorials/?tut=ros_depth_camera
4. Run Gazebo with any world of your choice and add the depth camera model to the world.
5. On RViz, pay close attention to the colors of the point cloud being published on the topic /camera/depth/points. The colors should closely match the ones for the image topic /camera/color/image_raw.
Here I provide two screenshots of what I can see in Gazebo ...
... and RViz: