DuetLapse available for Alpha testing
-
@Danal I have been using your tool for a week now and there is one thing which would be nice.
I have to log into the Pi to send the DuetLapse.py -camera pi - detect layer -duet 192.168.0.7
All this Pi does is run the TimeLapse software.When it has finished I have to log back in again and do it all again.
Is there a way that it can run all of the time as a service and maybe send a telnet command from the Duet to say,
I am about to print, get ready!!
i.e. M118 P4 S"Print Starting"Which in turn enables DuetLapse with the users setting.
Just a thought
Regards,
Paul. -
I will think about a way to do this... while minimally banging on the printer between prints.
-
Had a Malloc error, used all default settings.
Capturing frame 522 at X10.00 Y280.00 Z120.00 Now making 523 frames into a video at 10 frames per second. This can take a while... x264 [error]: malloc of size 25549312 failed Video encoding failed Killed Video processing complete. Video file is in home directory, named ~/DuetLapse0413200101.mp4
Was looking forward to this TimeLapse
-
As long as you have NOT started the overall script again, or rebooted, the images are still there and you can try to make the video over and over.
The actual command issued is:
ffmpeg -r 10 -i /tmp/DuetLapse/IMG%08d.jpeg -vcodec libx264 -y -v 8 ~/DuetLapse0413200101.mp4
You could try other ffmpeg options (I am not an expert), try making two videos out of half the images, and stitch the vids together later, etc, etc.
To be clear, the images are in /tmp and are named
IMG00000001.jpeg
IMG00000002.jpegEtc.
-
Awesome program. One issue I've always had is that my wifi and or duet do not like each other and disconnect constantly, but will always reconnect eventually. Is it possible to automatically 'skip' a frame if there is no connection to the printer at that time and not to throw an error?
Also would be nice if it looked at the file name it was printing and made subfolders with the name of the print
-
@mrwulff said in DuetLapse available for Alpha testing:
Awesome program. One issue I've always had is that my wifi and or duet do not like each other and disconnect constantly, but will always reconnect eventually. Is it possible to automatically 'skip' a frame if there is no connection to the printer at that time and not to throw an error?
Yes, I will add some error handling to the key spots.
Also would be nice if it looked at the file name it was printing and made subfolders with the name of the print
Hey, great idea!
-
@Danal does DuetLapse require RRF3 or a certain version or above of DWC?
I'm interested in trying it.by I don't know.what you mean by the step that says to place the DuetLapseAPI.Ph in the python libpath? Is it enough to place all the .py files in one directory?
-
@Baenwort said in DuetLapse available for Alpha testing:
@Danal does DuetLapse require RRF3 or a certain version or above of DWC?
- Supports Duet printers running V2, V3 standalone and V3 +Pi.
- Printer must be reachable via the network.
I'm interested in trying it.by I don't know.what you mean by the step that says to place the DuetLapseAPI.Ph in the python libpath? Is it enough to place all the .py files in one directory?
That step actually says: Copy included module https://github.com/DanalEstes/DuetWebAPI/blob/master/DuetWebAPI.py to the same directory, or to anywhere in python's libpath.
Thanks for the questions, I will do a bit of readme editing to make all above more clear.
-
If it helps with putting caption overlays on your output movie files I have been playing with ffmpeg in the last few days. The command I am using is
ffmpeg -r 10 -i ./IMG%06d.jpg -vcodec libx264 -crf 15 -s 800x600 -pix_fmt yuv420p -y -v warning -vf drawtext="fontfile=/usr/share/fonts/truetype/ttf-dejavu/DejaVuSerif.ttf: text='Text to put on screen':fontsize=40:fontcolor=yellow:box=1:boxborderw=5:boxcolor=black@0.5:x=10:y=10" movie.mp4
This will give you a caption in the top-left with a semi-transparent black box around
HTH
Dave -
What people are requesting changes as the frames flow. Things like Z height, etc. I believe those overlays need to be part of the stills.
-
@Danal said in DuetLapse available for Alpha testing:
What people are requesting changes as the frames flow. Things like Z height, etc. I believe those overlays need to be part of the stills.
That's true, if they need to reflect things changing as the print progresses.
I'm writing a similar program to yours. I use motioneye to generate my original images from a picam which is then displayed in the DWC Webcam view (or via a browser window).
Motioneye uses motion which has a http api available.e.g. To take snapshots
http://localhost:7999/1/action/snapshot
will cause motion to take a snapshot from Camera 1 and place it in
/var/lib/motioneye/Camera1
I'm picking them up from there, creating a movie when the print is complete (ffmpeg) and uploading it to my NAS server.
I had thought of doing something like this for a while but you have inspired me to get it done. I admit I have "borrowed" a few ideas from your program.
Also I'm using Java as it's what I'm more comfortable with. I like Netbeans as an IDE as it's perfect for Java development. -
@tekkydave said in DuetLapse available for Alpha testing:
I admit I have "borrowed" a few ideas from your program
The great architectural principle of "reuse". Cool!
-
Thanks very much for this. I got the program working, but the pause doesn't seem to work properly for me. I get multiple pauses on a single layer. My bed. g moves the head out of the way, so I don't have a movehead command. Using duet2 WiFi, delta, rrf3. 01rc9
-
@Adrian52 said in DuetLapse available for Alpha testing:
Thanks very much for this. I got the program working, but the pause doesn't seem to work properly for me. I get multiple pauses on a single layer. My bed. g moves the head out of the way, so I don't have a movehead command. Using duet2 WiFi, delta, rrf3. 01rc9
Can you post your command line that you are using to invoke?
-
@Danal I used . /DuetLapse -duet 192.168.1.16 -camera pi -pause yes If I leave out the pause it works fine. Not sure why I said bed.g of course I meant pause.g, which contains a z as well as x and y moves.
-
Thanks, I will take a look.
-
@Danal Love what you have done with DuetLapse, thanks for contributing it to the community. Overall works really well except for a couple of issues, some of which I know are on your radar such as error handling if you can't get a status update from the 3d printer (or if you are using a webcam error detecting) (as a side note, I have all hardlines between the printer and raspi 4 and computer running the camera and still randomly get errors).
The first issue I noticed was that the layer detection works by looking for z height changes. This is an issue for me as I do a vertical lift on retraction with the printhead. It should also resolve the issues people had with taking pictures during mesh bed scanning.
I added a function in the DuetWebAPI:
def getLayer(self): URL=(f'{self._base_url}'+'/rr_status?type=3') r = self.requests.get(URL) j = self.json.loads(r.text) s = j['currentLayer'] return (s)
The type3 return adds the current layer height information.
Then in the DuetLapse.py# zn=printer.getCoords()['Z'] #replace with following line zn=printer.getLayer()
along with updating the terminal printing in the oneInterval() function to
print('Capturing frame {0:5d} at X{1:4.2f} Y{2:4.2f} Z{3:4.2f} Layer {4:d}'.format(int(np.around(frame)),printer.getCoords()['X'],printer.getCoords()['Y'],printer.getCoords()['Z'],zn))
I figured out you might want to include it in your code. I can setup a pull request if you want.
Keep up the great work!P.S. I am running RRF3.0, I don't know if the layer output is included in RRF2.
Also for everyone else looking to contribute or modify:
I assume Danal know where the documentation for the status returns are, but for others like me who didn't know where the documentation on the firmware status returns are located, https://reprap.org/wiki/RepRap_Firmware_Status_responses -
Absolutely FANTASTIC, really, really appreciate the thoughts and code.
If you wish "attribution", code it up as a pull. Otherwise, I'll just integrate it, and save you some work.
-
@Danal I don't feel I need attribution, feel free to integrate it yourself. I realized after I posted the message I don't have a good way to push selected lines of code from my raspi at this moment (a bit rusty on my cmd line git commands) and I have other minor changes (such as directory storage) included in the changes of my copy.
-
Sure! Let me know of any other ideas.