-
Notifications
You must be signed in to change notification settings - Fork 4.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
wait_for_frames cannot be called if a callback was provided #7858
Comments
Hi @OneQuestion I hope that the information in the link below will be helpful to you. As the discussion in the above link mentions, the rs-callback C++ example program can provide guidance for using depth and IMU data in the same program. https://github.com/IntelRealSense/librealsense/blob/master/examples/callback/ The program's notes state: "The default video configuration contains Depth and Color streams. If a device is capable to stream IMU data, both Gyro and Accelerometer are enabled by default". |
Hi @OneQuestion Do you require further assistance with this case, please? Thanks! |
hi. I tried it and so far I couldnt get depth frames and imu data.
…On Thu, 3 Dec 2020 16:04 MartyG-RealSense, ***@***.***> wrote:
Hi @OneQuestion <https://github.com/OneQuestion> Do you require further
assistance with this case, please? Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7858 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALATSG44TWFXRTBBEWXY5VLSS6LHLANCNFSM4UCZG4AA>
.
|
Are you experiencing the same error as before please? terminate called after throwing an instance of 'rs2::wrong_api_call_sequence_error wait_for_frames cannot be called if a callback was provided |
Yes. I am trying to modify motion example, by puting *auto frames =
pipe.wait_for_frames(); *in while loop. I just want to be able to get both
frames and IMU data. But this callback thing is not letting me do that.
Maybe you could tell me how to modify this motion example to get *frames*?
Then I could adapt it to my main code. Thank you.
2020-12-03, kt, 22:18 MartyG-RealSense <[email protected]> rašė:
… Are you experiencing the same error as before please?
*terminate called after throwing an instance of
'rs2::wrong_api_call_sequence_error wait_for_frames cannot be called if a
callback was provided*
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7858 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALATSG3UXLRFU5FTCFUUSMTSS7XCXANCNFSM4UCZG4AA>
.
|
I researched your case further and found a past C++ case about adding depth to rs-motion where the RealSense user used the same cfg setup code for the depth stream that you did. Yet it was successful for them. The details of that case suggest that adding the cfg line was the only change that needed to be made to rs-motion. As you mentioned earlier, it may be the use of the auto frames = pipe.wait_for_frames() line that is causing the problem with your particular script. It is not present in the original rs-motion.cpp script. The rs-motion script uses callbacks. In a link that RealSense team member ev-mp provides, he explains that callbacks are Asynchronous and wait_for_frames is Synchronous, and the two cannot be mixed together interchangeably. |
So I have to get frames in asynchronous mode? Should I use this callback method? |
The impression that I get from the advice in #4185 (comment) is that you should only need to add the cfg statement for the depth stream. If you only add the cfg line for depth to rs-motion and add nothing else, does the program work for you please? |
The program works with added cfg line. But then I try to get frames and
thats where I get the error.
…On Sun, 6 Dec 2020 16:21 MartyG-RealSense, ***@***.***> wrote:
The impression that I get from the advice in #4185 (comment)
<#4185 (comment)>
is that you should only need to add the cfg statement for the depth stream.
If you only add the cfg line for depth to rs-motion and add nothing else,
does the program work for you please?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#7858 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALATSG7TL56HSWKFJPW4JJ3STOHPFANCNFSM4UCZG4AA>
.
|
I looked at your problem carefully. It would be best to refer your question to @ev-mp though, as asynchronous programming is outside of my knowledge. @ev-mp Could you assist @OneQuestion regarding how to get depth frames on a modified rs-motion program with depth added via a cfg stream definition please? Thanks! |
Hi @OneQuestion Do you require further assistance with this case, please? Thanks! |
Case closed due to no new comments received. |
Issue Description
I am trying to use "motion" example and add depth frames. I tried adding to this example
cfg.enable_stream(RS2_STREAM_DEPTH, 848, 480, RS2_FORMAT_Z16, 30);
, but after addingauto frames = pipe.wait_for_frames();
I getterminate called after throwing an instance of 'rs2::wrong_api_call_sequence_error wait_for_frames cannot be called if a callback was provided
error. How can I access the depth frames here?The text was updated successfully, but these errors were encountered: