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

MATLAB issue, device.as error #4034

Closed
upxela opened this issue May 21, 2019 · 9 comments
Closed

MATLAB issue, device.as error #4034

upxela opened this issue May 21, 2019 · 9 comments
Labels

Comments

@upxela
Copy link

upxela commented May 21, 2019

  • Before opening a new issue, we wanted to provide you with some useful suggestions (Click "Preview" above for a better view):

  • All users are welcomed to report bugs, ask questions, suggest or request enhancements and generally feel free to open new issue, even if they haven't followed any of the suggestions above :)


Required Info
Operating System & Version Win 10
Platform PC
SDK Version 2.22.0
Language matlab

Issue Description

I am using the MATLAB wrapper from the Windows Installer and MATLAB R2018A to read through a prerecorded bag file. To do this, I will set_real_time to false. This is my MATLAB code:

pipeline = realsense.pipeline();
config = realsense.config();
config.enable_device_from_file(name, false);

pipe_prof = pipeline.start(config);
device = pipe_prof.get_device();
playback = device.as('playback');
playback.set_real_time(false);

However, while doing so I get the following error:

Brace indexing is not supported for variables of this type.
Error in realsense.device/as (line 96)
dev = realsense.playback(out{:});
Error in readBag (line 10)
playback = device.as('playback');

@ev-mp ev-mp added the matlab label May 22, 2019
@upxela
Copy link
Author

upxela commented Jun 10, 2019

Has anybody else had similar problems with this/reproduced the error?

@RealSenseCustomerSupport
Copy link
Collaborator


@upxela Could you please try below to see if you still have issue?

playback = realsense.playback(device)

@upxela
Copy link
Author

upxela commented Jun 13, 2019

@RealSenseCustomerSupport Following your advice I changed the code to:

pipeline = realsense.pipeline();
config = realsense.config();
config.enable_device_from_file(name, false);

pipe_prof = pipeline.start(config);
device = pipe_prof.get_device();
% playback = device.as('playback');
playback = realsense.playback(device); 
playback.set_real_time(false);

My new error message is as follows:

Error using realsense.playback
Error: File: playback.m Line: 55 Column: 27
'current_status' is already defined as a method in the 'playback' class.

Error in readBag (line 11)
playback = realsense.playback(device);

@lramati
Copy link
Contributor

lramati commented Jun 13, 2019

As an immediate fix, you can replace line 60 of playback.m with function stop(this)

@upxela
Copy link
Author

upxela commented Jun 13, 2019

@RealSenseCustomerSupport @lramati Thanks for that. Now I have a problem with constructing the playback. Here is my error message:

Not enough input arguments.
Error in realsense.playback (line 6)
this = [email protected](handle, index);
Error in readBag (line 11)
playback = realsense.playback(device);

What exactly are handle and index? I am guessing that I need to change playback = realsense.playback(device); to have the parameters match handle and index.

@lramati
Copy link
Contributor

lramati commented Jun 13, 2019

The parameters handle and index were supposed to come from inside the device instance.
You can fix the .as('playback') syntax by replacing out{:} on lines 88, 94, and 96 of device.m with out, -1. A change in how devices are handled in the backend appears to have not been propagated to this function.

@upxela
Copy link
Author

upxela commented Jun 13, 2019

@lramati As clarification, you meant to change playback = realsense.playback(device); back to playback = device.as('playback'); after replacing the out{:}?

Doing so, I still get the same error:

Brace indexing is not supported for variables of this type.
Error in realsense.device/as (line 96)
dev = realsense.playback(out, -1);
Error in readBag (line 10)
playback = device.as('playback');

@lramati
Copy link
Contributor

lramati commented Jun 13, 2019

It just worked on my machine. I'm also confused because there doesn't actually appear to be any brace indexing on the line it's erroring on. Could you confirm the changes got saved and maybe restart the Matlab environment just in case?

@upxela
Copy link
Author

upxela commented Jun 13, 2019

Restarted matlab and it worked. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants