Like the title says, is this possible? I’d like to put my webcam on a pan/tilt setup so I can move the camera to view the filament left on the spool. I’d assume I’d have to create macros for left/right/up/down. But is it even possible to do this?
one idea
use 2 pwm output form your mainsboard (or rpi gpio) , create macro for predéfinite position , and use servo command
(i one servo for cleaning “buse” with brush , but the macro is just for fixed position set by Gcode command )
searching “servo klipper” in manual of klipper
Not out of the box AFAIK. In any case it would not be (and never become) a Klipper feature but something that needs to be supported by Moonraker and Mainsail et al.
There could be a slight chance since e.g. Mainsail uses Crownsnest, which uses uStreamer, which in turn uses the Linux v4l2 utilities that support the control of USB webcams.
So much for the theory and so much how I can contribute to this topic.
If you have a v4l pan/tilt controllable camera, there are commands you can run to do this. In my case as long as I’m not using maximum resolution of the camera it enables virtual pan tilt and zoom.
check crowsnest.log or run this command in an ssh session to see if you have one.
v4l2-ctl -L
I have mine setup in crowsnest as
mode: mjpg # mjpg/rtsp
port: 8080 # Port
#device: /dev/video0 # See Log for available ...
device: /dev/v4l/by-id/usb-Microsoft_Microsoft®_LifeCam_HD-6000_for_Notebooks-video-index0
resolution: 960x544 #800x600 #640x480 #960x544 #1280x720 # widthxheight format 640x480
max_fps: 30 #7.5 # If Hardware Supports this it will be forced, ohterwise ignored/coerced.
#custom_flags: # You can run the Stream Services with custom flags.
#v4l2ctl: # Add v4l2-ctl parameters to setup your camera, see Log what your cam is capable of.
v4l2ctl: focus_auto=0,focus_absolute=13,power_line_frequency=2
and can issue commands like this
pi@satellite:~$ v4l2-ctl -l
User Controls
brightness 0x00980900 (int) : min=30 max=255 step=1 default=133 value=133
contrast 0x00980901 (int) : min=0 max=10 step=1 default=5 value=5
saturation 0x00980902 (int) : min=0 max=200 step=1 default=83 value=83
white_balance_automatic 0x0098090c (bool) : default=1 value=1
power_line_frequency 0x00980918 (menu) : min=0 max=2 default=2 value=2 (60 Hz)
white_balance_temperature 0x0098091a (int) : min=2800 max=10000 step=1 default=4500 value=4500 flags=inactive
sharpness 0x0098091b (int) : min=0 max=50 step=1 default=20 value=50
backlight_compensation 0x0098091c (int) : min=0 max=10 step=1 default=0 value=0
Camera Controls
auto_exposure 0x009a0901 (menu) : min=0 max=3 default=1 value=3 (Aperture Priority Mode)
exposure_time_absolute 0x009a0902 (int) : min=5 max=20000 step=1 default=156 value=156 flags=inactive
pan_absolute 0x009a0908 (int) : min=-201600 max=201600 step=3600 default=0 value=0
tilt_absolute 0x009a0909 (int) : min=-201600 max=201600 step=3600 default=0 value=0
focus_absolute 0x009a090a (int) : min=0 max=40 step=1 default=0 value=14
focus_automatic_continuous 0x009a090c (bool) : default=0 value=0
zoom_absolute 0x009a090d (int) : min=0 max=10 step=1 default=0 value=0
p
to zoom
v4l2-ctl -c zoom_absolute=10
and pan right
v4l2-ctl -c pan_absolute=-201600
and finally tilt down
v4l2-ctl -c tilt_absolute=201600
You get the idea…