-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Extending LibRS's GL support to RS ROS2 #2956
Extending LibRS's GL support to RS ROS2 #2956
Conversation
04d3df4
to
920e708
Compare
realsense2_camera/CMakeLists.txt
Outdated
@@ -117,6 +117,7 @@ find_package(tf2 REQUIRED) | |||
find_package(diagnostic_updater REQUIRED) | |||
|
|||
find_package(realsense2 2.54.1) | |||
find_package(realsense2-gl 2.54.1) |
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.
This means we will need to publish realsense2-gl as well right?
We need to think about if we need to make this optional somehow
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.
Have added a cmake variable BUILD_ACCELERATE_WITH_GPU
.
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.
As discussed, can you check how we do it in the viewer?
Do we depend on realsense-gl and can disable/enable on runtime?
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.
As discussed, can you check how we do it in the viewer? Do we depend on realsense-gl and can disable/enable on runtime?
Yes, I think we should release/publish realsense2-gl as well.
The viewer is depending on realsense2-gl, and you can choose this from the settings of the viewer, whether to run or not the GLSL.
@Arun-Prasad-V, did you test if user changes the parameter from 0 to 1 during runtime, while the build was without OpenGL ?
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.
We need to follow this guidelines same as for the SDK.
- Users w/o GPU are not affected (meaning users w/o GPU can install and run the ROS node)
- Users with GPU can decide if to leverage the GPU or not (launch file is sufficient)
- We need to activate the internal formal conversion using GPU as well
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.
@Arun-Prasad-V, did you test if user changes the parameter from 0 to 1 during runtime, while the build was without OpenGL ?
Right now, dynamic change is not supported. User must set this param during launch.
And, if the build was without OpenGL, then this param won't be exposed to user.
realsense2_camera/CMakeLists.txt
Outdated
@@ -215,6 +218,7 @@ set(dependencies | |||
nav_msgs | |||
tf2 | |||
realsense2 | |||
realsense2-gl |
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.
Same, OK for POC
For final solution we will need to rethink about it
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.
@Nir-Az I don't think there is another way for doing that.. except if you want to create new branch for ROS, let's say, ros2-development-gl :)
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.
OK, So we will have to make sure this compile on platforms w/o a GPU, and that ROS build farm accept it
realsense2_camera/src/parameters.cpp
Outdated
@@ -82,6 +82,10 @@ void BaseRealSenseNode::getParameters() | |||
_base_frame_id = _parameters->setParam<std::string>(param_name, DEFAULT_BASE_FRAME_ID); | |||
_base_frame_id = (static_cast<std::ostringstream&&>(std::ostringstream() << _camera_name << "_" << _base_frame_id)).str(); | |||
_parameters_names.push_back(param_name); | |||
|
|||
param_name = std::string("data_processing_mode"); |
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.
maybe accelerate_with_gpu
, on/off``?
Or as is with values CPU/GPU
?
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.
Changed the param name to accelerate_with_gpu
and declared this param as int
not bool
. Because, if in case in future, we need to add new values (like for CUDA, etc.,), it can be added easily to the int
param.
@Nir-Az, your thoughts?
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.
Not sure CUDA is replacing GPU, let's make sure how it works in LibRS
920e708
to
da05add
Compare
@@ -22,6 +22,10 @@ using namespace rs2; | |||
|
|||
void BaseRealSenseNode::setup() | |||
{ | |||
#if defined (ACCELERATE_WITH_GPU) | |||
bool use_gpu_processing = (_accelerate_with_gpu == accelerate_with_gpu::GL_GPU); | |||
initOpenGLProcessing(use_gpu_processing); |
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.
can we save this call if accelerate_with_gpu != GL_GPU
?
or, we must call it and init things there ?
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.
or, we must call it and init things there ?
We must call initOpenGLProcessing()
and init things even for accelerate_with_gpu != GL_GPU
case, because the filter objects are created from rs::gl::colorizer
, rs2::gl::align
and rs2::gl::pointcloud
. classes
7786a9a
to
73df46b
Compare
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.
LGTM, Excellent work !
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.
Great work!
No description provided.