The capture command runs inside a loop with 0.25 second sleep between each iteration (prevents failures)
$captureCommand = $exec." -c -e\"shoot -tv=1/1000 -sv=50 -av=2 -dl\" ";
Do you think all -tv -av -sv etc. increases time consumption?
No. These take a minimal amount of time. If you put your camera in manual mode, it may spend less time doing AE. When you use CHDK override in an automatic mode, the camera still does all the normal auto exposure process, and then CHDK replaces the values with the override values later.
Some other notes on shooting speed can be found in
http://chdk.setepontos.com/index.php?topic=6231.msg98677#msg98677How can I get rid of it and set it only once in the $init command?
As above, this isn't needed, the time to set and apply the override values is miniscule. But for completeness: Normally, script exposure settings only apply while the script is running. PTP commands work by sending script to the camera to execute, so if you set the exposure with on call and then shoot later, the setting would be lost. So to set them once, you would need to set them using either the camera UI, or using CHDK exposure overrides in the menu or with set_config_value, or in manual mode using the USER_TV / USER_AV propcases.
A few things you could do to increase the shooting rate:
1) use remoteshoot instead of shoot. This takes most of the same options but downloads directly over USB instead of saving on the card and then downloading. Note this means the images will NOT be saved on the card.
2) Instead of launching, connecting, shooting and disconnecting every shot, just start chdkptp once and pipe the shoot or remoteshoot commands to it. This saves you the connection overhead, and also probably avoids the problem mentioned in:
The capture command runs inside a loop with 0.25 second sleep between each iteration (prevents failures)
3) If you only need fixed exposure and focus, you can try the experimental chdkptp module mentioned here:
http://chdk.setepontos.com/index.php?topic=6231.msg109228#msg109228 to do remoteshoot in continuous mode. This should be substantially faster. This requires using the "start once and pipe" approach mentioned in #2
edit:
Note the set_focus value is in mm, so unless you are flying really low set_focus(150) probably isn't what you want. If you are flying 15 cm off the deck, carry on
