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

add ROS2 rgb camera plugin #24

Merged
merged 7 commits into from
Dec 30, 2021
Merged

add ROS2 rgb camera plugin #24

merged 7 commits into from
Dec 30, 2021

Conversation

yuokamoto
Copy link
Contributor

No description provided.

@yuokamoto yuokamoto mentioned this pull request Dec 12, 2021
@yuokamoto yuokamoto marked this pull request as ready for review December 13, 2021 03:41
@yuokamoto yuokamoto force-pushed the camaera_plugin branch 2 times, most recently from be4d238 to a65d276 Compare December 26, 2021 05:57
Comment on lines 60 to 90
FROSImage UROS2CameraComponent::GetData()
{
SceneCaptureComponent->CaptureScene();
CaptureNonBlocking();
if(!RenderRequestQueue.IsEmpty()){
// Peek the next RenderRequest from queue
FRenderRequest* nextRenderRequest = nullptr;
RenderRequestQueue.Peek(nextRenderRequest);

if(nextRenderRequest){ //nullptr check
if(nextRenderRequest->RenderFence.IsFenceComplete()){ // Check if rendering is done, indicated by RenderFence
for (int I = 0; I < nextRenderRequest->Image.Num(); I++)
{
Data.data[I * 3 + 0] = nextRenderRequest->Image[I].R;
Data.data[I * 3 + 1] = nextRenderRequest->Image[I].G;
Data.data[I * 3 + 2] = nextRenderRequest->Image[I].B;
// UE_LOG(LogTemp, Warning, TEXT("AsyncTaskDone"));
}

// Delete the first element from RenderQueue
RenderRequestQueue.Pop();
delete nextRenderRequest;
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since here we do CaptureNonBlocking(), which means the GameThread is non-blocking, and the capturing (pixel reading from RHI) could possibly take some time before RHI returns the data.
Thus, if(nextRenderRequest->RenderFence.IsFenceComplete()) might not be instantly satisfied.

But more essentially, an instant data fetching function named GetData() could be inevitably blocking, if users want to invoke a non-blocking version, they might want to fetch data at a later time, when it is available from RHI, after invoking CaptureNonBlocking()?

References:

  • TimmHess actually runs the fence check in a tick then do async image saving.
  • Another one of async fetching style by off-loading the fence check to a thread.
@yuokamoto yuokamoto merged commit da1f761 into main Dec 30, 2021
@yuokamoto yuokamoto deleted the camaera_plugin branch December 30, 2021 09:21
Tadinu pushed a commit that referenced this pull request Jan 5, 2022
* add rgb camera plugin
yuokamoto added a commit that referenced this pull request Jan 6, 2022
* add rgb camera plugin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants