Body recognition SDK + Node JS addon

I know this question is very specific, but maybe someone could help me.

I am trying to integrate Astra SDK with a Node JS application using Node JS addons on Windows. Node JS addons are DLLs that you can call in Node from your Javascript code. I’ve done that before with other cameras (Kinect and Asus Xtion).

I have developed a simple body recognition functionality with Astra SDK that runs fine as a standalone application, but when I try to call it from my Node JS application I am always getting an ASTRA_STATUS_TIMEOUT (3) as a result of calling astra_reader_open_frame and the camera does not turn on.

I can’t figure out where the problem is. What can be causing this timeout error?

1 Like

I tried to simplifiy as much as I could to isolate the error. I followed the HelloWorld tutorial building it as a NodeJS Addon, and I can see a Warning saying that Plugins folder cannot be found, and to check working directory. Could this be the cause of the problem mentioned in my last post? However, I have astra DLLs in the same folder and they are found. If I print the working directory it seems to be correct and it has Plugins folder in it. In fact, If I run it as a standalone console app it is working.

Any status update on this? Also trying to integrate body recognition in to a NodeJS project.

1 Like

Are you having the same problem?

I checked disk accesses using Windows Process Monitor and I found that, at some point, the process tried to access the Plugins folder. As a normal EXE file, the result of this operation was “SUCCESS”, while the same operation with the SDK in a Node JS addon ended with an “INVALID NAME” result. I haven’t been able to figure out why. Finally I gave up.

My goal was to integrate the Astra SDK with my Node JS web socket server. Since I did not find the way to do it, I rewrote the web socket server in C++.

If you find a solution, please let me know.

A DLL will likely not have direct access to a path context in the same way that your exe does. It’s path will be relative to the location of the executable it is running inside most likely … As such it will likely not be finding the right config files.

Thank you for your reply.

I tried to place Plugins folder in any possible directory where I thought the process could try to find Plugins folder with no success. In fact, monitoring process disk accesses I see that the location where the process is looking for Plugins folder is correct. You can see in the image attached that the full path in both cases (DLL and normal EXE) is the same, and results are different.

The socket server sounds like a good work-around. Any chance you’d be willing to share your socket server code? I’m looking to do the same thing but I’m not very experienced with C++. I found GitHub - kashimAstro/SimpleNetwork: simple TCP server / client C++ linux socket but I’m having difficulties implementing it in to the example code.

I am not using a raw TCP socket, but a web socket. I am using Websocket++ GitHub - zaphoyd/websocketpp: C++ websocket client/server library together with Asio library (Downloading Asio). They are only-header libraries. Websocket++ includes some examples. I followed the echo_server one.

I am using websockets, because I am consuming “camera frames” from the web browser.

1 Like

Thanks for the info! I’m trying to getting body/hand tracking data in to an ElectronJS app. Thus far I’ve patched together a working version by way of using the Gestoos C++ API in a Processing app which sends data over a WebSocket. My NodeJS app connects to the socket. Not really an acceptable production solution.

A Javascript wrapper would be fantastic for us developing HTML5 apps who don’t know C++ or Java.

Hello,
I’ve already send data from Orbbec cpp SDK to electron app with a simple stdout from cpp, it’s really easy to do even if never code in c or cpp.

I modify the cpp example to output data in json format but it’s not necessary then got it in electron with spawn something like that in javascript :

this.exe = spawn("your exe build path");

this.exe.stdout.on('data', function (data) {
    var values;
    try {
        values = JSON.parse(data.toString());
    } catch (e) {
        alert("error : " + data.toString());
        console.log("error : " + data.toString());
   }

}

the thing I can’t do is to output the pixelmap but I don’t really need it for now.

Hope it’s help.

Regards.

1 Like

Looks good. You should publish it on github or write a Medium article.

1 Like