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

motion guard might could use a cork/inhibit during ptz operations #324

Open
goatzillax opened this issue Nov 19, 2024 · 6 comments
Open

Comments

@goatzillax
Copy link
Contributor

Maybe PTZ can drop a cork or inhibit file in /tmp that the motion script will check for before firing, and then delete the cork when PTZ is finished?

@themactep
Copy link
Owner

good idea. @gtxaspec, if you add a pid file (say /run/motors.pid) to motors app then i'll make motion script to check for that file and bail out if it is set.

@gtxaspec
Copy link
Collaborator

gtxaspec commented Nov 20, 2024

use
motors -b
-b prints 1 if motor is (b)usy moving or 0 if is not

@themactep
Copy link
Owner

won't that run another copy of motors with all the overhead?

@gtxaspec
Copy link
Collaborator

it will, but it works effectively while keeping things lightweight. the app is tiny and exits once it completes, which eliminates us from adding more bloat in the daemon. overhead is minimal and won't be noticed.

@goatzillax
Copy link
Contributor Author

goatzillax commented Nov 20, 2024

Edit: nm I might be overthinking things.

@goatzillax
Copy link
Contributor Author

goatzillax commented Nov 21, 2024

Hrm, I was playing around with wrapping motors with a script that drops a cork for motion look for.

Should motors block until the movement is completed, or would that not be in keeping with design?

Otherwise I pretty much do this and it works:

#!/bin/sh

CORK_DIR=/run/motors
CORK=$CORK_DIR/$PPID.$(cat /proc/$PPID/comm)
touch $CORK                                 
           
motors.bin "$@"
sleep 1        
               
rm $CORK

and I add this to /sbin/motion at the top:

[ "$(ls -A /run/motors)" ] && quit_clean 0

Also thinking this might need to apply to other settings like daynight...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants