RATOS + Timelapse + DSLR control
Has anyone used a DSLR with RATOS? Do I need to install Gphoto2 on the Rasp Pi to control the camera through USB?
52 Replies
No idea, but any guide you can find for raspberry pi os / mainsail will work in RatOS too
fair-roseOP•2y ago
No worries - I'll try Gphoto2 and update this query
I'd like to create a shell command config file (for Gphoto2 commands) within Mainsail/RatOS - if I do this will it cause any issues? I presume this is simply a collection of alternative commands and is totally independent of RatOS?
Nope! Go nuts 🙂 You can use the gcode_shell_command extension for whatever you want 🙂
Just know that you can't do sudo commands.
You can do sudo commands in a bash script if you whitelist the commands it runs (in /etc/sudoers.d/).
fair-roseOP•2y ago
Thanks! Really appreciate your input on all this.
Also - I'd like to add to the macros.cfg file - I guess there is no issue adding macros to this?
Everything you do, do it in printer.cfg (or your own includes).
Don't change anything in config/ but besides that go nuts
fair-roseOP•2y ago
ok - I can add macros in printer.cfg? If so - that's great!
Yes, or you can create a new file and put it in there and include it, whatever you want 🙂
fair-roseOP•2y ago
I need to install a shell command extension for Klipper - using KIAUH (https://github.com/th33xitus/kiauh). If I use KIAUH - will this over-write all Klipper settings and cause issues?
No you don't it's already there.
If I use KIAUH - will this over-write all Klipper settings and cause issues?No but it can royally screw things over, don't use KIAUH on a RatOS install. You should have no need for it any way.
fair-roseOP•2y ago
That's what I thought - thanks for your help!
Have you been able to get it running @Decorum ?
In the meantime i've done a few timelapses using a elgato camlink 4k, makes it a plug 'n play thing (it's just a "webcam" like anything else, except the quality is :chefkiss: ). No setup required.
Of course the camlink isn't free but it's very nice for many things DSLR/MILC related 🙂
That seems very cool, isn't the RPI too slow to stream 4k from the DSLR? I don't think my A7R3 does 4k live output through usb though.
I just got a script to work so that I have a "gphoto take frame" macro button on my mainsail and when I click it it runs the script timelapse.sh in my root folder and puts the image in /home/pi/timelapse
Now I'm wondering if there is a way for my mainsail dashboard to show the latest image that was added to that folder
This is the script, it wasn't working if there wasn't a sudo in front of the gphoto2 command. I thought it wasn't possible to sudo using gcode shell, but maybe it works for me because I call a script instead of a command
https://youtu.be/uNf3xjuUTbo
I tried to get live view working with this but it's a bit out of my technical league. I was able to get the output working showing me the fps in putty, but I'm clueless on how to connect it into webcam from mainsail
Blackberry Boy
YouTube
Canon 200D Webcam using gphoto2
Become my channel member: https://www.sparxsys.com/join
I am now able to use my Canon 200D nicely as a webcam using gphoto2. It works quite well.
#gphoto2 #Canon200D
####
Become Jira master: https://www.youtube.com/ravisagar1/join
Need my help? Raise a ticket for me: https://www.ravisagar.in/support
Atlassian Consultancy Services: https://www...
That seems very cool, isn't the RPI too slow to stream 4k from the DSLR?No not at all, in fact the pi3 and 4 have hardware encoding and decoding.
I don't think my A7R3 does 4k live output through usb though.The camlink is an external capture card, HDMI to the camera, USB to the pi.
Now I'm wondering if there is a way for my mainsail dashboard to show the latest image that was added to that folderThere isn't. You can add the timelapse path to moonraker, but it would be easier if you put it in /home/pi/printer_data/config/timelapse, then you can browse them through the file manager in the "machine" tab. Still wouldn't work, would need a password input, and since it's not a tty it'll just not do anything. Are you sure it works? the only way this would work (if gphoto2 indeed needs to run as root) is if you whitelist the gphoto2 binary in sudoers.d
Indeed, I did this step following one of the tutorials
Ah!
That makes more sense 😄
I have this in my printer.cfg user override section now;
[gcode_shell_command gphoto_trigger]
command: ~/./timelapse.sh
timeout: 2.
verbose: False
[gcode_macro GPHOTO_TAKE_FRAME]
gcode:
RUN_SHELL_COMMAND CMD=gphoto_trigger
[include my_timelapse.cfg]
I modified this gcode macro in my modified timelapse.cfg file called my_timelapse.cfg
[gcode_macro _TIMELAPSE_NEW_FRAME]
description: action call for timelapse shoot. must be a seperate macro
gcode:
{action_call_remote_method("timelapse_newframe",
macropark=printer['gcode_macro TIMELAPSE_TAKE_FRAME'].park,
hyperlapse=params.HYPERLAPSE)}
RUN_SHELL_COMMAND CMD=gphoto_trigger
in moonraker.conf I just added [timelapse]
This seems to work so far although I'm running into some issues that I'll try to document tomorrow. I'm not sure how the timelapse plugin knows how to parse the images in the /user/pi/timelapse/ folder and convert it into a video.In orca I have the gcode command here but I'm not sure it's needed it seems to be in the _TIMELAPSE_NEW_FRAME as well
Damn, this is badass dude, nice work!
Are you shooting through an enclosure? I've always had issues with glare when trying to use an external camera unless it is right up against the panel
Thanks! Yes this is shot through my enclosure panel, I'm using a 50mm fixed lens pretty close to the case and this is zoomed in even more on the video itself
This is one of the original images
you can see some of the reflections in the bottom of the shot
Nice, may try to do something similar this weekend 🙂 smart to just crop out the reflections around the focused area
by the end the script seems to become slower and sometimes the printhead is on its way back already when the shutter goes off
Moonraker-timelapse has the ability to toggle between taking pics with the toolhead parked, or just while it is printing. It is probably just in their gcode macros, so you may be able to take some parts of it https://github.com/mainsail-crew/moonraker-timelapse
GitHub
GitHub - mainsail-crew/moonraker-timelapse: Timelapse Plugin for mo...
Timelapse Plugin for moonraker. Contribute to mainsail-crew/moonraker-timelapse development by creating an account on GitHub.
But slowness could be a few things if that is the main issue, are you noticing photos are larger towards the end of the print? or are you keeping stuff in memory that you could write to disk or release?
the pictures are the same size, the memory on the pi doesn't seem to run up either, it might only be when the layer time is very short I haven't seen it on longer duration layers
I've got a 9 hour print on the way recording the timelapse in 8k resolution 🤓
USB power from the pi to the camera doesn't seem to be adequate to keep the battery level. I hope it makes it through the 9 hours 🥲
Guess we have a good use case for the oozeguards and IDEX park macros outside of IDEX @Helge Keck 😄
I would definitely run a separate supply to the camera, the poor PI has enough to deal with 🙂
lol yeah, i made this already 2 or 3 years ago with my 500
i coul deven move my toolheads during the timelapses
with key animations
and a camera slider
i still have a super pimped gcode timelapse solution here
damn, dont have the cool videos anymore
found one
yeah this was cool 😄
Damn almost was able to finish one full timelapse, towards the end the whole printer shut down with MCU overload error. I also got a lot of undervoltage warnings in the past I'm feeding my PI from the mainboard maybe I need to feed it with a better power supply?
That's insane, would love to do it with a moving dolly as well, do you know of affordable options? How did you sync it with your printer?
with some random stepper drivers and a 3d printer and some gcode macros you can do whatever you want
That's genious 😄
This got me thinking, it would look very cool to have it do an outer perimeter loop every 24 frames/second
did you ajust the timelapse.cfg file to park it dynamically?
no, this macro is not good enough for that
i made a own implementation
Nice! I think it looks better compared to parking the printhead out of the shot. It might reduce stringing as well, I'm still having some issues there and I'm already on 20mm retraction 🥲
well, after you make the photo you can tell the toolhead to clean the nozzle on a wiper or whatever
there are a lot of options
here is the timelapse repo
https://github.com/HelgeKeck/uberlapse
and here the slider repo, both work together if wanted
https://github.com/HelgeKeck/vcore-slider
it has a webserver on the PI, atn it works with the raspi HQ cam, but can easily be changed to whatever wou need
Let's see if I have some stepper ports left 😂
Seems like I do!