Turn on (I already know the answer is no but that would have been cool
Correct. Some very old cameras can power on when USB power is applied, but even for that, you would need software control of the USB power on your PC.
Zoom the lens to a certain distance
set_zoom(number) or click('zoom_in') a certain number of times.
Set the focus to a certain value
Use the set_focus() function, but be warned this has issues and behaves differently on different cameras. It also behaves differently between CHDK 1.2 (the stable builds) and 1.3 (the development branch) See this thread:
http://chdk.setepontos.com/index.php?topic=11078.0I don't think we have test data for TX1, so it would be very helpful if you can run the test script on that camera.
Adjust the aperture or change the ISO to a certain value
Can be done with normal script functions, found in the scripting cross reference below. However, as noted in the PTP scripting page, these will not take effect if set in separate PTP calls. This may also apply to set_focus depending on the CHDK version and whether the camera is in MF, aflock or auto mode.
Possibly set the white balance (not very important though)
We don't have a way to set arbitrary whitebalance values.
Keep the flash off
If you turn it off using the canon settings, I think it should stay off.
Take a photo and transfer it to the computer
There are several ways to do this. chdkptp has two commands, shoot and remoteshoot.
remoteshoot shoots and transfers over USB without saving to the SD card, but this is currently not supported on all cameras (the ones with YES in the FWT column of
http://chdk.wikia.com/wiki/CameraFeatureTable) If your camera isn't supported, it's possible someone here can add support.
shoot just shoots normally, saving on the card, but you can use the -dl and -rm options to download the file and delete it from the card.
Both these commands let you set the tv, av and ISO. Use help shoot in chdkptp for more info. Setting focus is currently not supported, but it could be set beforehand, at least on some cameras. I will try to add a focus distance option soon, but as mentioned above focus overrides have issues that can be camera dependent.
You can also send script to shoot and then download separately.
Turn the camera off
use the shut_down() function.
There is a list of script functions at
http://chdk.wikia.com/wiki/CHDK_Scripting_Cross_Reference_Pageand some information about scripting with PTP at
http://chdk.wikia.com/wiki/Lua/PTP_ScriptingI imagine that I should write a lua script on the computer and send it to the camera and then execute it. Is that the best way? I can't even figure out how to send a script from the chdkptp software to the camera.
In chdkptp, you send lua code with the lua (.) or luar (=) commands. The difference is the second one waits for the code to finish. These just send code, they don't directly run a file, but your code can run a file that is on the camera, as in the example in the PTP scripting page:
.loadfile('A/CHDK/SCRIPTS/yourscript.lua')()
If you want to change settings, you wouldn't have to upload the script, you could set them as variables before the loadfile, like
.a=1 b=2 loadfile('A/CHDK/SCRIPTS/yourscript.lua')()
and then use and a and b to do things like set your shutter speed and iso or whatever.
If you shoot using this approach, you will need to use separate chdkptp commands later to download the files. You can use the mdownload command to download files matching specific patterns, and rm to delete.
There are other approaches you could take:
Just run a sequence of commands in chdkptp. You can run the commands from a file (using the chdkptp source command) or pipe the output of another program to chdkptp. So you could do something like
chdkptp -c -e"source myfile"
where myfile contains
rec
=set_zoom(3)
shoot -dl -tv=1/200 -iso=100
Since shoot doesn't currently have a focus option, setting focus with this approach may be tricky. The best bet would probably be to set the camera to manual focus or afflock (using 1.3) and call set_focus() before the shoot command.
The whole point of this is to put it in a remote place (without mains power). Currently I am using my computer as the control unit but I will probably try to build it on a beagle bone or something like that.
I provide chdkptp builds for raspberry pi. Building similar platforms should not be terribly hard, if you don't require the GUI.
Also, I saw some notes on power savings by turning off the screen. That is definitely something I would like to do so I will attempt that after figuring all this out.
This is another complicate topic I'll leave for another post...