MMRIZE / MMM-GroveGestures

MagicMirror Module - detecting 3D gesture with GroveGesture Sensor(PAJ7620u2)
MIT License
38 stars 11 forks source link

Controls no longer working #27

Open alexsquared opened 3 weeks ago

alexsquared commented 3 weeks ago

This is a continuation of the previously closed issue linked below. I had to do a fresh install as my last MM was hanging up. I installed the module, enabled I2c, and controls still don't work. I get the gesture response (ie left, down, etc) to show up on my screen as I have that enabled, but the subsequent action (hide modules) doesn't work. Please note that previously this worked and then suddenly stopped. a lot of troubleshooting was done, however, we were never able to reestablish control before I had to do the fresh install. Any help would be greatly appreciated. The functionality provided by this app has been great when it works.

https://github.com/MMRIZE/MMM-GroveGestures/issues/24

eouia commented 3 weeks ago

With dev-debug mode, you can get some suspicious warning or error messages from MM on the front-side.

npm run start:dev

Or you can enter dev-console on running with Ctrl+Shift+J

Could you see any suspicious message there when you try to manipulate?

alexsquared commented 2 weeks ago

does it matter whether I'm using pm2 or npm?

eouia commented 2 weeks ago

Both doesn't matter, but if you are using pm2 currently, you have to stop your previous instance of MM on PM2. Then you can run npm run start:dev. Or just open dev-console on running by shortcut key.

lxne commented 2 weeks ago

Did you test the sensor?

cd ~/MagicMirror/modules/MMM-GroveGestures/py
python gesture_print.py

Just to make sure that this works correctly.

alexsquared commented 2 weeks ago

yup, it's running fine.

raspberrypi:~ $ cd ~/MagicMirror/modules/MMM-GroveGestures/py python gesture_print.py wake-up finish. Paj7620 initialize register finished. Down Left

alexsquared commented 2 weeks ago

Both doesn't matter, but if you are using pm2 currently, you have to stop your previous instance of MM on PM2. Then you can run npm run start:dev. Or just open dev-console on running by shortcut key.

When i stop MM via PM2 and then run NPM run start:dev, I get the below.

npm ERR! code ENOENT npm ERR! syscall open npm ERR! path /home/a2/package.json npm ERR! errno -2 npm ERR! enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/home/a2/package.json' npm ERR! enoent This is related to npm not being able to find a file. npm ERR! enoent

npm ERR! A complete log of this run can be found in: /home/a2/.npm/_logs/2024-11-14T21_57_02_006Z-debug-0.log

alexsquared commented 2 weeks ago

This is the output of that log file.

0 verbose cli /usr/local/bin/node /usr/local/bin/npm 1 info using npm@10.1.0 2 info using node@v20.9.0 3 timing npm:load:whichnode Completed in 5ms 4 timing config:load:defaults Completed in 9ms 5 timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 2ms 6 timing config:load:builtin Completed in 3ms 7 timing config:load:cli Completed in 13ms 8 timing config:load:env Completed in 2ms 9 timing config:load:project Completed in 6ms 10 timing config:load:file:/home/a2/.npmrc Completed in 1ms 11 timing config:load:user Completed in 1ms 12 timing config:load:file:/usr/local/etc/npmrc Completed in 22ms 13 timing config:load:global Completed in 22ms 14 timing config:load:setEnvs Completed in 5ms 15 timing config:load Completed in 66ms 16 timing npm:load:configload Completed in 68ms 17 timing config:load:flatten Completed in 14ms 18 timing npm:load:mkdirpcache Completed in 1ms 19 timing npm:load:mkdirplogs Completed in 1ms 20 verbose title npm run start:dev 21 verbose argv "run" "start:dev" 22 timing npm:load:setTitle Completed in 4ms 23 timing npm:load:display Completed in 3ms 24 verbose logfile logs-max:10 dir:/home/a2/.npm/_logs/2024-11-14T21_57_02_006Z- 25 verbose logfile /home/a2/.npm/_logs/2024-11-14T21_57_02_006Z-debug-0.log 26 timing npm:load:logFile Completed in 49ms 27 timing npm:load:timers Completed in 0ms 28 timing npm:load:configScope Completed in 0ms 29 timing npm:load Completed in 236ms 30 timing command:run Completed in 14ms 31 verbose stack Error: Could not read package.json: Error: ENOENT: no such file or directory, open '/home/a2/package.json' 32 verbose cwd /home/a2 33 verbose Linux 6.6.51+rpt-rpi-v7 34 verbose node v20.9.0 35 verbose npm v10.1.0 36 error code ENOENT 37 error syscall open 38 error path /home/a2/package.json 39 error errno -2 40 error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/home/a2/package.json' 41 error enoent This is related to npm not being able to find a file. 41 error enoent 42 verbose exit -2 43 timing npm Completed in 718ms 44 verbose code -2 45 error A complete log of this run can be found in: /home/a2/.npm/_logs/2024-11-14T21_57_02_006Z-debug-0.log

