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

TypeError: argument 0 of Sensor.open() should be a/an StreamProfile #8503

Closed
jameszw001 opened this issue Mar 5, 2021 · 8 comments
Closed

Comments

@jameszw001
Copy link


Required Info
Camera Model { D400 }
Firmware Version (Open RealSense Viewer --> Click info)
Operating System & Version {Ubuntu 18.04
Kernel Version (Linux Only) Linux version 5.4.0-65-generic (buildd@lgw01-amd64-048) (gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu118.04)) #7318.04.1-Ubuntu SMP Tue Jan 19 09:02:24 UTC 2021
Platform PC
SDK Version { how to check this one?}
Language {nodejs }
Segment {Robot}

Issue Description

I will add more above later.
I am trying the realsense_viewer example and I am getting:

`start command
{ tag: 'start',
data: { sensor: 'RGB Camera', streams: [ [Object] ] } }
[ { stream: 'color',
resolution: '1280*720',
format: 'rgb8',
fps: 30 } ]
open profiles:
[]
/home/a/Downloads/librealsense-master/wrappers/nodejs/index.js:3424
throw new TypeError(wrongTypeErrMsgPrefix + expectedType.name);
^

TypeError: argument 0 of Sensor.open() should be a/an StreamProfile
at checkArgumentType (/home/a/Downloads/librealsense-master/wrappers/nodejs/index.js:3424:17)
at ColorSensor.open (/home/a/Downloads/librealsense-master/wrappers/nodejs/index.js:743:7)
at Realsense._handleStart (/home/a/Downloads/librealsense-master/wrappers/nodejs/examples/realsense_viewer/index.js:310:14)
at Realsense.processCommand (/home/a/Downloads/librealsense-master/wrappers/nodejs/examples/realsense_viewer/index.js:111:14)
at WebSocket.cmdSocket.on (/home/a/Downloads/librealsense-master/wrappers/nodejs/examples/realsense_viewer/index.js:372:13)
at WebSocket.emit (events.js:198:13)
at Receiver.receiverOnMessage (/home/a/Downloads/librealsense-master/wrappers/nodejs/examples/realsense_viewer/node_modules/ws/lib/websocket.js:720:20)
at Receiver.emit (events.js:198:13)
at Receiver.dataMessage (/home/a/Downloads/librealsense-master/wrappers/nodejs/examples/realsense_viewer/node_modules/ws/lib/receiver.js:414:14)
at Receiver.getData (/home/a/Downloads/librealsense-master/wrappers/nodejs/examples/realsense_viewer/node_modules/ws/lib/receiver.js:346:17)
`

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Mar 5, 2021

Hi @jameszw001 May I first ask a couple of questions please:

  1. Have you installed the RealSense SDK (librealsense) software on your Ubuntu-using computer?

https://github.com/IntelRealSense/librealsense/releases

  1. If you have installed librealsense for Ubuntu, what method did you use to install it?

  2. Have you successfully built the nodejs wrapper?

https://github.com/IntelRealSense/librealsense/tree/master/wrappers/nodejs

If you have built it, have you tested it by running a simple example script?

https://github.com/IntelRealSense/librealsense/tree/master/wrappers/nodejs#2-run-examples

  1. It looks as though you are using the nodejs example version of realsense-viewer in the link below.

https://github.com/IntelRealSense/librealsense/tree/master/wrappers/nodejs/examples/realsense_viewer

What instructions did you use to launch this example, please?


It is also worth mentioning that from librealsense version 2.40.0 onwards there were changes to nodejs support to add support for nodejs 12 but drop support for nodejs 6.

#7573

@jameszw001
Copy link
Author

  1. Have you installed the RealSense SDK (librealsense) software on your Ubuntu-using computer?
    I followed this to install the SDK: https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md

Have you successfully built the nodejs wrapper?

cd wrappers/nodejs/examples
npm install
node nodejs-capture.js

I got
image

If you have built it, have you tested it by running a simple example script?
Hope the above answered your questions.

What instructions did you use to launch this example, please?

node index.js
also

node -v v10.24.0

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Mar 6, 2021

As the RealSense Viewer example is in a sub-folder of the examples directory called realsense_viewer, had you navigated to that directory before launching the Viewer's index.cpp script? The instructions would probably look like the ones below.

cd wrappers/nodejs/examples/realsense_viewer
npm install
node index.js

@jameszw001
Copy link
Author

jameszw001 commented Mar 6, 2021 via email

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Mar 6, 2021

The process that you are using to launch realsense_viewer seems logically correct (though I am admittedly not a nodejs specialist). So it may be worth going back to looking at the installation process for the nodejs wrapper.

The npm install method is considered to be the simplest installation procedure instead of building the wrapper from source, but it has had problems in the past for some RealSense users. A user posted their own modified method for using npm install though in October 2020 that they said was successful for them,

#7439 (comment)

@MartyG-RealSense
Copy link
Collaborator

Hi @jameszw001 Do you require further assistance with this case, please? Thanks!

@jameszw001
Copy link
Author

jameszw001 commented Mar 12, 2021 via email

@MartyG-RealSense
Copy link
Collaborator

Excellent news that the Python wrapper provided a solution for you. Thanks very much for your agreement to close the case, which I shall now do. Feel free to re-open it at a future date if you need to. Good luck!

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

No branches or pull requests

2 participants