balthisar / cncjs-pendant-gamepad

Use a Videogame Controller as a CNCjs Pendant
MIT License
13 stars 8 forks source link

HELP! cncjs-pendant-gamepad.js: No such file or directory #13

Open jamhot1 opened 4 months ago

jamhot1 commented 4 months ago

would really appreciate some help getting this setup. loaded CNCJS onto a RPI lite os version. have managed to setup SIXAD bluetooth but for some reason, after I install the gamepad and run I get no file or directory found errors, see below. I have limited experience with linux and have tried different versions of node (16 currently) still no ball. I will add that the install appears to go without errors apart from some vulnerabilities. I must be missing something crucial to get this going. I just don't have enough knowledge of linux to figure this out.

bin/cncjs-pendant-gamepad.js -p /dev/ttyUSB0 -b 115200 -t grbl --so cket-port 80 -bash: bin/cncjs-pendant-gamepad.js: No such file or directory pi@cncjs:~ $ cncjs-pendant-gamepad/bin/cncjs-pendant-gamepad.js -p /dev/ttyUSB0 -b 115200 -t grbl --socket-port 80 WARN CLI Error: ENOENT: no such file or directory, open '/etc/cncjs-pendan t-gamepad.rc.json' WARN CLI at Object.openSync (node:fs:590:3) WARN CLI at Object.readFileSync (node:fs:458:35) WARN CLI at loadOptionsFile (file:///home/pi/cncjs-pendant-gamepad/lib /console.js:57:28) WARN CLI at getFileOptions (file:///home/pi/cncjs-pendant-gamepad/lib/ console.js:75:26) WARN CLI at startCLI (file:///home/pi/cncjs-pendant-gamepad/lib/consol e.js:23:46) WARN CLI at file:///home/pi/cncjs-pendant-gamepad/bin/cncjs-pendant-ga mepad.js:12:1 WARN CLI at ModuleJob.run (node:internal/modules/esm/module_job:193:25 ) WARN CLI at async Promise.all (index 0) WARN CLI at async ESMLoader.import (node:internal/modules/esm/loader:5 30:24) WARN CLI at async loadESM (node:internal/process/esm_loader:91:5) WARN CLI Error: ENOENT: no such file or directory, open '/etc/cncjs-penda nt-gamepad.rc.json' WARN CLI at Object.openSync (node:fs:590:3) WARN CLI at Object.readFileSync (node:fs:458:35) WARN CLI at loadOptionsFile (file:///home/pi/cncjs-pendant-gamepad/lib /console.js:57:28) WARN CLI at getFileOptions (file:///home/pi/cncjs-pendant-gamepad/lib/ console.js:75:26) WARN CLI at startCLI (file:///home/pi/cncjs-pendant-gamepad/lib/consol e.js:23:46) WARN CLI at file:///home/pi/cncjs-pendant-gamepad/bin/cncjs-pendant-ga mepad.js:12:1 WARN CLI at ModuleJob.run (node:internal/modules/esm/module_job:193:25 ) WARN CLI at async Promise.all (index 0) WARN CLI at async ESMLoader.import (node:internal/modules/esm/loader:5 30:24) WARN CLI at async loadESM (node:internal/process/esm_loader:91:5) { WARN CLI errno: -2, WARN CLI syscall: 'open', WARN CLI code: 'ENOENT', WARN CLI path: '/etc/cncjs-pendant-gamepad.rc.json' WARN CLI } WARN CLI Error: ENOENT: no such file or directory, open '/home/pi/.cncjs-p endant-gamepad.rc.json' WARN CLI at Object.openSync (node:fs:590:3) WARN CLI at Object.readFileSync (node:fs:458:35) WARN CLI at loadOptionsFile (file:///home/pi/cncjs-pendant-gamepad/lib /console.js:57:28) WARN CLI at getFileOptions (file:///home/pi/cncjs-pendant-gamepad/lib/ console.js:76:26) WARN CLI at startCLI (file:///home/pi/cncjs-pendant-gamepad/lib/consol e.js:23:46) WARN CLI at file:///home/pi/cncjs-pendant-gamepad/bin/cncjs-pendant-ga mepad.js:12:1 WARN CLI at ModuleJob.run (node:internal/modules/esm/module_job:193:25 ) WARN CLI at async Promise.all (index 0) WARN CLI at async ESMLoader.import (node:internal/modules/esm/loader:5 30:24) WARN CLI at async loadESM (node:internal/process/esm_loader:91:5) WARN CLI Error: ENOENT: no such file or directory, open '/home/pi/.cncjs- pendant-gamepad.rc.json' WARN CLI at Object.openSync (node:fs:590:3) WARN CLI at Object.readFileSync (node:fs:458:35) WARN CLI at loadOptionsFile (file:///home/pi/cncjs-pendant-gamepad/lib /console.js:57:28) WARN CLI at getFileOptions (file:///home/pi/cncjs-pendant-gamepad/lib/ console.js:76:26) WARN CLI at startCLI (file:///home/pi/cncjs-pendant-gamepad/lib/consol e.js:23:46) WARN CLI at file:///home/pi/cncjs-pendant-gamepad/bin/cncjs-pendant-ga mepad.js:12:1 WARN CLI at ModuleJob.run (node:internal/modules/esm/module_job:193:25 ) WARN CLI at async Promise.all (index 0) WARN CLI at async ESMLoader.import (node:internal/modules/esm/loader:5 30:24) WARN CLI at async loadESM (node:internal/process/esm_loader:91:5) { WARN CLI errno: -2, WARN CLI syscall: 'open', WARN CLI code: 'ENOENT', WARN CLI path: '/home/pi/.cncjs-pendant-gamepad.rc.json' WARN CLI } cncjs-pendant-gamepad is currently running. Stop running with Control-C Use 'cncjs-pendant-gamepad --help' if you're expecting to see something else her e. file:///home/pi/cncjs-pendant-gamepad/lib/connector.js:117 this.socket.on(msg, callback); ^

TypeError: Cannot read properties of undefined (reading 'on') at Connector.subscribeMessage (file:///home/pi/cncjs-pendant-gamepad/lib/con nector.js:117:25) at new GcodeGrbl (file:///home/pi/cncjs-pendant-gamepad/lib/gcode-grbl.js:7: 24) at Actions.newGcodeSender (file:///home/pi/cncjs-pendant-gamepad/lib/actions .js:51:16) at new Actions (file:///home/pi/cncjs-pendant-gamepad/lib/actions.js:34:33) at startCLI (file:///home/pi/cncjs-pendant-gamepad/lib/console.js:32:5) at file:///home/pi/cncjs-pendant-gamepad/bin/cncjs-pendant-gamepad.js:12:1 at ModuleJob.run (node:internal/modules/esm/module_job:193:25) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:530:24) at async loadESM (node:internal/process/esm_loader:91:5)

grukx commented 3 days ago

I have the same problems. The first messages you get are just missing json config files, I just copied the one in the src-folder and these went away.

The real error is here: cncjs-pendant-gamepad/lib/connector.js:117 this.socket.on(msg, callback); ^ TypeError: Cannot read properties of undefined (reading 'on')

With only a brief look into the code it looks cncjs connection related. It fails here //-------------------------------------------------------------------------- // Handle receiving messages from cncjs socket server, or faking // out for --fake-socket option. //-------------------------------------------------------------------------- subscribeMessage(msg: string, callback: any) { if (!this.options.simulate) this.socket.on(msg, callback); log.info(this.logPrefix, Ready to listen for message '${msg}' from the socket.); };

Running with "simulate" command does not crash it.

Geir

jamhot1 commented 2 days ago

Ah, Not just me then. I was really keen to get this going but had to give up after nearly a week of my evenings and a weekend was sunk going around in circles with this. Please do post if you find a working system.

grukx commented 2 days ago

I have it working, but I need to fix my patch. Made a mess that needs to be some cleaning first .

Geir

tor. 14. nov. 2024, 10:20 skrev jamhot1 @.***>:

Ah, Not just me then. I was really keen to get this going but had to give up after nearly a week of my evenings and a weekend was sunk going around in circles with this. Please do post if you find a working system.

— Reply to this email directly, view it on GitHub https://github.com/balthisar/cncjs-pendant-gamepad/issues/13#issuecomment-2475801123, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSHRKHNL65AGONI2EXAEVL2ARSWBAVCNFSM6AAAAABKPFV64CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINZVHAYDCMJSGM . You are receiving this because you commented.Message ID: @.***>

jamhot1 commented 2 days ago

Oh. I thought you still had problems when reading your last post. So you copied the configs in the src-folder and that allowed it to function? What is the problem with the connector you stated?

grukx commented 2 days ago

The code is not very forgiving when it comes to connecting to the gamepad. I use a wireless gamepad and I get this error when the gamepad is not connected. It starts ok when my gamepad is up and running, but crashes when I disconnect. I have a patch for this, but it conflicts with another pull request that attempts to fix related issues with the communication retries.

If you get the this.socket.on(msg, callback); error it is likely an issue with the gamepad not being connected and detected as it should.

grukx commented 1 day ago

Pushed some code to make this more robust. I run ok with both PR9 and my fixes. For testing you can pull them from the "dev" branch in https://github.com/grukx/cncjs-pendant-gamepad.git if you dont want to merge stuff yourself.

grukx commented 1 day ago

btw the description for getting this to work is pretty inaccurate - on my install with the latest cncjs I had to do this to get things working as it should. Note the use of a fixed IP and no serial information given for the cncjs-pendant

pm2 start $(which cncjs) -- --host 192.168.102.70 --port 8000 -w /home/ge/watch --allow-remote-access --controller Grbl pm2 start /home/ge/cncjs-pendant-gamepad/bin/cncjs-pendant-gamepad.js -- -t Grbl --socket-port 8000 --socket-address 192.168.102.70 -vv run

Turns out that if you give the serial port to the pendant it will try to open it itself instead of going through cncjs. If you give --host 0.0.0.0 to cncjs it ends up binding to 127.0.0.1 for some reason, but works if you bind to the specific adapter address.

...and I recommend going through the commands that the pendant issues carefully before any hardware test, fun stuff can happen if this is not matched to your machine...

Geir