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

Fix nodejs14 cameras autoconfiguration new glfw #8633

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion wrappers/nodejs/examples/glfw-window.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

'use strict';

const glfw = require('node-glfw-3');
const glfw = require('node-12-glfw-3');
const rs2 = require('../index.js');
const now = require('performance-now');

Expand Down
2 changes: 1 addition & 1 deletion wrappers/nodejs/examples/nodejs-align.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const colorizer = new rs2.Colorizer();
const renderer = new Texture();
const align = new rs2.Align(rs2.stream.STREAM_COLOR);
const pipeline = new rs2.Pipeline();
const profile = pipeline.start();
const profile = pipeline.start(pipeline.autoConfig);

const depthScale = tryGetDepthScale(profile.getDevice());
if (depthScale === undefined) {
Expand Down
2 changes: 1 addition & 1 deletion wrappers/nodejs/examples/nodejs-capture.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const colorizer = new rs2.Colorizer();
const pipeline = new rs2.Pipeline();

// Start the camera
pipeline.start();
pipeline.start(pipeline.autoConfig);

while (! win.shouldWindowClose()) {
const frameset = pipeline.waitForFrames();
Expand Down
2 changes: 1 addition & 1 deletion wrappers/nodejs/examples/nodejs-pointcloud.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const win = new GLFWWindow(1280, 720, 'Node.js PointCloud Example');
const pc = new rs2.PointCloud();
const pipeline = new rs2.Pipeline();

pipeline.start();
pipeline.start(pipeline.autoConfig);

console.log('Drag to change perspective, scroll mouse wheel to zoom in/out.');

Expand Down
2 changes: 1 addition & 1 deletion wrappers/nodejs/examples/nodejs-save-to-disk.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const rs2 = require('../index.js');
let colorizer = new rs2.Colorizer();
let pipeline = new rs2.Pipeline();

pipeline.start();
pipeline.start(pipeline.autoConfig);

for (let i = 0; i < 30; i++) {
pipeline.waitForFrames();
Expand Down
117 changes: 57 additions & 60 deletions wrappers/nodejs/examples/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wrappers/nodejs/examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dependencies": {
"fsm-as-promised": "^0.15.1",
"input": "^1.0.1",
"node-glfw-3": "^0.3.4",
"node-12-glfw-3": "git+https://github.com/whsol/node-glfw.git",
"performance-now": "^2.1.0"
}
}
2 changes: 1 addition & 1 deletion wrappers/nodejs/examples/realsense_viewer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"license": "Apache-2.0",
"dependencies": {
"express": "^4.16.3",
"sharp": "^0.20.5",
"sharp": "^0.27.2",
"ws": "^5.2.0"
}
}
19 changes: 18 additions & 1 deletion wrappers/nodejs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2616,7 +2616,23 @@ class Pipeline {
}

if (ownCtx === true) {
this.ctx = new Context();
this.ctx = new Context();
// get existing sensors params
let sensores = this.ctx.querySensors();
if (sensores.length>=2) {
let depthSensor = sensores[0];
let colorSensor = sensores[1];
let cfg = new Config();
let depthProfiles = depthSensor.getStreamProfiles().filter(s=>s.streamType == stream.STREAM_DEPTH);
let depthProfile = depthProfiles.find(x=>x.width == 640 && x.height==480) || depthProfiles[depthProfiles.length-1];
let colorProfiles = colorSensor.getStreamProfiles().filter(s=>s.streamType == stream.STREAM_COLOR);
let colorProfile = colorProfiles.find(x=>x.width == 640 && x.height==480) ||colorProfiles[colorProfiles.length-1];
console.log(`depth: w: ${depthProfile.width}, h: ${depthProfile.height}, format: ${depthProfile.format}, fps: ${depthProfile.fps}`);
console.log(`color: w: ${colorProfile.width}, h: ${colorProfile.height}, format: ${colorProfile.format}, fps: ${colorProfile.fps}`);
cfg.enableStream(stream.STREAM_DEPTH, -1, depthProfile.width, depthProfile.height, depthProfile.format, depthProfile.fps);
cfg.enableStream(stream.STREAM_COLOR, -1, colorProfile.width, colorProfile.height, format.FORMAT_RGB8, colorProfile.fps);
this.autoConfig = cfg;
}
}

this.cxxPipeline = new RS2.RSPipeline();
Expand Down Expand Up @@ -2675,6 +2691,7 @@ class Pipeline {
} else {
checkArgumentType(arguments, Config, 0, funcName);
this.started = true;
console.log(`Pipeline started with config`);
return new PipelineProfile(this.cxxPipeline.startWithConfig(arguments[0].cxxConfig));
}
}
Expand Down