eouia commented 2 weeks ago

You have to run npm command in your MagicMirror directory. Sorry, my explanation was not enough.

alexsquared commented 2 weeks ago

Thanks for the clarification. Here is the log file with the dev run ongoing. The only thing I deleted were some calendar and google photos calls.

a2@raspberrypi:~/MagicMirror $ npm run start:dev

magicmirror@2.29.0 start:dev DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js dev

[2024-11-15 06:40:42.203] [LOG] Starting MagicMirror: v2.29.0 [2024-11-15 06:40:42.263] [LOG] Loading config ... [2024-11-15 06:40:42.269] [LOG] config template file not exists, no envsubst [2024-11-15 06:40:44.046] [INFO] Checking config file /home/a2/MagicMirror/config/config.js ... [2024-11-15 06:40:44.255] [INFO] Your configuration file doesn't contain syntax errors :) [2024-11-15 06:40:44.257] [INFO] Checking modules structure configuration ... [2024-11-15 06:40:44.487] [INFO] Your modules structure configuration doesn't contain errors :) [2024-11-15 06:40:44.493] [LOG] Loading module helpers ... [2024-11-15 06:40:44.496] [LOG] No helper found for module: alert. [2024-11-15 06:40:44.514] [LOG] Initializing new module helper ... [2024-11-15 06:40:44.516] [LOG] Module helper loaded: updatenotification [2024-11-15 06:40:44.517] [LOG] No helper found for module: clock. [2024-11-15 06:40:44.939] [LOG] Initializing new module helper ... [2024-11-15 06:40:44.941] [LOG] Module helper loaded: calendar [2024-11-15 06:40:44.942] [LOG] No helper found for module: compliments. [2024-11-15 06:40:45.737] [LOG] Initializing new module helper ... [2024-11-15 06:40:45.738] [LOG] Module helper loaded: MMM-DailyBibleVerse [2024-11-15 06:40:45.741] [LOG] No helper found for module: MMM-WeatherGraph. [2024-11-15 06:40:46.085] [LOG] Initializing new module helper ... [2024-11-15 06:40:46.086] [LOG] Module helper loaded: MMM-Remote-Control [2024-11-15 06:40:47.223] [LOG] Initializing new module helper ... [2024-11-15 06:40:47.224] [LOG] Module helper loaded: MMM-GooglePhotos [2024-11-15 06:40:47.228] [LOG] No helper found for module: MMM-WebView. [2024-11-15 06:40:47.240] [LOG] Initializing new module helper ... [2024-11-15 06:40:47.241] [LOG] Module helper loaded: MMM-GroveGestures [2024-11-15 06:40:47.241] [LOG] All module helpers loaded. [2024-11-15 06:40:47.258] [LOG] Starting server on port 8080 ... [2024-11-15 06:40:49.327] [LOG] Server started ... [2024-11-15 06:40:49.331] [LOG] Connecting socket for: updatenotification [2024-11-15 06:40:49.334] [LOG] Starting module helper: updatenotification [2024-11-15 06:40:49.336] [LOG] Connecting socket for: calendar [2024-11-15 06:40:49.339] [LOG] Starting node helper for: calendar [2024-11-15 06:40:49.342] [LOG] Connecting socket for: MMM-DailyBibleVerse [2024-11-15 06:40:49.345] [LOG] Started node_helper.js for MMM-DailyBibleVerse. [2024-11-15 06:40:49.347] [LOG] Connecting socket for: MMM-Remote-Control [2024-11-15 06:40:49.350] [LOG] Starting node helper for: MMM-Remote-Control [2024-11-15 06:40:50.838] [LOG] Connecting socket for: MMM-GooglePhotos [2024-11-15 06:40:50.841] [LOG] Connecting socket for: MMM-GroveGestures [2024-11-15 06:40:50.844] [LOG] Sockets connected & modules started ... [2024-11-15 06:40:59.739] [LOG] Launching application. [2024-11-15 06:41:12.077] [INFO] System information:

