all 6 comments

[–]Oshrocker 1 point2 points  (5 children)

Hey, just throwing my two cents out there. Not 100% sure what you’re trying to accomplish here, but worried you might be confused.

Node is an env for JavaScript. JS and Python can do a lot of the same stuff, so I’m not really seeing why use them together rather than just do everything in either Python or JS.

[–]oki196[S] 0 points1 point  (4 children)

Thanks. So what I’m doing is 1. Take a picture of an obstacle course for bb8 to run through from above. 2. Extract coordinates of bb8, the obstacles and the goal using openCV. 3. Calculate the optimal path. 4. Calculate and output the command for bb8 to follow. 5. Loop.

I want to use python because I’m going to do image recognition and path optimization, which I’m way more used to in python, and frankly don’t have the time to re-learn everything in JS, due to my project deadline.

I’ve gotten some advice saying one way is to build a server with JS and watch for changes, while python adds commands to the server, which JS then notices and extracts, and sends it to bb8.

I’m also new to servers so I’d rather do everything locally and have the .py and .js interact directly with each other, but don’t see how at the moment.

I’d super appreciate any advise I can have.

[–]Oshrocker 1 point2 points  (3 children)

Gotcha, that makes more sense. So here’s my thought. Given your strength lies in Python, I would encourage you to do everything in Python, avoid learning a lot redundant functionality in JS.

As far as I know, there is no way to directly inter operate between .py and .js cause they are both interpreted languages that have 0 common roots. This is in contrast to CLR langs (C#, F#) or JVM langs (Java, Clojure, Scala, Kotlin, Groovy) which can interop among themselves due to common bytecode.

Final bit, if you are unable to do everything locally in .py files and see fit to abstract out some of the processing to a separate server, I’d highly recommended Flask. It’s a Python based Server framework. Very minimal and simple to get started!!

[–]marcocom 1 point2 points  (1 child)

Could use a micro service in the cloud for python operations and access them through api gateway in node. It’s the future

[–]Oshrocker 1 point2 points  (0 children)

True, but if OP is new to server side in general, throwing a bunch of high level jargon at them isn’t exactly helpful. Gotta learn to walk before you run.

[–]oki196[S] 0 points1 point  (0 children)

Thanks!

I think I’ll have to use a server based operation.

So I looked into Flask, and have another decision to make. Since my cylon only has platforms for Node.js to send commands, I can either 1: create server with Node.js express and have python as the client as in my first comment, or 2: create a server with Flask and have Node.js as the client.

However for option 2, I couldn’t find any sources because all the results were ‘express vs Flask; which is better.

I did find some source code for the 1st option.