DuetLapse available for Alpha testing
-
As mentioned in the GitHub ticket - I wanted to see if you could ping the printer from the Pi, just to rule out low-level IP connectivity issues.
I just installed the DuetLapse about a month ago, so it is pretty fresh in my brain.
John
-
@JohnOCFII said in DuetLapse available for Alpha testing:
As mentioned in the GitHub ticket - I wanted to see if you could ping the printer from the Pi, just to rule out low-level IP connectivity issues.
I just installed the DuetLapse about a month ago, so it is pretty fresh in my brain.
John
Reading the very first messages of this thread I've seen a message of a user who suffered the exactly problem I've experienced... Both of us has setted the password and this seems to be the problem. Tomorrow I'll try to take off the password from config.g and see if it works.... I'll let you know
-
@JohnOCFII said in DuetLapse available for Alpha testing:
As mentioned in the GitHub ticket - I wanted to see if you could ping the printer from the Pi, just to rule out low-level IP connectivity issues.
I just installed the DuetLapse about a month ago, so it is pretty fresh in my brain.
John
Good morning, I've taken off the password and now the scripts comunicate with the printer but it doesn't work for this error:
-
What the of camera do you have? Looks like a Raspberry Pi camera? I'll need to look at that tomorrow. I have a USB-type camera.
-
@JohnOCFII said in DuetLapse available for Alpha testing:
What the of camera do you have? Looks like a Raspberry Pi camera? I'll need to look at that tomorrow. I have a USB-type camera.
Yes. i have a PI camera
-
@the_dragonlord What happens if you try to execute the
raspistill -o cam.jpg
command? Do you get an image?(I'm just guessing at a first troubleshooting step from here: https://www.raspberrypi.org/documentation/usage/camera/raspicam/raspistill.md )
This stack exchange issue mentions some other possibilities -- some were fixed by updating the firmware on the Pi with
sudo apt-get update and sudo apt-get upgrade
-
EDIT: These changes can be downloaded from here:
https://github.com/stuartofmt/DuetLapseFirst of all - thanks for this very useful program!!
I am using a Duet Wifi2 and have a Pi 3 near it that I use to provide a video stream from here:
http://picamera.readthedocs.io/en/latest/recipes2.html#web-streaming
I also run the Dueui app for local control. I am now adding DuetLapse.
One thing I noticed with the standard pi camera is that only one process can be connected to it at a time (otherwise you will get ENOSPC errors) - so the standard DuetLapse approach gave errors.
I added this code (and the appropriate checks for the new camera type etc.)
if ('ffmpeg' in camera): if (camparms == ''): cmd = 'ffmpeg -y -i ' +weburl+ ' -vframes 1 ' +fn else: cmd = 'ffmpeg '+camparms+' '+weburl+ ' -vframes 1 ' +fn
I use it like this (where the weburl is the pi camera stream. That way there is only one process connected to the camera but the output is serving two uses.
/usr/bin/python3 ./DuetLapse.py -duet <duet ip> -camera ffmpeg -weburl http://<camera ip:port>/stream.mjpg -detect layer &
Hope this helps others.
P.S. I also added this to the top of DuetLapse.py to prevent multiple instances from running due to my own fat fingering
# Added to stop multiple instances running import psutil procs = [p for p in psutil.process_iter() if 'python3' in p.name() and __file__ in p.cmdline()] if len(procs) > 1: print('Process is already running...') sys.exit(1)
-
See my post above
If you have two applications both trying to connect to the same Pi camera you will get these ENOSPC errors. This does not mean this is your exact problem - but is a good place to start. -
EDIT: These changes can be downloaded from here:
https://github.com/stuartofmt/DuetLapse@Danal
Another small suggested mod.I start DuetLapse.py remotely using a bash script and run it in background. Ctl+C cannot stop it if needed.
I added the following (just above the main routine) so that I could send a SIGINT to stop the process.
#Allows process running in background or foreground to be gracefully # Shutdown will SIGINt (Kill -2 <pid> import signal def quit_gracefully(*args): print('Stopped by SIGINT - Post Processing') postProcess() exit(0); if __name__ == "__main__": signal.signal(signal.SIGINT, quit_gracefully)
The bash script to control this is inelegant at this time but here it is to illustrate the use:
#! /bin/bash PROCESS=/home/pi/Lapse/DuetLapse.py case "$1" in start) /usr/bin/python3 $PROCESS -duet 192.168.86.235 -camera ffmpeg -weburl http://192.168.86.230:8081/stream.mjpg -detect layer & ;; stop) PROCESS_PID=`/bin/ps -ef | grep "$PROCESS" | grep -v "grep" | awk '{print $2}'` kill -2 $PROCESS_PID echo stopped ;; esac
-
@stuartofmt said in DuetLapse available for Alpha testing:
@Danal
Another small suggested mod.Sorry to tell you this, but Danal passed away several months ago now.
-
@Phaedrux
Very, very sorry to hear that. Thanks for letting me know.Do you know if anyone is taking over this work? I can do a little but I'm far from a professional programmer. More a programming by (google) example type.
I'll post my modifications in full, here, later today. I have some more slight mods coming but likely not for a couple of weeks
-
@stuartofmt starting a fork of the project on Github might be the best way forward. Then you can tinker away and it's available for others to use as well. I know Danal would have approved.
-
I have created a fork of my changes so far and will update as I make additional tweaks.
These changes can be downloaded from here:
https://github.com/stuartofmt/DuetLapse -
@stuartofmt said in DuetLapse available for Alpha testing:
See my post above
If you have two applications both trying to connect to the same Pi camera you will get these ENOSPC errors. This does not mean this is your exact problem - but is a good place to start.Thanks.
I have a solution in place that is working for me. I have ustreamer controlling the camera, and I have DuetLapse grabbing the images from ustreamer. I have both started by systemctl on my CentOS system. I have a script running that'll start capturing with DuetLapse by layer whenever a print starts.
The only modification I'd like to do is an ffmpeg input to add 2 seconds of the last jpeg image to the timelapse. I know it is possible - just need to figure it out.
John
-
Good to hear. When you say add 2 seconds - do you mean continue recording for 2 second after Duet reports that it is no longer printing ?
-
Maybe a small change like this at the end ?
elif (printerState == 2): onePhoto() time.sleep(2) onePhoto() postProcess()
-
Seeing I'm on a (UNTESTED) role. This may be better than the crude suggestion above. Note that it requires ffmpeg from Nov 2018 or newer.
I'll try it later today as I have a print to get done.
def postProcess(): print() print("Now making {0:d} frames into a video at 10 frames per second.".format(int(np.around(frame)))) if (250 < frame): print("This can take a while...") # fn = basedir+'DuetLapse'+time.strftime('%m%d%y%H%M',time.localtime())+'.mp4' fn = basedir+'DuetLapse'+time.strftime('%a-%H:%M',time.localtime())+'.mp4' if (vidparms == ''): cmd = 'ffmpeg -r 10 -i /tmp/DuetLapse/IMG%08d.jpeg -vcodec libx264 -y -v 8 tpad=stop_mode=clone:stop_duration=2 '+fn # cmd = 'ffmpeg -r 10 -i /tmp/DuetLapse/IMG%08d.jpeg -vcodec libx264 -y -v 8 '+fn else: cmd = 'ffmpeg '+vidparms+' -i /tmp/DuetLapse/IMG%08d.jpeg tpad=stop_mode=clone:stop_duration=2 '+fn # cmd = 'ffmpeg '+vidparms+' -i /tmp/DuetLapse/IMG%08d.jpeg '+fn subprocess.call(cmd, shell=True) print('Video processing complete.') print('Video file is in '+basedir+' directory, named '+fn) exit()
-
@stuartofmt Yes -- something like that. Basically hold the last image for 2 seconds.
Here's how OctoPrint refers to it:
-
Seems like the tpad filter is missing from my version (4.1.6) of ffmpeg Debian Buster on Pi.
Also the syntax above may (or not) work ....
I may have to compile ffmpeg from the latest source - will let you know.
-
@stuartofmt said in DuetLapse available for Alpha testing:
Seems like the tpad filter is missing from my version (4.1.6) of ffmpeg Debian Buster on Pi.
I seem to have the same version of ffmpeg:
ffmpeg version 4.1.6-1~deb10u1+rpt1 Copyright (c) 2000-2020 the FFmpeg developers
I should troll through the OctoPrint/OctoPi code to see what they do.