SYSTEM: manufacturer: Raspberry Pi Foundation; model: Raspberry Pi 3 Model B Plus Rev 1.3; virtual: false

OS: platform: linux; distro: Raspbian GNU/Linux; release: 12; arch: arm; kernel: 6.6.51+rpt-rpi-v7

VERSIONS: electron: 31.7.2; used node: 20.18.0; installed node: 20.9.0; npm: 10.1.0; pm2: 5.4.2

OTHER: timeZone: America/Los_Angeles; ELECTRON_ENABLE_GPU: undefined

[2024-11-15 06:41:22.872] [LOG] MMM-DailyBibleVerse node helper received a socket notification: START - Payload: NASB [2024-11-15 06:41:22.896] [INFO] Starting Initialization [2024-11-15 06:41:22.902] [INFO] updatenotification: Updater Class Loaded! [2024-11-15 06:41:22.904] [INFO] updatenotification: Checking PM2 using... [2024-11-15 06:41:26.237] [INFO] Checking git for module: MMM-DailyBibleVerse [2024-11-15 06:41:26.732] [INFO] Loading cached albumns list [2024-11-15 06:41:26.889] [INFO] updatenotification: [PM2] You are not using pm2 [2024-11-15 06:41:26.921] [INFO] Loading cached albumns list [2024-11-15 06:41:27.072] [LOG] {"votd":{"text":"“Trouble and anguish have come upon me, Yet Your commandments are my delight.”","content":"Trouble and anguish have come upon me, Yet<\/i> Your commandments are my delight.","display_ref":"Psalm 119:143","reference":"Psalm 119:143","permalink":"https:\/\/www.biblegateway.com\/passage\/?search=Psalm%20119%3A143&version=NASB","copyright":"","copyrightlink":"https:\/\/www.biblegateway.com\/versions\/index.php?action=getVersionInfo&vid=49&lang=2","audiolink":"https:\/\/www.biblegateway.com\/audio\/mcconachie\/nasb\/Ps.119.143","day":"15","month":"11","year":"2024","version":"New American Standard Bible","version_id":"NASB","merchandising":""}} [2024-11-15 06:41:28.015] [INFO] Checking git for module: MMM-WeatherGraph [2024-11-15 06:41:28.874] [INFO] Initialization complete! [2024-11-15 06:41:28.889] [INFO] Start first scanning. [2024-11-15 06:41:28.897] [INFO] Start Album scanning [2024-11-15 06:41:28.902] [INFO] Getting album list [2024-11-15 06:41:32.523] [LOG] [GESTURE] ORIGIN:wake-up finish. [2024-11-15 06:41:32.555] [LOG] [GESTURE] ORIGIN:Paj7620 initialize register finished. [2024-11-15 06:41:32.558] [INFO] Checking git for module: MMM-Remote-Control [2024-11-15 06:41:32.773] [INFO] Checking git for module: MMM-GooglePhotos [2024-11-15 06:41:32.899] [INFO] Checking git for module: MMM-WebView [2024-11-15 06:41:32.990] [INFO] Checking git for module: MMM-GroveGestures [2024-11-15 06:41:33.052] [INFO] Checking git for module: MagicMirror [2024-11-15 06:41:33.640] [INFO] Finish Album scanning. Properly scanned : 1 [2024-11-15 06:41:33.656] [INFO] Albums: A2Mirror [2024-11-15 06:41:34.352] [INFO] getAlbumList done [2024-11-15 06:41:48.714] [INFO] Total indexed photos: 364 [2024-11-15 06:41:48.742] [INFO] Next scan will be at 2024-11-15T15:36:28.896Z [2024-11-15 06:42:34.639] [ERROR] [GPHOTO] hidden.onerror { event: { isTrusted: true }, source: undefined, lineno: undefined, colno: undefined } [2024-11-15 06:45:16.687] [LOG] Keyboard Interrupted [2024-11-15 06:45:16.689] [LOG] [GESTURE] Gesture script is finished. [2024-11-15 06:45:17.192] [LOG] [GESTURE] Python script is terminated. It will restart soon. [2024-11-15 06:45:17.446] [LOG] Keyboard Interrupted [2024-11-15 06:45:17.453] [LOG] [GESTURE] Gesture script is finished. [2024-11-15 06:45:17.956] [LOG] [GESTURE] Python script is terminated. It will restart soon. [2024-11-15 06:45:18.294] [LOG] [GESTURE] ORIGIN:wake-up finish. [2024-11-15 06:45:18.389] [LOG] [GESTURE] ORIGIN:Paj7620 initialize register finished. [2024-11-15 07:02:37.519] [INFO] Used last pic in list [2024-11-15 07:06:17.588] [LOG] Keyboard Interrupted [2024-11-15 07:06:17.589] [LOG] [GESTURE] Gesture script is finished. [2024-11-15 07:06:18.100] [LOG] [GESTURE] Python script is terminated. It will restart soon. [2024-11-15 07:06:18.423] [LOG] [GESTURE] ORIGIN:wake-up finish. [2024-11-15 07:06:18.543] [LOG] [GESTURE] ORIGIN:Paj7620 initialize register finished. [2024-11-15 07:16:50.970] [LOG] [GESTURE] ORIGIN:Left [2024-11-15 07:16:50.972] [LOG] [GESTURE] Ongoing: LEFT [2024-11-15 07:16:50.976] [LOG] [GESTURE] Timer reset [2024-11-15 07:16:51.983] [LOG] [GESTURE] Finish: LEFT [2024-11-15 07:16:55.188] [LOG] [GESTURE] ORIGIN:Right [2024-11-15 07:16:55.193] [LOG] [GESTURE] Ongoing: RIGHT [2024-11-15 07:16:55.200] [LOG] [GESTURE] Timer reset [2024-11-15 07:16:56.206] [LOG] [GESTURE] Finish: RIGHT [2024-11-15 07:17:00.346] [LOG] [GESTURE] ORIGIN:Down [2024-11-15 07:17:00.351] [LOG] [GESTURE] Ongoing: DOWN [2024-11-15 07:17:00.392] [LOG] [GESTURE] Timer reset [2024-11-15 07:17:01.395] [LOG] [GESTURE] Finish: DOWN [2024-11-15 07:17:03.474] [LOG] [GESTURE] ORIGIN:Up [2024-11-15 07:17:03.475] [LOG] [GESTURE] Ongoing: UP [2024-11-15 07:17:03.477] [LOG] [GESTURE] Timer reset [2024-11-15 07:17:04.483] [LOG] [GESTURE] Finish: UP

eouia commented 2 weeks ago

It seems your sensor is working. Let's check the command thing. Could you show me the config of the module?

alexsquared commented 2 weeks ago

{ module: "MMM-GroveGestures", position: "bottom_left", config: { autoStart: true, //When Mirror starts, recognition will start. verbose:true, // If set astrue`, useful messages will be logged. recognitionTimeout: 1000, //Gesture sequence will be ended after this time from last recognized gesture. cancelGesture: "WAVE", //If set, You can cancel gesture sequence with this gesture. visible: true, //Recognized gesture sequence will be displayed on position

idleTimer: 1000*60*30, // `0` for disable, After this time from last gesture, onIdle will be executed.
onIdle: { // See command section
  moduleExec: {
    module: [],
    exec: (module, gestures) => {
      module.hide(1000, null, {lockstring:"GESTURE"})
    }
  }
},
onDetected: {
  notificationExec: {
    notification: "GESTURE_DETECTED",
  },
  /* You can make Mirror to wake up the modules which were hidden by onIdle with any gestures.
  moduleExec: {
    module: [],
    exec: (module) => {
      module.show(1000, null, {lockstring:"GESTURE"})
    }
  }
  */
},

gestureMapFromTo: { //When your sensor is installed with rotated direction, you can calibrate with this.
  "Up": "UP",
  "Down": "DOWN",
  "Left": "LEFT",
  "Right": "RIGHT",
  "Forward": "FORWARD",
  "Backward": "BACKWARD",
  "Clockwise": "CLOCKWISE",
  "anti-clockwise": "ANTICLOCKWISE",
  "wave": "WAVE"
},

defaultNotification: "GESTURE",
pythonPath: "/usr/bin/python", // your python path

defaultCommandSet: "default",
commandSet: {
  "default":
 //   {
 //   "FORWARD-BACKWARD": {

// notificationExec: { // notification: "ASSISTANT_ACTIVATE", // payload: null // } // }, // "LEFT-RIGHT": { // notificationExec: { // notification: "ASSISTANT_CLEAR", // payload:null, // } // }, { "UP": { moduleExec: { module: [], exec: (module, gestures) => { module.hide(1000, null, {lockstring:"GESTURE"}) } } }, "DOWN": { moduleExec: { module: [], exec: (module, gestures) => { module.show(1000, null, {lockstring:"GESTURE"}) } } }, "LEFT": { moduleExec: { module: ["MMM-WebView"], exec: (module, gestures) => { module.show(1000, null, {lockstring:"GESTURE"}) } } }, "RIGHT": { moduleExec: { module: ["MMM-WebView"], exec: (module, gestures) => { module.hide(1000, null, {lockstring:"GESTURE"}) } }

`

alexsquared commented 2 weeks ago

{ module: "MMM-GroveGestures", position: "bottom_left", config: { autoStart: true, //When Mirror starts, recognition will start. verbose:true, // If set as true, useful messages will be logged. recognitionTimeout: 1000, //Gesture sequence will be ended after this time from last recognized gesture. cancelGesture: "WAVE", //If set, You can cancel gesture sequence with this gesture. visible: true, //Recognized gesture sequence will be displayed on position

idleTimer: 1000*60*30, // `0` for disable, After this time from last gesture, onIdle will be executed.
onIdle: { // See command section
  moduleExec: {
    module: [],
    exec: (module, gestures) => {
      module.hide(1000, null, {lockstring:"GESTURE"})
    }
  }
},
onDetected: {
  notificationExec: {
    notification: "GESTURE_DETECTED",
  },
  /* You can make Mirror to wake up the modules which were hidden by onIdle with any gestures.
  moduleExec: {
    module: [],
    exec: (module) => {
      module.show(1000, null, {lockstring:"GESTURE"})
    }
  }
  */
},

gestureMapFromTo: { //When your sensor is installed with rotated direction, you can calibrate with this.
  "Up": "UP",
  "Down": "DOWN",
  "Left": "LEFT",
  "Right": "RIGHT",
  "Forward": "FORWARD",
  "Backward": "BACKWARD",
  "Clockwise": "CLOCKWISE",
  "anti-clockwise": "ANTICLOCKWISE",
  "wave": "WAVE"
},

defaultNotification: "GESTURE",
pythonPath: "/usr/bin/python", // your python path

defaultCommandSet: "default",
commandSet: {
  "default":
 //   {
 //   "FORWARD-BACKWARD": {

// notificationExec: { // notification: "ASSISTANT_ACTIVATE", // payload: null // } // }, // "LEFT-RIGHT": { // notificationExec: { // notification: "ASSISTANT_CLEAR", // payload:null, // } // }, { "UP": { moduleExec: { module: [], exec: (module, gestures) => { module.hide(1000, null, {lockstring:"GESTURE"}) } } }, "DOWN": { moduleExec: { module: [], exec: (module, gestures) => { module.show(1000, null, {lockstring:"GESTURE"}) } } }, "LEFT": { moduleExec: { module: ["MMM-WebView"], exec: (module, gestures) => { module.show(1000, null, {lockstring:"GESTURE"}) } } }, "RIGHT": { moduleExec: { module: ["MMM-WebView"], exec: (module, gestures) => { module.hide(1000, null, {lockstring:"GESTURE"}) } }

alexsquared commented 1 week ago

Any thoughts?

eouia commented 1 week ago

As I said before; I need the front-end dev-console log, but you showed me the backend-log; the front-end dev-console should be something like this; (The right side panel of the MM screen)

image

There could be some suspicious error or warning message;

And to make things simple;

  • Backup your current config; then make or copy a new one to test.
  • Remove all other modules except clock and MMM-GroveGestures
  • Then, make a simple test configuration to check whether the module works. (e.g. Hide/Show the clock module only)
  • Works?
    • If so, your other module makes something wrong.
    • If not working, Let's start to discuss further