CHDK Forum

Using CHDK => Script Writing => Completed and Working Scripts => Topic started by: waterwingz on 20 / October / 2013, 12:02:09

Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / October / 2013, 12:02:09
I've created a wiki page for a script designed to provide precision exposure control tailored specifically for KAP and UAV applications.   

link > KAP & UAV Exposure Control Script (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script)

The script attempts to use a user defined "fast" shutter speed by managing ISO settings and the adjustable iris / ND filter (if available).  Shutter speed is only lowered when all other options have been exhausted.

This is based on ideas discussed here : http://chdk.setepontos.com/index.php?topic=10754.0 (http://chdk.setepontos.com/index.php?topic=10754.0)  and http://chdk.setepontos.com/index.php?topic=10762 (http://chdk.setepontos.com/index.php?topic=10762)

Credit for the ideas, exposure calculation code, and much patient testing goes to peabody (http://chdk.setepontos.com/index.php?action=profile;u=7384) ( a.k.a. wayback on the KAP forums).

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lapser on 20 / October / 2013, 13:09:55
Very nice script!

I was wondering how you got the camera to peel potatoes, until I looked up "KAP" and discovered it means "Kite Aerial Photography." I'd love to see some of the results.

My only suggestion would be to try reyalp's method of turning the display off with event_proc instead of set_backlight. I've been using it, and it really does turn the power off to the display, with resulting increase in battery life (15% versus 10% in my test). You can tell the power was off because it takes awhile for the light to turn back on, compared to set_backlight(1). It also doesn't turn back on with every picture, as long as the picture review is off.

This is the function I use. You can just replace "set_backlight" in the script with "backlight".
Code: [Select]
blight=1 -- backlight on / current state
bldisp=true -- turn off display with eventproc if true
if call_event_proc('DispDev_EnableEventProc') == -1 then
  if call_event_proc('DispDev.Create') == -1 then
    bldisp=false -- must turn off display with set_backlight
  end
end -- end of initialization code
function backlight(bl) -- bl=0 off, 1 on, -1 toggle
  if(bl<0)then bl=bitxor(blight,1)  -- toggles 0 or 1
  elseif (bl>1)then bl=1 end
  if(bl==blight)then return end -- don't double set to current state
  blight=bl
  if(bldisp)then
    if(bl==0)then call_event_proc('DispCon_TurnOffDisplay')
    else call_event_proc('DispCon_TurnOnDisplay') end
  else set_backlight(bl) end
end
I discovered something interesting about set_backlight while adding this function to my custom C code in CHDK. If you try to turn off the backlight by calling TurnOffBacklght() twice or more, without a "sleep" in between, the backlight doesn't go off. I assume this applies to set_backlight(0) if there is no sleep (lua yield) between calls, although I haven't tested it.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / October / 2013, 13:36:07
My only suggestion would be to try reyalp's method of turning the display off with event_proc instead of set_backlight. I've been using it, and it really does turn the power off to the display, with resulting increase in battery life (15% versus 10% in my test).
Thanks.  Seems like a good idea but for a 5% power saving gain I think I'll pass for now.  There are enough things to go wrong with a new & complex script like this!  Adding a relatively untested method to toggle the backlight seems like one risk too many. 

In any case, I think that if I was really worried about power,  I'd also add the power saving modes from my Ultimate Intervalometer (http://chdk.wikia.com/wiki/Ultimate_Intervalometer#Display_blanking_mode) script.   

edit :  Might be interesting to also test and add here : Battery Intervalometer (http://chdk.setepontos.com/index.php?topic=9049)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Microfunguy on 20 / October / 2013, 14:25:32
Just for interest, some SDM 1.86 Beta testers have used the following two uBasic commands for KAP,UAV and balloon flights to achieve the same result :-

set_max_iso_to o
shoot_fast_at 1/4000,z

'z' is a return variable that reports ISO used or shutter speed achieved, as appropriate.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: peabody on 20 / October / 2013, 14:58:50
Thanks for all your work on this, waterwingz.  I think the script will be of great benefit to kite flyers the world over.  Now, where did I leave my 7-foot Rokkaku?

I believe there is a problem with turning off the display instead of turning off the backlight.  But I'm having trouble bringing up what that problem is - or at least *was* in earlier versions of CHDK.  There's something that's disabled when you turn off the display.  Actually, I believe it's manual focus. In normal mode, if you turn on manual focus, then hit the display button and turn it off, when you turn it on again you will be back in autofocus.  That's the camera doing that, not CHDK, but you would have to get around that somehow if you wanted to use manual focus and still turn off the display.

 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / October / 2013, 16:30:11
I believe there is a problem with turning off the display instead of turning off the backlight. 
I seem to recall that too.  And while the battery savings is interesting,  I'm not sure its really necessary on for a kite or UAV shooting sequence.   With just the backlight off, my experience shows 3 to 4 hours of shooting time.  Seems like a long time to hold onto a kite string?

Meanwhile,  having full control of not only the shutter speed and ISO values but aperture and ND filter settings as well - with the ability to easily adjust the ranges they work over - should give people plenty of things to experiment with and optimize their personal shooting experience.



Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lapser on 21 / October / 2013, 02:09:09
I believe there is a problem with turning off the display instead of turning off the backlight.
When you turn off the display with the camera display button, it cancels manual focus and returns to auto-focus on some cameras, including the G1X. Using the event_proc method of turning off the display doesn't affect the manual focus.

Someone on YouTube said he returned his G1X because of this problem, even though he loved the camera. When I told them we had solved the problem, he said he might buy the camera again.

Another major advantage of turning off the display instead of the backlight is that it doesn't turn back on again after every picture (with picture review off). I tried to fix set_backlight() by repeatedly turning the backlight off every 10 msec, but the screen still flashed after every picture. This was unacceptable, especially at night.

As for being "untested", I've been using this method of turning off the display instead of backlight for a few months on my 4 cameras during time lapses. It's always worked without any problems at all. A typical time lapse for me is 5,000 pictures, so I think it's been tested pretty well.

I've included a display on/off feature in my new "switch_state" Lua function. I'll be posting the patch and custom builds (no compiling required) in the other thread next, so you're welcome to try it out there.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Microfunguy on 21 / October / 2013, 07:27:49
having full control of not only the shutter speed and ISO values but aperture and ND filter settings as well - with the ability to easily adjust the ranges they work over - should give people plenty of things to experiment with and optimize their personal shooting experience.

Whilst that is true, I believe it is not necessary.
Consider the following settings from a user in Las Vegas in very bright conditions :-

Bv96 = 900
Sv96 = 465 (100 ISO real)
Tv96 = 1148 (1/4000 sec)
Av96 = 363 (f3.7 real)

Most shooting conditions will be in dimmer light where shutter speed need to be reduced and/or ISO increased.

The aperture will obviously not be made smaller (in physical size).

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / October / 2013, 08:45:47
Whilst that is true, I believe it is not necessary.
You may very well believe its acceptable to force the camera's lens wide open and the ND filter out. 
 ( source link ) (http://arch.ced.berkeley.edu/kap/discuss/index.php?p=/discussion/4734/first-flight-chdk-settings#Item_10).  The script offers choices to those who may have their own beliefs - especially the owners of G & S series cameras.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Microfunguy on 21 / October / 2013, 08:59:21
'believe' was a careless use of words, my conclusions are not based on belief but on practical experience and the hard data presented above.

By all means ignore the technical conclusions drawn from the data if you feel more comfortable with that.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: peabody on 21 / October / 2013, 11:15:58
I posted the following in the KAP Forum, where David dismissed the new script on the same basis as here:

-----------

In my experience with my A590is, mid-range apertures seem to be a bit sharper than either wide open or completely stopped down.  So I would prefer to shoot at something like f/3.5 or f/4.0 since that produces better pictures for me.  But that's a preference, and for KAP in particular I would be willing to go wide open if it means I don't have to slow down the shutter speed, which is the most important determinant of getting sharp pictures.  The script manages those decisions automatically based on the user's parameter settings and the algorithms described in detail in the wiki linked to above.

The new script has the advantage of letting me set value preferences and ranges for all exposure components - shutter speed, ISO, and aperture or ND filter.  Someone who believes the aperture setting has no effect on sharpness can set his aperture preference to wide open and shoot on that basis, and he may still benefit from other features found in the script.  Or if he doesn't want to use the script, he can lock his aperture to wide open and just use the Custom Auto ISO function found in the CHDK menu, which works much as the script does, but without any aperture control.

So the script offers the user a good bit of flexibility to set the exposure preferences the way *he* wants to, without locking them in stone, and it provides within the script a few settings that normally require manual camera settings, such as going into manual focus, then setting focus to infinity, or zooming to a particular point.  In fact, if you use auto-run, everything would be automatic  - you would only have to hit the power button to turn on the camera.

By the way, I should mention that for my A590is, and presumably the A570is, the Focus setting "MF2" in the parameters is the one that works to go to manual focus at infinity.  Or if you want to use autofocus, just set that preference to "Off".

-------------
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 22 / October / 2013, 13:07:44
I moved the discussion of display control to http://chdk.setepontos.com/index.php?topic=10551.msg106496#msg106496 (http://chdk.setepontos.com/index.php?topic=10551.msg106496#msg106496)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: gtoonstra on 30 / October / 2013, 06:38:56
I tested the script on my camera. I use a Canon IXUS 230 HS (ELPH310HS) version 1.00e. I noticed that when first installed, the script starts and works fine. When the camera is restarted, it fails with "could not load propcase.lua". I researched this a bit and it seems it's related to memory issues and pools. So I removed some of the functions that I didn't require for my camera like the iris control and some of the focusing methods. This got rid of the memory issues.

The next strange issue is that when the camera shuts down with the script running, on restart it crashes. When I press the shutter to stop script execution on reboot, the cam starts ok and then the script can be restarted.

Some of the uav control boards use 5V usb power to do the photo triggering. For cams without gps, this is great, because the position of the trigger is stored on the controllers storage. So in the end I removed the intervalometer too and replaced that with usb trigger, where a much longer pulse shuts down the camera.

It would be an interesting idea to extend the script to choose what happens with the usb trigger, but obviously I'm having troubles fitting the script in memory already. Is there any setting I can make to influence the use of memory?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 30 / October / 2013, 09:45:06
I tested the script on my camera. I use a Canon IXUS 230 HS (ELPH310HS) version 1.00e. I noticed that when first installed, the script starts and works fine. When the camera is restarted, it fails with "could not load propcase.lua". I researched this a bit and it seems it's related to memory issues and pools.
So if you start the camera "cold", have you loaded and run the script for an extended period of time (10 minutes) taking pictures?  Is it only when you stop the script and rerun it that you have this problem?

If so,  that's interesting as it says Lua is either not freeing all the memory it allocated or it's leaving it fragmented.  The script does explicit calls to collectgarbage() after each shot but clearly that's not enough.

I've noticed something similiar if a script crashes during testing - you need to power cycle the camera to get all your memory back.

Quote
So I removed some of the functions that I didn't require for my camera like the iris control and some of the focusing methods. This got rid of the memory issues.
Painful but whatever works.  On my "low memory" A1200 I never had to do that.

Quote
The next strange issue is that when the camera shuts down with the script running, on restart it crashes. When I press the shutter to stop script execution on reboot, the cam starts ok and then the script can be restarted.
Strange.  Just a guess here - do you have logging to the SD card enabled?  And by "shut down" do you mean you press the power button while the script is running?

Quote
Some of the uav control boards use 5V usb power to do the photo triggering. For cams without gps, this is great, because the position of the trigger is stored on the controllers storage. So in the end I removed the intervalometer too and replaced that with usb trigger, where a much longer pulse shuts down the camera.
I'm now glad I added the USB functionality too   :)

Quote
It would be an interesting idea to extend the script to choose what happens with the usb trigger, but obviously I'm having troubles fitting the script in memory already. Is there any setting I can make to influence the use of memory?
There are a couple of things to try.

First of all,  go to the Miscellaneous menu, click on Show Memory Info to give us some idea of how little memory you have.  There are better ways to get a break down of memory use using a small Lua script but that's a good start.   Your camera uses EXMEM - I suppose a look through the porting thread to see if that was the right choice might be in order.

Second, there are a lot of function at the top of the script that could be moved into their own Lua file and loaded as a module.  I have not tried this (yet) but this should relieve a lot of memory as only the compiled Lua pcode will stay in memory - not the source code (I'm told that the source stays in memory for the main program).  When I have some time I'll play with this as I'm curious to see how well it works.

Third,  if you are willing to give up working with and displaying nice "photographer" units ( like fractional seconds,  f-stops, and ISO sensitivity) and just work in APEX96 units (painful) then you can strip out all the  parts that convert back and forth in the @param sections and the print_av() print_sv() print_tv() functions. And things that have lots of options - like the backlight code, focus mode or zoom position can be shortened to just default to your current preference. 

Finally,  you can keep hacking away until you eventually have a one line script that just says "shoot()" if you work hard enough   ;)   It would be good to see if the module trick (step 2) works though.  It might also be good to dig up that Lua code snippet that gets all memory status - get_meminfo() - , add to the script and log how the memory management performs.

Or you could just use the script "as is" and restart the camera between runs.  I'm guessing there is enough space for your USB additions if you operate that way.

I'll ask about memory fragmentation on IRC tonight and see if there are any ideas.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 31 / October / 2013, 00:30:47
I tested the script on my camera. I use a Canon IXUS 230 HS (ELPH310HS) version 1.00e. I noticed that when first installed, the script starts and works fine. When the camera is restarted, it fails with "could not load propcase.lua". I researched this a bit and it seems it's related to memory issues and pools.
So if you start the camera "cold", have you loaded and run the script for an extended period of time (10 minutes) taking pictures?  Is it only when you stop the script and rerun it that you have this problem?
Further to all my above questions,  if you stop the script (when it has been launched after a cold start) by pressing the "Menu" key while it's running (rather than the shutter button or the power button),  can you then successfully restart and run the script?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: philgib on 04 / November / 2013, 06:34:55
I am using a not-released yet A2500 test version

I am doing Kap and multirotors so I have gotta luv this script  :D

I cannot figure out how to use this script properly.

Target speed : 1/1000
Max speed : 1/2000
Iso min : 200
Iso min : 400

I want to enforce infinite focus distance, but I am failing to
I have written :
Min Av : 8
Target Av : 8
Max Av : 8

So I am expecting 8 as Av but I am getting 2.8/3... What am I doing wrong ?

Thank you :-)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 04 / November / 2013, 08:51:42
I want to enforce infinite focus distance, but I am failing to
There is a choice of MF setting methods available as a user parameter for the script.  Not every one will work with every camera unfortunately but when they do they will force the focus to infinity.   If you use the AFLock method, which should work for your camera,  just be sure the camera is pointed at something off in the distance when the script starts.

Altenatively,  set the focus lock manually from the camera keypad.

Quote
I have written :
Min Av : 8
Target Av : 8
Max Av : 8
So I am expecting 8 as Av but I am getting 2.8/3... What am I doing wrong ?
Setting the Av (aperture) is only useful on cameras with an adjustable aperture.  The A2500 has a fixed aperture and thus will not respond to those settings.  (Any changes you see in the aperture reported in your picture's EXIF or the camera's on screen display are caused by changes in zoom position).

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: philgib on 04 / November / 2013, 15:14:04
OK, all clear now, I have learnt something new today.
Thank you for taking the time to educate me.

just be sure the camera is pointed at something off in the distance when the script starts.

So from my multirotor, I will therefore aim at the skyline, start the script, then put it on the ground and start flying.

A cool thing would have been to focus at the time of the very first picture and not when starting the script, so that delay before first picture can be used for taking off and elevate high enough before initial focus.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 04 / November / 2013, 16:05:00
So from my multirotor, I will therefore aim at the skyline, start the script, then put it on the ground and start flying.
The "trick" here is making sure the camera actually has something to "focus" on.  Clouds or a building way off in the distance work well here.   Clear blue skys do not.

Quote
A cool thing would have been to focus at the time of the very first picture and not when starting the script, so that delay before first picture can be used for taking off and elevate high enough before initial focus.
That's easy enough to add to the script but why not just let the camera focus before every shot then?   
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: philgib on 05 / November / 2013, 00:09:52
That's easy enough to add to the script but why not just let the camera focus before every shot then?

- Unnecessary repetitive process for KAP, focus is always on infinity since kite is usually 50-150 meters high so one is enough

-This allows for faster shooting cadence, no time wasted between 2 shots
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 11 / November / 2013, 08:20:41
Thanks for the wonderful script waterwingz :)

Don't know if you seen my post on the KAP forum, but it would be great for if there was an option to set focus by hyperfocal distance.

Link to thread on KAP forum.
http://arch.ced.berkeley.edu/kap/discuss/index.php?p=/discussion/4751/new-chdk-script-for-kap-uav-for-fast-shutter-speeds (http://arch.ced.berkeley.edu/kap/discuss/index.php?p=/discussion/4751/new-chdk-script-for-kap-uav-for-fast-shutter-speeds)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / November / 2013, 08:55:15
Don't know if you seen my post on the KAP forum, but it would be great for if there was an option to set focus by hyperfocal distance.
Yes,  I've seen the post.  Thanks for using the script and commenting positively.

I'm looking into enabling hyperfocal focus as an option.  One of the issues is the differing ability of various cameras to actually allow you to set (and hold) a MF setting.  Once I get that as good as it will get,   I'll roll huperfocal into the next upgrade.   peabody (a.k.a wayback) has pointed out a few other little improvements that need to be added.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 11 / November / 2013, 10:52:07
Thanks waterwingz,

I just posted this on the KAP thread:
A590 IS:
If the focus lock is set to off in the script, and you use CHDK to set the focus to hyperfocal distance before running the script the photos will be taken at the hyperfocal distance. You will want to make sure Iris is not enabled for AV Mode in the script, as different apertures will affect the hyperfocal distance.

Looking forward to the next upgrade.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 11 / November / 2013, 14:43:57
Would it be possible to add 1/640 as a Target Tv?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / November / 2013, 19:19:05
If the focus lock is set to off in the script, and you use CHDK to set the focus to hyperfocal distance before running the script the photos will be taken at the hyperfocal distance.
Your camera is one of those that can set focus without being in MF (or AFL) mode.  Lucky you! I'll probably modify the script params so people with camera models like that will be able to set infinity or hyperfocal focus without the trying for MF or AF lock.

Quote
You will want to make sure Iris is not enabled for AV Mode in the script, as different apertures will affect the hyperfocal distance.
The script will take that into account.

Quote
Looking forward to the next upgrade.
Me too :)  Should be this week some time.

Would it be possible to add 1/640 as a Target Tv?
Yes - good idea.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 12 / November / 2013, 08:10:27
Excellent!!!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 12 / November / 2013, 14:23:00
waterwingz, here's a comparison between infinite and hyperfocal. Infinite appears to do a better job unless Safety MF is set to on.
f/4.0  1/800  ISO:80
(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fwww.digital-mapping.net%2Fforums%2FKAP%2Finfinite-hyperfocal.jpg&hash=37e7e942d9cdc7392f34649ddd691fa8)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 12 / November / 2013, 15:53:21
waterwingz, here's a comparison between infinite and hyperfocal. Infinite appears to do a better job unless Safety MF is set to on.
f/4.0  1/800  ISO:80
Thanks for taking the time to put this together.  Its nice to see some actual data!  To my tired eyes, the hyperfocal image is clearly inferior and the other three are about the same.  But then I've never been much good at "pixel peeping" - how do you see it?

The safety MF data suggests that the camera adjusted your "hyperfocal" setting back out towards infinite.  If you want to try and get a better look at what is happening,  the CHDK OSD "DOF calculator" will give you an onscreen display of where the camera is focused.

At this point,  it sounds like using the hyperfocal point is of little value for KAP, where the image at infinity is more important than anything that might chance to be in focus close up?

This has not been a wasted effort for me.  As I struggle with CHDK's MF capability I'm learning a lot more about what works and what doesn't.  My four cameras all work differently and I'm sure there are other examples.  In fact, I've started a list of sorts here : CHDK Wiki  : Manual_Focus. (http://chdk.wikia.com/wiki/User:Waterwingz/Manual_Focus)   We will have to see what comes out of that.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Microfunguy on 13 / November / 2013, 06:53:19
The above is not a valid test.

The point is, the magnified views in the images above represent a different set of viewing conditions.
For the magnified images viewed at the same distance, the 'circle-of-confusion' would need to be smaller and the hyperfocal distance would be different than that used.
It would move closer to infinity.

I agree there is no point having a hyperfocal option.
If you are using a wide-angle setting with a UAV then it is not needed there either.
Anything beyond one metre is at infinity anyway.

As for aperture, that should not be variable but fixed at your determined optimum value.
In the case of my S95 that is fully open.

Just change shutter speed and ISO, that is all that is needed.

It is important to understand the optical principles.

Keep it simple ............
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 13 / November / 2013, 08:48:29
The photos were all taken from the same location on a tripod at f/4.0 - 1/800 - ISO 80. The only difference between the images were the focus set at hyperfocal and infite and the Safety MF setting. The posted image is a screen capture from Adobe Bridge Review Mode. The  Loupe tool is a feature of Review Mode that lets you compare areas of different images at 100% magnification (1:1). For more information on Adobe Bridge Review Mode and the Loupe tool see this link.
http://help.adobe.com/en_US/creativesuite/cs/using/WS7049512F-0ED0-4f33-B6D9-D7B89F8F0909a.html (http://help.adobe.com/en_US/creativesuite/cs/using/WS7049512F-0ED0-4f33-B6D9-D7B89F8F0909a.html)

I agree that it looks like hyperfocal distance is of little value for KAP.

I've notice with my cameras that the sweet spot is around the middle of Aperture range. I prefer to use the AV setting for KAP with lower ISO to avoid noise in shadow areas.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 20 / November / 2013, 16:26:00
Hi waterwingz,
Any news on the update!
I would like to be able to set the script to shoot at 1/640 with AV mode Iris. On a clear sunny day this would keep the aperture around f/4.0 on my A590. Perfect for one of my favorite KAP shooting environments. :)
Thanks,
Bill
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / November / 2013, 18:28:33
I would like to be able to set the script to shoot at 1/640 with AV mode Iris. On a clear sunny day this would keep the aperture around f/4.0 on my A590. Perfect for one of my favorite KAP shooting environments. :)
Here's link to version 1.2 :  https://app.box.com/s/5rrq66k71vq9u22jwqug

After some discussion here and on the KAP forum,  I've decided not to add focus at hyperfocal as a menu item.  It seems there is very little to be gained and implementing it complicates the shooting code enough to make it not worth the effort.

However,  your change for 1/640 is included,  along with a rework of the "focus at infinity" code.   I've been holding back on releasing this update until I get time to update the documentation in the wiki but feel free to download and try it out now.

Update :  changes now in general release at the download link give in the first post of this thread.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 22 / November / 2013, 13:05:08
Yep, infinity focus looks like the way to go for this type of application. Thanks very much for including the 1/640. Your script does everything I want for setting up my cameras for KAP and UAV use.

When I click on the link to download version 1.2 it ask me to sign up for box. With the original script I didn't need to sign up. Would it be possible to download version 1.2 without having to sign up?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 23 / November / 2013, 12:26:14
When I click on the link to download version 1.2 it ask me to sign up for box. With the original script I didn't need to sign up. Would it be possible to download version 1.2 without having to sign up?
Box.com can be annoying that way sometime. Rather than fix it, I updated the wiki page to reflect the changes in the script and updated the normal link to provide the 1.2 version.

https://app.box.com/files/0/f/0/1/f_11162762030

Enjoy!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 25 / November / 2013, 18:28:19
Thanks waterwingz, much appreciated.  :D
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: milobg on 28 / November / 2013, 09:35:51
Hi
I install KAP UAV script for my CHDK Canon S110 ONLY to take photo from my Dji550 exacopter… I use a remote lcd screen with TX RX to see image from Canon Camera in the sky to my monitor on the field.
It works well but I have some question for you.

I shot manual mode in CHDK; so in Enanched Photo Operation/Override Tv i put 1/1250 and the dot, Override Av 2,05 and the dot, Override ISO 100 and the dot, so all photo has some exposure… How can I do the same with KAP UAV script ??? Which are the correct parameters here?? I try to Override Tv+Av+Iso like I write here up and try to put these values in your script like this…
Av Mode none
Target Tv 1/1250
Tv Max 1/1250
Lowest Av 2,8
Target Av 2,8
Highest Av 2,8
ISO Min 100
ISO Max1 100
ISO Max2 100

But when I see photos in Lightroom (with this values just up here in your script) I saw this in metadata info:
AV2,0
Iso 50
and different TV from 1/1700 to 1/590….
The script try to use always the correct time shutter, good, but it is possible fix it, as my request (1/1250 sec.) ????
 Can you help me??? Thanks a lot Milobg www.skymotion.it (http://www.skymotion.it)
Very good script…..
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 28 / November / 2013, 10:51:09
I install KAP UAV script for my CHDK Canon S110 ONLY to take photo from my Dji550 exacopter… I use a remote lcd screen with TX RX to see image from Canon Camera in the sky to my monitor on the field.
It works well but I have some question for you.

I shot manual mode in CHDK; so in Enanched Photo Operation/Override Tv i put 1/1250 and the dot, Override Av 2,05 and the dot, Override ISO 100 and the dot, so all photo has some exposure… How can I do the same with KAP UAV script ??? Which are the correct parameters here?? I try to Override Tv+Av+Iso like I write here up and try to put these values in your script like this…
Av Mode none
Target Tv 1/1250
Tv Max 1/1250
Lowest Av 2,8
Target Av 2,8
Highest Av 2,8
ISO Min 100
ISO Max1 100
ISO Max2 100
What you have done here has a couple of problems. 

First of all,  setting Av Mode to None tells the script not to control the camera's aperture.  The S110 has a variable aperture so doing that allows the Canon firmware to control it instead - but in a manner unrelated to the exposure settings from the script.  You will see random changes in exposure as a result - not good!  Set it to "Both".

Secondly, your other settings tell the script to lock the shutter speed, aperture and ISO at single fixed values.  Does this means you really do not want to adjust the exposure as lighting conditions change?  The script will try to do that for you,  but if the resulting exposure is not correct, the script will change the shutter speed to compensate - outside of your defined range if necessary.  That would explain the changes in shutter speed that you are seeing.

But when I see photos in Lightroom (with this values just up here in your script) I saw this in metadata info:
AV 2.0
Iso 50
and different TV from 1/1700 to 1/590….
Sometimes, the exif meta values in the image information are the values that the Canon firmware is trying to use.  They are not the override values that CHDK forces the camera to use. I'm not clear on when that happens and when it does not.

Quote
The script try to use always the correct time shutter, good, but it is possible fix it, as my request (1/1250 sec.) ????   Can you help me??? Thanks a lot Milobg www.skymotion.it (http://www.skymotion.it)
If you just want to lock the exposure at 1/1250 and still use the script, then you are going to have to let the script adjust the aperature and ISO values to get a good exposure setting. Try this :

Otherwise,  maybe you just need a simple intervalometer script (like the interval.lua script included in the CHDK distribution) and the exposure locked via the CHDK menus as you reported at the beginning of your post?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: milobg on 02 / December / 2013, 06:51:06
Thank you for your long answer…
But I prefer to lock exposure and shot all images at 1/1250,  f2,8  100iso…

I was using interval script (like you wrote me) but I can’t zoom…

I try also “conservation drone” script… Perfect… but I can’t lock focus to infinity.

That’s why I like your kap-uav script… Because as soon as I start script I point the camera near infinity and it lock the focus for all other photos… (In script menu, I put focus @ infinity in AFLock mode..).             Is it correct???

I don’t know any other script that does this…..
So what I need (IF POSSIBLE) is a script like your kap-uav with the possibility to lock exposure and shot all images at 1/1250,  f2,8  100iso…
Do you think is it possible ?

So first I try the values you suggest me…. I put camera outside my window to taking photo to bright an dark areas:
•   Av Mode :     both
•   Target Tv :    1/1250
•   Tv Max :       1/1250
•   Lowest Av :   2.0
•   Target Av :    2.8
•   Highest Av :   8.0
•   ISO Min :       100
•   ISO Max1 :     400
•   ISO Max2 :     1600

After I look all photo in Lightroom… All photos have a good exposure… but the ones in dark light have 1/640 and 400 iso….
I do not want this….

I don’t know script language so I can’t write by myself..

So I need an intervallometer with Zoom, Lock Focus to infinity and Lock exposure to my values...

Is it possible????
Thanks a lot milobg
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / December / 2013, 08:05:23
So first I try the values you suggest me…. I put camera outside my window to taking photo to bright an dark areas:
•   Av Mode :     both
•   Target Tv :    1/1250
•   Tv Max :       1/1250
•   Lowest Av :   2.0
•   Target Av :    2.8
•   Highest Av :   8.0
•   ISO Min :       100
•   ISO Max1 :     400
•   ISO Max2 :     1600

After I look all photo in Lightroom… All photos have a good exposure… but the ones in dark light have 1/640 and 400 iso….
I do not want this….
Its very strange that you see this behavior. With those settings, the shutter speed should not drop below 1/1250 until the ISO hits 1600.  I'll take a look - you might have discovered a bug or the EXIF ISO values are not being reported correctly in LightRoom


Quote
So I need an intervallometer with Zoom, Lock Focus to infinity and Lock exposure to my values...  Is it possible????
If that's all you need,  its a simple script.  Do you have a link to the "conservation drone" script you mentioned - it might be easiest just to modify that.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: milobg on 02 / December / 2013, 08:51:12
I don't remember where I download conservation drone" script..
I try to attach here the relative script file.... Is it all right?
let me know...


PS: Sorry for my english but I don't understandi what do you mean here...
I'll take a look - you might have discovered a bug or the EXIF ISO values are not being reported correctly in LightRoom
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / December / 2013, 10:26:28
So first I try the values you suggest me…. I put camera outside my window to taking photo to bright an dark areas:
Can you enable logging and repeat this test?  Use the last parameter in the script menu that says Logging and set it to Both.

Rerun your test and then attach the resulting log file from your SD card (  KAP.log ) to a response here?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: milobg on 03 / December / 2013, 09:04:44
Hi Like you told me yesterday, here is the KAP.log file....

Is it corect???

Milobg
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 03 / December / 2013, 09:18:22
Hi Like you told me yesterday, here is the KAP.log file....
Thanks.  Only the last seven shots in the log are setup as you described in your previous posts.    The only shot there not at 1/1250 is IMG_7351.JPG.   It's shooting at 1/800 because the ISO is maxed out at 1600.  The script seems to be performing exactly as designed.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: milobg on 03 / December / 2013, 10:12:01
ok I understand... script works well,

now if I want to lock exposure with your script...
What do you suggest to me??

Are these the right values??

    Av Mode :     both
    Target Tv :    1/1250
    Tv Max :       1/1250
    Lowest Av :   2.8
    Target Av :    2.8
    Highest Av :   2.8
    ISO Min :       100
    ISO Max1 :     100
    ISO Max2 :     100

Let me know, if you can....

thank milobg
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 03 / December / 2013, 10:17:50
now if I want to lock exposure with your script...
What do you suggest to me??
To get the correct exposure, the script will lower the shutter speed once the ISO is at maximum and the f-stop is fully opened.  Otherwise you will have an underexposed picture. You could try setting ISO Max2 to 3200 to help with this.   

Otherwise, the script will need to be modified or you will need a different script. 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 07 / December / 2013, 05:07:44
Thanks for creating this script Waterwingz.
 
I've just used it for the first time on an sd960is. I have the target shutter speed set to 1/1600, and most images are being shot correctly at that speed, however I've come across a couple which were shot at a lower shutter speed and iso, and are blurry because of it.

In my kap.log for some of those files, this is the output:
2013Dec06 15:02:52 26) IMG_1022.JPG
2013Dec06 15:02:52  meter : Tv:1/640 Av:2.8 Sv:80 827:827
2013Dec06 15:02:52  actual: Tv:1/1600 Av:- Sv:160
2013Dec06 15:02:59 27) IMG_1023.JPG
2013Dec06 15:02:59  meter : Tv:1/320 Av:5.6 Sv:80 910:910
2013Dec06 15:02:59  actual: Tv:1/1600 Av:- Sv:400
2013Dec06 15:02:59          AvMin:2.8 NDF:none foc:infinity
2013Dec06 15:03:07 28) IMG_1024.JPG
2013Dec06 15:03:07  meter : Tv:1/125 Av:5.6 Sv:n/a 838:838
2013Dec06 15:03:07  actual: Tv:1/1600 Av:- Sv:640
2013Dec06 15:03:07          AvMin:2.8 NDF:none foc:infinity
2013Dec06 15:03:13 29) IMG_1025.JPG
2013Dec06 15:03:14  meter : Tv:1/500 Av:2.8 Sv:80 780:780
2013Dec06 15:03:14  actual: Tv:1/1600 Av:- Sv:250
2013Dec06 15:03:14          AvMin:2.8 NDF:none foc:infinity

When I look at the exif for these files, they don't match up to the log:
IMG_1022.JPG is 1/400, f2.8, iso 50.
IMG_1023.JPG is 1/200, f2.8, iso 50
IMG_1024.JPG is 1/1600 iso 640 (as it should be)
IMG_1025.JPG is 1/320, f2.8, iso 50.

Any idea what could be going on?



Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / December / 2013, 11:07:51
I have the target shutter speed set to 1/1600, and most images are being shot correctly at that speed, however I've come across a couple which were shot at a lower shutter speed and iso, and are blurry because of it.
This is most curious.   Would you say the exposure was correct (i.e. not too dark or too bright) even though the shutter speed was not what you required?

Thanks for posting the log entries.  I color coded a couple of things that pop out right away and commented below.
Quote
In my kap.log for some of those files, this is the output:
2013Dec06 15:02:52 26) IMG_1022.JPG
2013Dec06 15:02:52  meter : Tv:1/640 Av:2.8 Sv:80 827:827
2013Dec06 15:02:52  actual: Tv:1/1600 Av:- Sv:160
2013Dec06 15:02:59 27) IMG_1023.JPG
2013Dec06 15:02:59  meter : Tv:1/320 Av:5.6 Sv:80 910:910
2013Dec06 15:02:59  actual: Tv:1/1600 Av:- Sv:400
2013Dec06 15:02:59          AvMin:2.8 NDF:none foc:infinity
2013Dec06 15:03:07 28) IMG_1024.JPG
2013Dec06 15:03:07  meter : Tv:1/125 Av:5.6 Sv:n/a 838:838
2013Dec06 15:03:07  actual: Tv:1/1600 Av:- Sv:640
2013Dec06 15:03:07          AvMin:2.8 NDF:none foc:infinity
2013Dec06 15:03:13 29) IMG_1025.JPG
2013Dec06 15:03:14  meter : Tv:1/500 Av:2.8 Sv:80 780:780
2013Dec06 15:03:14  actual: Tv:1/1600 Av:- Sv:250
2013Dec06 15:03:14          AvMin:2.8 NDF:none foc:infinity
First of all,  the script did try to take every shot at 1/1600.  You can see that in the log lines that start with the word "actual".

Secondly,  the SD960 has a fixed aperture.  Yet the camera is trying to use  f2.8 for some shots and  f5.6 for other shots.  One of two things must be happening here.  Either the zoom position is changing or the camera's Neutral Density filter is being engaged by the Canon firmware.  Are you changing the zoom setting some how between shots?  If not, it must be the ND filter, and that will cause unwanted exposure variations.  (Notice that the Canon firmware is only trying to use the f5.6 setting in brighter scenes). Set the AV Mode in the script parameters to "NdFlter" and the script will manage that for you.   (Its not clear how this would cause the shutter override not to work though .. )

Finally, when taking image IMG_1024.JPG, the camera's light meter system tried to select an ISO setting below the range expected by the script.  That's quite curious but should not have caused any problems.

Quote
When I look at the exif for these files, they don't match up to the log:
IMG_1022.JPG is 1/400, f2.8, iso 50.
IMG_1023.JPG is 1/200, f2.8, iso 50
IMG_1024.JPG is 1/1600 iso 640 (as it should be)
IMG_1025.JPG is 1/320, f2.8, iso 50.
Do the exif values for other images match the log entries made by the script?  ( Other than ISO80 being reported as ISO50 ).

tl;dr : (http://www.urbandictionary.com/define.php?term=tl%3Bdr)  try setting the AV Mode in the script parameters to "NdFlter"
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 07 / December / 2013, 16:09:07
Yeah the exposure on those images which had the low shutter speed and iso was more or less correct, so it must be that the ND filter was engaging. It seems that the images where this happened generally had more of a bright feature in the frame than others that were more of a uniform tone.

I've just had a more thorough look through the exif data on the rest of the images, and there are quite a few images that don't have the correct shutter speed/iso, but they were sharp so I didn't look at them initially.

2013Dec06 15:01:28 14) IMG_1010.JPG
2013Dec06 15:01:28  meter : Tv:1/200 Av:5.6 Sv:80 832:832
2013Dec06 15:01:29  actual: Tv:1/1600 Av:- Sv:640

This one ended up shooting 1/125 at f5.6 iso 50. I don't think there's any way that the zoom would have been engaging since the FOV of all of the images is the same.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 07 / December / 2013, 19:20:32
Just did a test with the AV Mode set to NDFilter, and pretty much every shot is way overexposed, generally with a shutter speed of 1-250-1/400 at iso 50 (target shutter speed was set to 1/1250)

2013Dec08 11:17:17 14) IMG_1114.JPG
2013Dec08 11:17:17  meter : Tv:1/320 Av:5.6 Sv:80 923:923
2013Dec08 11:17:17  actual: Tv:1/1250 Av:- Sv:250
2013Dec08 11:17:17          AvMin:2.8 NDF:NDout foc:infinity
2013Dec08 11:17:23 15) IMG_1115.JPG
2013Dec08 11:17:24  meter : Tv:1/400 Av:5.6 Sv:80 927:927
2013Dec08 11:17:24  actual: Tv:1/1250 Av:- Sv:250
2013Dec08 11:17:24          AvMin:2.8 NDF:NDout foc:infinity
2013Dec08 11:17:30 16) IMG_1116.JPG
2013Dec08 11:17:30  meter : Tv:1/400 Av:5.6 Sv:80 958:958
2013Dec08 11:17:31  actual: Tv:1/1250 Av:- Sv:200
2013Dec08 11:17:31          AvMin:2.8 NDF:NDout foc:infinity
2013Dec08 11:17:37 17) IMG_1117.JPG
2013Dec08 11:17:37  meter : Tv:1/500 Av:5.6 Sv:80 973:973
2013Dec08 11:17:37  actual: Tv:1/1250 Av:- Sv:200
2013Dec08 11:17:38          AvMin:2.8 NDF:NDout foc:infinity
2013Dec08 11:17:43 18) IMG_1118.JPG
2013Dec08 11:17:44  meter : Tv:1/640 Av:5.6 Sv:80 1039:1039
2013Dec08 11:17:44  actual: Tv:1/1250 Av:- Sv:120
2013Dec08 11:17:44          AvMin:2.8 NDF:NDout foc:infinity
2013Dec08 11:17:50 19) IMG_1119.JPG
2013Dec08 11:17:50  meter : Tv:1/250 Av:5.6 Sv:n/a 947:947
2013Dec08 11:17:50  actual: Tv:1/1250 Av:- Sv:200
2013Dec08 11:17:51          AvMin:2.8 NDF:NDout foc:infinity

From Exif:
IMG_1114.JPG - 1/200, f5.6, iso 50
IMG_1115.JPG - 1/250 f5.6 iso 50
IMG_1116.JPG - 1/250 f5.6 iso 50
IMG_1117.JPG - 1/320 f5.6 iso 50
IMG_1118.JPG - 1/500 f5.6 iso 50
IMG_1119.JPG - 1/1250 f5.6 iso 200
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / December / 2013, 19:58:55
Just did a test with the AV Mode set to NDFilter, and pretty much every shot is way overexposed, generally with a shutter speed of 1-250-1/400 at iso 50 (target shutter speed was set to 1/1250)
Looks like you took those shots in bright light?  In every one of those shots, the camera appears to be inserting the ND filter and taking an exposure reading that way. This is different behavior from what I've seen on my cameras - I will have to study it a bit.

Meanwhile, I think you will find that the shutter speed used is actually 1/1250.   The exif values are not correct.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 07 / December / 2013, 20:10:06
How do you tell if the exif values are correct or not? I was just shooting straight down onto grass (the same area and conditions as yesterday) and it's a reasonably sunny day today. The overexposed images that were produced make me think that it did actually use a slower shutter speed, but I'm not much of an expert with chdk cameras.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / December / 2013, 20:18:20
How do you tell if the exif values are correct or not? I was just shooting straight down onto grass (the same area and conditions as yesterday) and it's a reasonably sunny day today. The overexposed images that were produced make me think that it did actually use a slower shutter speed, but I'm not much of an expert with chdk cameras.
The script log reports that CHDK is trying to override the shutter to 1/1250.  I would be very surprised if that does not happen.  On my A1200,  once you ask for a shutter speed above the normal camera upper range, the exif data does not save the higher shutter speed for some reason even though the image is taken at the faster speed.

Meanwhile,  I think that the overexposed images are because the script is assuming the aperture is set to f5.6 and does not realizing its actually at f2.8 with the ND filter engaged.   So when it does its exposure calculation it uses f5.6 and then shoots with the ND filter out!  This causes it to be about 3 f-stops over exposed.

Clearly a bug - I just need to do some testing to figure out if its an anomaly of your SD960 or normal behavior for most cameras.



Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 07 / December / 2013, 20:25:12
These overexposed shots all have motion blur too, so I still think the shutter speed is low.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / December / 2013, 20:29:00
These overexposed shots all have motion blur too, so I still think the shutter speed is low.
If that's true,  then it would mean the CHDK port for the SD960 is seriously broken.  Nothing much I can do about that with a script.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / December / 2013, 21:52:04
Okay,  if you are up for a little more testing,  this should handle the ND filter issue properly in bright light (tested taking pictures of my desk lamp's light bulb).

https://app.box.com/s/hslxxa9tiotgwxm35jhw

Let me know if it fixes the overexposure issue when you have the AV Mode in the script parameters to "NdFlter" ?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 07 / December / 2013, 21:56:16
Thanks for that.  I'll give it a go and let you know how I get on.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 08 / December / 2013, 09:02:26
These overexposed shots all have motion blur too, so I still think the shutter speed is low.
If that's true,  then it would mean the CHDK port for the SD960 is seriously broken.  Nothing much I can do about that with a script.
Bug reports are welcome (preferably with a description on how to reproduce).
I have applied the 'short shutter press' override fix in changesets 3264, 3265, but I'm not sure if that will have any influence on this script.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / December / 2013, 10:13:21
Bug reports are welcome (preferably with a description on how to reproduce).
The script does not correctly handle the situation where the camera wants to insert the ND filter and reports using a smaller f-stop setting as a result.   It assumes the reported Av value is the actual aperture f-stop setting and does its exposure calculations based on that.  When the actual shot occurs, it ends up using calculations based on the ND filter being inserted even though it does not insert that filter.

Once that gets sorted out,  we can worry about possible Tv override bugs.   The fix for cameras without an adjustable aperture is to use  get_prop(props.MIN_AV) to determine the actual Av96 value of the aperture rather than the get_av96() function.

Quote
I have applied the 'short shutter press' override fix in changesets 3264, 3265, but I'm not sure if that will have any influence on this script.
Thanks for that.  Reading your commit comments,  it appear this only happens on the first shot?  In this case, according to the script's log,  if there is a bug then it is happening through-out the intervalometer run on many shots. 

Also, if your second svn commit comment :
    The camera may engage the ND filter in bright light, but take the picture without it (not CHDK related).
is about the issue here,  that's a script logic problem and not related to the patch?

I posted a patched script file for Wreck to try.  With the ND filter issue fixed, we can work on whether there is an issue with the exif value not matching the override or with the override not actually being applied.  The shooting part of the script code is pretty much standard stuff :
Code: [Select]
                -- set up all exposure overrides
                set_tv96_direct(tv96setpoint)
                set_sv96(sv96setpoint)
                if( av96setpoint ~= nil) then set_av96_direct(av96setpoint) end   
                nd_string="none"           
                if(Av_mode > 1) then                      -- ND filter available ?
                    if ( insert_ND_filter == true ) then
                        set_nd_filter(1)                         -- activate the ND filter
                        nd_string="NDin"
                    else
                        set_nd_filter(2)                         -- make sure the ND filter does not activate
                        nd_string="NDout"
                    end
                end

                -- and finally shoot the image
                press("shoot_full_only")
                sleep(100)
                release("shoot_full")
                repeat sleep(50)  until get_shooting() == false
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / December / 2013, 10:39:03
I have applied the 'short shutter press' override fix in changesets 3264, 3265, but I'm not sure if that will have any influence on this script.
Looking at the code in core/shooting.c,  it does not look like the change to  the aperture_sizes_table[] in this patch going to change the value returned by get_av96() if the ND filter is inserted ?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 08 / December / 2013, 10:44:48
The script does not correctly handle the situation where the camera wants to insert the ND filter and reports using a smaller f-stop setting as a result.   It assumes the reported Av value is the actual aperture f-stop setting and does its exposure calculations based on that.  When the actual shot occurs, it ends up using calculations based on the ND filter being inserted even though it does not insert that filter.
I thought PROPCASE_AV should show the chosen Av value (it seemed to when I recorded the possible Av values).
Quote
The fix for cameras without an adjustable aperture is to use  get_prop(props.MIN_AV) to determine the actual Av96 value of the aperture rather than the get_av96() function.
This is probably correct for DOF calculations, but is it really good basis for determining exposure?
Quote
Reading your commit comments,  it appear this only happens on the first shot?
Testing this is rather boring, but it seemed to only affect the Tv override, when ISO was also overridden, and mostly when doing a short press. I've only seen this right after transitions to rec mode, subsequent shots were correct.

Quote
The camera may engage the ND filter in bright light, but take the picture without it (not CHDK related).
is about the issue here,  that's a script logic problem and not related to the patch
I was referring to live view, the ND is moved to its final position on half-shoot.

I have applied the 'short shutter press' override fix in changesets 3264, 3265, but I'm not sure if that will have any influence on this script.
Looking at the code in core/shooting.c,  it does not look like the change to  the aperture_sizes_table[] in this patch going to change the value returned by get_av96() if the ND filter is inserted ?
Probably, but people without the cam will now at least see what's available.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / December / 2013, 10:56:40
The script does not correctly handle the situation where the camera wants to insert the ND filter and reports using a smaller f-stop setting as a result.   It assumes the reported Av value is the actual aperture f-stop setting and does its exposure calculations based on that.  When the actual shot occurs, it ends up using calculations based on the ND filter being inserted even though it does not insert that filter.
I thought PROPCASE_AV should show the chosen Av value (it seemed to when I recorded the possible Av values).
I thought so too.  But looking at the logs posted above,  the Av values I highlighted in red are straight from a get_av96() call and as I commented,  for the SD980 they can only change like that if the zoom shifts or the ND filter engages.   The OP says he did not move the zoom,  so that leads me to the conclusion that PROPCASE_AV is changed when the camera plans to insert the ND filter.  (i.e. the reported APEX96 value is the  effective aperature value and not the ratio of the lens' focal length to the diameter of the entrance pupil.)

Quote
Quote
The fix for cameras without an adjustable aperture is to use  get_prop(props.MIN_AV) to determine the actual Av96 value of the aperture rather than the get_av96() function.
This is probably correct for DOF calculations, but is it really good basis for determining exposure?
On a camera without an adjustable aperature this works correctly (assuming you control the ND filter in the script as well) and is a tricky way to detect if the camera planned to use the ND filter (thanks to reyalp for that one).   

Meanwhile, at least for now, the script logic for cameras with adjustable aperature assumes the camera does not try to use the ND filter automatically (based on my testing and an IRC conversation with reyalp).

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 08 / December / 2013, 14:26:57
I've just tried the v1.3 script, with Avmode set to ndfltr and I don't seem to be getting overexposure (just shooting a bright scene outside the window).

2013Dec09 07:15:03 KAP 1.2 started - press MENU to exit
2013Dec09 07:15:03 CHDK 1.2.0-3155-0 ixus110_sd960 101d Oct 13 2013
2013Dec09 07:15:03  Tv:1/1250 maxTV:1/2000 exp comp:0.0
2013Dec09 07:15:03  Av:4.0 minAv:2.8 maxAv:8.0
2013Dec09 07:15:04  ISOmin:100 ISO1:400 ISO2:800
2013Dec09 07:15:04  AvM:2 int:2 Shts:0 Dly:0 B/L:0 USB:false
2013Dec09 07:15:17 1) IMG_1214.JPG
2013Dec09 07:15:18  meter : Tv:1/500 Av:2.8 Sv:80 774:774
2013Dec09 07:15:18  actual: Tv:1/1250 Av:- Sv:200
2013Dec09 07:15:18          AvMin:2.8 NDF:NDout foc:infinity
2013Dec09 07:15:24 2) IMG_1215.JPG
2013Dec09 07:15:24  meter : Tv:1/200 Av:5.6 Sv:80 845:845
2013Dec09 07:15:25  actual: Tv:1/1250 Av:- Sv:120
2013Dec09 07:15:25          AvMin:2.8 NDF:NDout foc:infinity
2013Dec09 07:15:32 3) IMG_1216.JPG
2013Dec09 07:15:32  meter : Tv:1/200 Av:2.8 Sv:n/a 719:719
2013Dec09 07:15:32  actual: Tv:1/1250 Av:- Sv:320
2013Dec09 07:15:32          AvMin:2.8 NDF:NDout foc:infinity

Exif values:
IMG_1214.JPG - 1/320, f2.8, iso 50
IMG_1215.JPG - 1/500, f5.6, iso 50
IMG_1216.JPG - 1/1250 f2.8, iso 320
IMG_1217.JPG - 1/1250 f2.8, iso 250

A subsequent test of 6 shots gives exif showing 1/1250. I'll strap it to the copter and give it a proper go this afternoon if I can sort out my GPS issues...
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / December / 2013, 16:54:01
A subsequent test of 6 shots gives exif showing 1/1250.
Sound a bit like the bug srsa_4c patched yesterday.  If you download the latest build from the autobuild this might just go away.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 08 / December / 2013, 19:34:16
Have just installed the latest build, and with the 1.3 script it seems to be behaving from my limited backyard test. Will have to see how it goes in the air and report back.

Thanks for your help.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 09 / December / 2013, 20:22:49
Looks to be working pretty well now. Getting a few not-so-sharp images still, but could just be due to gimbal shake...

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fimg534.imageshack.us%2Fimg534%2F2665%2F24ja.jpg&hash=0d0f2df27bd2b1c0207411e6c0f3a6d5)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / December / 2013, 20:26:38
Looks to be working pretty well now. Getting a few not-so-sharp images still, but could just be due to gimbal shake...
Good to hear - thanks for reporting back! 

What Tv value is reported in the exif & the script log for those images ?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 09 / December / 2013, 20:32:56
Looks to be working pretty well now. Getting a few not-so-sharp images still, but could just be due to gimbal shake...
Good to hear - thanks for reporting back! 

What Tv value is reported in the exif & the script log for those images ?

Here's a selection.

2013Dec10 11:05:32 30) IMG_1390.JPG
2013Dec10 11:05:32  meter : Tv:1/400 Av:2.8 Sv:80 753:753
2013Dec10 11:05:32  actual: Tv:1/1600 Av:- Sv:320
2013Dec10 11:05:32          AvMin:2.8 NDF:NDout foc:infinity
2013Dec10 11:05:38 31) IMG_1391.JPG
2013Dec10 11:05:38  meter : Tv:1/320 Av:2.8 Sv:80 733:733
2013Dec10 11:05:39  actual: Tv:1/1600 Av:- Sv:320
2013Dec10 11:05:39          AvMin:2.8 NDF:NDout foc:infinity
2013Dec10 11:05:46 32) IMG_1392.JPG
2013Dec10 11:05:46  meter : Tv:1/400 Av:2.8 Sv:80 739:739
2013Dec10 11:05:46  actual: Tv:1/1600 Av:- Sv:320
2013Dec10 11:05:46          AvMin:2.8 NDF:NDout foc:infinity
2013Dec10 11:05:53 33) IMG_1393.JPG
2013Dec10 11:05:53  meter : Tv:1/640 Av:2.8 Sv:80 809:809
2013Dec10 11:05:53  actual: Tv:1/1600 Av:- Sv:200
2013Dec10 11:05:53          AvMin:2.8 NDF:NDout foc:infinity
2013Dec10 11:05:59 34) IMG_1394.JPG
2013Dec10 11:06:00  meter : Tv:1/640 Av:2.8 Sv:80 810:810
2013Dec10 11:06:00  actual: Tv:1/1600 Av:- Sv:200
2013Dec10 11:06:00          AvMin:2.8 NDF:NDout foc:infinity

Exif shows all were shot at 1/1600, f2.8, and the ISOs all match up.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / December / 2013, 20:43:53
Exif shows all were shot at 1/1600, f2.8, and the ISOs all match up.
Gotta like that!   Thanks to srsa_4c for making the fix to the SD980 !
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 10 / December / 2013, 16:21:15
Hi waterwingz, would it be possible to add a function to turn off the camera when it completes shooting the total number of shots?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 10 / December / 2013, 16:50:59
Hi waterwingz, would it be possible to add a function to turn off the camera when it completes shooting the total number of shots?
Doesn't sound like a big problem to add.   At one point I had the code simply switch to playback when shooting was done so that the lens could retract prior to landing.   I assume you are asking for the same reason?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 15 / December / 2013, 15:18:07
Script updated to version 1.4.   Changes include : 
Changelog and link on the wiki page : http://chdk.wikia.com/wiki/KAP_%26_UAV_Exposure_Control_Script (http://chdk.wikia.com/wiki/KAP_%26_UAV_Exposure_Control_Script)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 19 / December / 2013, 07:52:16
Hi waterwingz, would it be possible to add a function to turn off the camera when it completes shooting the total number of shots?
Doesn't sound like a big problem to add.   At one point I had the code simply switch to playback when shooting was done so that the lens could retract prior to landing.   I assume you are asking for the same reason?
Yes, that's the reason. Thanks for adding it to the script.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: AndrewFerrara on 19 / December / 2013, 23:49:03
First time on this forum. I just got a SX260 to use on a quadcopter. I want to take off without the lens extended and then start this script. How would some one go about doing that?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / December / 2013, 23:59:21
First time on this forum. I just got a SX260 to use on a quadcopter. I want to take off without the lens extended and then start this script. How would some one go about doing that?
Easy - all you need to do is set the script's Start Delay and then start the script just prior to launch. 

Do this :

Sixty seconds later (depending on the delay you set) the camera will switch to shooting mode and the lens will extend.

Does that do it for you ?

WW
 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: AndrewFerrara on 20 / December / 2013, 00:57:16
Ok, thank you for the instructions. I just tested it and that will work well.

I see there is a parameter to turn off the backlight off. However, it doesn't appear that my backlight turns off what is this suppose to look like? Does the screen dim or turn off? It doesn't appear to be dimming.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / December / 2013, 08:32:24
I see there is a parameter to turn off the backlight off. However, it doesn't appear that my backlight turns off what is this suppose to look like? Does the screen dim or turn off? It doesn't appear to be dimming.
If you have your shot rate set fairly high, on the order of one shot every 5 sec or less, then the backlight never gets a chance to turn off.  Its a long standing limitation of the CHDK script set_backlight() command caused by the fact that the backlight turns on after every shot, requiring the script to pause briefly to turn it back off again.

You can test this for yourself by changing the shot interval to 60 seconds and observing the backlight when you run the script in that mode.

Fortunately, there is a new script command,  set_lcd_display() that actually turns off both the backlight and the LCD itself.   It has been available in the unstable testing version of CHDK for some time now.  I have not used it in the kap_uav script as it was not available in the stable public version of CHDK.   That changed two days ago (http://chdk.setepontos.com/index.php?topic=10551.msg108056#msg108056) thanks to philmoz (http://chdk.setepontos.com/index.php?action=profile;u=4722) - I just have not had a chance to update the script yet.

And as an added bonus, set_lcd_display() should save quite a bit more battery power than set_backlight()
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / December / 2013, 10:26:52
Release 1.5 now available at the regular download link (https://app.box.com/s/a5tbl1xasp8m3a57fclx).

This version used set_lcd_display() rather than set_backlight() and requires a recent version of CHDK 1.2.0 or 1.3.0.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: AndrewFerrara on 22 / December / 2013, 16:50:45
I tired the script out the other day and it worked very well. However, I do need to make some adjustments to my setup to make it easier to use the camera (usb remote) and take better photos. A lot of them came out blurry. (https://www.dropbox.com/sh/lknjmwbsfhcp5h7/Qc6g88E_WJ) It was pretty windy though. Is there a way to correct this on the camera or do I just need a better anti-vibration setup? Right now the camera is directly mounted to the quadcopter in a case made from polymorph plastic (pictured below).

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fapi.ning.com%2Ffiles%2FxMCtlOLhuRfM8mIfstbR2zbiKP907EUCA2qcOa4LbWqyOvoRB5ruXzSsLfemANoRkIln4RvX3PaUKsPYA-p9F-uCcYL%2Ax23h%2Fphoto1.JPG%3Fwidth%3D737%26amp%3Bheight%3D552&hash=3c05d2985c17db4c6c09938e0b7d9c3e)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 22 / December / 2013, 17:43:07
From the exif, it looks like the focus mode is set to auto. You would probably be better off focusing at infinity. With the sort of camera, infinity should be fine for the kind of altitude you are shooting from.

Since your camera has MF, you should be able to just set it to MF mode and adjust the focus before flight. There might be a way to do this from script, but it varies a lot by camera so a manual test is likely to be more reliable.  It looks like the camera is in full auto mode, you may need to switch the camera to P mode to turn off autofocus.

I'm not sure if all of your problem focus, there could well be some motion blur from vibration in there too, but
Code: [Select]
exiftool -a -u -g1 -h IMG_0181.JPG  > IMG_0181.HTMLreports

Code: [Select]
Focus Distance Upper 0.78 m
which I think indicates that it was trying to focus quite close. If I set my D10 to infinity in MF mode, I get
Code: [Select]
Focus Distance Upper 15.69 m
Focus Distance Lower 0 m

The exposure was 1/1000th which should be pretty good for keeping motion blur down with wide angle shots like that.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / December / 2013, 18:43:58
The script supports various methods of setting focus at infinity, selectable by a user defined @param value.    You might have to tweak the code for your particular camera though. 

Details are discussed in the Wiki page documentation for the script (linked in the first post of this thread).
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: AndrewFerrara on 27 / December / 2013, 13:30:28
With the SX260 HS I haven't been able to figure out how to get the focus to lock at infinity. I even tried to take pictures using just M mode (no CHDK) and using these settings:


Here is the result, from viewing properties->details it says the Focal Length is 90mm. How do I get it to lock at infinity before running the KAP_UAV script?
(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FE1WR4b4.jpg&hash=b427c3f74d69172dfa39f722d62d3d8e)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / December / 2013, 13:39:30
With the SX260 HS I haven't been able to figure out how to get the focus to lock at infinity. I even tried to take pictures using just M mode (no CHDK) and using these settings:
What setting are you using for the focus mode in the script?  Its possible you are locking the focus when you run the script and its staying locked between runs.

With a little work, it should be possible to let the script set the focus at infinity for you. 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: AndrewFerrara on 27 / December / 2013, 13:50:58
I am using aflock for the Focus @ Infinity Mode parameter. Also, does it matter what mode the camera is in when the script is running? Which mode should it be it M, Av, Tv, AUTO etc?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / December / 2013, 13:53:48
I am using aflock for the Focus @ Infinity Mode parameter. Also, does it matter what mode the camera is in when tthe script is running? Which mode should it be it M, Av, Tv, AUTO etc?
The mode should not matter - the script will override.  But try disabling the aflock - go with "none" for now and power cycle the camera before running the script again.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: AndrewFerrara on 27 / December / 2013, 14:08:31
I took the memory card out and reset the camera. Then put it back in with the changed Focus param to "none".
I went outside and point the camera at the overcast clouds and ran the script. The properties of each photo say that the focal length is 4mm.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / December / 2013, 14:51:29
I took the memory card out and reset the camera. Then put it back in with the changed Focus param to "none".
I went outside and point the camera at the overcast clouds and ran the script. The properties of each photo say that the focal length is 4mm.
Sorry - I'm sitting in a very cramped coach seat on an airplane right now and can't do much in the way of testing. Can you enable logging to the SD card, rerun the test, and post the result here?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 27 / December / 2013, 16:30:24
the properties of each photo say that the focal length is 4mm.
The focal length is the lens focal length (zoom level), not the focus distance.

The "Focus Distance Upper" and "Focus Distance Lower" items I mentioned earlier should tell you something about the the focus distance, but the meaning is not entirely clear to me. This can be displayed with exiftool, but they are proprietary Canon "maker notes" so many programs will not display them. It is also not certain they would correctly reflect CHDK overrides.

If you are testing on the ground, you can aim the camera at something close. If it is in focus, the camera AF is active and your override to infinity is not working.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 28 / December / 2013, 14:52:11
The "Focus Distance Upper" and "Focus Distance Lower" items I mentioned earlier should tell you something about the the focus distance, but the meaning is not entirely clear to me. This can be displayed with exiftool, but they are proprietary Canon "maker notes" so many programs will not display them. It is also not certain they would correctly reflect CHDK overrides.

If you are testing on the ground, you can aim the camera at something close. If it is in focus, the camera AF is active and your override to infinity is not working.
Alternatively,  if you go to  CHDK Settings ->  OSD Settings and select Show OSD [ * ] and then go to CHDK Settings ->  OSD Settings->DOF Calculator and set Show DOF Calculator to [ In Misc ] and select Show Sub. Dist. in Misc [ * ] you will get a nice on screen display of the current focus distance in mm.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: willburt on 21 / January / 2014, 16:30:16
I thought you might like to know I'm using this script successfully in a UAV.

I've stitched together a 3D montage of a nearby field. The aircraft was being piloted directly so the 3D model isn't great. The next step is to get an autopilot into the aircraft.

I have uploaded a snapshot of the model to my blog at http://ecologydrones.tumblr.com/post/74093831920/the-first-test-run-without-an-autopilot-so-the (http://ecologydrones.tumblr.com/post/74093831920/the-first-test-run-without-an-autopilot-so-the)

Thanks for the time and effort that has done into this script  :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 25 / January / 2014, 14:39:04
Hello all,

since yesterday evening i have started to use this script , it is very nice.

I'm using it with remote control function: i'm starting the camera in Playback mode (lens closed) and i'm playing with the voltage supplied on the camera mini usb connector ( 0v-5v) to start and stop the script.

Now if i'm stopping the script the lens remain opened and for me it would be perfect if when i stop the script camera to turn off the lenses and remain in playback mode, it is possible? If i want to restart the script lens to open again, and so on.

I am using a Canon SX230 , if there are users using the same camera, can post the parameters used, please? I'm using the camera on a rc airplane for photomapping.

Thank you.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 25 / January / 2014, 16:44:24
I'm using it with remote control function: i'm starting the camera in Playback mode (lens closed) and i'm playing with the voltage supplied on the camera mini usb connector ( 0v-5v) to start and stop the script.
Now if i'm stopping the script the lens remain opened and for me it would be perfect if when i stop the script camera to turn off the lenses and remain in playback mode, it is possible? If i want to restart the script lens to open again, and so on.
Script updated to version 1.6   When USB control is enabled and USB power is "Off" then the camera will be placed into playback mode.  When USB control is enabled and USB power is "On" then camera is placed into shooting mode.

Set the Canon lens retract parameter to 0 Seconds if you want the lens to retract as soon as USB power is removed.

Edit : fixed new version number.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 26 / January / 2014, 01:47:38
Thank you !

Can you please tell me from where i can download v1.7?

I have tried here   http://chdk.wikia.com/wiki/KAP_%26_UAV_Exposure_Control_Script (http://chdk.wikia.com/wiki/KAP_%26_UAV_Exposure_Control_Script)    but it seems that is v1.6
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 26 / January / 2014, 03:11:50
Can you please tell me from where i can download v1.7? I have tried here   http://chdk.wikia.com/wiki/KAP_%26_UAV_Exposure_Control_Script (http://chdk.wikia.com/wiki/KAP_%26_UAV_Exposure_Control_Script)    but it seems that is v1.6
There is no 1.7 - I meant to say 1.6. 

Sorry.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 26 / January / 2014, 11:06:20

Set the Canon lens retract parameter to 0 Seconds if you want the lens to retract as soon as USB power is removed.

Edit : fixed new version number.

I have tried the v1.6 and , now, when i remove power from usb the camera enter in playback mode , GREAT!

Sorry for asking but can you point me to the parameter that is responsible to retract the lens ? What exactly i must modify and where on the script?

Many thanks!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 26 / January / 2014, 11:39:00
Sorry for asking but can you point me to the parameter that is responsible to retract the lens ? What exactly i must modify and where on the script?
I'm not sure what it is that you think you want to modify?  Lens retract delay is done by setting that value in the Canon menus.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 26 / January / 2014, 11:55:54
Sorry for asking but can you point me to the parameter that is responsible to retract the lens ? What exactly i must modify and where on the script?
I'm not sure what it is that you think you want to modify?  Lens retract delay is done by setting that value in the Canon menus.

Now i have understood, the parameter that you talked about if from the Canon menu.

I have made a trial and is working as expected, THANK YOU!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 26 / January / 2014, 12:35:47
Now i have understood, the parameter that you talked about if from the Canon menu.
I have made a trial and is working as expected, THANK YOU!
Thank you too.  I think its a good upgrade to the script.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 03 / February / 2014, 20:37:33
Thanks waterwingz for the amazing script.  8)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 03 / February / 2014, 20:49:42
Thanks waterwingz for the amazing script.  8)
You're welcome.  But to be clear,  equal credit goes to peabody (http://chdk.setepontos.com/index.php?action=profile;u=7384)  (a.k.a. wayback).  It was very much a joint effort.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: campingkaper on 18 / February / 2014, 20:52:22
First off waterwingz you are a GOD among kapers i love your script it has been well needed for a long time.
and of course once you get something you like you always want more ........can your script be altered
to include  video recording  so that stills and video can be taken on the same flight ?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / February / 2014, 21:39:19
can your script be altered to include  video recording  so that stills and video can be taken on the same flight ?
Its just a script and as such always possible to modify.  How would you see this working?  Take a short video every so many seconds with video duration and interval user defined? Or trigger video mode via the USB remote input?  Or both, I guess.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: campingkaper on 19 / February / 2014, 03:44:35
you hit the nail right on the head .... now since i do not know how to write code
what will it take to bribe a fine upstanding techno superior being like yourself
waterwingz to alter your KAP script i am sure all the high altitude balloon people will love the alteration too. 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Microfunguy on 19 / February / 2014, 05:39:11
Deleted.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 26 / February / 2014, 00:16:44
Is anyone using a canon s100/110?

Does it have an adjustable iris and nd filter? Can't seem to find any info around on this.

I've done a couple of test runs so far with 1/1250 shutter with AVmode set to none, but I'm getting a lot of overexposed and blurry images.

Also what's the best focus at infinity mode to use with this camera? I'm currently using AFL and it seems to show focus set to infinity in the kap.log. 'aflock' didn't seem to work.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 26 / February / 2014, 00:25:18
Does it have an adjustable iris and nd filter? Can't seem to find any info around on this.
I've done a couple of test runs so far with 1/1250 shutter with AVmode set to none, but I'm getting a lot of overexposed and blurry images.
They have both.   The next release of the script will force the ND filter off if the user does not select a mode that allows it.  Apparently several people have set the AVmode to no ND filter on cameras that actually have one,  and that can throw things off.  So will setting AVmode to none when your camera has an adjustable iris and an ND filter.

Quote
Also what's the best focus at infinity mode to use with this camera? I'm currently using AFL and it seems to show focus set to infinity in the kap.log. 'aflock' didn't seem to work.
While we continue to sort the whole SD override thing out, if you have something that works,  use it.   We are getting really close now.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 26 / February / 2014, 03:14:36
Thanks for that. I'll give it a run tomorrow with avmode set to both.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 09 / March / 2014, 23:02:23
Is there a way to keep the HDMI port active while the script is running? It works until the script starts, then it seems to stop outputting to the HDMI port.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 10 / March / 2014, 00:08:12
Is there a way to keep the HDMI port active while the script is running? It works until the script starts, then it seems to stop outputting to the HDMI port.
Most of  my cameras have an HDMI port so I've never tried to use it.   Does it stop outputting to the HDMI port when you run any script or just with the kap_uav.lua script?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 10 / March / 2014, 01:24:05
Most of  my cameras have an HDMI port so I've never tried to use it.   Does it stop outputting to the HDMI port when you run any script or just with the kap_uav.lua script?

Yeah it stops outputting the HDMI signal with other scripts too. I just wondered if you knew a way around it?

I've ordered a few 11 pin micro USB plugs to try hacking into a cable so that I can get the analog video out through there, but they're still somewhere in the postal system. Thought if I didn't need to trigger via USB that I could at least get the HDMI live view so that I could frame shots and run it on an intervalometer, but maybe not :/
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 10 / March / 2014, 02:28:38
Is there a way to keep the HDMI port active while the script is running? It works until the script starts, then it seems to stop outputting to the HDMI port.
Most (if not all) cameras are incapable of outputting HDMI while in shooting mode.

Does it work if you switch the camera to shooting mode without the script?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Wreck on 10 / March / 2014, 05:53:38
Most (if not all) cameras are incapable of outputting HDMI while in shooting mode.

Does it work if you switch the camera to shooting mode without the script?

No, switching to shooting mode without the script also stops the HDMI output. I guess I just got used to the luxury of live HDMI output from my nex5 and figured other cameras must do it.

The 11 pin mini usb plug will have to be the thing to use then.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 10 / March / 2014, 13:09:14
The 11 pin mini usb plug will have to be the thing to use then.
I'm not clear which camera you are using, but it's not necessarily safe to assume it will support video out in shooting mode using the analog out either. The Canon manual should tell you if it does, see discussion in http://chdk.setepontos.com/index.php?topic=11290.10 (http://chdk.setepontos.com/index.php?topic=11290.10)

From the Canon manuals, it looks like the S100 and s110 do support analog video out in shooting mode.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 14 / March / 2014, 10:04:19
Hi waterwingz,
Can the interval part of the script be bypassed and the camera be triggered through the USB with a CHDK cable instead?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 14 / March / 2014, 22:39:19
Oops  :-[ should have read the wiki a little closer. This is stated under features:
shooting enable / disable via USB remote signal
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 14 / March / 2014, 23:24:05
Hi waterwingz,
Can the interval part of the script be bypassed and the camera be triggered through the USB with a CHDK cable instead?
Oops  :-[ should have read the wiki a little closer. This is stated under features:
shooting enable / disable via USB remote signal
The feature enables/disables interval shooting.  So when USB remote is active, the script shoots at whatever rate you have specified in the script parameters.  Probably fine for most applications but it does not give you one shot per USB activation if that's what you were looking for.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 16 / March / 2014, 19:02:16
Here's a link to a tutorial that shows how to use a flight controller to trigger a camera running CHDK based on distance intervals as the vehicle travels.

http://diydrones.com/profiles/blogs/apm-to-chdk-camera-link-tutorial (http://diydrones.com/profiles/blogs/apm-to-chdk-camera-link-tutorial)

Would your script work with something like this?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 16 / March / 2014, 19:30:23
Here's a link to a tutorial that shows how to use a flight controller to trigger a camera running CHDK based on distance intervals as the vehicle travels.

http://diydrones.com/profiles/blogs/apm-to-chdk-camera-link-tutorial (http://diydrones.com/profiles/blogs/apm-to-chdk-camera-link-tutorial)

Would your script work with something like this?
Wow,  that page and all the ones it links to are a whole new world.  Lots of CHDK references there too - nice to see.

It would be a small change to make kap_uav.lua work with the Ardupilot.  If you are interested and have the actual hardware to do some testing then let me know?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 16 / March / 2014, 22:36:22
I am very interested  :) and do have the hardware to do the testing.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 16 / March / 2014, 22:48:59
I am very interested  :) and do have the hardware to do the testing.
Okay - game on.

The script he posts is pretty funny :  http://www.event38.com/v/vspfiles/downloadables/E38_APM.bas (http://www.event38.com/v/vspfiles/downloadables/E38_APM.bas) There is no way for that code to ever reach the :terminate label.  There are a few other laughs too.

So what do you want to be able to do from the ArduPilot Mega ?  Can you program that end?  Simply telling the CHDK script to shoot is easy.  Shutdown mode too.  What about switching to video and back on command?  Or zoom in / out?   All possible from the CHDK end but I can't really help you (much) with programming the ArduPilot Mega unless there is more documentation somewhere online.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 17 / March / 2014, 01:04:10
So what do you want to be able to do from the ArduPilot Mega ?  Can you program that end?  Simply telling the CHDK script to shoot is easy.  Shutdown mode too.  What about switching to video and back on command?  Or zoom in / out?   All possible from the CHDK end but I can't really help you (much) with programming the ArduPilot Mega unless there is more documentation somewhere online.
The setup outlined in the link I posted is designed to be used for aerial mapping. It would be great to use it in conjunction with your scripts ability to set the camera parameters for taking good photos from a moving object. Something that would be nice to add to your script, for this setup, would be to have it turn the camera off after a set number of photos are taken. This would cause the lens to retract and make for safer landings. There are probably more things to suggest, but I'm getting tired and my brain is getting fuzzy.

Here are a couple more links to help give you an idea of the possibilities:
http://diydrones.com/profiles/blogs/how-to-plan-missions-for-aerial-survey (http://diydrones.com/profiles/blogs/how-to-plan-missions-for-aerial-survey)

and (you may have already seen reference to the following the link) another method for connecting the APM to a CHDK enabled camera:
http://plane.ardupilot.com/wiki/common-chdk-camera-control-tutorial/ (http://plane.ardupilot.com/wiki/common-chdk-camera-control-tutorial/)

More tormorrow :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / March / 2014, 08:39:33
The setup outlined in the link I posted is designed to be used for aerial mapping. It would be great to use it in conjunction with your scripts ability to set the camera parameters for taking good photos from a moving object.
There is a discussion about doing aerial mapping (with pictures at the end) in this forum thread : http://chdk.setepontos.com/index.php?topic=8984 (http://chdk.setepontos.com/index.php?topic=8984) .   Most of the discussion is about getting the shot rate as fast as possible to provide maximum overlap in images.  Unfortunately, the best way to do this is to lock exposure, zoom, and focus so that the camera can fire at its maximum rate.

Quote
Something that would be nice to add to your script, for this setup, would be to have it turn the camera off after a set number of photos are taken. This would cause the lens to retract and make for safer landings.
Ummm ... you mean by using the existing script parameter settings to define the Total Shots and then selecting the Power off when done? option?   :-[

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2Fyv5jkW7.png&hash=7ea363e0ed49626d9f49fbc1c9ae1503)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 17 / March / 2014, 14:00:38
There is a discussion about doing aerial mapping (with pictures at the end) in this forum thread : http://chdk.setepontos.com/index.php?topic=8984 (http://chdk.setepontos.com/index.php?topic=8984) .   Most of the discussion is about getting the shot rate as fast as possible to provide maximum overlap in images.  Unfortunately, the best way to do this is to lock exposure, zoom, and focus so that the camera can fire at its maximum rate.
I'm not interested in getting as many shots as quick as possible. I would rather control where the pictures are taken and the quality of the pictures to make the whole system as efficient as possible, including post processing of the photos.

Quote
Ummm ... you mean by using the existing script parameter settings to define the Total Shots and then selecting the Power off when done? option?   :-[

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2Fyv5jkW7.png&hash=7ea363e0ed49626d9f49fbc1c9ae1503)
:-[ uhh... yes that's exactly what I was suggesting, so would your script work, as it is, to have the APM trigger the camera and your script control the camera parameters? Would I set the shot interval to 0 so the shots are just triggered by the APM/USB?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 17 / March / 2014, 14:05:16
We had some snow here yesterday, but it's warming up nicely today. To wet to play outside today though. It is suppose to be nice the rest of the week, so I should be able to do some real testing then. In the meantime, I'll set my rig up inside close to a window to see if can do some testing.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / March / 2014, 18:54:14
so would your script work, as it is, to have the APM trigger the camera and your script control the camera parameters? Would I set the shot interval to 0 so the shots are just triggered by the APM/USB?
Maybe.  It will depend on how the APM trigger was configured.  If the trigger turns on the 5V USB signal and leaves it on when pictures are required, the script will happily shoot continuously if the shot interval is set to 0.   

But if the APM simply pulses the USB signal for less that 500 mSec then the script might or might not take a picture after each pulse. And shorter pulse widths will be less likely to succeed.

It would be trivial to modify the script to handle the second scenario.  I would also be easy to trigger a camera shutdown by using a longer pulse,  as suggested in some of the documentation that you linked.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 17 / March / 2014, 23:45:24
But if the APM simply pulses the USB signal for less that 500 mSec then the script might or might not take a picture after each pulse. And shorter pulse widths will be less likely to succeed.

It would be trivial to modify the script to handle the second scenario.  I would also be easy to trigger a camera shutdown by using a longer pulse,  as suggested in some of the documentation that you linked.

In his tutorial, he sets 4 Camera parameters in the APM:

1) CAM_TRIGG_TYPE - how to trigger the camera to take a picture. Two options; 0=Servo, 1=Relay. In the tutorial he used the value 1 (relay).

2) CAM_DURATION - How long the shutter will be held open in 10ths of a second (i.e. enter 10 for 1second, 50 for 5seconds). Range 0 to 50. In the tutorial he used the value 1 (1/10th of a second).

3) CAM_TRIGG_DIST - Distance in meters between camera triggers. If this value is non-zero then the camera will trigger whenever the GPS position changes by this number of meters regardless of what mode the APM is in. Note that this parameter can also be set in an auto mission using the DO_SET_CAM_TRIGG_DIST command, allowing you to enable/disable the triggering of the camera during the flight. Range: 0 to 1000.

 4) RELAY_PIN - Digital pin number for first relay control. This is the pin used for camera control. In the tutorial he used the value 13. This is the A9 pin on the APM that he plugged the USB cable into.

If I interpret this right, it looks like if you set the distance to 10 meters. Every time the vehicle reaches a 10 meter interval, calculated from GPS readings, a pulse that last 1/10th of a second is sent to the camera USB port via the A9 pin on the APM. If this is correct, could it be made to work as the triggering mechanism with your script?

Here's a link to the page that list the CAM_Parameters for the APM:
http://copter.ardupilot.com/wiki/arducopter-parameters/#CAM__Parameters (http://copter.ardupilot.com/wiki/arducopter-parameters/#CAM__Parameters)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / March / 2014, 08:33:30
If I interpret this right, it looks like if you set the distance to 10 meters. Every time the vehicle reaches a 10 meter interval, calculated from GPS readings, a pulse that last 1/10th of a second is sent to the camera USB port via the A9 pin on the APM. If this is correct, could it be made to work as the triggering mechanism with your script?
This is very close. 

The current script (for no particular reason) only checks the USB status ever 1/2 second while waiting for it to activate.  If you make a small edit to the script (line484)  you can have it check every 20 mSec (with no ill effect) like this:
Code: [Select]
repeat wait_click(20) until ((get_usb_power(1) == 1) or ( is_key("menu")))Alternatively,  you could change the value of  CAM_DURATION  to 600 and get the same result (albeit with a slightly slower average response speed).

Update :  are you planning on a copter or plane approach?  I think I found the source on that site, look at it now. Doesn't look like it supports a "shut down" pulse though
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 18 / March / 2014, 12:39:43
This is very close. 

The current script (for no particular reason) only checks the USB status ever 1/2 second while waiting for it to activate.  If you make a small edit to the script (line484)  you can have it check every 20 mSec (with no ill effect) like this:
Code: [Select]
repeat wait_click(20) until ((get_usb_power(1) == 1) or ( is_key("menu")))Alternatively,  you could change the value of  CAM_DURATION  to 600 and get the same result (albeit with a slightly slower average response speed).
Cool  8) thanks, I'll take a shot at modifying the script.
Quote
Update :  are you planning on a copter or plane approach?  I think I found the source on that site, look at it now. Doesn't look like it supports a "shut down" pulse though
Right now I'm using a copter, but plan on also using a plane down the road. A plane can stay aloft quite a bit longer on the same amount of power. Will your script still shut off the camera after the set number of photos is reached?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / March / 2014, 13:01:15
Cool  8) thanks, I'll take a shot at modifying the script.
You also need to make the same change on line 383 of the 1.6 version of the script. Note that the script will wait for the first pulse to actually switch into shooting mode, extend the lens, and set the zoom position.

I'll make the same changes in the next release of the script.

Quote
Right now I'm using a copter, but plan on also using a plane down the road. A plane can stay aloft quite a bit longer on the same amount of power.
The only issue with using a plane then is the speed over the ground. The fastest the script can shoot will vary a bit from camera to camera but you can probably assume 3 seconds per shot for planning purposes.

Quote
Will your script still shut off the camera after the set number of photos is reached?
Depending on how you configure it,  it will either put the camera into playback mode (and thus withdraw the lens) or completely shut the camera down.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bisenberger on 18 / March / 2014, 23:24:18
Hopefully the wind will die down soon so I can do a real test.  :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: philgib on 22 / March / 2014, 12:03:35
Hi,

Thank you for this much improved script.

As much as I like this script, I cannot seem to be able to keep any settings changes...
When I switch the camera off (Canon A2500), all data is back to start...

Thank you
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / March / 2014, 12:10:07
As much as I like this script, I cannot seem to be able to keep any settings changes...
When I switch the camera off (Canon A2500), all data is back to start...
Nothing to do with the script itself, its an ongoing problem with the 1.3.0 version of CHDK. 
http://chdk.setepontos.com/index.php?topic=6179.msg111409#msg111409 (http://chdk.setepontos.com/index.php?topic=6179.msg111409#msg111409)
I can't tell from the thread if its been totally resolved but you might want to grab the latest update from the autobuild server.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 22 / March / 2014, 19:50:54
As much as I like this script, I cannot seem to be able to keep any settings changes...
When I switch the camera off (Canon A2500), all data is back to start...
Nothing to do with the script itself, its an ongoing problem with the 1.3.0 version of CHDK. 
http://chdk.setepontos.com/index.php?topic=6179.msg111409#msg111409 (http://chdk.setepontos.com/index.php?topic=6179.msg111409#msg111409)
I can't tell from the thread if its been totally resolved but you might want to grab the latest update from the autobuild server.
A fix for this is in trunk autobuild 3392 and later. Let us know if the settings still aren't saving. There may be other issues involved.

For script specific parameters (rather than CHDK settings), there are cases where they aren't saved correctly if you don't run the script between setting the parameters and rebooting.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / March / 2014, 22:07:48
For script specific parameters (rather than CHDK settings), there are cases where they aren't saved correctly if you don't run the script between setting the parameters and rebooting.
Feels good to know I'm not completely crazy ..
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: philmoz on 22 / March / 2014, 22:45:21
For script specific parameters (rather than CHDK settings), there are cases where they aren't saved correctly if you don't run the script between setting the parameters and rebooting.
Feels good to know I'm not completely crazy ..

Should be fixed in revision 3394 (trunk).

Phil.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / March / 2014, 22:54:10
Script updated to v2.2 :  LINK (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script)

Principal changes include the addition of interleaved video modes,  improved focus at infinity for CHDK 1.2.0 and 1.3.0,  automatic camera ND filter & aperture detection,  and "much much more".

Feedback on bugs, bumps in the night, and/or things not working as expected are all appreciated.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 23 / March / 2014, 17:41:35
Hello all,

I am using v1.6 on a Canon SX230(CHDK activated using remote control,4 sec delay between pictures, TV max 1600) , the camera is installed on a flying wing.

The script is very good, but I have difficulties in choosing the best script parameters.

I have made some flights in the past days and it seems that around 50% of the pictures are not so sharp/clear.

During my flights i have the parameter "focus at infinity mode - none" , to what value do you recommend to change it ?

If there are users that are using same camera can they post please their settings?

Thank you.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 23 / March / 2014, 17:55:01
I have made some flights in the past days and it seems that around 50% of the pictures are not so sharp/clear.
Looking at the images,  can you decide if it's a focus issue or a shutter speed (motion) issue?

Quote
During my flights i have the parameter "focus at infinity mode - none" , to what value do you recommend to change it ?
Using that parameter to set focus at infinity has a couple of advantage.  First of all,  the camera will not accidentally focus on the kite string.  Secondly, to avoid issues if there is a lot of motion and it has trouble finding a focus point, setting at infinity is a safe setting.  FInally, the camera will tend to cycle shots more quickly if it does not have to focus between shots. 

I'd recommend updating to the 2.2 version of the script - it has a much enhanced focus at infinity ability.  It gets even better if you update to the current 1.3.0 version of CHDK.  In either case,  experiment on the ground with the different modes - some of them will not work with the stable version of CHDK (1.2.0).   The 2.2 version of the script will warm you when that happens.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 23 / March / 2014, 18:06:56
I have made some flights in the past days and it seems that around 50% of the pictures are not so sharp/clear.
Looking at the images,  can you decide if it's a focus issue or a shutter speed (motion) issue?


I do not have the proper "eyes" to see from where it could come the issue ,  maybe you can take a look, i have on the link below some pictures as example and the final result ( multiple pictures put together with Microsoft ICE). Please tell me your point of view.

http://fastupload.rol.ro/590e4167ad13aae0f4510f36556513d4.html (http://fastupload.rol.ro/590e4167ad13aae0f4510f36556513d4.html)

Quote
During my flights i have the parameter "focus at infinity mode - none" , to what value do you recommend to change it ?
Using that parameter to set focus at infinity has a couple of advantage.  First of all,  the camera will not accidentally focus on the kite string.  Secondly, to avoid issues if there is a lot of motion and it has trouble finding a focus point, setting at infinity is a safe setting.  FInally, the camera will tend to cycle shots more quickly if it does not have to focus between shots. 

I'd recommend updating to the 2.2 version of the script - it has a much enhanced focus at infinity ability.  It gets even better if you update to the current 1.3.0 version of CHDK.  In either case,  experiment on the ground with the different modes - some of them will not work with the stable version of CHDK (1.2.0).   The 2.2 version of the script will warm you when that happens.

It is working too well with v 1.6 to change it :) . I will do some more tests with this version and after this i will jump to v 2.2 .
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 23 / March / 2014, 18:16:50
I do not have the proper "eyes" to see from where it could come the issue ,  maybe you can take a look, i have on the link below some pictures as example and the final result ( multiple pictures put together with Microsoft ICE). Please tell me your point of view.
It would be better to post some examples of the "bad" images using the original file. This would give us the most chance of understanding the problem, and we wouldn't have to download the whole >100 meg zip.

That said, if you aren't forcing the camera to focus at infinity in some way, there is a very good chance that is the problem.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 23 / March / 2014, 19:41:52
I do not have the proper "eyes" to see from where it could come the issue ,  maybe you can take a look, i have on the link below some pictures as example and the final result ( multiple pictures put together with Microsoft ICE). Please tell me your point of view.
Like reyalp suggests,  this will be a lot easier if you would just attach two images here - one that you think is good and one that is bad.  The composite image you posted dragged my machine to its knees for a couple of minutes.

From the images I could see - and I'm not a pixel peeper - the issue seems to be focus rather than motion blur.  Unfortunately,  Canon in its wisdom does not embed focus distance information in its exif data.  Did you happen to enable logging in the script?  Focus distance of each shot is recorded there.

Quote
It is working too well with v 1.6 to change it :) . I will do some more tests with this version and after this i will jump to v 2.2 .
Good to hear.  But as I said, the focus at infinity code is much improved in 2.2
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: philgib on 26 / March / 2014, 04:33:36
I believe the following issue is purely KAP_UAV related

I decided to re-installed CHDK for A2500 along with latest KAP_UAV which used to work perfectly on previous versions. I am perfectly aware that the A2500 is a pre-alpha  :-X

With the new version of KAP_UAV I have now the following msg :
*** STARTED ***
KAP 2-2 started - Press Menu to exit
CHDK 1.3.0-3250 a2500 100a Nov 28 2013
CHDK 1.2.0 build 3276 or higher required
*** FINISHED ***

So my beloved kap_uav script is on strike. Is CHDK 1.3.0 not higher than 1.2.0 ?  :haha :P
FYI, other scripts installed per default still work well (intervalometer, etc...)

*** UPDATE
I kept CHDK 1.3 but downgraded to KAP_UAV 1.2 and guess what ? It works fine but also saves the script parameters values !

Hope that helps.

Phil
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 26 / March / 2014, 07:15:27
tl;dr >  use the most recent CHDK 1.3.0 to run kap_uav version 2.2

I believe the following issue is purely KAP_UAV related
Actually,  it's not.  Both the 1.2, 1.6 and 2.2 versions of the script are just fine.

But I can see how you could be confused about it.

Quote
With the new version of KAP_UAV I have now the following msg :
*** STARTED ***
KAP 2-2 started - Press Menu to exit
CHDK 1.3.0-3250 a2500 100a Nov 28 2013
CHDK 1.2.0 build 3276 or higher required
*** FINISHED ***
So my beloved kap_uav script is on strike.
This tells me you are running the 3250 build of  CHDK release 1.3.0.  That's an older version of CHDK 1.3.0 released prior to the problems with saving script parameters and before the changes to SD overrides that the 2.2 version of kap_uav.lua needs when using CHDK 1.3.0

So the script correctly refused to run.

Quote
Is CHDK 1.3.0 not higher than 1.2.0 ?
This is probably why you are confused.  The source code for all versions of CHDK are kept in same svn version control repository.  When an change is made to any version,  the revision number for the whole repository increments.  So CHDK 1.3.0-3250 is actually older than CHDK 1.2.0-3275 in terms of what version of the code repository it was built from, even though it may contain changes and updates not found in CHDK 1.2.0-3275.

If that's confusing,  you'll just have to trust me on that one.

Compounding this confusion (and hence the deceptive error message) is the fact that the 2.2 version of the script will work with older versions of CHDK 1.2.0, which do not have the SD override updates used for "focus at infinity". When the script see 1.2.0, it uses older (inferior) methods to try and set focus at infinity.  It could probably also do that for older versions of 1.3.0 but doesn't.

Quote
FYI, other scripts installed per default still work well (intervalometer, etc...)
They will as long as they are not trying to use the new features of 1.3.0

Quote
*** UPDATE
I kept CHDK 1.3 but downgraded to KAP_UAV 1.2 and guess what ? It works fine but also saves the script parameters values !
Proving my point.  kap_uav 1.2 does not use the new MF features of 1.3.0 and so does not need a recent version of 1.3.0  And the old version of 1.3.0 you are using did not have the problem with saving script parameters.  (Incidentally,   kap_uav 1.6 (https://app.box.com/s/4zne4yiytqv41flp44i7) is the most recent version that does not need an up-to-date 1.3.0 release)

The answer here is to update your CHDK 1.3.0 version to 3394 or newer (which has the fix for the script parameter bug and the new SD overrride MF code) and you should be back in business for the most recent 2.2 version of kap_uav.lua !
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 29 / March / 2014, 04:14:09

From the images I could see - and I'm not a pixel peeper - the issue seems to be focus rather than motion blur.  Unfortunately,  Canon in its wisdom does not embed focus distance information in its exif data.  Did you happen to enable logging in the script?  Focus distance of each shot is recorded there.


Hello,

This morning i have made some flights using v2.2 and settings at infinity mode @shot :

http://www.myap.ro/kap-script-v-2-2-trials/ (http://www.myap.ro/kap-script-v-2-2-trials/)

In the topic there are OK and NOK pictures and also the KAP log.

I observed on the log that I am using CHDK 1.2.0-3338 , this could affect somehow the "focus at infinity mode" performances?

Thank you.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 29 / March / 2014, 09:34:23
This morning i have made some flights using v2.2 and settings at infinity mode @shot :
I observed on the log that I am using CHDK 1.2.0-3338 , this could affect somehow the "focus at infinity mode" performances?
According to your log,  only a few of your shots were actually focused at infinity.  Some are focused as close as .2 meters.

And according to reported test results for the sx230,  the @shot mode will not work.   

Please try setting the "focus at infinity mode" to MF .

Update :  IMG_4723 is marked as good while IMG_4724 is marked as bad.  Both have their focus set at 3.2m.  So something else is affected the image quality.  But the focus setting is not helping. Unfortunately, none of the images in your sample set (good or bad) are focused at infinity.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 29 / March / 2014, 10:00:12
This morning i have made some flights using v2.2 and settings at infinity mode @shot :
I observed on the log that I am using CHDK 1.2.0-3338 , this could affect somehow the "focus at infinity mode" performances?
According to your log,  only a few of your shots were actually focused at infinity.  Some are focused as close as .2 meters.

And according to reported test results for the sx230,  the @shot mode will not work.   

Please try setting the "focus at infinity mode" to MF .

Update :  IMG_4723 is marked as good while IMG_4724 is marked as bad.  Both have their focus set at 3.2m.  So something else is affected the image quality.  But the focus setting is not helping. Unfortunately, none of the images in your sample set (good or bad) are focused at infinity.

Thanks for the advices I will do another flight with focus at infinity mode set to MF and come with the feedback.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 29 / March / 2014, 10:35:06
Thanks for the advices I will do another flight with focus at infinity mode set to MF and come with the feedback.
You might want to delete the log file from your SD card prior to the test.  Each test adds to the previous one so it can get pretty big.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 29 / March / 2014, 10:56:51
Thanks for the advices I will do another flight with focus at infinity mode set to MF and come with the feedback.
You might want to delete the log file from your SD card prior to the test.  Each test adds to the previous one so it can get pretty big.

I have made an indoor test using MF but i have an error on the screen : 218: native calls disabled and the script stops.

Using AFL the script is running with no issues.

I have attached the last information from the KAP log.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 29 / March / 2014, 11:00:28
Thanks for the advices I will do another flight with focus at infinity mode set to MF and come with the feedback.
You might want to delete the log file from your SD card prior to the test.  Each test adds to the previous one so it can get pretty big.

I have made an indoor test using MF but i have an error on the screen : 218: native calls disabled and the script stops.

Using AFL the script is running with no issues.

I have attached the last information from the KAP log.
The new log shows the camera going into AFL mode but the focus is not being set to infinity.

To get rid of the error message (if you want to try MF mode),  go to the CHDK Miscellaneous menu and select "Enable Lua Native Calls".

You might want to upgrade to CHDK 1.3.0 if you continue to have focus issues.  The MF & AFL code are completely rewritten in the 1.3.0 and will work much more reliably.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 30 / March / 2014, 14:42:38
Hi Waterwingz,

Today i had the chance to do some flights with  CHDK 1.3.0-3402 sx230hs , KAP v2.2 - i have tried MF  also AFL modes. Looking at the KAP log it seems that during AFL the focus was set to infinity in the majority of cases while on MF only few times.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 30 / March / 2014, 14:57:58
Today i had the chance to do some flights with  CHDK 1.3.0-3402 sx230hs , KAP v2.2 - i have tried MF  also AFL modes. Looking at the KAP log it seems that during AFL the focus was set to infinity in the majority of cases while on MF only few times.
Thanks for the log !  Seems to be related to stopping and restarting shooting via the USB signal.

It looks like the camera drops out of MF mode when the USB signal tells it to stop and then restart shooting.    AFL mode might have that problem too - your log does not show you stopping and restarting while in AFL mode.

I'll do some testing myself and issue an update if I find something.

Update : doesn't seem to loose MF lock on my A1200.   But I've updated the script to unlock focus when the USB power =0v and relock focus when USB power returns (assuming a focus lock at infinity mode has been selected in the first place).  Download from the usual link :  kap_uav.lua version 2.3 (https://app.box.com/s/a5tbl1xasp8m3a57fclx)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 19 / April / 2014, 16:37:04
Hi Waterwingz,

Today I have made some flights using script version 2.3 , looking at the log it seems that now, using MF mode, all the pictures are focused at infinity. :)

I have noticed that , even if in the script the interval between pictures is set at 3 seconds, the pictures are captured at an interval of 2,3 or even 4 sec , what could cause this ?

And last observation , majority of pictures were blurry. In the KAP log I saw almost all over the place :  " actual: Tv:1/800" , also the sky was covered by clouds... Could I "force" somehow to have values for Tv around 1/1600 ?

Thank you.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / April / 2014, 17:17:00
I have noticed that , even if in the script the interval between pictures is set at 3 seconds, the pictures are captured at an interval of 2,3 or even 4 sec , what could cause this ?
The script is only working in 1 second increments, so some variation around the interval setpoint is to be expected.   I'll take a look at switching to milliseconds and see if I can get the interval to be more repeatable.

Quote
And last observation , majority of pictures were blurry. In the KAP log I saw almost all over the place :  " actual: Tv:1/800" , also the sky was covered by clouds... Could I "force" somehow to have values for Tv around 1/1600 ?
Blurry is not good.  The script is doing what it can with the available light.  Hoever, you have set the maximum ISO to 800 so it likely can't set the shutter speed much over 1/800 second and still get the correct exposure.

You can try allowing a higher value for ISO Max2 and/or you can force a minimum shutter speed using the TV Min setting.   If you end up with underexposed pictures,  you can usually fix that up somewhat in your computer.  Blurry tends to be permanent.

Update :  v2.4 of the script now available for download - interval timing should be more precise
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 20 / April / 2014, 02:13:40

Update :  v2.4 of the script now available for download - interval timing should be more precise

Waterwingz , you are moving SO FAST !!!

I will try today the v 2.4.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 20 / April / 2014, 12:18:41
Waterwings ,

Attached the log after 3 flights done today with v2.4.

I am using a low cost SD card, I suppose that the Write speed is not very high , maybe this could cause the issue regarding the interval between pictures ?

Today it was a very sunny weather and I have tried to do pictures both in MF and AFL mode. While analyzing the pictures it seems that during AFL mode the percentage of NOK pictures is mush smaller ( by NOK picture I mean blurry).

Thank you.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / April / 2014, 12:55:58
Attached the log after 3 flights done today with v2.4.
The log showing taking 324 seconds to take 100 shots or about 3.2 seconds per shot (if my math is correct) and you asked for a  3 second shot rate.  Pretty close.  Just for fun, what does it look like if you ask for a 5 second shot rate?

Quote
I am using a low cost SD card, I suppose that the Write speed is not very high , maybe this could cause the issue regarding the interval between pictures ?
That might make a small difference.  I can't tell from the log - do you have RAW or DNG enabled?  That would make a huge difference.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 20 / April / 2014, 13:21:35
Attached the log after 3 flights done today with v2.4.
The log showing taking 324 seconds to take 100 shots or about 3.2 seconds per shot (if my math is correct) and you asked for a  3 second shot rate.  Pretty close.  Just for fun, what does it look like if you ask for a 5 second shot rate?

Tomorrow I will try.

That might make a small difference.  I can't tell from the log - do you have RAW or DNG enabled?  That would make a huge difference.
RAW and DNG are not enabled.

To tagg the images with latitude/longitude what are the steps that I must follow ?

1.at CHDK settings/GPS-Settings - enable the GPS-CHDK;
2.tagging-Settings:
2.1. Save waypoint to each JPG- enable;
2.2. Wait for GPS signal - 300 ?!!?

Can you guide me to some instructions regarding the GPS goodies :) ?

Thank you.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / April / 2014, 13:24:13
Can you guide me to some instructions regarding the GPS goodies :) ?
Sorry - don't have a camera with GPS so I've never looked at it.  I'd be guessing, just like you.

But have you enabled this feature already?  That could slow down the shot rate I expect.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 05 / May / 2014, 16:00:12
Hi Waterwingz,

The information regarding ISO are recorded for each picture in the log ?

Or , in another words, what is the meaning of the parameters from below ( eg. Sv) :

2014May03 08:19:28 1) IMG_6422.JPG
2014May03 08:19:28  meter : Tv:1/160 Av:4.0 Sv:100 720:720
2014May03 08:19:29  actual: Tv:1/1600 Av:3.2 Sv:500
2014May03 08:19:29          AvMin:3.2 NDF:NDout foc:infinity


Thank you.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 05 / May / 2014, 19:09:28
The information regarding ISO are recorded for each picture in the log ?
Yes.

Quote
Or , in another words, what is the meaning of the parameters from below ( eg. Sv) :
2014May03 08:19:28 1) IMG_6422.JPG
2014May03 08:19:28  meter : Tv:1/160 Av:4.0 Sv:100 720:720
2014May03 08:19:29  actual: Tv:1/1600 Av:3.2 Sv:500
2014May03 08:19:29          AvMin:3.2 NDF:NDout foc:infinity
Tv , Av,  Sv are standard acronyms for Time Value (shutter speed).  Aperature Value (f-stop), and Sensitivity Value (ISO setting).

shot number :  1)
filename :    IMG_6422.JPG

meter = exposure value the camera would use if it was in Auto mode

measured brightness & measured brightness with exposure compensation :  720:720

actual = exposure value the CHDK script will force instead of the metered values

minim f-stop available at current zoom position : AvMin:3.2
neutral density filter mode                             :   NDF:NDout   ( NDin / ND out)
focus :                                                        :  foc:infinity
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 06 / May / 2014, 14:54:00
Thanks a lot !

Today I have done 2 flights using the same value for shutter speed but using different values for ISO ( I am working to find the best camera settings).

After the flights while looking at the pictures I observed that the pictures from the second flight are more blurry , the reason could be the weird value for shutter speed from the KAP log (the value is totally different from my settings, I have as target 1/1600 and the pictures are at 1/320 for example).

Is there any relation between ISO target values and Shutter speed target values (one of the parameters has "priority" comparing with the other one?).

Attached the log.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / May / 2014, 18:37:01
Today I have done 2 flights using the same value for shutter speed but using different values for ISO ( I am working to find the best camera settings).

After the flights while looking at the pictures I observed that the pictures from the second flight are more blurry , the reason could be the weird value for shutter speed from the KAP log (the value is totally different from my settings, I have as target 1/1600 and the pictures are at 1/320 for example).
Your first flight had the ISO2 limit set to 800 while second flight had the ISO2 limit set to 200.  This forced lower shutter speeds on the second flight and thus the blurring.

You might want to increase ISO2 back to 800 and maybe also set the minTV value to something like 1/800 or 1/1000 for UAV shooting.  This might give underexposed pictures but will help prevent blurring on dull days.

Is there any relation between ISO target values and Shutter speed target values (one of the parameters has "priority" comparing with the other one?).
Full documentation here : http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script#Calculation_Algorithm (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script#Calculation_Algorithm)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: afishindouban on 09 / May / 2014, 19:03:37

Hi waterwingz

Thanks for you contribution. I was using your kap_uav.lua with my fix wing to take some point down picture. But I feel there is some strange behave and some point need improve.

My camera is elph320 hs.

TV min 640, target 1000, max 2000
F min 2.8, target 4, max 8
ISO min 80 max1 400 max2 800
AFL mode

1. My flight was 300 meter high. Some picture are good, more are not good. Bad picture looks like has focus problem.

My wing is kind of stable while flying, maybe bank and pitch in 5 degree. My camera is not in perfect status because was a hard crash before. But taking picture in the ground is normal.

Is that possible camera focus ability has problem, maybe focus lock time is too long  ? How to verified it ? That bank and pitch should not cause the problem right, because shutter was really fast at 1000.

2 USB control is really working great, but the problem is the time, when I trigger it, it took 6 second to be ready for another trigger, before that if you trigger it, it just been ignored. How can I improve it ? Because if I put intervalometer camera can the picture in 3 second fastest.

Thank you so much for help me, I have been fight with camera for a long time, really hard to tune it good. Please give me some help.

I will upload the log shortly
Thanks you.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / May / 2014, 20:57:23
But I feel there is some strange behave and some point need improve.
Okay .. let's take a look.

Quote
My camera is elph320 hs.
Thanks for that.  It would be good to know what version of CHDK you are using, and the version of the script.

Quote
TV min 640, target 1000, max 2000
F min 2.8, target 4, max 8
ISO min 80 max1 400 max2 800
AFL mode
Looks pretty reasonable.

Quote
1. My flight was 300 meter high. Some picture are good, more are not good. Bad picture looks like has focus problem.
Hmmm ... so most likely causes are either low shutter speed, bad focus, UAV vibration,  or earthquakes.


Quote
My wing is kind of stable while flying, maybe bank and pitch in 5 degree. My camera is not in perfect status because was a hard crash before. But taking picture in the ground is normal.
Sound like you should be okay then.  Hard crashes really suck though - kind of like watching $100 bills burn in a bucket.

Quote
Is that possible camera focus ability has problem, maybe focus lock time is too long  ? How to verified it ?
The script locks the focus prior to the first shot.  It should not change after that, so focus lock time or focus ability should be "all good" or "all bad".  Unless the camera actually failed to lock focus that is.  Need to see the script log.

Quote
How to verified it ?
Let's start with the script log file?  Please post it here.

Quote
That bank and pitch should not cause the problem right, because shutter was really fast at 1000.
Shutter speed at 1/1000 is probably the minimum you want to use.  Faster would be better.

Quote
2 USB control is really working great, but the problem is the time, when I trigger it, it took 6 second to be ready for another trigger, before that if you trigger it, it just been ignored. How can I improve it ? Because if I put intervalometer camera can the picture in 3 second fastest.
The USB control mode was setup to start/stop intervalometer shooting when the USB power = 5V ( i.e. On).   It was really not designed for single shot shooting via USB pulses.  Obviously it could be changed to do that if necessary if you can't leave the USB on when you want the UAV to be shooting.   The nice thing about the current setup is that it retracts the lens when USB power is absent.  This slows down the cycle time but is a really nice thing to have prior to your UAV rejoining the ground.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: afishindouban on 09 / May / 2014, 22:40:44
Hi waterwingz, thank you so much for the help

here is the log file. I will post my picture also.
I can not find anything strange in the log. but the picture some are bad and some are really good.

https://plus.google.com/photos/105328353808607790727/albums/6011616743782592257

here is the picture was taking with this log. you can see from IMG1800 to 1803 was bad picture, IMG 1804 to 1808 are better, 1808 to 1013 is really good quality. picture are really big so I can not upload too much, there are more picture in bad quality. hope it help you to make some analyze.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / May / 2014, 23:28:42
I can not find anything strange in the log. but the picture some are bad and some are really good.
https://plus.google.com/photos/105328353808607790727/albums/6011616743782592257
Sorry.  Maybe it's me, but none of these pictures look very good compared to many KAP and UAV pictures I've seen taken using CHDK with less expensive cameras. 

Picture 12 of 14 is particularly confusing ... there is a small section of forest in the center of the shot that seems clear but the rest of the image appears to be under a cloud or something ?

Maybe this is because these are downsized images?  Can you post both a full size good & bad image to a file sharing site ( hint :  box.com please - no spam or dancing balony) along with the image name/number from the log file?    That would help a lot!

FWIW, the script seems to be performing well.   The log shows shutter speeds at 1/1000 min - that's good.  And the focus is reported as 'infinity" in all shots - also good.

ISO setting are fairly low.   I suspect you could jack up the Tv target to 1/2000 safely.

Not sure what else to say here.   I can't correlate the image names in the log ( IMG_1803.JPG ) to the images you kindly posted on plus.google.com.



Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: afishindouban on 09 / May / 2014, 23:44:05
Quote
Quote
My camera is elph320 hs.
Thanks for that.  It would be good to know what version of CHDK you are using, and the version of the script.

KAP 2.4 with CHDK 1.3.0-3437 ixus240_elph320hs 101a

Quote
Quote
1. My flight was 300 meter high. Some picture are good, more are not good. Bad picture looks like has focus problem.
Hmmm ... so most likely causes are either low shutter speed, bad focus, UAV vibration,  or earthquakes.

if you can check the picture and log, you will see all the shutter time are right at 1/1000. also from picture you can not see blur,  i guess is the only focus problem, please let me know if I'm wrong.

Quote
Quote
My wing is kind of stable while flying, maybe bank and pitch in 5 degree. My camera is not in perfect status because was a hard crash before. But taking picture in the ground is normal.
Sound like you should be okay then.  Hard crashes really suck though - kind of like watching $100 bills burn in a bucket.

Here I would like thanks for my Zephry II wing, so tough, I crash to a tree ar 60 meters high, and fall to the ground, just need a little fix, nothing need to replace. amazing, right ? only make me worried is my camera, test on the ground look normal, and fly in the sky still take some good picture, but more are bad picture. lololo... I shake the camera I can hear some sound inside, like some piece are not fixed.... that could be the problem ? but why still take good picture ?

Quote
Quote
Is that possible camera focus ability has problem, maybe focus lock time is too long  ? How to verified it ?
The script locks the focus prior to the first shot.  It should not change after that, so focus lock time or focus ability should be "all good" or "all bad".  Unless the camera actually failed to lock focus that is.  Need to see the script log.

what means script locks the focus prior to the first shot ?  it is not always in infinity focus ? if it is always infinity lock, why some are good some are not good? even I saw my first shot is not focus, but later some picture can focus, some can not... that is the strange thing.

Quote
Quote
How to verified it ?
Let's start with the script log file?  Please post it here.

Quote
Quote
That bank and pitch should not cause the problem right, because shutter was really fast at 1000.
Shutter speed at 1/1000 is probably the minimum you want to use.  Faster would be better.
you are right, you can see in log, all are taken in 1/1000, no blur, just no focus.

Quote
Quote
2 USB control is really working great, but the problem is the time, when I trigger it, it took 6 second to be ready for another trigger, before that if you trigger it, it just been ignored. How can I improve it ? Because if I put intervalometer camera can the picture in 3 second fastest.
The USB control mode was setup to start/stop intervalometer shooting when the USB power = 5V ( i.e. On).   It was really not designed for single shot shooting via USB pulses.  Obviously it could be changed to do that if necessary if you can't leave the USB on when you want the UAV to be shooting.   The nice thing about the current setup is that it retracts the lens when USB power is absent.  This slows down the cycle time but is a really nice thing to have prior to your UAV rejoining the ground.
[/quote]
nice to know that, sorry for I can not undersstand clear the script about USB control. but my suggestion is for UAV shooting, most of case people will need autopilot control board to control the camera shoot, not by camera intervalometer shooting, because autopilot can make camera shoot by distance, not time. by the wind, UAV can fly faster or slower, but photo need to be arranged in same distance. for that reason, can you modified the script for this purpose ? one USB pulse, one shoot, as fast response as the best. that will helps a lot.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: afishindouban on 10 / May / 2014, 00:15:04
I can not find anything strange in the log. but the picture some are bad and some are really good.
https://plus.google.com/photos/105328353808607790727/albums/6011616743782592257
Sorry.  Maybe it's me, but none of these pictures look very good compared to many KAP and UAV pictures I've seen taken using CHDK with less expensive cameras. 

Picture 12 of 14 is particularly confusing ... there is a small section of forest in the center of the shot that seems clear but the rest of the image appears to be under a cloud or something ?

Maybe this is because these are downsized images?  Can you post both a full size good & bad image to a file sharing site ( hint :  box.com please - no spam or dancing balony) along with the image name/number from the log file?    That would help a lot!

FWIW, the script seems to be performing well.   The log shows shutter speeds at 1/1000 min - that's good.  And the focus is reported as 'infinity" in all shots - also good.

ISO setting are fairly low.   I suspect you could jack up the Tv target to 1/2000 safely.

Not sure what else to say here.   I can't correlate the image names in the log ( IMG_1803.JPG ) to the images you kindly posted on plus.google.com.

it is great to know that still my picture are bad, because it means I can improve it. lololo...
https://app.box.com/s/i0vi6x5m6zx56ipqnxky  can you download the original pic with original name to have a review ? Today was not a sunny day, but cloud is not so heavy. what I am thinking is that camera set to infinity, so that is really infinity, from which distance to infinity all are focus ?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 10 / May / 2014, 00:26:12
it is great to know that still my picture are bad, because it means I can improve it. lololo...
https://app.box.com/s/i0vi6x5m6zx56ipqnxky  can you download the original pic with original name to have a review ?
Downloading now .. my slow connection will take a few moments.

Quote
Today was not a sunny day, but cloud is not so heavy. what I am thinking is that camera set to infinity, so that is really infinity, from which distance to infinity all are focus ?
Everything from about 2 meters to infinity should be in focus - the depth of field on these little camera is amazing.

Update :   not sure what to say here.  The full size images are not "sharp". Far from it.  And it does not look like a focus issue.   You might try using the simple intervalometer script included with CHDK and set the camera into "Sports" mode with ISO force to 1600.  Just to see what the camera can do on its own?  Also,  I'd be curious to see a picture taken on the ground under similar lighting conditions in Auto or P mode of the local landscape seen in these picture - with the center of the picture pointed off into the distance.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: afishindouban on 10 / May / 2014, 01:30:59
Update :   not sure what to say here.  The full size images are not "sharp". Far from it.  And it does not look like a focus issue.   You might try using the simple intervalometer script included with CHDK and set the camera into "Sports" mode with ISO force to 1600.  Just to see what the camera can do on its own?  Also,  I'd be curious to see a picture taken on the ground under similar lighting conditions in Auto or P mode of the local landscape seen in these picture - with the center of the picture pointed off into the distance.

320HS has no sports mode, I will take pic and show to you tomorrow, now here is middle night :)

but one question, you can compare the picture, for example IMG1813, 1810. the detail of the red car, and the cow. still is not good ? but you can see, at least these few picture has more detail than the others. and why you say that it is not like a focus issue?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: afishindouban on 10 / May / 2014, 01:41:20
by the way, can you post some picture of your camera shoot point down from around 300 meter high? I really want to know how good and detail could a camera make it.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 10 / May / 2014, 10:05:01
but one question, you can compare the picture, for example IMG1813, 1810. the detail of the red car, and the cow. still is not good ? but you can see, at least these few picture has more detail than the others. and why you say that it is not like a focus issue?
IMG1810 is better than most of the images but the green colors on the ground look to be all smudged.

by the way, can you post some picture of your camera shoot point down from around 300 meter high? I really want to know how good and detail could a camera make it.
I don't have any pictures of my own but these shots are what I was expecting to see :  http://chdk.setepontos.com/index.php?topic=6118.msg91326#msg91326 (http://chdk.setepontos.com/index.php?topic=6118.msg91326#msg91326)

The author of that post also has more info about UAV shooting :
http://chdk.setepontos.com/index.php?topic=10223.msg101855#msg101855 (http://chdk.setepontos.com/index.php?topic=10223.msg101855#msg101855)
including some comments about the effects of vibration for the motor.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: afishindouban on 10 / May / 2014, 20:40:36

Quote
2 USB control is really working great, but the problem is the time, when I trigger it, it took 6 second to be ready for another trigger, before that if you trigger it, it just been ignored. How can I improve it ? Because if I put intervalometer camera can the picture in 3 second fastest.
The USB control mode was setup to start/stop intervalometer shooting when the USB power = 5V ( i.e. On).   It was really not designed for single shot shooting via USB pulses.  Obviously it could be changed to do that if necessary if you can't leave the USB on when you want the UAV to be shooting.   The nice thing about the current setup is that it retracts the lens when USB power is absent.  This slows down the cycle time but is a really nice thing to have prior to your UAV rejoining the ground.
[/quote]

Hi Waterwingz, can you include a new feature into your script, let Gentled CHDK2 USB cable PWM signal trigger the camera to make a shoot? for that people can use control board to control shooting by fly distance. also control many shooting parameter during the fly.


here is the simple sample for that but in ubasic. I can help you make test.

@title gentled chdk2 script - Version 2
rem author Dave Mitchell - [email protected]
rem this script does nothing except display the state of the two transmitter joysticks that
rem correspond to the two receiver servo slots connected to the Gentled CHDK2
rem it's designed to let you test that your Gentled CHDK2 is working properly
rem
rem you can modify this script by putting whatever camera actions you like in place of the "print" statements

while 1
   do
      a = get_usb_power
   until a>0
   if a < 5 then gosub "ch1up"
   if a > 4 and a < 8 then gosub "ch1mid"
   if a > 7 and a < 11 then gosub "ch1down"
   if a > 10 and a < 14 then gosub "ch2up"
   if a > 13 and a < 17 then gosub "ch2mid"
   if a > 16 and a < 20 then gosub "ch2down"
   if a > 19 then print "error"
wend
end

:ch1up
   print "channel 1 up"
   return

:ch1mid
   print "channel 1 middle"
   return

:ch1down
   print "channel 1 down"
   return

:ch2up
   print "channel 2 up"
   return

:ch2mid
   print "channel 2 middle"
   return

:ch2down
   print "channel 2 down"
   return

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Bobo67 on 11 / May / 2014, 12:00:24
The USB control mode was setup to start/stop intervalometer shooting when the USB power = 5V ( i.e. On).   It was really not designed for single shot shooting via USB pulses.  Obviously it could be changed to do that if necessary if you can't leave the USB on when you want the UAV to be shooting.   The nice thing about the current setup is that it retracts the lens when USB power is absent.  This slows down the cycle time but is a really nice thing to have prior to your UAV rejoining the ground.

Fantastic script, thanks for you great work!
If it's possible it would be nice to have an improved version that works faster with the "usb control" because, as already reported after the "usb shot" the script shows the preview of the image (can not be disabled, or can not find how to do it) and to take the next shot it takes too many seconds, not usefull during flight with a plane for orthophoto.
With the intervallometer function and my Isux 125 i can make shots at full quality (superfine) every two seconds, superb!
With the "usb control" only every 6 seconds (too long for my X8).
I wait the V2.5 version...  :P

Bests, Marco (3DRobotics)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / May / 2014, 12:11:04
Hi Waterwingz, can you include a new feature into your script, let Gentled CHDK2 USB cable PWM signal trigger the camera to make a shoot? for that people can use control board to control shooting by fly distance. also control many shooting parameter during the fly.
I'll take a look but I don't have any Gentled stuff so somebody will need to do the testing.   

Note that on some cameras, the USB pulse width timing is pretty inaccurate.  This might need the new HP timer functions enabled.


If it's possible it would be nice to have an improved version that works faster with the "usb control" because, as already reported after the "usb shot" the script shows the preview of the image (can not be disabled, or can not find how to do it) and to take the next shot it takes too many seconds, not usefull during flight with a plane for orthophoto.
You need to disable the "preview" in the Canon menus. This is not something that CHDK controls.  On every one of my cameras, you can adjust the time that the preview is displayed - including turning the feature off.

Meanwhile,  when I look at the Gentled stuff (above),  I'll also add a "single shot via USB mode" that should be a lot faster.  The current code actually goes to playback mode between shots (to retract the lens in case you are landing) and this slows things down a lot.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Bobo67 on 11 / May / 2014, 13:36:21

You need to disable the "preview" in the Canon menus. This is not something that CHDK controls.  On every one of my cameras, you can adjust the time that the preview is displayed - including turning the feature off.

Meanwhile,  when I look at the Gentled stuff (above),  I'll also add a "single shot via USB mode" that should be a lot faster.  The current code actually goes to playback mode between shots (to retract the lens in case you are landing) and this slows things down a lot.

The "preview" in the Canon menus is disabled.
Same issue with Canon Ixus 140 and 125.
If you possible add an option to disable the preview or better some like "go to preview only if there's no usb command for x seconds", thanks!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / May / 2014, 13:48:59
The "preview" in the Canon menus is disabled. Same issue with Canon Ixus 140 and 125.
If you possible add an option to disable the preview or better some like "go to preview only if there's no usb command for x seconds", thanks!
It's because the camera goes into playback mode when USB is inactive (i.e. intervalometer off).  When I add the "single shot under USB control" mode,  you won't see that.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / May / 2014, 14:30:40
Hi Waterwingz, can you include a new feature into your script, let Gentled CHDK2 USB cable PWM signal trigger the camera to make a shoot? for that people can use control board to control shooting by fly distance. also control many shooting parameter during the fly.
What shooting parameters are you interesting in controlling mid-flight?    Other than taking an actual photograph, what kind if things would you want to change during a flight?   Zoom?  Switch to video mode?  Shoot in high speed burst mode (with exposure locked) ?  Retract lens?  Reformat the SD card?

I run out of ideas pretty quickly but am very open to suggestions.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: afishindouban on 11 / May / 2014, 18:58:10

Hi Waterwingz, can you include a new feature into your script, let Gentled CHDK2 USB cable PWM signal trigger the camera to make a shoot? for that people can use control board to control shooting by fly distance. also control many shooting parameter during the fly.
I'll take a look but I don't have any Gentled stuff so somebody will need to do the testing.   

Note that on some cameras, the USB pulse width timing is pretty inaccurate.  This might need the new HP timer functions enabled.


I will test for you.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / May / 2014, 19:03:47
I will test for you.
Thanks.  I now have all the code changes done to add the two new USB modes - single shot per USB pulse and Gentles pwm detection mode - in addition to the old mode of intervalometer while USB power is present.    Not quite sure how to tell the lens to retract in single shot per USB pulse mode though.

If I can find another hour today and my Arduino test rig will fire up and send precision pulses, I'll do some testing prior to sending you a new version.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Bobo67 on 12 / May / 2014, 08:08:18
Nice, if you want i'm here for testing the "one shot usb" function with my two Ixus.

Regards, Marco
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 14 / May / 2014, 23:14:38
I will test for you.
Nice, if you want i'm here for testing the "one shot usb" function with my two Ixus.
Here you go.  Beta release of version 2.5 of the kap_uav.lua script is here >  kap_uav_2.5_beta.zip (https://app.box.com/s/bl00mviahfedwp81hqwp)

There are new options for the USB Shot Control parameter :

Off :  USB power ignored
Interval : intervalometer runs normally when USB power is applied,  off when no power
Single :  script takes one shot every time the USB power is applied
PWM : script detects width of power pulse and calls a subroutine to a match

Notes :

Update : this has been tested with a pulse width modulated signal from an Arudino microcontroller is I'm pretty sure it works correctly.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Bobo67 on 15 / May / 2014, 09:17:08
Single usb shot work fine, thanks!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: afishindouban on 20 / May / 2014, 11:21:05
just return today, I will test and let you know.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: ausdroid on 21 / May / 2014, 03:07:12
Hi Waterwinz,

Thank you sooo much for this script.

I have an IXUS 132 and do not appear to be able to lock the camera into infinite focus. I have tried AFL and @Shot & MF but it will continue to attempt to focus with the small blue square appearing on the screen. The log shows that it is not focused at infinity, but it does not give me any errors.

Attached Log File.

Thanks.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / May / 2014, 08:01:52
I have an IXUS 132 and do not appear to be able to lock the camera into infinite focus.
What version of CHDK are you using ? (the full filename of the CHDK zip file you installed)  And what version of the script?

Quote
I have tried AFL and @Shot & MF but it will continue to attempt to focus with the small blue square appearing on the screen.
Did you disable the Canon ServoAF and ContinuousAF modes?  Those modes will override the CHDK Subject Distance Override settings.

Quote
The log shows that it is not focused at infinity, but it does not give me any errors.
Looking at the log, Canon auto-focus is probably focusing your pictures probably correctly though CHDK is unable to lock the focus (see previous comment).
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: nafraf on 21 / May / 2014, 08:32:44
I have an IXUS 132 and do not appear to be able to lock the camera into infinite focus.
What version of CHDK are you using ? (the full filename of the CHDK zip file you installed)  And what version of the script?
In log file:
Code: [Select]
2014Jun21 16:53:43 KAP 2.4 started - press MENU to exit
2014Jun21 16:53:43 CHDK 1.3.0-3387 ixus132_elph115 100b Mar 17 2014
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / May / 2014, 08:55:49
I have an IXUS 132 and do not appear to be able to lock the camera into infinite focus.
What version of CHDK are you using ? (the full filename of the CHDK zip file you installed)  And what version of the script?
In log file:
Code: [Select]
2014Jun21 16:53:43 KAP 2.4 started - press MENU to exit
2014Jun21 16:53:43 CHDK 1.3.0-3387 ixus132_elph115 100b Mar 17 2014
thanks   ;)

Meanwhile, I'll add a log of ServoAF and ContinuousAF states at the next script update, just for this reason.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: gotcha640 on 23 / May / 2014, 15:09:29
Hi there

This is my first post related to KAP, and I really appreciate the script. I took a few pics with the stock intervalometer, but all were blurry.

I'd like to ask for camera and shot specific analysis help, as far as setting the mins and maxes and such, and I'm not sure if it's better to ask here or start a new thread in the general newb forum.

I got three decently clear shots out of about 50 this morning, some cloud cover.

For now, I'm just gonna throw up the first few lines of the log:

2014May23 10:51:00 CHDK 1.2.0-3439 a495 100f May 12 2014
2014May23 10:51:00  Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2014May23 10:51:00  Av:4.0 minAv:2.8 maxAv:8.0
2014May23 10:51:00  ISOmin:100 ISO1:400 ISO2:800
2014May23 10:51:00  MF mode:0  Video:0 USB:false
2014May23 10:51:00  AvM:2 int:30 Shts:0 Dly:60 B/L:0
2014May23 10:51:00 entering start delay of 60 seconds


And a few more lines from the log:

Blurry shot:

2014May23 10:53:38 4) IMG_1535.JPG               
2014May23   10:53:39   meter   Tv:1/800   Av:4.5   
2014May23   10:53:39   actual:   Tv:1/1000   Av:-   Sv:320
2014May23   10:53:39   AvMin:3.2   NDF:NDin   foc:0.9m   


I think the "foc:0.9m" is my problem there.

Clearer shot:

2014May23 10:54:38 6) IMG_1537.JPG   IMG            
2014May23   10:54:39   meter   Tv:1/1000   Av:4.5   
2014May23   10:54:39   actual:   Tv:1/1000   Av:-   Sv:200
2014May23   10:54:39   AvMin:3.2   NDF:NDin   foc:infinity   

"foc:infinity" is the only parameter that I understand well enough to see that it's significantly different.

I intend to get out again this afternoon or tomorrow morning, and I'd like to know what I should try changing.

My preferred method of messing with this kind of thing is to save my own edits as revs, for specific conditions. I'm thinking I could set "foc:infinity" in the script, and possibly Tv min:1/1000.

Is there anything else I should be looking at, or should those two get me better pics?

Happy to post the pics, but I didnt see many others doing that.

Thanks for any help.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 24 / May / 2014, 20:34:28
I'd like to ask for camera and shot specific analysis help, as far as setting the mins and maxes and such, and I'm not sure if it's better to ask here or start a new thread in the general newb forum.
Here works fine for me - and I suspect I'll be answering most of your questions. However, I'm travelling for the next couple of days on a photography trip somewhat at "the ends of the earth" so network connectivity might make my response time a little slow.

Quote
2014May23 10:51:00  Tv:1/1000 max:1/2000 min:10 ecomp:0.0
You probably want to crank Tv max up.  Way up.

Quote
2014May23   10:53:39   AvMin:3.2   NDF:NDin   foc:0.9m   
I think the "foc:0.9m" is my problem there.
That's one problem.  With MF Mode set to zero, the script will not attempt to lock focus at infinity for you and is doing its best to autofocus instead.

Also, the ND filter is engaging - probably because its a bright day and you have set the maximum shutter speed quite slow.

Quote
My preferred method of messing with this kind of thing is to save my own edits as revs, for specific conditions. I'm thinking I could set "foc:infinity" in the script, and possibly Tv min:1/1000.
You do all that with the setup parameters in the script menu.  You can even save as many as 10 different combinations of parameters for later use.  If you are not familiar with that,  scroll down in the CHDK script menu - the kap_uav.lua script has a lot of things you can adjust to suit your application.

Quote
Happy to post the pics, but I didnt see many others doing that.
We can cross that bridge when we come to it.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: gotcha640 on 29 / May / 2014, 08:49:08
Regarding the shutter speed, the a495 specs show max shutter speed 1/2000. Will it make any difference to set it higher?

Regarding the focal length and MF mode, what's the recommended setting?

Last, the three times I've been out, a set of two AA batteries has lasted about 30 minutes. Is this expected, because the script is using a lot of processing power? Or am I doing something wrong? I've used fairly new Eneloops, and brand new disposable Duracells.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lapser on 29 / May / 2014, 13:53:35
Regarding the shutter speed, the a495 specs show max shutter speed 1/2000. Will it make any difference to set it higher?
It might, but it won't be a lot of difference. On the SX260, the shutter speed maxed out at about 1/3500. Anything faster didn't change the actual exposure of the picture.
Quote
Regarding the focal length and MF mode, what's the recommended setting?
The ideal is to set it at the hyperfocal distance, which is as close as the camera will focus and still have infinity be in focus. That way pictures of ground objects will be sharper at low altitude.

If you're setting it manually before starting the script, you could crank the focus up to infinity and then back off one notch. A script can find the hyperfocal distance and set it to that, if it has that feature.
Quote
Last, the three times I've been out, a set of two AA batteries has lasted about 30 minutes. Is this expected, because the script is using a lot of processing power? Or am I doing something wrong? I've used fairly new Eneloops, and brand new disposable Duracells.
I would try AA lithium batteries. They're advertised to last 7 times longer, so they should last a few minutes longer, at least :)  They are more expensive, though.

There may be camera settings that are using a lot of power. Image stabilization might be using a lot of juice. You could try shutting it off and see if the pictures are still sharp. GPS also uses a lot of power, if the camera has it. Shutting the display off saves about 10 or 15% power use.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 29 / May / 2014, 14:59:03
Regarding the shutter speed, the a495 specs show max shutter speed 1/2000. Will it make any difference to set it higher?
It might, but it won't be a lot of difference. On the SX260, the shutter speed maxed out at about 1/3500. Anything faster didn't change the actual exposure of the picture.
Try it and see.  Just be sure to compare the actaul images rather than reported settings.  Some cameras have been reported to go up over 1/5000.  Unlike ISO and f-stops,  this is one setting where CHDK can usually substantially extend the available range.

Quote
Quote
Regarding the focal length and MF mode, what's the recommended setting?
The ideal is to set it at the hyperfocal distance, which is as close as the camera will focus and still have infinity be in focus. That way pictures of ground objects will be sharper at low altitude.

If you're setting it manually before starting the script, you could crank the focus up to infinity and then back off one notch. A script can find the hyperfocal distance and set it to that, if it has that feature.
In practice,  using hyperfocal distance rather than infinity does not produce any measurable difference in the resulting images with Canon P&S cameras.   The lens depth of field is so high that it's not worth the effort to even try.   So for the kap_uav.lua script,  you can just have the script set the focus at infinity and be done with worrying about that.

Quote
Quote
Last, the three times I've been out, a set of two AA batteries has lasted about 30 minutes. Is this expected, because the script is using a lot of processing power? Or am I doing something wrong? I've used fairly new Eneloops, and brand new disposable Duracells.
I would try AA lithium batteries. They're advertised to last 7 times longer, so they should last a few minutes longer, at least :)  They are more expensive, though.

There may be camera settings that are using a lot of power. Image stabilization might be using a lot of juice. You could try shutting it off and see if the pictures are still sharp. GPS also uses a lot of power, if the camera has it. Shutting the display off saves about 10 or 15% power use.
Camera settings can change battery life quite a bit.  But what you need to remember is that normally these cameras power off after 30 seconds if there is no activity, resulting on a perceived long battery life.  With an intervalometer script,  the camera processor never shuts down and draws power continuously.  It's not a question of the script using a lot of processor power - it's just a question of not shutting down after a shot is taken.  The display off settings in the script parameters  can help as lapser noted.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: afishindouban on 29 / May / 2014, 18:00:07

I will test for you.
Thanks.  I now have all the code changes done to add the two new USB modes - single shot per USB pulse and Gentles pwm detection mode - in addition to the old mode of intervalometer while USB power is present.    Not quite sure how to tell the lens to retract in single shot per USB pulse mode though.

If I can find another hour today and my Arduino test rig will fire up and send precision pulses, I'll do some testing prior to sending you a new version.

Hi waterwingz, gentle PWM drive mode test ok. So good. Thank you so much. Now it's works perfect.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 30 / May / 2014, 19:45:43
Version 3.0 now posted to the CHDK KAP_UAV wiki page (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script) and download site (https://app.box.com/s/a5tbl1xasp8m3a57fclx).

Support added for single shot per usb pulse mode and gentWIRE-USB2 pwm type devices.   I also snuck in a restore of the console timeout interval (the script sets it really long on entry) and logging of the camera mode and focus modes when the script starts.

Thanks to afishindouban (http://chdk.setepontos.com/index.php?action=profile;u=26971) and Bobo67 (http://chdk.setepontos.com/index.php?action=profile;u=27336) for testing the latest changes.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bchristal on 08 / June / 2014, 08:49:10
Need quicker shot interval

Hi all,

I'm using a Elph 300 in a fixed wing for aerial mapping. I can't slow the plane down any more. The fastest I can get pictures are about 3.5 seconds apart. That just doesn't get enough overlap to build a map. What are the best settings to achieve smallest shot interval, or is that just a limitation on the camera? Also, is there a known canon point and shoot that takes that fastest pictures?

Thanks!

Brian
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / June / 2014, 09:14:20
I'm using a Elph 300 in a fixed wing for aerial mapping. I can't slow the plane down any more. The fastest I can get pictures are about 3.5 seconds apart. That just doesn't get enough overlap to build a map.
That seems a bit slow but consistent with my results.Do you have "RAW/DNG" enabled? That will slow things down.

Quote
What are the best settings to achieve smallest shot interval, or is that just a limitation on the camera?
That's a limit when you cycle through a complete "shooting" cycle.  A fast Class 10 SD card can help a bit.  After that you need a different script.   Try these on the ground and see how fast you can get :
http://chdk.wikia.com/wiki/Fast_Shooter_Intervalometer (http://chdk.wikia.com/wiki/Fast_Shooter_Intervalometer)
http://chdk.wikia.com/wiki/UBASIC/Scripts:_A_fast_%22intervalometer%22 (http://chdk.wikia.com/wiki/UBASIC/Scripts:_A_fast_%22intervalometer%22)
They can probably be tweaked a bit for UAV work if you find they work for you.

Quote
Also, is there a known canon point and shoot that takes that fastest pictures?
I don't believe anyone has done a comparison across the brand.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 08 / June / 2014, 09:51:04
What are the best settings to achieve smallest shot interval, or is that just a limitation on the camera?
That seems a bit slow but consistent with my results.Do you have "RAW/DNG" enabled? That will slow things down.
+ 'review' should be off in the Canon menu + AFL or MF to eliminate refocusing
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / June / 2014, 10:07:38
+ 'review' should be off in the Canon menu + AFL or MF to eliminate refocusing
Good point on the "review". 

FWIW, the script's "focus @ infinity" setting let's you pick AFL or MF to lock focus and warns you if it doesn't work.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bchristal on 08 / June / 2014, 10:19:36
Thanks guys!!!

Review was set at 2 seconds. Camera now snapping pictures at < 2 seconds. Can't wait to go fly. :)

Brian
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: M141 on 12 / June / 2014, 13:20:32
Hi,
I had to register, just to say big thanks to Waterwingz and everybody who have been developing this script! So thank you and awesome work!  :)

At the moment i'm using 2.4 version of script with Arducopter quadrocopter and diy brushless gimbal. Camera is ELPH300(IXUS 220HS) with 1.2.0-3418 CHDK. Not yet using usb-remote, but soon will. So far i've been done aerial mapping or just shooting generic photos.

 I'm still playing with gimbal and script settings and i have few questions:

1. What metering mode we should use in genarally? Does is make any difference for exposure or will chdk/KAP&UAV overdrive this setting anyway?

2. Not sure about what is possible with usb remote. Is it possible to do following at one flight:
 a. turn camera and script running on/off?
 b. Zoom in/out?
 c. Change camera mode between video and script mode? Recording video on/off?
I can use Arduino to generate pulses, but not sure what are actually the limits and is possible.

Also i might found two little bugs or things to improve?
1.
@param     e Exposure Comp (stops)
  @default e 6
  @values  e -2.0 -1.66 -1.33 -1.0 -0.66 0.33 0.0 0.33 0.66 1.00 1.33 1.66 2.00
  <--missing "-" for negative 0.33??

2. When using Video Interleave and Video Duration the camera stops responsing after hitting Interrupt button, when camera is taking video. Have to take battery out to reset. Interrupt works if it is done during photo shoot.

ps. sorry my english ;)
Regards Jani
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 12 / June / 2014, 13:38:41
Camera is ELPH300(IXUS 220HS) with 1.2.0-3418 CHDK.
Personally,  I only use the 1.3.0 version of CHDK.  Despite the name, it has always been very stable for me.  And it does a much better job of focusing at infinity on a lot more cameras that 1.2.0

Quote
1. What metering mode we should use in genarally? Does is make any difference for exposure or will chdk/KAP&UAV overdrive this setting anyway?
The script uses whatever metering mode is set in the camera.  It does not try to override it.

Quote
2. Not sure about what is possible with usb remote. Is it possible to do following at one flight:
 a. turn camera and script running on/off?
 b. Zoom in/out?
 c. Change camera mode between video and script mode? Recording video on/off?
I can use Arduino to generate pulses, but not sure what are actually the limits and is possible.
The latest version of the script has "place holders" where you can insert whatever code you want to run for any particular pulse width.  Changing zoom position, starting and stopping video is all possible. Turning the camera off is possible as is stopping the script.  But turning the camera on or starting the script is not possible.

Quote
@param     e Exposure Comp (stops)
  @default e 6
  @values  e -2.0 -1.66 -1.33 -1.0 -0.66 0.33 0.0 0.33 0.66 1.00 1.33 1.66 2.00
  <--missing "-" for negative 0.33??
Thanks - I'll fix that in the next update. As it stand, selecting the first 0.33 value will give you -1/3 stop ev comp, selecting the second 0.33 value gives you +1/3 stop ev comp.  It's just the label that's wrong.

Quote
2. When using Video Interleave and Video Duration the camera stops responding after hitting Interrupt button, when camera is taking video. Have to take battery out to reset. Interrupt works if it is done during photo shoot.
I'll look at that but it may not be something that I can fix.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: M141 on 12 / June / 2014, 14:47:15
Personally,  I only use the 1.3.0 version of CHDK.  Despite the name, it has always been very stable for me.  And it does a much better job of focusing at infinity on a lot more cameras that 1.2.0
I tried latest 1.3 but it hangs the camera if using Zoom position from script. It drives the zoom to correct position and then camera shuts down.

Quote
The latest version of the script has "place holders" where you can insert whatever code you want to run for any particular pulse width.  Changing zoom position, starting and stopping video is all possible. Turning the camera off is possible as is stopping the script.  But turning the camera on or starting the script is not possible.
I'll check this out after i get my usb cable done.

Quote
2. When using Video Interleave and Video Duration the camera stops responding after hitting Interrupt button, when camera is taking video. Have to take battery out to reset. Interrupt works if it is done during photo shoot.
Quote
I'll look at that but it may not be something that I can fix.
Ok. I tried more and found:
-Interrupt when recording Interleave video works ok if i hit MENU first and just after that "shoot" button. I've always started and stopped scripts just pressing Shoot button ::)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 12 / June / 2014, 19:17:32
I tried latest 1.3 but it hangs the camera if using Zoom position from script. It drives the zoom to correct position and then camera shuts down.
Strange.  What setting are you using for Focus @ Infinity Mode ?  What happens if you try None ? What if  you try one of the other options ?

Quote
Ok. I tried more and found:
-Interrupt when recording Interleave video works ok if i hit MENU first and just after that "shoot" button. I've always started and stopped scripts just pressing Shoot button ::)
Pressing the Menu key tells the script that you want it to shut down, so it gracefully stops whatever it's doing and exits.  Pressing the shutter key actually abruptly halts the script in the middle of whatever it was doing - no graceful shutdown.   This can be problematic if the script is currently recording in video mode. I don't know why but it is.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: nafraf on 12 / June / 2014, 23:46:43
I tried latest 1.3 but it hangs the camera if using Zoom position from script. It drives the zoom to correct position and then camera shuts down.
Strange.  What setting are you using for Focus @ Infinity Mode ?  What happens if you try None ? What if  you try one of the other options ?
Another possible cause of the crash is that camera requires #define CAM_NEED_SET_ZOOM_DELAY 
@M141. What is the fw version of your camera?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: M141 on 13 / June / 2014, 09:02:41
Tried another time with ixus220_elph300hs-100c-1.3.0-3462-full and KAP UAV 3.0. Camera still shuts down at least 50% of time when script has to zoom and move lens. If zoom is already in right position it seems to work better.
Strange.  What setting are you using for Focus @ Infinity Mode ?  What happens if you try None ? What if  you try one of the other options ?
Seems to hang with every settings or at least i didn't find any of them to be much better or worse. Have to test more though.

Another possible cause of the crash is that camera requires #define CAM_NEED_SET_ZOOM_DELAY 
@M141. What is the fw version of your camera?
Fw is 100C. This might be the problem or at least it is related. When camera hangs it first move the lens to correct position, then very quickly after that i hear low sound like one click and then immediately it shuts down.
I also tried different settings for IS and ND -filter, but no help from there.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 13 / June / 2014, 09:22:31
Might be worth just doing some zoom testing.  http://chdk.setepontos.com/index.php?topic=7071.msg76192#msg76192
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: nafraf on 13 / June / 2014, 17:22:07
In attachment, a test version with: #define CAM_NEED_SET_ZOOM_DELAY   300
Please test it and report the results
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 14 / June / 2014, 14:13:59
Script & loader updated to v3.1 today.

Changes include having the camera do a "half press" cycle after setting the zoom position as this has been shown to decrease subsequent set focus at infinity problems.

Also update the @param text for Exposure Compensation - the -0.33 value was missing its "minus" sign.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: M141 on 14 / June / 2014, 16:56:43
Might be worth just doing some zoom testing.  http://chdk.setepontos.com/index.php?topic=7071.msg76192#msg76192 (http://chdk.setepontos.com/index.php?topic=7071.msg76192#msg76192)
I tried zoom test script and with chdk 1.3 camera always shut down between zoom set 2 and 3. Once it went up to 5 before hang. With chdk 1.2 camera runned zoom steps 1-64 up and down multiple times without any problem.

In attachment, a test version with: #define CAM_NEED_SET_ZOOM_DELAY   300
Please test it and report the results
I tried with this version and there was no difference vs original 1.3.

Thanks for your help. As this seems not to be problem with KAP UAV script should this conversation continue in elph300 thread?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 18 / July / 2014, 01:11:12
Using v3.1 and have pushed shutter all the way up to 1/1600 and still have blurring on the 3rd or 4th image and the next is crisp.

Adding kap.log and 4 or 5 of the images.

Any thoughts or feedback is MUCH appreciated.

Uploaded 43 images to zip file and shared on dropbox, link below;
https://www.dropbox.com/s/u4m5vki1ypk4mb6/115_0717.zip (https://www.dropbox.com/s/u4m5vki1ypk4mb6/115_0717.zip)

TIA
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / July / 2014, 01:33:58
Using v3.1 and have pushed shutter all the way up to 1/1600 and still have blurring on the 3rd or 4th image and the next is crisp.
1/1600 is not really all that high - but it's a lot better than 1/100 !

However,  it looks to me like your problem is with focus rather than motion blur.  Taking a quick look at the log, a few things seem to pop out.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 18 / July / 2014, 02:38:51
AWESOMENESS!!!

Thanks for the quick reply.

Implementing all the changes you noted and will test/fly tomorrow.

Thank you again!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / July / 2014, 08:22:17
Implementing all the changes you noted and will test/fly tomorrow.
You might want to do some testing prior to flying?  Place the camera on a tripod and take some pictures where you have objects distributed between short, medium and long range.   Taking a picture down the lenght of a fence is a good example.  Then let the script run a couple of time, taking two or three picutred each run.  Check the pictures carefully on your PC to determine where the camera was focused.

We have recently run into two camera models than still will not focus properly.  The only thing currently possible is to not try to set focus at infinity for those with the script. Just select the scenery focus setting in the Canon and let the Canon autofocus try to do its job. 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 18 / July / 2014, 11:03:12
Implementing all the changes you noted and will test/fly tomorrow.
Just select the scenery focus setting in the Canon and let the Canon autofocus try to do its job.

How is this set on the sx260?

How do you disable the following:
Mode:PLAY,Continuous_AF:1,Servo_AF:1

Is there a way to dump the settings, both KAP_UAV settings and camera setting to a file?

Here is the link to the images shot this AM, and similar results.
https://www.dropbox.com/s/uok9081z8xiwdwc/140718_DCIM-1.zip (https://www.dropbox.com/s/uok9081z8xiwdwc/140718_DCIM-1.zip)

KAP.log is attached here.

Current camera AF settings;
AF Frame - center
AF Frame size - normal
Digital zoom - off
AF Point zoom - off
Servo AF - off
Continuous AF - off
AF-Assist Beam - off
MF Point zoom - off
Safety MF - off
I-Contrast - off
Blink Detect - off
IS Settings/Modes - off

The previous set of images from my initial post, the AF Frame setting was set to AF Tracking, and the only other option is Face Tracking or Center as noted above on the pics from the flight this AM.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / July / 2014, 11:35:03
Just select the scenery focus setting in the Canon and let the Canon autofocus try to do its job.
How is this set on the sx260?
I don't know - I'll have to download the sx260 manual and take a look tonight.  Looking at the log, the camera "thinks" that it's focussed at infinity.

Quote
How do you disable the following:
Mode:PLAY,Continuous_AF:1,Servo_AF:1
From what you posted below,  it looks like you now have done that. They show up in the log file that way too. Although I see you are now using "M" mode - I think that should be okay.

Quote
Is there a way to dump the settings, both KAP_UAV settings and camera setting to a file?
The kap.log file already has that for the things it cares about.

Quote
Here is the link to the images shot this AM, and similar results.
https://www.dropbox.com/s/uok9081z8xiwdwc/140718_DCIM-1.zip (https://www.dropbox.com/s/uok9081z8xiwdwc/140718_DCIM-1.zip)
Thanks - won't bet able to download until tonight.  The exposure settings in the log look strange - it will be interesting to see the actual pictures.

Quote
Current camera AF settings;
...
Servo AF - off
Continuous AF - off
...
The kap.log file show these as being disable too - that's good.


Quote
IS Settings/Modes - off
You probably want to leave the IS (image stabilization) modes enabled.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 18 / July / 2014, 12:53:59
Quote
IS Settings/Modes - off
You probably want to leave the IS (image stabilization) modes enabled.
[/quote]

Will go re-shoot with the IS modes enabled.

Just re-shot with the settings in the prior post, still blurring going on.  Log file attached.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / July / 2014, 13:17:21
Shutter speed is still kind of low, mostly because the minimum f--stop is small. Are  you setting the zoom at something other than wide angle?  You might want to jack up the MaxISO2 value to 3200 to compensate -the image will be a little noisier but that is better than blurry.

Also, is there a chance that you need to work on the vibration mounting for the camera?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / July / 2014, 17:40:08
Update :  I'm afraid that I'm getting a really bad sense of deja vu here.   

The best focus of all your pictures (e.g. IMG_3218.JPG) are the ones taken of the pavement, inches away, when your UAV is on the ground !   Yet kap.log file says the camera is focussed at infinity and the Canon Maker Notes information in the image file report subject distance as 6553 (which I believe is 655 meters).   And while many of the aerial shots are quite good, at least 3/4 of them are whacked.  Again, the image maker note data all shows 6553.

I guess we have to add the sx260 to the S100 and ixus125 as cameras that refuse to set_focus as requested by the script.  We really need to find a way to solve this.

 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 18 / July / 2014, 18:20:04
Update :  I'm afraid that I'm getting a really bad sense of deja vu here.   

The best focus of all your pictures (e.g. IMG_3218.JPG) are the ones taken of the pavement, inches away, when your UAV is on the ground !   Yet kap.log file says the camera is focussed at infinity and the Canon Maker Notes information in the image file report subject distance as 6553 (which I believe is 655 meters).   And while many of the aerial shots are quite good, at least 3/4 of them are whacked.  Again, the image maker note data all shows 6553.

I guess we have to add the sx260 to the S100 and ixus125 as cameras that refuse to set_focus as requested by the script.  We really need to find a way to solve this.

I have a set completed with MaxISO2 at 1/1600 as it does not got to 3200 and F/5.0 with pretty much same results.  Those images I have not uploaded though.

I am going to do another flight now, with the Min Fstop at 4.0.  Any other thoughts/suggestions/recommendations?

After the above flight, I am going to remount the camera with more vib dampening to see what the impact is if the results do not improve.

Crazy thing is, I can not believe I am the only one who has had this challenge, yet, it's all good.  Keeps things interesting.  :)

Cheers and thank you for all YOUR efforts.  Amazing work BTW!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / July / 2014, 18:46:51
I have a set completed with MaxISO2 at 1/1600 as it does not got to 3200 and F/5.0 with pretty much same results.  Those images I have not uploaded though.
Yea - it's a focus issue rather than shutter speed I'm afraid.

Quote
I am going to do another flight now, with the Min Fstop at 4.0.  Any other thoughts/suggestions/recommendations?
Leave the "Focus @ Infinity Mode" option at "None" and let the camera fend for itself ?  Or take a look at pages 125 & 126 of the manual for your camera : http://gdlp01.c-wss.com/gds/7/0300007147/01/pssx260hs-sx240hs-cug-c-en.pdf (http://gdlp01.c-wss.com/gds/7/0300007147/01/pssx260hs-sx240hs-cug-c-en.pdf)  and put the camera into native MF mode, set at infinity.  (leaving the CHDK option at "none")


Quote
After the above flight, I am going to remount the camera with more vib dampening to see what the impact is if the results do not improve.
Can't hurt but I don't think it's the root cause of the issues.

Quote
Crazy thing is, I can not believe I am the only one who has had this challenge, yet, it's all good.
Thanks for keeping your "chin up" on this. It's most frustrating.  And you are not the only one - an S100 owner and ixus125 owner have discovered the same thing.  Still,  over 1250 people have downloaded the script but no telling how many have actually tried it. I'll bet there are only a few camera models that have this issue.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 18 / July / 2014, 19:32:36
Attached is the log.

Will have the images uploaded shortly.  Pics are up, f/4.0
https://www.dropbox.com/s/sjxvea94j1iyis1/140718_1522_DCIM-5.zip (https://www.dropbox.com/s/sjxvea94j1iyis1/140718_1522_DCIM-5.zip)

The one change in this flight was to set f/4.0, and still in manual on the camera and script.

Will make the changes you noted and test it now.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / July / 2014, 19:40:18
Attached is the log.

Will have the images uploaded shortly.

The one change in this flight was to set f/4.0, and still in manual on the camera and script.

Will make the changes you noted and test it now.
I'd be curious to see a log & pixs where you set the camera to "P" mode rather than "M". Page 115 of your user manual.

TIA

WW
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 18 / July / 2014, 20:17:06
Leave the "Focus @ Infinity Mode" option at "None" and let the camera fend for itself ?  Or take a look at pages 125 & 126 of the manual for your camera : http://gdlp01.c-wss.com/gds/7/0300007147/01/pssx260hs-sx240hs-cug-c-en.pdf (http://gdlp01.c-wss.com/gds/7/0300007147/01/pssx260hs-sx240hs-cug-c-en.pdf)  and put the camera into native MF mode, set at infinity.  (leaving the CHDK option at "none")

Here are the images and log attached below after the above noted changes. 
https://www.dropbox.com/s/0uqkfo0xa04fu7j/140718_1653_DCIM-6.zip (https://www.dropbox.com/s/0uqkfo0xa04fu7j/140718_1653_DCIM-6.zip)

Check out the ground pic's and what are your thoughts on the focus.

Through more thoughts/changes my way.  Happy to test.  Need a solution or a new camera. :)

Others have done it, thus, it can be done.  Onward.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 18 / July / 2014, 20:25:21
WW,

I inquired on this post as well.  It's been done, need to figure out how.

Thanks again for the assist!

Hi!

Waterwiz, the script is working as it should and its very nice. I tested it these days and the speed right now is amazing and I learned that my only limitation with this camera is the battery. Sometimes I get the same GPS coordinates for 2 pictures in sequence, but then I manually edit the coordinate so the orthoretification software doesn't get confused.

The attachment is just a test. :)

Anyway, thanks again both of you, waterwiz and lapser, you really have helped me a lot here!

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fimg23.imageshack.us%2Fimg23%2F8829%2Fflorestav.jpg&hash=09872ccca06883bc667857b2756f50c2)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / July / 2014, 20:41:44
I inquired on this post as well.  It's been done, need to figure out how.
Unfortunately, it seems most people join this forum but either don't supply an email address or don't have responses to threads they've posted in setup to notify them via email.   So alkasber will likely never be heard from.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / July / 2014, 20:59:48
Check out the ground pic's and what are your thoughts on the focus.
Okay  - explain to me your exact settings for this last sequence.  I notice you still have the shooting mode in "M" rather than "P".   And it looks like you set the camera into Manual Focus mode with the focus locked at infinity? If so, then why are the pics of the pavement so perfectly in focus when the camera is inches away.  This is not making sense.

We could try something else basic here.   Using just the Canon menus (no CHDK yet), put the camera in Tv priority mode (pg 140 in the manual),  set the shutter speed as high as it will go,  select Canon Manual Focus mode and lock that at infinity (pg 125-126), and then just run the simple interval.lua script that comes with CHDK ( in the A/CHDK/SCRIPTS folder). 

Make sure you have set  Enhanced Photo Operations  -> Disable Overrides [ Yes ]
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 18 / July / 2014, 21:07:52
We could try something else basic here.   Using just the Canon menus (no CHDK yet), put the camera in Tv priority mode (pg 140 in the manual),  set the shutter speed as high as it will go,  select Canon Manual Focus mode and lock that at infinity (pg 125-126), and then just run the simple interval.lua script that comes with CHDK ( in the A/CHDK/SCRIPTS folder). 

Make sure you have set  Enhanced Photo Operations  -> Disable Overrides [ Yes ]

Will go test now and post results.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 18 / July / 2014, 21:36:56
Settings;
TV mode
Shutter:  1/3200
Focus:  camera manual/infinity
Script:  interval.bas
Disable Overrides:  YES

Image results
https://www.dropbox.com/s/ozwek0sm9stwbdo/140718_1831_DCIM-8.zip (https://www.dropbox.com/s/ozwek0sm9stwbdo/140718_1831_DCIM-8.zip)

Is there a script that will read all the camera settings, chdk settings and dump it to a file?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / July / 2014, 21:40:24
Is there a script that will read all the camera settings, chdk settings and dump it to a file?
No. 

But it would be trivial to write something that would report on the things that CHDK actually has access to. As I said earlier, the kap_uav.lua script basically does that already.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 18 / July / 2014, 21:45:27
Was thinking of and looking for something that would dump all, for troubleshooting/debug.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / July / 2014, 21:51:11
Settings;
TV mode
Shutter:  1/3200
Focus:  camera manual/infinity
Script:  interval.bas
Disable Overrides:  YES
I've assumed you are somewhere in the western USA by the previous pictures but these pix are all really dark - and you'd have to be about 500 miles east of Boston to be that dark right now.

So I've learned something about Canon's Tv priority mode.  It only cranked the ISO up to 200 when you went to 1/3200.   Hence the massively underexposed images.

Unless of course you did not have ISO in auto mode - and have it locked at ISO200 in the Canon settings?

Try again ?  (Incidentally,  the focus looks really good if I squint at the darkness)

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 18 / July / 2014, 21:56:06

Yes, Cali

Unless of course you did not have ISO in auto mode - and have it locked at ISO200 in the Canon settings?
Will check and re-shoot now.

Try again ?  (Incidentally,  the focus looks really good if I squint at the darkness)
Maybe that's the trick?  LOL

Back shortly.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 18 / July / 2014, 22:16:22
Images are uploading, set ISO to auto, lighting is better, and not great.

Check it out and let me know.

Link to follow.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / July / 2014, 22:42:06
Images are uploading, set ISO to auto, lighting is better, and not great.
Those don't look too bad for ISO3200.  Could try dialing the Tv value back to 1/1000 and trying again tomorrow in normal day light.

I did note that the Maker Note data say Subj Dist 6553 for every shot still - even though it is clearly auto focusing at different distances in these shots.
 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 19 / July / 2014, 00:18:22
Those don't look too bad for ISO3200.  Could try dialing the Tv value back to 1/1000 and trying again tomorrow in normal day light.
Will give this a shot in the AM and check the results.

Quote
I did note that the Maker Note data say Subj Dist 6553 for every shot still - even though it is clearly auto focusing at different distances in these shots.
The flight altitude is set at 100 meters so, not sure what the Subj Dist value of 6553 is though.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / July / 2014, 10:09:19
The flight altitude is set at 100 meters so, not sure what the Subj Dist value of 6553 is though.
6553 means 65535 millimeters - (also -1 in binary)  - and is supposed to represent infinity to the camera.

65 meters with the amazing DOF of these little boxes,  that's close enough.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 19 / July / 2014, 14:05:07
Hi timvand,

On the link below there are the parameters used by me on a Canon SX230 (starting with page 13):

http://www.myap.ro/wp-content/uploads/2014/07/Gluonpilot-photomapping-setup-v1.31.pdf (http://www.myap.ro/wp-content/uploads/2014/07/Gluonpilot-photomapping-setup-v1.31.pdf)


What flying platform you use ? The cruise speed is a very important parameter to obtain good pictures.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 19 / July / 2014, 14:25:51
Hi timvand,

On the link below there are the parameters used by me on a Canon SX230 (starting with page 13):

http://www.myap.ro/wp-content/uploads/2014/07/Gluonpilot-photomapping-setup-v1.31.pdf (http://www.myap.ro/wp-content/uploads/2014/07/Gluonpilot-photomapping-setup-v1.31.pdf)

Thanks I will re-review these settings after I do a quick test of the settings from WW suggested yesterday.  One way or the other, I WILL, with the assistance from others, get this to work.

Quote
What flying platform you use ? The cruise speed is a very important parameter to obtain good pictures.

I am using a DJI s800 frame with Pixhawk FC.  Mission Planner does all the calc's and waypoints for the flight.  The speed I have set now is 4 m/s.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / July / 2014, 14:32:28
Thanks I will re-review these settings after I do a quick test of the settings from WW suggested yesterday.  One way or the other, I WILL, with the assistance from others, get this to work.
I've been communicating with zeno  (dave mitchell) who has an s100 - one of the cameras that also won't focus at infinity - and he is using the kap_uav.lua script successfully.  He even sent me a link to some great shots he took in Italy.   One difference is that he sets the Focus @ Infinity Mode to None and lets the camera's AF take over - which would explain why he is not having problems.   That's basically what I've been working you towards with my instructions from last night - use Tv mode with a 1/1000 shutter speed, set the Canon MF to infinity, and then let a simple intervalometer script run.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 19 / July / 2014, 14:40:50
Thanks I will re-review these settings after I do a quick test of the settings from WW suggested yesterday.  One way or the other, I WILL, with the assistance from others, get this to work.
I've been communicating with zeno  (dave mitchell) who has an s100 - one of the cameras that also won't focus at infinity - and he is using the kap_uav.lua script successfully.  He even sent me a link to some great shots he took in Italy.   One difference is that he sets the Focus @ Infinity Mode to None and lets the camera's AF take over - which would explain why he is not having problems.   That's basically what I've been working you towards with my instructions from last night - use Tv mode with a 1/1000 shutter speed, set the Canon MF to infinity, and then let a simple intervalometer script run.

Awesomeness!  On my way out now to run it.  Will have pics posted in 20 mins or less.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: timvand on 19 / July / 2014, 15:12:19
Could try dialing the Tv value back to 1/1000 and trying again tomorrow in normal day light.

Tv value:  1/1000
ISO:  Auto
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 10 / August / 2014, 17:27:46
Hi  taking this conversation from Facebook to here for the convenience of attaching files.

Walter Wing Mark Beauchamp : here's a preview of the next version of the script. It add a new parameter value in the script menu called "Meter Filter Factor" . Set it to High and see how it works for you ? https://app.box.com/s/3h6ugwo9pl06axrxqagx (https://app.box.com/s/3h6ugwo9pl06axrxqagx)

So I did a test. http://youtu.be/85B2JNOnACk (http://youtu.be/85B2JNOnACk)

Nothing exciting just off my balcony.  Initially I set infinity to AFL and I got the message  Focus not at infinity.  So I stopped it, took it out of CHDK  took a single image to get it to focus on a building, started the script again and got the same message.  Stopped it, took out of CHDK again, took a shot, set script to @shot, got the same message.  Stopped it again, took a shot, then set focus to none.  Started again and didn't get the message.  Seemed to hold focus for the entire sequence.  I have found when using yass or AUTOEXP3 it will sometimes drift in and out of focus.  I found the was more flickering and changes in exposure from shot to shot with this new version than I did when I used an older one.

I have attached the log.

Thanks,

Mark

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 10 / August / 2014, 19:15:28
Hi  taking this conversation from Facebook to here for the convenience of attaching files.
Looking at the log,  the script takes each shot at the almost the same exposure setting - gradually increasing the ISO as the scene darkens towards the end. I should not have been flickering like that.

However,  the focus setting is all over the map - jumping from infinity to 1.2m (or so) and back and forth between shots.

Two quick things you could try.  First of all,  you seem to have servo_AF mode enabled in the Canon menu.  Can you disable that?

Then change the "Focus at Infinity" mode to MF and try that. Also,  try the script with the mode set to Off.

The only other think I can see that might be goofy is the way the ND filter is working.  I made some changes to that code in the CHDKplus.lua script.  I'll look to see if they are needed here.  In the mean time,  you could try disabling ND filter use in the script menu?

Edit :  can you post / drop box three or four sequential images from that series that exhibit a sudden exposure change ?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 10 / August / 2014, 23:54:29
Sure.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / August / 2014, 10:05:13
Sure.
These look to have been post processed? Do you have the originals from straight out of the camera?

Edit: the reason I ask is that the EXIF values in the images seem to match the exposure but they are completely different than what I see in the log file you posted?

Edit #2:  I noticed you are  asking for a shot rate of 2 second but the camera is not quite keeping up with that rate. Does the exposure look any better if you slow down to a 5 second per shot rate?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 11 / August / 2014, 22:32:13
Oops, yes they were processed.  Here are some right out of the camera.   (the jpgs are too large to upload to the forum)
https://www.dropbox.com/sh/0n07d3p6u1elow0/AAByj9AgWALy6PG1-64VyAUXa (https://www.dropbox.com/sh/0n07d3p6u1elow0/AAByj9AgWALy6PG1-64VyAUXa)   
Might not be the same images from the first batch.

I can turn off the servo_AF.

I will try to do a test in the next few day, with servo_AF off, ND filter off, 5 seconds, and infinity focus to off and see how that comes out.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / August / 2014, 22:57:58
I will try to do a test in the next few day, with servo_AF off, ND filter off, 5 seconds, and infinity focus to off and see how that comes out.
Thanks - you probably only need 20 or so shots to see what helps. 

It would be good to get separate tests as you change each thing but start with the 5 seconds interval ?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 12 / August / 2014, 16:47:46
Hi  did another test today.  More than 20 shots though I t least wanted to put together a few seconds of video.

http://youtu.be/i3XvwEM04ps (http://youtu.be/i3XvwEM04ps)

Initially looking at the jpeg's  they look good, no sudden changes in exposure. 

Started off with 5sec intervals, no ND, Servo AF off, focus none. No warning messages, though looking at log the focus moves around from time to time.

Second sequence same as above but enabled ND filter, same results.

Third sequence, changed focus to MF.  According to log focus stayed at infinity. Though looking at the jpegs they look out of focus. Though when the  focus was set to none and the log says infinity the jpeg looks sharp, it also looks sharp at 4.4m.  Just soft when set to MF

Fourth sequence set to AFL and I got the "Focus not at infinity message" so I stopped it early

Fifth sequence set to @shot, same message as above so stopped it.

So it looks like the exposure is getting better, but the there is still focus issues.

I am shooting another test right now, 5 sec  then 4sec, 3sec and 2sec to see if that creates the exposure issue.

Sorry about the log, I didn't delete the old one off the SD card so today's test was added to the one from the weekend.

 


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 12 / August / 2014, 23:52:54
I did another test with v3.3.  With this one the ND Filter was in use and focus was set to MF, started off with 150 images as a 5sec interval, followed by 150 at 4sec, then 150 at 3sec and finishing off at 150 as 2sec interval.

Other than underexposing at the shorter interval (but that could be in part due to the conditions) the exposures seem fairly consistent.

In spite of script set to MF it appears to change from shot to shot. I am assuming some of my focus issues have to do with the camera itself and how it reacts to the script.  Could this me a case of not the right tool for the job?  Has there been anyone who had done a fair amount of timelapse with the S series camera (S90,S100,S110,S120) since they do have manual focus? 

http://youtu.be/9fv4pHQKmPs (http://youtu.be/9fv4pHQKmPs)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 13 / August / 2014, 08:36:28
I did another test with v3.3.  With this one the ND Filter was in use and focus was set to MF, started off with 150 images as a 5sec interval, followed by 150 at 4sec, then 150 at 3sec and finishing off at 150 as 2sec interval.
This is quite interesting.  The random jumps in exposure are all gone.  However, the script did not attempt to use the ND filter - probably because the shots were later in the day and the scene darker so it did not need to use it.  I'm thinking I need to do more testing of the ND filter use.

Quote
Other than underexposing at the shorter interval (but that could be in part due to the conditions) the exposures seem fairly consistent.
You are seeing the "filter factor" at work there.  The filtering is so high that the exposure changes lag the actual scene illumination changes as evening approaches.   I have an improve version of the filter I'm working on to remove a small offset error at high filter factors.  But you will probably want to Medium or even Low settings for the filter factor in any case based on what I see here.

Quote
In spite of script set to MF it appears to change from shot to shot. I am assuming some of my focus issues have to do with the camera itself and how it reacts to the script.  Could this me a case of not the right tool for the job?  Has there been anyone who had done a fair amount of timelapse with the S series camera (S90,S100,S110,S120) since they do have manual focus? 
There have been many thousands of CHDK timelapses with all kinds of cameras.  I personally have used my G, S, IXUS, A and SX series cameras.   However,  the vast majority of all those sessions have been with the camera in autofocus mode or with a simple AFL set at the start of the script.  On many of those cameras, up until recently, the AFL really did nothing.

In the last eight month, there has been a lot of work done on using MF & AFL for manual focus ( a.k.a Subject Distance override ) in CHDK 1.3.0.   The rather long forum thread is here : Setting focus from scripts or menus (http://chdk.setepontos.com/index.php?topic=11078.0)

I thought we had made pretty good progress as we seemed to be able to make most cameras work in MF mode.  And those that did not would focus in AFL mode instead.   At least based on the test script we used they all seemed to work.

However, I've come to realize that we actually only evaluated the ability to set  focus distances between 0.4 meters and 1.0 meters. We reported success based on the camera's reported subject distance versus the focus distance requested.  While I checked the resulting images from my cameras, the majority of the test results did not, so the camera reported focus distance could be wrong too. 

So now we seem to have a few cameras that passed the tests but that do not manually focus well out to infinity ("soft images").  Even though reports from owners of the same camera models (including mine) do not have that problem when running the same tests.

And we seem to have cases where the MF setting gets lost after initially working.  Like in your tests. 

And even I have had issues with my A1200 : http://chdk.setepontos.com/index.php?topic=11078.msg111388#msg111388 (http://chdk.setepontos.com/index.php?topic=11078.msg111388#msg111388) that have never been resolved.

So for now I continue to collect test results, write new tests, study what we are seeing, and report it here.  Somewhat frustrating as I have not been able to reproduce the problems on my six different camera models.

tl;dr note : I would like to test the way the kap_uav.lua script handles the set focus at infinity part.  Are you are up for another test round?   Currently the script enables MF and/or AFL mode when it  starts but it  tries to set_focus before each shot as well  That should be fine but I'd like to see if that is actually causing issues so I've attached a modified version. Run a few hundred shots from your balcony in MF and AFL modes and see what happens to the reported focus setting ?   

Thanks - progress here will only be made here with the help of people like you !
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 14 / August / 2014, 09:55:19
Yes I am up for another round of tests, though I will not be able to get around to it until Sunday.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 17 / August / 2014, 17:45:05
Did  another test today on a Canon Elph300HS with CHDK 1.3 and KAP & UAV Exposure Control Script v3.3MF

ND Filter was in use and focus was set to MF for 300 images at a 5sec interval, followed by 300 Images with focus set to AFL at a 5sec interval.  Images seems sharper with AFL than MF, thought both are soft compared to taking a single shot when not running the script. Also on the video it seems the interval time seems to fluctuate.

http://youtu.be/0OHYxg1pGQw (http://youtu.be/0OHYxg1pGQw)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / August / 2014, 17:48:44
Did  another test today on a Canon Elph300HS with CHDK 1.3 and KAP & UAV Exposure Control Script v3.3MF
Thanks Mark!   Log looks good based on a quick scan.   I'll take a more detailed look later today.

Can you try a long one later this afternoon and see if you can capture the transistion between it needing the ND filter and not needing it as the sun goes down?   That will be a bit trickly I realize but would tell us a lot if you can.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 17 / August / 2014, 17:55:31
Sure will set it up now since it is almost 6pm local time.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 18 / August / 2014, 08:37:04
Here is another test  shot on a Canon Elph300HS with CHDK 1.3 and KAP & UAV Exposure Control Script v3.3MF

ND Filter was in use and focus was set to MF  images were taken at a 5sec interval.  In the video it seems the interval time fluctuates at a number of points and exposure fluctuates as the lighting conditions change.

http://youtu.be/dh96MxonxUk (http://youtu.be/dh96MxonxUk)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: aircraftstories on 19 / August / 2014, 16:38:43
Hello,

I'm a new user of this wonderful script but I have a little problem.

I use it on my Canon Ixus 80 (SD1100) : firmware version 101a.
I use the CHDK 1.2.0 (full).

After a random number of pictures taken by the script : it crash !
I have the following indication in the file "crash.log" :  !!!WatchDog expired!!!

I use the script with the following parameters on a quadcopter :

autostart : on
shot interval : 3 sec
start delay time : 30 sec
tv min : 1/640
target tv : 1/1000
tv max : 1/1250
av low : 4
av target : 5
av max : 8
iso min : 80
iso max 1 : 400
iso max 2 : 800
nd filter : yes
zoom pos : off
focus : @shot
 
What the problem ?

Thanks a lot for the support.

Regards

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / August / 2014, 17:07:36
I use the CHDK 1.2.0 (full).
That should be okay but using CHDK 1.3.0 might be something to try instead.

Quote
After a random number of pictures taken by the script : it crash !
I have the following indication in the file "crash.log" :  !!!WatchDog expired!!!
Please post the actual ROMLOG.LOG file.  It would also be good to get a copy of the script's log file.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / August / 2014, 23:49:40
Did  another test today on a Canon Elph300HS with CHDK 1.3 and KAP & UAV Exposure Control Script v3.3MF
Here is another test  shot on a Canon Elph300HS with CHDK 1.3 and KAP & UAV Exposure Control Script v3.3MF
@MarkB :  I find myself wishing that I had setup the script log file to put the data about each shot on a single tab delimited line. Importing that into a spreadsheet for analysis would be a breeze.  Things like comparing the time interval between each shot to try and understand the speed changes in your videos would be trivial.

Instead,  I need to find a couple of hours to write some script to read in the log files and parse them into something more useful in a spreadsheet.  Which I will do - it will just take a little while to get it all done.

Thanks again for posting that test info.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: aircraftstories on 23 / August / 2014, 17:22:58
That should be okay but using CHDK 1.3.0 might be something to try instead.

It's OK now with the version 1.3.0 of the CHDK.

I need to do more tests to confirm, but it seems to be good.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 24 / August / 2014, 01:01:46
Decided to try another test.  The settings this time: ND Filter was in use, focus was set to AFL, images taken at a 3sec interval, and meter filter factor was set to low. 

With this meter filter factor setting I noticed more flicker in the daylight shots, but not the wild changes when the light conditions changed. 

The ending was rather dark, but with max iso set to 1600 and min Tv at 1/60 I am assuming it was under exposed.  A min Tv of 1/30 or 1/20 might have helped without making light trails on the cars.

The time interval also doesn't seem consistent as can be seen with the speeding up or slowing down of action in the video.

http://youtu.be/e8Nau75tdP8 (http://youtu.be/e8Nau75tdP8)

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 24 / August / 2014, 07:16:47
Decided to try another test.  The settings this time: ND Filter was in use, focus was set to AFL, images taken at a 3sec interval, and meter filter factor was set to low.  The time interval also doesn't seem consistent as can be seen with the speeding up or slowing down of action in the video.
I'm travelling this week but I finished the little script that converts the log files into something I can easily analyze in a spreadsheet.  I'll look at timing first.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 24 / August / 2014, 13:13:48
Decided to try another test.  The settings this time: ND Filter was in use, focus was set to AFL, images taken at a 3sec interval, and meter filter factor was set to low.  The time interval also doesn't seem consistent as can be seen with the speeding up or slowing down of action in the video.
Had a quick look at this on the plane today and it's quite interesting.  Here's a couple of plots from your log files - the shot number is on the X axis and the number of seconds between shots is the Y axis (one was the 3 second per shot log,  the other the 5 second per shot log)

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FrKEMxbl.gif&hash=f1ae2272e3d600735a9f312d25d52792)

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FM4RkB2m.gif&hash=4c469be275b8b2250eb900a3457ccb25)

Notice that the time goes from the requested 3 (or 5) seconds gradually out to about 13 second and then resets ever 150 shots (approx.).    The shot rate does not affect this - its consistently slowing down over the course of 150-160 shots.  When the reset occurs,  the script runs at a 2 second shot rate until it catches up with the time it missed shooting slow.

I can't explain the slow down based on anything the script is doing.  In fact,  when the shots gets slow,  the rate at which the script can write subsequent lines to the log also slows down.

Which brings me to a theory that this is related to SD card writing.  The script just seems to get ahead of the camera's ability to write to the SD card.    It might be interesting to see what happens if you change the image size / compression to smaller, more compressed images.  Does that increase the number of shots until it slows down ?

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 30 / August / 2014, 12:37:04
This is interesting.  I have tried other intervalometer scripts and the fast I could get the camera to shoot at was 2 to 2 1/3 seconds between shots.  This was with drivelapse and I didn't get any noticeable shift in time interval but had some focusing issues with it.  With other scripts I probably had a smaller pixel dimensions and may or may not have had superfine in the CHDK menu turned on.

I am happy to try another test this weekend if there is a set of parameters you would like me to try outside of smaller file size and quality override turned off.  And I still don't find the images as sharp when running the script as I do do when just taking a shot with no script running.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 30 / August / 2014, 17:42:13
Decided to try another test this afternoon.  ND Filter was in use, focus was set to AFL, images taken at a 5sec interval, and meter filter factor was set to medium.    Interval seems to drift but not as much as the last test,  focus seems to hold, but lots of flicker with exposure, which is odd since the lighting conditions didn't change much. Had a major error and the sequence stopped early.  See error at the end of the log.  Though this might have to do that I was saving RAW files by accident and the 16g card ran out of memory,

http://youtu.be/DPW9MGtISCg (http://youtu.be/DPW9MGtISCg)




Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 31 / August / 2014, 12:53:15
Did another test befor and after sunset with filter factor set to medium.  Lots of flickering and the change in speed.

http://youtu.be/RH_8iu80SDw (http://youtu.be/RH_8iu80SDw)

One note, I set this for 3000 images and it stopped before that.  I wasn't home so don't know if there was an error message.  The camera was powered off and the lens was still extended.  Hit the power to turn it back on then off again to retract the lens.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 31 / August / 2014, 13:10:42
Are you recording RAW/DNG in any of these ?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 31 / August / 2014, 19:54:55
Only recorded RAW once by accident on Test 7. 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 01 / September / 2014, 10:57:45
Had a major error and the sequence stopped early.  See error at the end of the log.  Though this might have to do that I was saving RAW files by accident and the 16g card ran out of memory,
The error occurred because the camera stopped being ready to shoot within 2 seconds after a half-press.  Once it got into that mode, it appears to have become stuck in that mode.  I don't see anything in the log that might have caused that - the scene illumination had not shifted much.

However, the fact that you were saving RAW suggests a possible issue with processor / SD card write overloading.

Did another test befor and after sunset with filter factor set to medium.  Lots of flickering and the change in speed.

One note, I set this for 3000 images and it stopped before that.  I wasn't home so don't know if there was an error message.  The camera was powered off and the lens was still extended.  Hit the power to turn it back on then off again to retract the lens.
No lockup reported in the log like the one we saw in series 7.   The same time sequence thing is happening though :
(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FJErzi8d.png&hash=e63b9e7f7f30bb881ba7d03fa5f65001)
The write speed to the SD card slows down after a while,  and then seems to release and the script run at a 2 second interval to catch up.

Focus still bounces around with this series,  and the ND filter goes in & out.    I'll look at the exposure variations next - I may want to see some of the original images if you still have them.

One thing we could also try is to  isolate the timing glitches is a simplified intervalometer script that just shoots every 4 seconds in AUTO mode and that also logs to the SD card.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 01 / September / 2014, 12:52:45
I didn't keep any of the RAW files but I do have the jpeg's from test 7, I also have the jpeg's from test 8.  I only had RAW files saved for the one test and none of the others.  Just lest me know which jpeg's you would like to see.

I would be happy to test a simplified intervalometer script that just shoots every 4 seconds in AUTO mode and that also logs to the SD card, is there one you suggest?  As a note I usually shoot in program mode, would that affect the results in any way?

For fun I did a test with the AUTOEXP3 script yesterday set at a shot every 3 seconds.  It seems to hold the 3 seconds.  Unfortunately it does not have a longing option.

http://youtu.be/4QjnLxLmG9E (http://youtu.be/4QjnLxLmG9E)

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 01 / September / 2014, 13:46:05
I didn't keep any of the RAW files but I do have the jpeg's from test 7, I also have the jpeg's from test 8.  I only had RAW files saved for the one test and none of the others.  Just lest me know which jpeg's you would like to see.
JPG will be all I need.  I'll let you know.

Quote
I would be happy to test a simplified intervalometer script that just shoots every 4 seconds in AUTO mode and that also logs to the SD card, is there one you suggest?  As a note I usually shoot in program mode, would that affect the results in any way?
Program mode is fine.  Attached is a stripped down script that lets the camera control the focus and exposure and logs every shot. Let's see if it slows down every 300 pictures or so as well?  It's possible that opening and closing the log file for each log line is causing part of the problem.

Quote
For fun I did a test with the AUTOEXP3 script yesterday set at a shot every 3 seconds.  It seems to hold the 3 seconds. 
Does the exposure not seem to flicker here too?  Looks a bit like that to me.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 01 / September / 2014, 23:55:16

Quote
For fun I did a test with the AUTOEXP3 script yesterday set at a shot every 3 seconds.  It seems to hold the 3 seconds. 
Does the exposure not seem to flicker here too?  Looks a bit like that to me.
[/quote]

Yes the exposure does flicker here also.  Though not as badly as in some of the other tests.

Here is the test I did with the TLAPTEST script.  Still some flickering and changes in interval time.

I kept the camera in Program mode, so I could turn off servoAF, AF-assist Beam and Review.  AF Frame was Center and size normal.  Metering mode was Center Weighted AVG.  Recorded Pixels was M2 1920x1080

http://youtu.be/FApgk5wZE70 (http://youtu.be/FApgk5wZE70)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / September / 2014, 19:08:07
Same pattern :
(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FosfkgEi.png&hash=c0819aa83ed98c20e532cd075b24760f)
Attached is a modified version of the script that logs to the SD card at 1/4 the rate of the previous script.  I would be interesting to see if that moves the slow downs.  Next step after that is to try logging with the file handle left open for the whole sequence and to log to RAM and only write to SD card at the end of the sequence.
Title: 1500th Download : KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 05 / September / 2014, 18:34:28
Just a quick note to acknowledge the 1500th download of the kap_uav.lua script yestereday.  The download count is now at 1503.

Thanks to the kap & uav community for your interest in the script and ongoing support through feature requests and test reports.

It seems that many KAP's have a big interest in the more sophisticated features that Lua makes possible ..... as they have now clearly told me!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 08 / September / 2014, 00:48:41
Another test this weekend with the latest TLAPTEST script/  Some flicker and slow down and speed up.

http://youtu.be/-OByidaPPjg (http://youtu.be/-OByidaPPjg)



Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / September / 2014, 09:05:42
Another test this weekend with the latest TLAPTEST script/  Some flicker and slow down and speed up.
I'll take a look tonight. Meanwhile, can you try the same sequence but with all logging disabled? ( set the Logging parameter to "none").

It will be interesting to see if all the speed changes go away
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: M141 on 08 / September / 2014, 13:45:53
Hi,
I have some problems with script editing and need some advice or help.

When using " video interleave" mode i like to set focus mode to AFL@Infinity with video. I'm shooting with IXUS 300ELPH and it sucks with autofocus in video. For pictures i'm using setting "none" with good results. So maybe this script should have separate parameter for video and picture focus?

So far i simply tried to force focus mode to AFL everytime video is recorded.  It seems to work ok with chdk 1.2 but not with chdk 1.3? With 1.3 it seems to lock focus everytime very near like <2.5m:
Code: [Select]
-- Video mode
function check_video(shot)
    local capture_mode
    if ((video_mode>0) and(shot>0) and (shot%video_mode == 0)) then
        unlock_focus()
        sleep(500)
        focus_mode = 2                                                    -- Change focus mode to AFL @ Infinity??
        lock_focus()
        printf("Video mode started. Button:"..tostring(video_button))
Code: [Select]
printf("Video mode finished.")
        sleep(1000)
        unlock_focus()
        focus_mode = 0                                                   --mode back to 0 (None)
        sleep(500)                                   
        lock_focus()
        return(true)
    else
        return(false)
    end
end

I'm not good with scripting so like to have tips how to change it? By the way is there any good editor that is made specially for scripts?

Regards Jani
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / September / 2014, 18:48:05
Another test this weekend with the latest TLAPTEST script/  Some flicker and slow down and speed up.
Interesting result! 

This version of the  script only writes once to the log file per picture (the original scripts write four times).  Same amount of data, just all combined into one write vs four.

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F8Y6sVj7.png&hash=8d9376ba275eb816c5351b5dd611a77f)

The frequency of the slow downs has stayed the same in every test (approximately every 150 images) regardless of shot frequency or # of writes.    However, it seems that once it slows down, decreasing the number of log writes per picture makes a big difference in the delay - 12 seconds down to about 5.  Which I think makes sense as you are writing once instead of four times while the card is running slow.

I'll post a version that logs to RAM and only writes a log file after the script has shot the desired number of images.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / September / 2014, 19:00:37
When using " video interleave" mode i like to set focus mode to AFL@Infinity with video. I'm shooting with IXUS 300ELPH and it sucks with autofocus in video. For pictures i'm using setting "none" with good results. So maybe this script should have separate parameter for video and picture focus?
I don't have a lot of experience with trying to use manual focus with video (although I have a little experience with MF and regular shooting) so I'm not prepared to try this right now. But the nice part about CHDK scripts is that you can edit and modify to suit your needs and desires. 


Quote
So far i simply tried to force focus mode to AFL everytime video is recorded.  It seems to work ok with chdk 1.2 but not with chdk 1.3? With 1.3 it seems to lock focus everytime very near like <2.5m:
You now have my full and undivided attention.  Would you mind enabling logging in the script parameter in the CHDK Script menu and run the test with both 1.2.0 and 1.3.0 and post the logs here?

Quote
Code: [Select]
-- Video mode
function check_video(shot)
    local capture_mode
    if ((video_mode>0) and(shot>0) and (shot%video_mode == 0)) then
        unlock_focus()
        sleep(500)
        focus_mode = 2                                                    -- Change focus mode to AFL @ Infinity??
        lock_focus()
        printf("Video mode started. Button:"..tostring(video_button))
......
        printf("Video mode finished.")
        sleep(1000)
        unlock_focus()
        focus_mode = 0                                                   --mode back to 0 (None)
        sleep(500)                                   
        lock_focus()
        return(true)
    else
        return(false)
    end
end
On quick inspection, this looks okay.  Nice hack!

Quote
By the way is there any good editor that is made specially for scripts?
Any programming editor that supports syntax highlighting for Lua will work.  For Windows I'd suggest notepad++ although there are a raft of others.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 08 / September / 2014, 22:09:39
The frequency of the slow downs has stayed the same in every test (approximately every 150 images) regardless of shot frequency or # of writes.    However, it seems that once it slows down, decreasing the number of log writes per picture makes a big difference in the delay - 12 seconds down to about 5.  Which I think makes sense as you are writing once instead of four times while the card is running slow.
Are all these tests being done with the same card? If so, it would be every interesting to know what brand / size / model it is, and if different brands show the same behavior. Apologies if this was mentioned earlier, I skimmed the last few posts but I haven't been following closely.

Cards have various wear leveling and garbage collection stuff that may be relevant https://wiki.linaro.org/WorkingGroups/KernelArchived/Projects/FlashCardSurvey
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / September / 2014, 22:59:01
Are all these tests being done with the same card?
MarkB has told me that he has CHDK loaded on a Patriot  LX series 16GB Class 10 card that he has been using for the tests.  He also has a Lexar Platinum II  16GB  200x Class 10 and a Kingston 16GB Class 10 but has not tried those.

Quote
Apologies if this was mentioned earlier, I skimmed the last few posts but I haven't been following closely.
I try to keep most discussion out of PM's but this one has been a little busy and has gone both ways.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: M141 on 09 / September / 2014, 15:00:31
You now have my full and undivided attention.  Would you mind enabling logging in the script parameter in the CHDK Script menu and run the test with both 1.2.0 and 1.3.0 and post the logs here?
Sure! I already had enabled logging and posting 2 logs. 120 log is from flight few days ago and pics + video seems to be ok.

130 log is from yesterday flight and again pics looks reasonable good, but every video is out of focus. Not very bad but clearly soft and blur.

Kap script is version 3.0 with my above post rude modification to set AFL for video. I might need to do proper tests as there's so much going on with my quadcopter, gimbal and camera setup right now that it's mixing my head :)

Today i made one flight with same 1.3 chdk and modified KAP 3.2 version script only to use direct button commands to set AFL lock before video:
Code: [Select]
-- Video mode
function check_video(shot)
    local capture_mode
    if ((video_mode>0) and(shot>0) and (shot%video_mode == 0)) then
        unlock_focus()
sleep(500)
press("shoot_half")
sleep(2000)
click("left")
sleep(500)
release("shoot_half")
        printf("Video mode started. Button:"..tostring(video_button))

This seems to work just like it should. Press shutter half camera tried to focus-->got focused with green square ons creen-->clicked left button to set AFL--->AFL "logo" showed on screen and after that video started with locked focus. Of course this is not the best as focus can be also else where than infinity.

By the way should we see that Canon original AFL info or logo on screen with any of focusing modes in kap script? I quess not because i can't remember ever seen it ....

Quote
For Windows I'd suggest notepad++ although there are a raft of others.
Downloaded and it's great. Earlier i was using PSPad and noticed i somehow had 5-6 years old version of it ::) Now it's updated but i think Notepad++ is still better...

Regards Jani
Title: Issues with blur using script after repair
Post by: Johnso10 on 15 / September / 2014, 20:23:53
I recently sent our s100 for repair and when it came back the images captured using the script were extremely blurry yet when the same parameters are used just taking a picture manually (1/1600 tv; ~3.5av; ~200 ISO all at infinity)  the images are crystal clear.  When talking to the manager he mentioned that if a camera is sent to canon for repair they will automatically install the latest firmware even if that model (s100) has been discontinued...could this have any effect on the inability of the camera to focus using the script? I have another s100 with an IR lens that I swap the sd card with that uses the script with no issues but for some reason I can't get the newly repaired camera to work with the script...am I missing something extremely obvious? All the settings in the other camera are the exact same as the repaired one and they work pretty much he same except for when running the script...which has been an absolute lifesaver for us btw...if you have any ideas I would really appreciate the help seeing as we will start combining the fields soon and will start losing opportunities to fly our fields.

Thanks for any help,
Jeff j
Title: Re: Issues with blur using script after repair
Post by: waterwingz on 15 / September / 2014, 20:44:59
I recently sent our s100 for repair and when it came back the images captured using the script were extremely blurry yet when the same parameters are used just taking a picture manually (1/1600 tv; ~3.5av; ~200 ISO all at infinity)  the images are crystal clear. 
Do I understand that your S100 would focus properly with the kap_uav.lua script prior to sending it for repair but not after it was returned?   (Or had you not  tested it prior to having it fixed?)

Setting focus on some cameras seems to be problematic.  I've been working with several S100 users on this problem with little success.   Yet my S100 does not have any issues setting focus at infinity accurately.

Quote
When talking to the manager he mentioned that if a camera is sent to canon for repair they will automatically install the latest firmware even if that model (s100) has been discontinued...could this have any effect on the inability of the camera to focus using the script?
No.   If they had upgraded the firmware,  you would need a whole new version of CHDK installed for that firmware.  The old one simply would not work.

Quote
I have another s100 with an IR lens that I swap the sd card with that uses the script with no issues but for some reason I can't get the newly repaired camera to work with the script...
So does the IR converted camera focus properly?  (How do you know if you are using it for IR ?)

Quote
am I missing something extremely obvious?
Just the sight of me slitting my wrists in frustration over this problem.

Quote
...which has been an absolute lifesaver for us btw...if you have any ideas I would really appreciate the help seeing as we will start combining the fields soon and will start losing opportunities to fly our fields.
Well, I'm still working the issue.  I have a theory that in auto focus mode some cameras focus well based on feedback control but they will not set a manual focus accurately due to calibration issues.  Just a theory at the moment - I'm using a test script with my cameras to compare lens mechanical posting and subject distance as reported by the camera to try and track this down.

Meanwhile, can you use the script if you set the Focus @ Infinity Mode to Off ?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Johnso10 on 15 / September / 2014, 21:18:06
1. Now that I'm thinking about it the reason I found the script in the first place was because we were looking for something that we could use to remotely retract the lens before landing due to breaking said camera...so I do not know if it was working previously.

3. Running the IR camera at infinity was returning images that were/are much clearer than those taken at infinity with the recently repaired camera...the only thing really being different is that the corn is "red" using the IR lens (actually uses an IR lens not just run without filter) so I guess I'm assuming the camera is focusing properly due to the much higher quality images.

4. I've found that pulling off fingernails is just as therapeutic and creates half the mess.

5. I just tried the camera in the kitchen without infinity and the images did seem to be a little better...does this mean I should take the camera out of 'M' mode and run it in something else or would this not make a difference?

I/we really appreciate the help and can't say enough how much this script has helped us...especially when using IR in changing light conditions, the previous stitched images had basically zero value for us when having to do multiple flights to capture a field so thank you for making me look much better at my job than I really am.

>Jeff j
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 15 / September / 2014, 21:29:42
5. I just tried the camera in the kitchen without infinity and the images did seem to be a little better...does this mean I should take the camera out of 'M' mode and run it in something else or would this not make a difference?
Leaving it in 'M' mode is fine - the script overrides all the M settings anyway.   What you want to try is setting the script parameter that says Focus @ Infinity Mode to None. That will let the S100 autofocus and hopefully do a better job that the script can when it requests "infinity" and doesn't get it with the S100.

Quote
I/we really appreciate the help and can't say enough how much this script has helped us...especially when using IR in changing light conditions, the previous stitched images had basically zero value for us when having to do multiple flights to capture a field so thank you for making me look much better at my job than I really am.
Thanks.  Always good to meet yet another member of the growing group of kap & uav users who have discovered the value and power of scripts written in Lua.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / September / 2014, 12:14:25
Another test this weekend with the latest TLAPTEST script/  Some flicker and slow down and speed up.
I'll take a look tonight. Meanwhile, can you try the same sequence but with all logging disabled? ( set the Logging parameter to "none").  It will be interesting to see if all the speed changes go away
@MarkB : modified version of latest test script that let's you disable all logging to the SD card.  Please do another time lapse run and see if the speed up / slow down goes away completely?

TIA
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: JMarques on 21 / September / 2014, 12:45:21
Hi guys!

Fantastic script waterwingz! thx!


But i need a little help. I use a UAV to shoot vertical photos every 3s (Photogrammetry), i always use AUTO and it works very very well when is sunny. The problem is when its alot cloudy i get everything blurry and unfocus, already tried to play with the iso's an shutter speed but still cant find a good solution

Can anyway give me some advice on what should i use?

UAV speed = between 7m/s to 10/ms (25km/h to 36km/h)
Altitude = between 80m to 100m
Camera = Canon SX260 HS

Examples (both is auto):

Photo 1 (IMG_1384.JPG)

Sunny (taken at 11am) with F/Stop = 4, Exposure time = 1/500s, ISO = 100, Max Aperture = 3.625


Photo 2 (IMG_2486.JPG)

Cloudy (taken at 11am but alot cloudy) with  F/Stop = 4, Exposure time = 1/250s, ISO = 125, Max Aperture = 3.625


Any tips to fix this?

Sorry to be such a noob with this question but if anyway can help it would be fantastic!


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / September / 2014, 12:57:49
But i need a little help. I use a UAV to shoot vertical photos every 3s (Photogrammetry), i always use AUTO and it works very very well when is sunny. The problem is when its alot cloudy i get everything blurry and unfocus, already tried to play with the iso's an shutter speed but still cant find a good solution

Can anyway give me some advice on what should i use?
Are you letting the script control exposure or relying on the camera? 

In both your shots,  the shutter speed (and thus the ISO setting) seem pretty low for UAV work.   I've normally seen people using minimum shutter speeds of 1/500 or 1/1000 of a second.  This will cause the ISO setting to crank up but as long as you keep it below 1000 you should be okay.  You might even find the results at 1600 & 3200 acceptable so you should experiment a bit.  You can use the script's parameter settings to do all of this.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: JMarques on 21 / September / 2014, 13:10:42
So i should use minimum shutter between 1/500 or 1/1000 and iso above 100 but below 1000. Correct?

And should i use this setup for sunny days and cloudy days? And the F-Stop? low = 2.8, target = 4.0, max = 8.0?

And btw in the Focus @ infinity mode i choose the none option, right?

Thank you so much waterwingz!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / September / 2014, 13:17:54
So i should use minimum shutter between 1/500 or 1/1000 and iso above 100 but below 1000. Correct?
Start with 1/1000 and let the max ISO1 be 800 and max ISO2 be 1600 and see how it looks ?

Quote
And should i use this setup for sunny days and cloudy days? And the F-Stop? low = 2.8, target = 4.0, max = 8.0?
I'm travelling this week so doing this all from memory via a mobile phone.  Does your camera actually even have a user adjustable aperture?  If not, the script will just ignore those settings.

Quote
And btw in the Focus @ infinity mode i choose the none option, right?
If it works for you (and it does for most people) then the setting focus at infinity to MF is probably best.  Gives the camera one less thing to do between shots.

Update :  one of the common causes of blurr is vibrations on the UAV platform.  You have some good pix so that's probably not an issue.  Also,  it seems that turning off image stablization (if your camera allows that) is may actually a good idea - YMMV.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: JMarques on 21 / September / 2014, 13:42:13
So i should use minimum shutter between 1/500 or 1/1000 and iso above 100 but below 1000. Correct?
Start with 1/1000 and let the max ISO1 be 800 and max ISO2 be 1600 and see how it looks ?

Ok!

Quote
And should i use this setup for sunny days and cloudy days? And the F-Stop? low = 2.8, target = 4.0, max = 8.0?
I'm travelling this week so doing this all from memory via a mobile phone.  Does your camera actually even have a user adjustable aperture?  If not, the script will just ignore those settings.

It have only a ND Filter, so those settings wont work!

Quote
And btw in the Focus @ infinity mode i choose the none option, right?
If it works for you (and it does for most people) then the setting focus at infinity to MF is probably best.  Gives the camera one less thing to do between shots.

Update :  one of the common causes of blurr is vibrations on the UAV platform.  You have some good pix so that's probably not an issue.  Also,  it seems that turning off image stablization (if your camera allows that) is may actually a good idea - YMMV.

How does it work that MF thing?
And regarding the vibration inst a problem, i got very sharp photos when there is plenty of sun!
And yes i can turn off the image stabilization!

Thank you so much man. Tomorrow i share the results!

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / September / 2014, 13:50:41
The MF and AFL settings basically tell the camera not to autofocus.  The script gives it a command to just set the focus at infinity.   This saves time as the focus should be at infinity and the camera does not need to figure that out based on a moving image off in the distance.

Either of the setting works well on most cameras if you are using CHDK release 1.3.0.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: JMarques on 21 / September / 2014, 14:00:41
I have the 1.2.0 version.

Maybe that why that when i tried to use the AFL the result was total unfocus in all batch of photos (see attch)

Does it worth to upgrade to 1.3.0?


Ps. since the interval is 3s and i start to take photos since altitude is 0m to 100m maybe this option inst valid for me.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / September / 2014, 14:07:54
1.3.0. is what I use to test the script.  You'll need it for MF setting.   Go for it.

And on these little cameres,  infinity starts at about 30' due to their large depth of field.  So I'd advise using it if it works for you.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: JMarques on 21 / September / 2014, 14:17:19
ok! gonna upgrade ASAP.

And one final question i have another sx260 but with a NIR filter should i use the same settings? Or do i need another settings?


 ;)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / September / 2014, 14:46:35
I'm guessing the same settings. One script user reported better success with his IR modded camera than his stock unit.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: JMarques on 21 / September / 2014, 15:19:02
Thanks once again.

Tomorrow i will post some feedback regarding this settings!

 :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / September / 2014, 15:25:07
Make sure you have logging to the SD card enabled. If things don't turn out well those log files can be a big help in understanding what!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: JMarques on 21 / September / 2014, 15:43:52
Checked! ;)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: MarkB on 27 / September / 2014, 19:16:20
Finally got around to testing the latest TLAPTEST v3 script with no logging. 

My apologies for taking so long. 

I used the same SD card I had been using for all the previous test. In the video there does not seem to be the time shift I have been previously experiencing.  Unfortunately it was a cloudless sky and the clouds moving was the easiest way to see the shift in the interval time, but the shadows moving and the traffic seems to be consistent.  There is some flicker in the exposure.  It is not the huge jumps I have seen in some of my other attempts but still there.  This might be down to the limitations of the camera since it is one without an iris in the lens so if there is any breathing in the focus (the lens moving in and out) there might be subtle changes in the exposure.

http://youtu.be/4qMANT8VItA (http://youtu.be/4qMANT8VItA)

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: JMarques on 02 / October / 2014, 15:04:56
After a week of tweaking, the problem was vibration from the propellers. Its almost fixed but niw i have a little bug with the KAP script.

Every time i put 3s interval photo the script dont use it, sometimes use 2s interval, and in the next point use 5s or 4s. Totally random. Is this a bug or what? Wierd.


THANKS!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / October / 2014, 15:38:11
Every time i put 3s interval photo the script dont use it, sometimes use 2s interval, and in the next point use 5s or 4s. Totally random. Is this a bug or what? Wierd
You may be running into a limit on how fast the camera can shoot. Three seconds per shoot using standard shooting methods is pretty much the limit for most small P&S cameras. Because of this you will see shots at 2,3 and 4 seconds.  Try setting the shoot time to four seconds and see if things settle down?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: JMarques on 02 / October / 2014, 19:53:12
Hi water,

The problem is if i use the intervalometer default script it works in 3s, it even work in 2s timer.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / October / 2014, 19:56:06
The problem is if i use the intervalometer default script it works in 3s, it even work in 2s timer.
Understood.  But humor me and let me know what happens when your run kap_uav with a four second interval ?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / October / 2014, 20:09:37
My apologies for taking so long. 
No worries - I know how that goes.  And I'll apologize for the late response by me too.

Quote
I used the same SD card I had been using for all the previous test. In the video there does not seem to be the time shift I have been previously experiencing.  Unfortunately it was a cloudless sky and the clouds moving was the easiest way to see the shift in the interval time, but the shadows moving and the traffic seems to be consistent. 
I think the pretty much demonstrates that when the log file is "flogging" the SD card with log messages, in addition to the actual image data being stored,  every 4 seconds, then the SD card bogs down.   I'll look at doing a "delayed write" log file that only updates every so often - or maybe after shooting has completed.  The issue there is making sure people shut the script down cleanly so that the log file has time to be written.

Quote
There is some flicker in the exposure.  It is not the huge jumps I have seen in some of my other attempts but still there.  This might be down to the limitations of the camera since it is one without an iris in the lens so if there is any breathing in the focus
In these later tests (unlike kap_uav.lua which tries for the highest shutter speed at reasonable ISO) the camera exposure is running in full "AUTO" mode.  Nothing to do with the script.   The flashing seems to be some sort of artifact of the camera AE operation - either it is not responding to legitimate exposure changes very well or  the scene is actually changing like that as clouds roll over.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: JMarques on 02 / October / 2014, 20:10:35
The problem is if i use the intervalometer default script it works in 3s, it even work in 2s timer.
Understood.  But humor me and let me know what happens when your run kap_uav with a four second interval ?

tomorrow i give you a answer! ;) thank1
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: JMarques on 02 / October / 2014, 20:42:21
So i tried with 4s, 3s and 2s. And the results were always the same, very very random between 5s to 6s.

The wierd thing is that between shots the real time dont look that big. I'm using the default parameters in the KAP Script.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / October / 2014, 20:45:01
So i tried with 4s, 3s and 2s. And the results were always the same, very very random between 5s to 6s.
The weird thing is that between shots the real time don't look that big. I'm using the default parameters in the KAP Script.
I should have asked this right away.  Do you have RAW or DNG enabled?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: JMarques on 02 / October / 2014, 20:49:28
I should have asked this right away.  Do you have RAW or DNG enabled?

No! Just plain JPG. Gonna remove the script and reinstall it again.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / October / 2014, 21:31:27
Gonna remove the script and reinstall it again.
That does not really reset everything.   You also need to click on "Load default param values" in the CHDK Script menu.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: JimiSlew on 04 / November / 2014, 17:11:19
Hi All,

I'm trying to get this to work with a gentwire using PWM. So far using the defaults It will turn off, turn on, and take a picture. I was wondering if anyone made a script that would allow for off, turn on, and take pictures at an interval until turned PWM turned it to one of the other two modes.

Thanks for any help!

Jim
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 04 / November / 2014, 19:21:18
I'm trying to get this to work with a gentwire using PWM. So far using the defaults It will turn off, turn on, and take a picture. I was wondering if anyone made a script that would allow for off, turn on, and take pictures at an interval until turned PWM turned it to one of the other two modes.
Hi Jim.  You are the first person to report using the gentwire device and it's good to hear it's working.  I added that code without the ability to really test it with an actual gentwire module  ( I used an arduino board to generate the pulses for testing ).

As a small "reward",  I'll update the script to allow enabling intervalometer shooting under gentwire control.  As there are "only" six discrete signals available from that device and they are currently all used by the script,  I guess the question is what to trade off ? Select between zoom control and intervalometer mode?   Or just make the on/off also (optionally) enable the intervalometer when turned on?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: JimiSlew on 04 / November / 2014, 20:36:07
Thanks! Waterwingz,

I think changing out the zoom with an intervalometer would be great (for me at least). I've used your script before but today was the first time with Gentwire so thanks for all the support and detail you put into this.

Best,

Jim
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Skndol on 17 / December / 2014, 18:21:42
Hi!
I want buy a canon to install it to my multicopter for photogrammetry, also i dont know which one would be better. (I know i need to install chdk and the script)
Canon s100?
Sx260hs?
Any recommendations?

Thanks :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / December / 2014, 09:48:51
Any recommendations?
Asking for camera recommendation on this forum is often a good idea.  However, most of the people who post here usually only have experience with one or two models (the one they happen to own and use) so most of the advice you will receive is basically opinions.

Having said that, from a CHDK perspective, it does not really matter much which CHDK supported camera you use - all the features will work pretty much the same way on any released camera. However, for your application there may be camera performance features that matter more to you.   Things like weight, size and battery life will be important.  You probably also want something that will shoot as fast as possible.  WIthout playing tricks, this is currently somewhere between two and four seconds per shot using things like the KAP_UAV.LUA script.  If you anticipate needing to go faster there are scripted ways to do so but getting below one second per shot could depend on the particular camera.

Sorry not to be more specific.  If you can live with the two seconds per shot and size/weight then either the s100 or sx260 would be good choices.  As the principal author of the KAP_UAV.LUA script, I also have an S100 and know it works well with the script.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Skndol on 18 / December / 2014, 18:14:17
For the same reason that s100 seems to be the best one...i will buy one and try it :)
I wait to dont have blurry photos!! Hhaha

Thanks :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Skndol on 21 / December / 2014, 09:41:19
Culd you post your setup with the s100?
Thanks :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / December / 2014, 10:29:37
Culd you post your setup with the s100?
Shot Interval (sec)      [ 3 ]
Total Shots (0=infinite) [ 0 ]
Power off when done?     [   ]
Exposure Comp (stops)    [ 0 ]
Tv Min (sec)             [ 1/200  ]
Target Tv (sec)          [ 1/1000 ]
Tv Max (sec)             [ 1/5000 ]
Av Low(f-stop)           [ 2.0  ]
Av Target (f-stop)       [ 4.0  ]
Av Max (f-stop)          [ 8.0  ]
ISO Min                  [ 80   ]
ISO Max1                 [ 400  ]
ISO Max2                 [ 1600 ]
Meter Filter Factor?     [ Off  ]
Allow use of ND filter?  [ Yes  ]
Zoom position            [ 0%   ]
Focus @ Infinity Mode    [ MF   ]
Video Interleave (shots) [ Off  ]
Video Duration (sec)     [ 0    ]
USB Shot Control?        [ None ]
Backlight Off?           [ * ]
Logging                  [ Both ]
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Skndol on 21 / December / 2014, 17:18:24
Culd you post your setup with the s100?
Shot Interval (sec)      [ 3 ]
Total Shots (0=infinite) [ 0 ]
Power off when done?     [   ]
Exposure Comp (stops)    [ 0 ]
Tv Min (sec)             [ 1/200  ]
Target Tv (sec)          [ 1/1000 ]
Tv Max (sec)             [ 1/5000 ]
Av Low(f-stop)           [ 2.0  ]
Av Target (f-stop)       [ 4.0  ]
Av Max (f-stop)          [ 8.0  ]
ISO Min                  [ 80   ]
ISO Max1                 [ 400  ]
ISO Max2                 [ 1600 ]
Meter Filter Factor?     [ Off  ]
Allow use of ND filter?  [ Yes  ]
Zoom position            [ 0%   ]
Focus @ Infinity Mode    [ MF   ]
Video Interleave (shots) [ Off  ]
Video Duration (sec)     [ 0    ]
USB Shot Control?        [ None ]
Backlight Off?           [ * ]
Logging                  [ Both ]



Love you  :-*

Thanks waterwingz =)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / December / 2014, 17:28:31
Love you  :-*
Thanks waterwingz =)
Umm ... let's not get too carried away here.  Those are sample values that should be useful.  As you start using the script you will probably want to tune for your own use.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Skndol on 09 / January / 2015, 14:44:35
I can´t understand how to set in each option the infinity focus

@shot : tells the script to  focus at infinity prior to each shot.  Some cameras do not require the use of Canon AFL or MF moded to focus. (This one would be very slow? because it needs to focus and then do the photo)

AFL :  sets the camera into Canon AFL ( auto focus lock ) mode and sets the focus to infinity.

MF :  sets the camera into Canon MF ( manual focus ) mode and sets the focus to infinity.

Which one is the diference between the AFL and MF? what i need to do if i choose one of them to put them to infinity?

For example with the AFL: i start the cammera pointing to something really far (infinity) but how i focus that object in the infinity? and when is focused i start the script so i start to take photos. is it correct?

and with the MF what i need to do?

and other question, in which option needs to be the cammera? Auto, P, Tv, Av??


thanks :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / January / 2015, 19:45:24
]Which one is the diference between the AFL and MF? what i need to do if i choose one of them to put them to infinity?
There are two methods that Canon cameras will accept to disable auto focus and allow manual focus.   These are AFL (for auto focus lock)  and  MF  (for manual focus).   For most cameras, either method will work.  For some only one or the other works.   The script allows you to pick which one you would like used - typically AFL will work fine for almost every camera.  If it does not work for yours,  try MF.

Quote
For example with the AFL: i start the cammera pointing to something really far (infinity) but how i focus that object in the infinity? and when is focused i start the script so i start to take photos. is it correct?
Not correct.   The script will put the camera into AFL mode and then set the focus distance at infinity.  You do not need to point the camera at anything (near or far) for this to happen.  Same thing for MF mode.

Quote
and other question, in which option needs to be the cammera? Auto, P, Tv, Av??
The script will override all exposure and focus values so it should not matter.  However, in general,  P mode is usually the least likely to cause problems.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Skndol on 10 / January / 2015, 11:15:35
]Which one is the diference between the AFL and MF? what i need to do if i choose one of them to put them to infinity?
There are two methods that Canon cameras will accept to disable auto focus and allow manual focus.   These are AFL (for auto focus lock)  and  MF  (for manual focus).   For most cameras, either method will work.  For some only one or the other works.   The script allows you to pick which one you would like used - typically AFL will work fine for almost every camera.  If it does not work for yours,  try MF.

Quote
For example with the AFL: i start the cammera pointing to something really far (infinity) but how i focus that object in the infinity? and when is focused i start the script so i start to take photos. is it correct?
Not correct.   The script will put the camera into AFL mode and then set the focus distance at infinity.  You do not need to point the camera at anything (near or far) for this to happen.  Same thing for MF mode.

Quote
and other question, in which option needs to be the cammera? Auto, P, Tv, Av??
The script will override all exposure and focus values so it should not matter.  However, in general,  P mode is usually the least likely to cause problems.

Ok, per parts

I have the s100,you told me you have the mf, but i really dont know the difference. Which one do you recommend me? I am a bit noob but i learn very fast hehe

Another thing, you are saying that the P is the best one? I tried a couple of photos moving my cammera with my hand (trying to simulate the flight with my drone) but the phottos were a bit moved (blurry)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 10 / January / 2015, 11:47:18
I have the s100,you told me you have the mf, but i really dont know the difference. Which one do you recommend me? I am a bit noob but i learn very fast hehe
Either will work.   Use MF if you want me to make the decision for you.

Quote
Another thing, you are saying that the P is the best one? I tried a couple of photos moving my cammera with my hand (trying to simulate the flight with my drone) but the phottos were a bit moved (blurry)
That will depend on what Tv settings you are using (shutter speed) and how fast yoou moved the camera.   Nothing to do with the script - it's simple physics.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Skndol on 10 / January / 2015, 12:25:55
I have the s100,you told me you have the mf, but i really dont know the difference. Which one do you recommend me? I am a bit noob but i learn very fast hehe
Either will work.   Use MF if you want me to make the decision for you.

Quote
Another thing, you are saying that the P is the best one? I tried a couple of photos moving my cammera with my hand (trying to simulate the flight with my drone) but the phottos were a bit moved (blurry)
That will depend on what Tv settings you are using (shutter speed) and how fast yoou moved the camera.   Nothing to do with the script - it's simple physics.

Ok, i didnt changed the defaults settings. But i will try it in the air instead with my hand hahaha and i hope the results will be better.

Thanks :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 10 / January / 2015, 12:37:39
Ok, i didnt changed the defaults settings. But i will try it in the air instead with my hand hahaha and i hope the results will be better.
I'd suggest starting with the ones I posted earlier in this thread.   < link >  (http://chdk.setepontos.com/index.php?topic=10822.msg119218#msg119218)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Skndol on 10 / January / 2015, 13:57:35
Ok, i didnt changed the defaults settings. But i will try it in the air instead with my hand hahaha and i hope the results will be better.
I'd suggest starting with the ones I posted earlier in this thread.   < link >  (http://chdk.setepontos.com/index.php?topic=10822.msg119218#msg119218)
Just changued the settings.  :-*
I made couple of photos a moment ago and i set the ISO(with the ring) in the P (P is the best one as you said before, right? Hehehe) as auto but i think it doesnt affect because the is taken with the script.
The photos were a bit dark but i think is because im at my room with a light bulb in the roof. But no blurry :)

What i need to do if they continue dark with natural light?

Thanks again :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 10 / January / 2015, 14:06:12
What i need to do if they continue dark with natural light?
You need to look at the exposure values that the script used (  Tv, Av, Sv ) and determine if any of them are at the limit values set in the parameters for the script.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Skndol on 10 / January / 2015, 14:21:33
What i need to do if they continue dark with natural light?
You need to look at the exposure values that the script used (  Tv, Av, Sv ) and determine if any of them are at the limit values set in the parameters for the script.

Yes it arrived to the iso max2
I will check it with natural light
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 19 / January / 2015, 07:59:34
Hi All!

First, a big kudos for waterwingz for the script and the support!
My question would be:
For the RC PWM control what kind of cable do I need?
I would prefer to use all 6 options.
Also where should I set my "don't do anything PWM"?

I have a gentWIRE-USB which converts the PWM to Pulses for the script below but using that wire I was getting random actions and many errors in-between .
Many thanks in advance!
Tom

while 1
   do
      k = get_usb_power
   until k>0
   if k < 5 then gosub "ch1up"
   if k > 4 and k < 8 then gosub "ch1mid"
   if k > 7 and k < 11 then gosub "ch1down"
   if k > 10 and k < 14 then gosub "ch2up"
   if k > 13 and k < 17 then gosub "ch2mid"
   if k > 16 and k < 20 then gosub "ch2down"
   if k > 19 then print "error"
wend

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / January / 2015, 20:06:26
My question would be:  For the RC PWM control what kind of cable do I need?
gentWIRE-USB

Quote
I would prefer to use all 6 options.  Also where should I set my "don't do anything PWM"?
I understand the "6 options" part.  But what do you mean by "don't do anything PWM"?

Quote
I have a gentWIRE-USB which converts the PWM to Pulses for the script below but using that wire I was getting random actions and many errors in-between .
What camera are you using?  After a lot of fussing and worry last year, it turned out that some cameras are have better accuracy measuring PWM data (in shooting mode) than others.  I emailed with George at Gentles and he indicated not having run into this problem but my testing leads me to believe it will happen. 

Fortunately, there is a solution in the 1.3.0 version of CHDK (or newer)  - a new function called  set_remote_timing().  Using this causes CHDK to use a camera internal high precision timer to measure pulses, giving much better accuracy.  For your code snippet,  you need to do something like this :

Code: [Select]
   set_remote_timing 1000
   while 1
   do
      k = get_usb_power
   until k>0
   if k < 5 then gosub "ch1up"
   if k > 4 and k < 8 then gosub "ch1mid"
   if k > 7 and k < 11 then gosub "ch1down"
   if k > 10 and k < 14 then gosub "ch2up"
   if k > 13 and k < 17 then gosub "ch2mid"
   if k > 16 and k < 20 then gosub "ch2down"
   if k > 19 then print "error"
wend

Try that and let us know how it works out?  If it's good, I guess I should add this option to the next release of kap_uav.lua.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: zapf on 22 / January / 2015, 23:26:22
Hello waterwingz, I wanted to say thanks for making this script. I was originally going to ask about an error I was having, but it turns out it was due to being on a developmental 1.4 version of chdk. Two other questions though. (I'm using an S100 for reference)

A) are there any other camera settings I need to set up before starting the script? GPS is on, and I had some custom settings in the C mode prior to installing / configuring the script - does it matter what shooting mode my s100 is dialed to?
B) is there any way to disable to automatic rotation of images / orientation sensor in the s100? this is not really a script specific question, but you seem knowledgeable of the s100
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / January / 2015, 23:44:21
Hello waterwingz, I wanted to say thanks for making this script.
A lot of CHDK people have helped to make the script happen.  I'll say thanks for all of them.

Quote
I was originally going to ask about an error I was having, but it turns out it was due to being on a developmental 1.4 version of chdk.
So was it an error or just a message about the version of CHDK you were using?  I'll be fixing that in the next update regardless.

Quote
A) are there any other camera settings I need to set up before starting the script? GPS is on, and I had some custom settings in the C mode prior to installing / configuring the script - does it matter what shooting mode my s100 is dialed to?
Hmmm .. well, the script will use CHDK to override Canon exposure settings so that is gets the Tv, Av, and Sv settings it thinks is needed.   To be safe,  P mode should work for most cameras but you can probably use your C mode stuff - CHDK will override the settings it needs to.

Quote
B) is there any way to disable to automatic rotation of images / orientation sensor in the s100? this is not really a script specific question, but you seem knowledgeable of the s100
AFAIK,  the camera will take the image it sees - full sensor resolution.  Any automatic rotation you see is only happening to the image displayed in the camera's LCD.  The final result you get from the SD card should be the full sensor resolution with something in the image EXIF information that tells PC software about the camera's rotation at the time the image was taken.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: zapf on 23 / January / 2015, 07:42:33
It warned me about not being able to detect the version of chdk I was using, and then when attempting to run, it would flash repeatedly in the corner the script title, but not actually start doing anything. At that point, the camera became very laggy / unresponsive until I turned it off. I dont remember the exact build of 1.4 I was using unfortunately - it was my first time installing it, and the 1.3 build was temporarily not available either via ACID or direct download for some reason.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: suffolkkapper on 26 / January / 2015, 14:07:28
Hi there, this is my first post to the CHDK forum...I have been reading the advice and using the scripts for a while, and thought I should say hi...especially as I have some questions!... I was hoping I could get some help here....I added this script to my scripts folder in chdk and used it on the weekend with a canon s100 suspended below a kite.....

I don't know where I went wrong, but after a few seconds of it working it went from taking pictures every few seconds, to taking video! I'm sure I am doing something very obviously wrong, but I cant work it out!...the video option appeared to be switched off?

I also started playing with some of the parameters, and when I tried to revert the parameters back to defaults it didn't seem to want to do anything....it just held onto my settings I had put in myself!

I have been worrying a lot recently that my S100 may be a bit of a dud...and the focus seems very soft, and I have been advised that this script will get the best out of my camera, so now I just have to work out how to use it properly!

I was speaking to Dave Mitchell and he said that I could use it with my autokap rig, but couldn't remember which of the options to select for the usb shooting mode, i.e. on/off, none, oneshot or pwm?

Finally I was wondering if I can use the script if I want to just take shots with it on my remote controlled rig, where a servo arm comes down and presses the shutter?

Thanks in advance for any help!

Cheers!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 26 / January / 2015, 17:26:54
I don't know where I went wrong, but after a few seconds of it working it went from taking pictures every few seconds, to taking video! I'm sure I am doing something very obviously wrong, but I cant work it out!...the video option appeared to be switched off?
Cheers!
Strange.  I can test tonight on my S100 to see if I can reproduce this.

What version of CHDK are you using ?  (the complete name of the downloaded zip file if possible).

Do you have the CHDK USB remote settings disabled while using the script?  Was the camera mode dial in P mode (rather than video) ?

Quote
I also started playing with some of the parameters, and when I tried to revert the parameters back to defaults it didn't seem to want to do anything....it just held onto my settings I had put in myself!
How did you attempt to do that?

Quote
I have been worrying a lot recently that my S100 may be a bit of a dud...and the focus seems very soft, and I have been advised that this script will get the best out of my camera, so now I just have to work out how to use it properly!
We have had issues with focus at infinity with several user's S100's so I bought one to try it our.  Naturally mine works properly without issues.   Are your images soft without CHDK loaded?


Quote
I was speaking to Dave Mitchell and he said that I could use it with my autokap rig, but couldn't remember which of the options to select for the usb shooting mode, i.e. on/off, none, oneshot or pwm?
You'll have to tell me what you are hooking up to the camera before I can answer that.

Quote
Finally I was wondering if I can use the script if I want to just take shots with it on my remote controlled rig, where a servo arm comes down and presses the shutter?
No.  If you press the button with the shutter script running,  the script will simply stop.   The script does a lot of complex exposure calculations and then takes each shot itself.  You could modify the script so that it disables the shutter button from shooting and then monitors the state of that button and shoots when you press it.  Not sure that gets you much though?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: ferdix on 27 / January / 2015, 16:57:21
Hi,
thank you for this wonderful script.
I try to set it up with my quadcopter and a canon ixus 70.
So far it works fine. But as i wanted to get more control i soldered some wires an added a USB switch that i trigger with my rc (taranis). I used this tutorial: http://youtu.be/69V5F0iRtIY (http://youtu.be/69V5F0iRtIY)
Here is my question: When i use the USB Shot Control option On/Of I have to use the switch of my radio twice to start shooting. After the first time i only get the message "waiting for USB..." and it needs the second push to start shooting pictures. Is that ok ? And if it is, why is it better not to start immediately...
The second question ist more important. In the chdk settings "Enable Remote" won't stay checked after on use of the script - that means i have to check this option everytime before start otherwise my rc switch won't start the script at all.
Do you know why that is?
Hope my questions aren't to stupid...

Thanks a lot
Ferdix 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / January / 2015, 17:32:43
When i use the USB Shot Control option On/Off I have to use the switch of my radio twice to start shooting. After the first time i only get the message "waiting for USB..." and it needs the second push to start shooting pictures. Is that ok ? And if it is, why is it better not to start immediately...
I think your issue here (and below) is not understanding how the USB Shot Control options work.

Documentation for this script can be found here :
http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script)

In your case,  the use of On/Off control mode means that the script's built-in intervalometer will start shooting when the USB remote is active (+5V) and wait when it is in active (0v).  If you want to shoot each time the USB voltage goes active,  use the "OneShot" setting.

Quote
The second question is more important. In the chdk settings "Enable Remote" won't stay checked after on use of the script - that means i have to check this option every time before start otherwise my rc switch won't start the script at all.
The script sets the "Enable Remote" setting to "Enabled" when it starts.  It resets it to not enabled when it completes.  I had not though about people actually trying to start the script with their remote as well.   Thank you for finding this and reported it!

To fix this,  I'll add some code to detect if that setting is already enabled when the script starts and then not disable it when the script exists.

If you want to fix this on the current 3.2 version of the script,  delete line 298 with a text editor where it says :

Code: [Select]
set_config_value(121,0)                                             -- USB remote disable
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: ferdix on 28 / January / 2015, 02:16:25
Thanks a lot for your quick reply waterwingz

One of my problems is my poor english  - at least when it comes to technical expressions...   :)
As far as i understand i need the initial USB 5v not till then the script starts with the second impulse.
My problem with that is that i don't get a feedback of the actual stat and therefore I am never sure if the camera is shooting when my quadcopter is in the air. Yes, with only one needed push i wouldn't know that either...
Probably there won't be a perfect solution for me...

As I read in some post above - if i want to use the PWM function I need this particular cable you mentioned.
I there some micro controller inside to transform the signal? I tried some funny time changing the script to get some longer lasting 'windows' for the pulse and tried to emulate it by hand - just got error messages. You see I am not a tech guy (in fact a gardener) and need a lot of try and errors.

Anyway a great script - already got some good photos !

ferdix

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 28 / January / 2015, 21:06:08
As far as i understand i need the initial USB 5v not till then the script starts with the second impulse.
My problem with that is that i don't get a feedback of the actual stat and therefore I am never sure if the camera is shooting when my quadcopter is in the air. Yes, with only one needed push i wouldn't know that either...
Probably there won't be a perfect solution for me...
The "normal" sequence with this script is :


Quote
As I read in some post above - if i want to use the PWM function I need this particular cable you mentioned.
That's probably the easiest way to do it.   You could build your own with a small microcontroller but why bother?

Quote
I there some micro controller inside to transform the signal?
I assume so.

Quote
I tried some funny time changing the script to get some longer lasting 'windows' for the pulse and tried to emulate it by hand - just got error messages. You see I am not a tech guy (in fact a gardener) and need a lot of try and errors.
I can't help here unless you post your modified script and the exact error messages you saw.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 11 / March / 2015, 12:21:19
Hello, I made a few modifications to the v3.3 KAP_UAV script (for CHDK v1.3). My focus was to adapt the script to flying a fixed wing with pixhawk autopilot and a cheap hobbyking relay adapter (using the scripts "PWM" mode).

Changelog vs stock 3.3:
- Added an option to use the external USB timer when reading USB pulse widths ("set_remote_timing" command)
- Added an option to stop the script after X minutes (useful to ensure the lens will retract if I cannot signal the script to stop)
- Added a buffer to the log routine, in order to prevent write delays on slow SD cards. The Log is written every 0.1 second
- Removed a limitation that prevented the camera to power off when setting "Total Shots" param to 0 (infinite shots)
- Customized the pwm_mode to suit my needs: a short pulse signals "shoot", and a longer pulse signals "stop script" (mission end)
- Added logging in a few places, the most interesting place is in the "pwm_mode(pulse_width)" function, it now logs the measured pulse width (useful for debugging purposes when using a cheap relay with poor timing control)


I hope somebody finds my modifications useful!
Naccio
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / March / 2015, 18:22:04
Hello, I made a few modifications to the v3.3 KAP_UAV script (for CHDK v1.3). My focus was to adapt the script to flying a fixed wing with pixhawk autopilot and a cheap hobbyking relay adapter (using the scripts "PWM" mode).

Changelog vs stock 3.3:
- Added an option to use the external USB timer when reading USB pulse widths ("set_remote_timing" command)
- Added an option to stop the script after X minutes (useful to ensure the lens will retract if I cannot signal the script to stop)
- Added a buffer to the log routine, in order to prevent write delays on slow SD cards. The Log is written every 0.1 second
- Removed a limitation that prevented the camera to power off when setting "Total Shots" param to 0 (infinite shots)
- Customized the pwm_mode to suit my needs: a short pulse signals "shoot", and a longer pulse signals "stop script" (mission end)
- Added logging in a few places, the most interesting place is in the "pwm_mode(pulse_width)" function, it now logs the measured pulse width (useful for debugging purposes when using a cheap relay with poor timing control)
Nice! 

I've actually been circulating a 3.4 beta version that has a set_remote_timing(1000) command included (but not optional).   When I release the 3.4 update I'll add your logging changes (per the MarkB conversation earlier in this thread this probably needs to use a longer interval than 10 seconds) and the shutdown after "n" minutes option.   I'll add your name to the script credits too.

FWIW, I'm also working on a GUI option (something like the ultimate intervalometer uses) :
(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fvignette1.wikia.nocookie.net%2Fchdk%2Fimages%2F8%2F8e%2FUltimate2.png%2Frevision%2Flatest%3Fcb%3D20130519223357&hash=8aad815e3ede9e7d9436f4099cca952f)

even though nobody will see it when the kite/uav is airborne.

I'm currently thinking of waiting until CHDK 1.4.0 is release all of this - the improved memory handling and better script parameter options are probably worth the wait and that way I don't have to retest everything twice.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: AdamDynamic on 21 / March / 2015, 14:41:44
Firstly, thanks to all for this script, it looks like it will do *exactly* what I need it to :)

I'm having am issue getting it to run reliably on my Canon A560 (CHDK v1.3 installed). The time-lapse photos work fine, the first video is triggered fine but the script seems to crash when it should revert back to time-lapse photos.

There is an error message displayed on the screen:

Quote
:133 attempt to index global 'log' (a nil value)

I have logging enabled for the script (screen and SD card), I don't know much about the 'logging' process though - I can see a 'LOG' folder in the CHDK folder but it is empty (perhaps it's trying to write to a file that doesn't exist?)

Any assistance on resolving this issue would be much appreciated!

Thanks,

Adam
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / March / 2015, 15:12:14
I have logging enabled for the script (screen and SD card), I don't know much about the 'logging' process though - I can see a 'LOG' folder in the CHDK folder but it is empty (perhaps it's trying to write to a file that doesn't exist?)
The log file is actually stored in the root of the SD card (the top level directory folder) rather than the LOG folder.   It is called KAP.log.  If you can find that and post it here, it will make fixing this much easier.

Thanks.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: AdamDynamic on 21 / March / 2015, 16:44:53
Thanks for the reply, the output in the KAP.log file is below:

2015MAR21 20:37:09 KAP 3.3 started - press MENU to exit
2015MAR21 20:37:09 CHDK 1.3.0-4043 a560 100a Mar  4 2015
2015MAR21 20:37:09 Mode:AUTO,Continuous_AF:0,Servo_AF:17
2015MAR21 20:37:09  Tv:1/100 max:1/2000 min:10 ecomp:0.0
2015MAR21 20:37:09  Av:4.0 minAv:2.8 maxAv:8.0
2015MAR21 20:37:09  ISOmin:100 ISO1:400 ISO2:800
2015MAR21 20:37:09  MF mode:0  Video:1 USB:0
2015MAR21 20:37:10  AvM:2 int:15 Shts:5 Dly:0 B/L:0
2015MAR21 20:37:10 setting zoom to 0 percent step=0
2015MAR21 20:37:16 1) IMG_5329.JPG
2015MAR21 20:37:16  meter : Tv:1/8 Av:2.8 Sv:200 -213:-213
2015MAR21 20:37:17  actual: Tv:1/5 Av:- Sv:800
2015MAR21 20:37:17          AvMin:2.8 NDF:NDout foc:1.1m
2015MAR21 20:37:28 Video mode started. Button:false
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / March / 2015, 17:13:43
Thanks for the reply, the output in the KAP.log file is below:
As it happens,  I too have an A560 and get the same crash (which doesn't happen with my S100 or A1200 or G10).

I'll see what I can find out.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / March / 2015, 18:12:26
Okay - found the problem.  Not really sure why it's camera specific but adding a short delay after releasing the shutter button when halting video cures the problem.

Test script here :  xkap_uav.lua (https://app.box.com/s/fczbteiduuysfme8h678uepnaea4uyf2)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 22 / March / 2015, 07:46:33
Hello Waterwingz ,

I am using this script since a lot of time and it's working great!

I'm using it on a S100 camera for photomapping purposes , in order to geotag the pictures I need to do a correlation between the hour/minute/second when the picture was done and the hour/minute/second when my autopilot recorded the corresponding coordinates.

My autopilot records 4 time per second the coordinates (longitude,latitude,altitude) , so for 1 picture I have 4 possible locations. To be easier to geotagg the image with the right values is possible to have also on KAP.log file the second divided to 4 or 2 timeframes ? So to have HH/MM/SS/xx where xx represent 00 / 25 /50 /75 th of a second ?

Also , to better understand , the hour recorded in the log is the hour when:
- the picture is recorded on the memory card;
- camera start to focus to take the picture;
-the script gives the "command" to the camera to take the picture ?

Thank you.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / March / 2015, 10:25:36
I'm using it on a S100 camera for photomapping purposes , in order to geotag the pictures I need to do a correlation between the hour/minute/second when the picture was done and the hour/minute/second when my autopilot recorded the corresponding coordinates.
Just curious here - do you use the S100's GPS capability here?  Or is it too slow / inaccurate to be useful?

Quote
My autopilot records 4 time per second the coordinates (longitude,latitude,altitude) , so for 1 picture I have 4 possible locations. To be easier to geotagg the image with the right values is possible to have also on KAP.log file the second divided to 4 or 2 timeframes ? So to have HH/MM/SS/xx where xx represent 00 / 25 /50 /75 th of a second ?
The camera's system clock only provides the time to a one second resolution and that's what the script currently uses.  The internal tic timer is more accurate - it works in 10 mSec increments.  There have been several discussions about this on the forum :

link > EXIF timestamp with milliseconds precision from GPS (http://chdk.setepontos.com/index.php?topic=9597.0)
link > Display time with milliseconds (http://chdk.setepontos.com/index.php?topic=5785.10)
link > Need help with script that can show timestamp in recorded video file (http://chdk.setepontos.com/index.php?topic=5783.msg56561#msg56561).

and it looks like philmoz may have actually implemented a tic time 10 msec accuracy time stamp that gets save in the EXIF tags in CHDK DNG files.  In the last link,  fudgey found that just adding the tic timer to the system clock value seemed to stay sync'd as well.

So if you are using CHDK DNG files you already have pretty much as accurate a timestamp as CHDK / Canon is going to be able to produce.  Although I suppose we could go one more step and use the recently discoverd high precision timers to go down to 1 mSec or better with some more CHDK core coding work.

The drawback to using DNG files of course is the extra time it takes to store them - which will slow down your maximum shot rate quite a bit.

So having said all that,  I think it might be possible learn from what philmoz did and implement better resolution in kap_uav.lua by using reyalp's new script shooting hooks (hook_shutter()).  I'm not sure how good the absolute accuracy of the timestamps would be but the relative accuracy from one to the next should be pretty good.

Would that work?

Quote
Also , to better understand , the hour recorded in the log is the hour when:
- the picture is recorded on the memory card;
- camera start to focus to take the picture;
-the script gives the "command" to the camera to take the picture ?
I'm afraid it's pretty much your first case.  The time stamp is when the actual log file entry is record in the log.  Which happens after quite a bit of additional code that collects shot data and formats it.   That has not been a problem to date but it would be trivial to record the actual time stamp at the moment the shutter is commanded to release.  With a bit more work (see my comments above) the script raw shooting hooks could get even closer to when the actual image is taken.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / March / 2015, 12:21:03
I did a little more playing with this idea of combining the tic timer and the os system time.  Wrote a script to do that and had it periodically check that the rollover from 990 mSec to 000 mSec happens in sync with the OS time.

Looks pretty good on the cameras I tested - including my S100 and my very old A560.

I guess that makes sense though.  The camera likely only reads the current date & time from the RTC chip at power-up.  After that,  the tic timer maintains the date & time so it will by default be sync'd with the reported time!

So without over thinking this,  I think I can easily add this to the script and use the hook_shutter() function to give me about 20 mSec of resolution on the exact time the camera starts each shot.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 22 / March / 2015, 15:57:13
Thanks a lot for your feedback, if it will be possible to implement hook_shutter() function on the KAP script I will test it during several flights.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / March / 2015, 16:13:20
Thanks a lot for your feedback, if it will be possible to implement hook_shutter() function on the KAP script I will test it during several flights.
I've added it to the v3.4 release that I've been working on.   There are several other changes in there that have not had any testing.  I'll do some unit testing of each of the changes and then ask you to give it a try?  There are a few other script users who might also be willing to give the changes a whirl.   That should be the last version before CHDK 1.4.0 becomes the "stable" release and I can upgrade the script to use the new functionality that brings.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: AdamDynamic on 22 / March / 2015, 16:34:49
Okay - found the problem.  Not really sure why it's camera specific but adding a short delay after releasing the shutter button when halting video cures the problem.

Test script here :  xkap_uav.lua (https://app.box.com/s/fczbteiduuysfme8h678uepnaea4uyf2)

This seems to have solved the problem, many thanks!

As a small aside, the script now returns to taking still frames once the camera has finished shooting the video, I have turned the flash to 'off' initially but when the video finishes the flashmode seems to revert to 'auto'? I thought about changing the flashmode each time using the lua script but I can see a 'get_flash_mode' function but no obvious 'set_flash_mode' option? Am I missing something obvious?

Thanks again for the help,

Adam
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 22 / March / 2015, 16:42:01
Thanks a lot for your feedback, if it will be possible to implement hook_shutter() function on the KAP script I will test it during several flights.
I've added it to the v3.4 release that I've been working on.   There are several other changes in there that have not had any testing.  I'll do some unit testing of each of the changes and then ask you to give it a try?  There are a few other script users who might also be willing to give the changes a whirl.   That should be the last version before CHDK 1.4.0 becomes the "stable" release and I can upgrade the script to use the new functionality that brings.

Perfect, please let me know when it's available and I will try it.

Thank you.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / March / 2015, 16:47:19
As a small aside, the script now returns to taking still frames once the camera has finished shooting the video, I have turned the flash to 'off' initially but when the video finishes the flashmode seems to revert to 'auto'? I thought about changing the flashmode each time using the lua script but I can see a 'get_flash_mode' function but no obvious 'set_flash_mode' option? Am I missing something obvious?
One of the (many) things the script does at startup is disable the flash and the AF assist beam.  The code looks like this:
Code: [Select]
        set_prop(props.FLASH_MODE, 2)     -- flash off
        set_prop(props.AF_ASSIST_BEAM,0)  -- AF assist off if supported for this camera

Apparently the flash mode resets when you exit video recording.  I have to reset the "focus at infinity" mode when recording ends,  I can add flash disable too.

Thanks for point that out.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 28 / March / 2015, 19:35:45
Script updated to v3.4 at the usual download link. (https://app.box.com/s/a5tbl1xasp8m3a57fclx)

Changes include :
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: exposeIT on 09 / April / 2015, 07:48:44
Hallo,
tried to use the 3.4a script on my IXUS970.
It doesn't work. (CHDK 4138)
The old script 1.6 works well.

Checked also on IXUS130. The KAP_UAV 3.4a works great.(1.6 also)

I can start the script, one Photo is taken (and stored), then nothing else happens.
I can leave the script with the playback key but i can not contol the camera as usual.
After restart I always can reproduce that.

Focus@Infinity doen't change the problem.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / April / 2015, 08:39:24
tried to use the 3.4a script on my IXUS970.  It doesn't work. (CHDK 4138)
There have been almost 100 downloads for 3.4a.  This is the first problem report.

Quote
Checked also on IXUS130. The KAP_UAV 3.4a works great.(1.6 also)
So to be very clear, does this mean there is no problem when using the script on your IXUS130? 

There are only problems with the IXUS970?

Quote
I can start the script, one photo is taken (and stored), then nothing else happens.
Hmmm ... I'll need to know a little more about what "nothing else happens" means.

Please enable logging to both the SD card and screen.  Rerun your test and then post the resulting KAP.log script from the top (root) directory of your SD card as an attachment here.   Also please write down the last three things shown on the console log on the LCD screen and post them here.

See note below about the correct way to halt the script (so that the log file is correctly written to the SD card.)

Quote
I can leave the script with the playback key but i can not contol the camera as usual. After restart I always can reproduce that.
The 3.4 version of the script should only halt when you press the MENU key.  All other keys should be locked out - including the shutter button and Playback key.   It's possible that there is a problem with the CHDK port for the IXUS 970 where this does not work properly.

Please confirm that you can stop the script when it "hangs" by using the MENU key?

Quote
Focus@Infinity doen't change the problem.
Good to know - thanks.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: exposeIT on 09 / April / 2015, 10:18:39
tried to use the 3.4a script on my IXUS970.  It doesn't work. (CHDK 4138)
There have been almost 100 downloads for 3.4a.  This is the first problem report.
Sorry for that.

Quote
There are only problems with the IXUS970?
Yes.

Quote
Hmmm ... I'll need to know a little more about what "nothing else happens" means.
1. Load Script.
2. In Alt-Mode press shoot -> Script starts, four lines of Results appear, one photo is taken and reviewed.
3. the camera seems to be frozen.
4. menu button pressed, screen stays with the already taken picture (and nothing else). Nothing else happens. (like frozen)
5. Review button pressed: immediatly i can see the four result-lines and the next photo is taken.
   but from now on there is nothing going on automatic.
   Sometimes the result lines are a little bit dearranged and show: shot in auto mode, meter reading invalid.
6. when I press print-button(Alt-key) the result lines disappear. (but the photo is still on the screen and
   nothing else)
   I cannot go back in Alt-mode
   pressing review button reboots the camera.
   
Quote
... and post them here.
done.

Quote
Please confirm that you can stop the script when it "hangs" by using the MENU key?
No, for the moment I can't confirm.


I will try to make a fresh copy of CHDK and the script in the evening.

Hopefully


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / April / 2015, 11:46:33
Sorry for that.
No apology necessary - it's always good to get feedback early of problems. I was just trying to point out that it was probably something specific to your situation rather than a general problem.

Quote
Quote
There are only problems with the IXUS970?
Yes.
Thanks - that's good to know.

Quote
1. Load Script.
2. In Alt-Mode press shoot -> Script starts, four lines of Results appear, one photo is taken and reviewed.
3. the camera seems to be frozen.
4. menu button pressed, screen stays with the already taken picture (and nothing else). Nothing else happens. (like frozen)
5. Review button pressed: immediatly i can see the four result-lines and the next photo is taken.
   but from now on there is nothing going on automatic.
   Sometimes the result lines are a little bit dearranged and show: shot in auto mode, meter reading invalid.
6. when I press print-button(Alt-key) the result lines disappear. (but the photo is still on the screen and
   nothing else)
   I cannot go back in Alt-mode
   pressing review button reboots the camera.
Based on this description and the photo you posted,  I think that I know what might be happening. 

When the script tries to take a shot,  it simulates a "half press" on the shutter button in order to read the current exposure values.  If the camera is unable to set the exposure or unable to focus then the script just hangs there waiting for the camera to finish doing that.  There is a timeout built-into the script but that takes quite a while to activate.   So it looks like the script is "hung" or "stuck" when in fact it is just waiting for an exposure reading to finish.

This situation seems to happen when there is not enough light to take a good image.  This is normally never a problem when shooting outdoors but might be when testing the script at your desk in the evening.  ;)

When this happens,  if you just leave the camera alone it should eventually take a shot and then display a message similar to the one in the image you posted.  Typically it will then be behind in time for the next shot,  so it will immediately try to take the next shot.  Which will also hang if there is not enough light.  The cycle repeats and the script appears to be "broken".

Does this seem like what you might be seeing?  Point the camera out a window in the day time and I suspect you will no longer see the problem.   I'll see if I can improve how the script reacts in this situation.


Quote
I will try to make a fresh copy of CHDK and the script in the evening.
It will not hurt to try this but I don't think there is anything wrong with your CHDK installation or how the script is installed.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bchristal on 10 / April / 2015, 12:04:52
Hello Waterwingz,

Thanks for the awesome script! I'm using it successfully with USB Shot Control set to One Shot with a Pixhawk Autopilot. However, I'm unable to retract the lens. I see you've implemented a couple of features that will almost work (PWM and return camera to playback mode). Can the script be set so that I use multiple PWM values to, extend lens, take picture, retract lens?

Thanks!

Brian
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 10 / April / 2015, 13:56:10
I'm using it successfully with USB Shot Control set to One Shot with a Pixhawk Autopilot. However, I'm unable to retract the lens. I see you've implemented a couple of features that will almost work (PWM and return camera to playback mode). Can the script be set so that I use multiple PWM values to, extend lens, take picture, retract lens?
I have not looked to see if there is some sort of event_proc that could be used to force the lens to retract. 

However,  what seems to make more sense is to just set the camera to immediately retract the lens when it switches to playback mode.  That's usually a setup option in the Canon menus.   Then you just need a PWM values that tell the camera to switch from playback to shooting  or from shooting to playback.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: exposeIT on 10 / April / 2015, 14:07:30
Quote
I will try to make a fresh copy of CHDK and the script in the evening.
It will not hurt to try this but I don't think there is anything wrong with your CHDK installation or how the script is installed.

Yes you are definitly right, but first things first.

In the morning in bright sunlight I tried again with the given setup,
but no other reaction.

So I setup a new SDcard with CHDK and the script
and I reset the canon setup (I had issues with that in the past),
but also the the same reaction.

I told you, when I press the review button, then I switch over to another picture.
That's shure.
The very first picture taken is very dark (underexposed; IMG_8828.JPG).
In the KAP.LOG you will find only the underexposed pictures.(IMG_8828.JPG,IMG_8830.JPG,IMG_8832.JPG)
Pay attention to the numbering.
But there were well exposed pictures IMG_8829.JPG,IMG_8831.JPG,IMG_8833.JPG, taken when I press the review key and they are stored.
Immediatly after that well exposed picture the next underexposed picture is taken automaticly and the picture stays on the screen.
Pressing review key works again ... and so on.
When I press the menu key quick enough, then the script is canceled in a korrekt way, as you see in the log.

 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 10 / April / 2015, 15:14:56
I told you, when I press the review button, then I switch over to another picture.
...
Pressing review key works again ... and so on.
There is something else I probably should have asked earlier.  Do you have the camera setup to switch to "review" mode after each shot?   And probably worse still,   is it setup to "hold" the review image rather than time out automatically and return to shooting mode?

If so,   what happens when you turn that stuff off using the Canon setup menu and just have the camera stay in shooting mode all the time?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: exposeIT on 10 / April / 2015, 15:37:34
If so,   what happens when you turn that stuff off using the Canon setup menu and just have the camera stay in shooting mode all the time?

I usually have two seconds review time.
When I switch that to OFF in Canon menu  than there is no difference in the script behavior.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 10 / April / 2015, 18:50:42
I usually have two seconds review time. When I switch that to OFF in Canon menu  than there is no difference in the script behavior.
Thanks for trying.

The behavior of the Playback key is strange.   Do you also use it as the CHDK <ALT> key by any chance?   What happens if you just start the script and let it sit there - don't press any buttons.   Does it take a picture every so often? Or just sit there hung forever?  What does the LCD console say in that case?  If you exit via the Menu button you can go to the CHDK Miscellaneous Stuff menu ->  Console -> Display last console to see what was on the console during the test.

One other thing to try. You mentioned having two cameras?  Can you use the working one to record video of the operation of the not working one so that I can actually see what is happening.   Don't select the script's  Backlight Off option and in the Console menu,  set the Hide N secs after last change to 30 seconds.   Upload to a file sharing site like box.net or youtube and PM the link to me?

Edit :  my best guess is that something in the script shot timing is not working right with your older camera.  I'll do some comparison with the older script version that you say works and see if I can spot the difference.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: exposeIT on 12 / April / 2015, 05:36:03
The behavior of the Playback key is strange.   Do you also use it as the CHDK <ALT> key by any chance?
Not by intention. There was a lot of keyboard stuff in the last weeks, maybe something changed?
But why other scripts work?
Quote
What happens if you just start the script and let it sit there - don't press any buttons.   Does it take a picture every so often? Or just sit there hung forever?
The picture stays foreever, no additional pictures.
Quote
  What does the LCD console say in that case?
nothing, there isn't any overlay.
Quote
If you exit via the Menu button you can go to the CHDK Miscellaneous Stuff menu ->  Console -> Display last console to see what was on the console during the test.
When I am able to leave by menu key, for that case you already have a valid kap.log
And I also tried the way you have shown and there is nothing else in the 'last console' display.
(because the script is normally stopped)
Quote
Can you ... record video of the operation

hopefully I try that in the evening.

Thank you very much for your help.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 12 / April / 2015, 09:08:46
There was a lot of keyboard stuff in the last weeks, maybe something changed?
That's a very interesting thought!   The changes are all in CHDK 1.4.0 - which is what you are using.  What happens if you load CHDK 1.3.0 into your camera and run that?

Quote
But why other scripts work?
Other scripts might not using the set_exit_key() (http://chdk.wikia.com/wiki/Script_commands#set_exit_key) function, the new RAW script shooting hooks,  or the same methods of reading & setting exposure that the kap_uav.lua script uses.

Quote
Quote
What happens if you just start the script and let it sit there - don't press any buttons.   Does it take a picture every so often? Or just sit there hung forever?
The picture stays foreever, no additional pictures.
Quote
  What does the LCD console say in that case?
nothing, there isn't any overlay.
I don't have a lot of time today but I will send you a link to a test version of the script that will have a lot more debugging information logged.  At this point we need to figure out exactly where the script is stopping.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 12 / April / 2015, 09:48:42
Debug version of the script :  ku_test.lua (https://app.box.com/s/hnxfrge16xn748lb5a3gowk92v76x28f)

Please run this and post the resulting log here.

TIA
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: exposeIT on 12 / April / 2015, 13:55:25
There was a lot of keyboard stuff in the last weeks, maybe something changed?
That's a very interesting thought!   The changes are all in CHDK 1.4.0 - which is what you are using.  What happens if you load CHDK 1.3.0 into your camera and run that?

I tested that now, there is a little difference how the console looks, but my main problem is also there.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: exposeIT on 12 / April / 2015, 14:02:08
Debug version of the script :  ku_test.lua (https://app.box.com/s/hnxfrge16xn748lb5a3gowk92v76x28f)

Please run this and post the resulting log here.

TIA

two KAP.LOGs as attachment.

The first I wait "forever"
The second I pressed the Review-button after a while and at last finished with the Menu-key.

I tried a video with this version. This will follow.

Thank you again.

I try to find someone with the same camera, to test it on another equipment.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 12 / April / 2015, 16:47:16
two KAP.LOGs as attachment.
Now we are getting somewhere!   I can see where the script hangs up :

Code: [Select]
dprint("Debug :hook_shoot.set")                 
                press('shoot_full')                -- and finally shoot the image
dprint("Debug : shoot_full")               
                while not hook_shoot.is_ready() do sleep(10) end -- wait until the hook is reached
dprint("Debug : hook_shoot.is_ready done")     
The hook_shoot.is_ready() function never returns true on your older camera.   Either something wrong with the raw hooks or (more likely) something I am doing wrong while trying to use them.  Will likely need some of reyalp's help here.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 12 / April / 2015, 17:38:58
The hook_shoot.is_ready() function never returns true on your older camera.   Either something wrong with the raw hooks or (more likely) something I am doing wrong while trying to use them.  Will likely need some of reyalp's help here.
This sounds like this is probably a bug in the ixus970_sd980 capt_seq.c, such that there is a code path where wait_until_remote_button_is_released is never called. Further debugging should go in the porting thread: http://chdk.setepontos.com/index.php?topic=3246.130 (http://chdk.setepontos.com/index.php?topic=3246.130)

FWIW, I suggest using a timeout when waiting for hooks to become ready. The hookutil lua library adds a wait_ready function for this, described in http://chdk.wikia.com/wiki/Script_Shooting_Hooks#hookutil_Lua_module (http://chdk.wikia.com/wiki/Script_Shooting_Hooks#hookutil_Lua_module)

edit:
@exposeIT I think I found the issue, please try the test build posted in the porting thread.
I posted a test build in the porting thread,
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: exposeIT on 13 / April / 2015, 10:59:05

@exposeIT I think I found the issue, please try the test build posted in the porting thread.
I posted a test build in the porting thread,

ok, first test works fine now.
a broader test in the evening will follow.

exposeIT

A lot of thanks @reyalp and @ waterwingz
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 17 / April / 2015, 12:43:02
Hello Waterwingz,

Thanks for the awesome script! I'm using it successfully with USB Shot Control set to One Shot with a Pixhawk Autopilot. However, I'm unable to retract the lens. I see you've implemented a couple of features that will almost work (PWM and return camera to playback mode). Can the script be set so that I use multiple PWM values to, extend lens, take picture, retract lens?

Thanks!

Brian

Brian, I am also using PixHawk with CHDK. Unfortunatedly, "PWM" is not the best name for that mode. The script is not reading a RC PWM signal. It just reads 5v DC signal (what it does is measure for how long there is a 5v voltage in the usb power line).

You cannot use the pixhawk as is to drive the camera's (wrongly named) "PWM" mode. What I did is buy a "RC controlled switch (http://www.hobbyking.com/hobbyking/store/__46040__Turnigy_Receiver_Controlled_Switch.html)", and connect it to the Pixhawk's channel 7 output on one side and a gutted USB port on the other.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / April / 2015, 12:59:31
Brian, I am also using PixHawk with CHDK. Unfortunatedly, "PWM" is not the best name for that mode. The script is not reading a RC PWM signal. It just reads 5v DC signal (what it does is measure for how long there is a 5v voltage in the usb power line).
Well,  PWM is an acronym that means Pulse Width Modulation.  With PWM information is conveyed by an  input pulse via the length of the pulse.   CHDK's USB input function can read such "pulse width modulated" signals.  And as such,  calling the CHDK PWM input by that name is correct.   

Quote
You cannot use the pixhawk as is to drive the camera's (wrongly named) "PWM" mode. What I did is buy a "RC controlled switch (http://www.hobbyking.com/hobbyking/store/__46040__Turnigy_Receiver_Controlled_Switch.html)", and connect it to the Pixhawk's channel 7 output on one side and a gutted USB port on the other.
As I understand the issue with the PixHawk output is a question of the Pixhawk only providing a 3.3V PWM signal and the Canon camera USB port expecting 5V.  So a level translator is needed.  Many others have interfaced a Pixhawk directly to a CHDK camera using the PWM capability of both.   I'll dig up the links later if necesary.

Otherwise,  there is a device available from Gentles that will directly connect an RC servo signal to the camera.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 17 / April / 2015, 13:58:35
Brian, I am also using PixHawk with CHDK. Unfortunatedly, "PWM" is not the best name for that mode. The script is not reading a RC PWM signal. It just reads 5v DC signal (what it does is measure for how long there is a 5v voltage in the usb power line).
Well,  PWM is an acronym that means Pulse Width Modulation.  With PWM information is conveyed by an  input pulse via the length of the pulse.   CHDK's USB input function can read such "pulse width modulated" signals.  And as such,  calling the CHDK PWM input by that name is correct.   
I don't have any formal knowledge about the subject, so I may be wrong. I believe that to be able to call a pulsed signal "PWM" the signal has to pulse regularly (for example every 20ms), and what you vary is how long you keep the pulse high. I don't know if it can be called PWM when there is no pulse repetition.

Anyway, this is not really important except for one detail: In RC the standard is to use a PWM signal at 5v, with the pulse's length (usually) varying between 900 and 1900us, and the pulse repeating every 20ms. If you have RC background and read 5v PWM, you might believe this script's "PWM" control scheme is compatible with RC's standard PWM, when it is not.

Quote from: waterwingz
Quote from: Naccio
You cannot use the pixhawk as is to drive the camera's (wrongly named) "PWM" mode. What I did is buy a "RC controlled switch (http://www.hobbyking.com/hobbyking/store/__46040__Turnigy_Receiver_Controlled_Switch.html)", and connect it to the Pixhawk's channel 7 output on one side and a gutted USB port on the other.
As I understand the issue with the PixHawk output is a question of the Pixhawk only providing a 3.3V PWM signal and the Canon camera USB port expecting 5V.  So a level translator is needed.  Many others have interfaced a Pixhawk directly to a CHDK camera using the PWM capability of both.   I'll dig up the links later if necesary.

Otherwise,  there is a device available from Gentles that will directly connect an RC servo signal to the camera.
What you are talking about here are not the Pixhawk's main RC PWM outputs (which output a 5v PWM signal), but it's auxiliary outputs, which can be configured as switches, but output a 3.3v signal instead of a 5v signal. These switches could be used to drive your script's "PWM" mode, but in order to do so you need to drive the voltage up to 5v.
The Gentles device reads the Pixhawk's main RC outputs' PWM signal (or any RC receiver's PWM signal) to drive a switch which outputs 5v pulses.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / April / 2015, 17:16:21
I don't have any formal knowledge about the subject, so I may be wrong. I believe that to be able to call a pulsed signal "PWM" the signal has to pulse regularly (for example every 20ms), and what you vary is how long you keep the pulse high. I don't know if it can be called PWM when there is no pulse repetition.
While I don't agree with the limitation that a regular pulse series is required, I do understand that it's the most common way PWM is implemented.   

But going back to your earlier post,  CHDK scripts (including the kap_uav.lua script) are quite capable of decoding continuous pulse width modulate signals per your definition.  So the use of the term PWM is not "wrongly named".

Quote
Anyway, this is not really important except for one detail: In RC the standard is to use a PWM signal at 5v, with the pulse's length (usually) varying between 900 and 1900us, and the pulse repeating every 20ms. If you have RC background and read 5v PWM, you might believe this script's "PWM" control scheme is compatible with RC's standard PWM, when it is not.
Using the new high precision timer in CHDK 1.3.0 it is quite possible to read and interpret a PWM sequence generated to this specification.  So it can be quite compatible if setup correctly.

Quote from: Naccio
What you are talking about here are not the Pixhawk's main RC PWM outputs (which output a 5v PWM signal), but it's auxiliary outputs, which can be configured as switches, but output a 3.3v signal instead of a 5v signal. These switches could be used to drive your script's "PWM" mode, but in order to do so you need to drive the voltage up to 5v.
True.  Although as I said, you can also use the PWM output with a few code changes.

Quote
The Gentles device reads the Pixhawk's main RC outputs' PWM signal (or any RC receiver's PWM signal) to drive a switch which outputs 5v pulses.
Hmmm ... well seeing as we are on a terminology kick today,  I think those PWM outputs your are describing are simply the standard RC digital servo signal that had been around forever?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 17 / April / 2015, 18:19:29
Quote
Using the new high precision timer in CHDK 1.3.0 it is quite possible to read and interpret a PWM sequence generated to this specification.  So it can be quite compatible if setup correctly.
Really? This is great news to me! I never thought the hardware might be able to read pulses with sub millisecond resolution! Implementing this would be great, it would enable anyone with a RC radio system to control a canon camera without any extra hardware! As soon as I get my SD1100 back I will try to program a script to do just that.
Quote
Hmmm ... well seeing as we are on a terminology kick today,  I think those PWM outputs your are describing are simply the standard RC digital servo signal that had been around forever?
That is correct. If we can get the camera to read the standard servo signal it would enable a lot of people to do great stuff at almost no extra cost.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / April / 2015, 19:29:25
I never thought the hardware might be able to read pulses with sub millisecond resolution! Implementing this would be great, it would enable anyone with a RC radio system to control a canon camera without any extra hardware!
Now comes the disclaimers.   :o   

The standard CHDK release has the fastest timer precision locked at 1 mSec.    This was a somewhat arbitrary limit that the devs felt would be safe to use and not overload the camera.

To change this (i.e. to time pulses shorter that 1 mSec) you need to recompile with the following line in your platform_camera.h file :

Code: [Select]
#define CAM_REMOTE_HIGHSPEED_LIMIT 250This will give fairly course resolution of a standard servo signal.  Lower values may be possible but you are on the bleeding edge at that point - some cameras with better processor may work better than others.  Still, with this setting you should be able to distinguish the servo control pulses (1.0 mSec to 2.0 mSec)  in steps of 250 uSec ( or 5 discrete "positions").

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fupload.wikimedia.org%2Fwikipedia%2Fcommons%2Fb%2Fb7%2FSinais_controle_servomotor.JPG&hash=8425e8b6a4a4690c91dc46ef5fcc403f)

There was some experimentation done in the forum thread for this feature :  Using timing functions (http://chdk.setepontos.com/index.php?topic=11342).  Here is a more specific reference. (http://chdk.setepontos.com/index.php?topic=11342.msg112365#msg112365)

Quote
As soon as I get my SD1100 back I will try to program a script to do just that.
That's pretty much the only way to find out.  The script function you are looking for is set_remote_timing() (http://chdk.wikia.com/wiki/USB_Remote_V2#set_remote_timing.28uSec.29).   I guess the first question is how many discrete commands you want to give?  Shoot, zoom in, zoom out, shutdown ?


Let us know if you need a custom build to try this out.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 20 / April / 2015, 14:11:03
Quote from: waterwingz
I guess the first question is how many discrete commands you want to give?  Shoot, zoom in, zoom out, shutdown ?
My use case (orthophoto for aerial surveys) only requires three instructions: "mission start", "shoot", and "mission end". Your script takes the first pulse (any length) as mission start, so I really need only two distinct commands, meaning I don't need a lot of resolution. Right now the APM configuration limits the PWM min and max values to 800 and 2200us (pixhawk hardware can probably do a lot better, but that might mean messing with the [open source!] firmware, which I am not ready to do, as I don't want to destroy my expensive hardware in a crash), so I should be able to use 800us as baseline, 1500us as "shoot", and 2200us as "mission end".

Now I am getting into unknown territory, so I need to understand this process completely:
Assuming my camera has a fast processor, if I recompile CHDK with "CAM_REMOTE_HIGHSPEED_LIMIT 250", I would be able to measure pulses with a 250us resolution. Taking into account the limitations imposed by APM, that would leave me with 750, 1000, 1250, 1500, 1750, and 2000us. I need one of those values for the "no command" state, so that nets me 5 commands. Useful for some, but a waste for me. Maybe I can use a lower resolution? That would mean I don't have to drive my camera hardware so hard, it might be more compatible with slow hardware, and it will probably consume less battery, right?
If I use a CAM_REMOTE_HIGHSPEED_LIMIT value of 700, I get a baseline of 700us, and two usable values at 1400us and 2100us. The mapping would be:

Source (Pixhawk)     -      Destination (Camera)
      800us                        700us   --> Baseline (awaiting instructions)
     1500us                       1400us   --> Shoot
     2200us                       2100us   --> Mission end

This mapping allows the benefit of sending a pulse 100us longer than needed, that might be useful if the camera clock is not very precise...
Am I correct? Did I miss something? Do you have any suggestions?

Quote
Let us know if you need a custom build to try this out.
Unfortunately I don't have the camera with me, and I will not be getting it at least for a month, so right now all I can do is write very long posts... But assuming this change has low chances of bricking my camera I will definitely ask for a custom build.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 20 / April / 2015, 15:20:17
A few extra thoughts:

If this gets implemented, the message to the camera would become very small, and it would get buried in a lot of noise... So in order for this to work there should be a way for the camera to disregard the noise (baseline 800us pulses), and only report the signal (1500us and 2200us pulses). I don't know how easy or hard this might be. Do LUA scripts get compiled and then run using native camera code or are they interpreted every time? The answer to that question might determine if the code that detects the signal vs the noise should be implemented in firmware code (fast?) or LUA code (slow if interpreted?), as this code would be executed a lot.

For how long should the pixhawk hardware send the 1500us and 2200us pulses? I believe this will depend on how long it takes the camera to run one loop of the script... If the pixhawk sends the pulse for a very short time and the timing is such that the camera misses reading it, the signal might get lost... On the other hand, if the signal is sent for too long, the camera might take the same action twice...
Has anybody timed the shortest & longest time to run a complete loop? The longest time will probably vary if for example the camera has to write the log to disk, or perform other actions...

Finally, the signal will probably be repeated a few times, I wonder how the camera reads that. If for example it constantly reads for a signal and buffers, and then sends whatever it buffered when the LUA script asks, this whole thing might be difficult to implement... I don't know if I can get the pixhawk hardware send only one 1500us pulse and then revert to 800us.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / April / 2015, 16:00:15
If this gets implemented, the message to the camera would become very small, and it would get buried in a lot of noise... So in order for this to work there should be a way for the camera to disregard the noise (baseline 800us pulses), and only report the signal (1500us and 2200us pulses). I don't know how easy or hard this might be. Do LUA scripts get compiled and then run using native camera code or are they interpreted every time? The answer to that question might determine if the code that detects the signal vs the noise should be implemented in firmware code (fast?) or LUA code (slow if interpreted?), as this code would be executed a lot.
The high precision pulse counting / measurement code runs in a interrupt service routing written in C.  There is a Lua call to allow it to read buffered data from that routine.

Quote
For how long should the pixhawk hardware send the 1500us and 2200us pulses? I believe this will depend on how long it takes the camera to run one loop of the script... If the pixhawk sends the pulse for a very short time and the timing is such that the camera misses reading it, the signal might get lost... On the other hand, if the signal is sent for too long, the camera might take the same action twice...

This can be fairly easily handled in the Lua code.   But rather than continue worrying about the various "armchair theories" it would be better to just hook up the camera to a RC receiver and try it.
 

Quote
Has anybody timed the shortest & longest time to run a complete loop? The longest time will probably vary if for example the camera has to write the log to disk, or perform other actions...
I don't think this will be much of an issue.

Quote
Finally, the signal will probably be repeated a few times, I wonder how the camera reads that. If for example it constantly reads for a signal and buffers, and then sends whatever it buffered when the LUA script asks, this whole thing might be difficult to implement... I don't know if I can get the pixhawk hardware send only one 1500us pulse and then revert to 800us.
This can be fairly easily handled in the Lua code.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 20 / April / 2015, 16:07:20
This can be fairly easily handled in the Lua code.   But rather than continue worrying about the various "armchair theories" it would be better to just hook up the camera to a RC receiver and try it.
 be fairly easily handled in the Lua code.
I'm itching to try this out, unfortunately I won't be able to for at least a month  :'(
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / April / 2015, 18:22:30
I'm itching to try this out, unfortunately I won't be able to for at least a month  :'(
Like I said, this is pushing the envelope a bit but if you only need three states, there should be enough resolution to pull that off reliably.   

I have a bunch of RC parts laying around that I could probably hook up.  Although now that I think about it, my Arduino clone on a bread board that I used for a bunch of other USB remote CHDK testing seems like a better option.  Once I verify operation of that on my ancient analog scope then trying it out on the camera will be trivial.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 20 / April / 2015, 18:28:22
The high precision pulse counting / measurement code runs in a interrupt service routing written in C.  There is a Lua call to allow it to read buffered data from that routine.
Did someone actually test the code with sub-millisecond repetition rate? As far as I remember, timers are not very accurate when called that often.
Also, Naccio mentioned an SD1100, which is a DIGIC III model. The ARM core in DIGIC II and III runs at 36 MHz (DIGIC 4 and 5 is clocked higher, at least 72 MHz).

edit:
not to mention that CPU load is much higher in shooting mode.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / April / 2015, 18:36:25
The high precision pulse counting / measurement code runs in a interrupt service routing written in C.  There is a Lua call to allow it to read buffered data from that routine.
Did someone actually test the code with sub-millisecond repetition rate?
Yes, there was some work done and reported in the thread where all this was documented.  The OP was running a bit banging UART at 1 kbps  and getting responable results.   I couldn't find the post but I believe from memory that thing got really shakey down below 500 uSec timer rate. Which is partly why I set the lower limit that can be set from a script at 1 mSec.

Quote
As far as I remember, timers are not very accurate when called that often.  Also, Naccio mentioned an SD1100, which is a DIGIC III model. The ARM core in DIGIC II and III runs at 36 MHz (DIGIC 4 and 5 is clocked higher, at least 72 MHz). edit: not to mention that CPU load is much higher in shooting mode.
All true.  The question is whether we can differentiate a 1 mSec pulse, a 1.5 mSec pulse, and a 2 mSec pulse to get the three states required.   As I've said a few times now, this is pushing the envelope and not guaranteed, but it seems worth trying?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / April / 2015, 19:17:22
I couldn't find the post but I believe from memory that thing got really shakey down below 500 uSec timer rate.
Found it :  http://chdk.setepontos.com/index.php?topic=11342.msg111415#msg111415 (http://chdk.setepontos.com/index.php?topic=11342.msg111415#msg111415)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 29 / April / 2015, 07:45:33
I already have CHDK installed on my Canon S110, how do I go about adding this script into it and is there a link anywhere on how to do it????
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 29 / April / 2015, 08:19:34
I already have CHDK installed on my Canon S110, how do I go about adding this script into it and is there a link anywhere on how to do it????
Well, you could always RTFM (http://chdk.wikia.com/wiki/CHDK_1.3.0_User_Manual).  The particular section you are looking for is here (http://chdk.wikia.com/wiki/CHDK_1.3.0_User_Manual#Scripting_.28program_your_camera.29).

This (http://chdk.wikia.com/wiki/Scripts) might help as well, although it's a bit old.

Finally, there is some documentation (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script) on the actual script.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 29 / April / 2015, 08:46:37
I already have CHDK installed on my Canon S110, how do I go about adding this script into it and is there a link anywhere on how to do it????
Well, you could always RTFM (http://chdk.wikia.com/wiki/CHDK_1.3.0_User_Manual).  The particular section you are looking for is here (http://chdk.wikia.com/wiki/CHDK_1.3.0_User_Manual#Scripting_.28program_your_camera.29).

This (http://chdk.wikia.com/wiki/Scripts) might help as well, although it's a bit old.

Finally, there is some documentation (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script) on the actual script.

Thank you for that, you've saved me hours of reading / trawling to find it so it is very much appreciated!!!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 29 / April / 2015, 08:47:39
Thank you for that, you've saved me hours of reading / trawling to find it so it is very much appreciated!!!
One final gift then : http://chdk.wikia.com/wiki/CHDK_Links (http://chdk.wikia.com/wiki/CHDK_Links)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 29 / April / 2015, 09:28:38

[/quote]
One final gift then : http://chdk.wikia.com/wiki/CHDK_Links (http://chdk.wikia.com/wiki/CHDK_Links)
[/quote]

Oh brilliant, thank you again .... very useful and all bookmarked !!!!!!

You're a gentleman and a scholar  :D
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 30 / April / 2015, 11:18:44
I've downloaded and installed the script but it doesn't seem to be running, I get a message that comes up saying

126 attempt to call glow bal
get_sd_over_modes
(a nil value)

Anybody any idea what that may be????
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 30 / April / 2015, 13:29:34
Anybody any idea what that may be????

What version of CHDK are you using?  (the complete filename you loaded would tell us that)

Your version of CHDK might be too old.  The script is supposed to check the version but I might have messed that up a bit.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 01 / May / 2015, 00:58:15
The oly thing I could find the referenced it's filename is cchdk3 .... is that what you meant??

it was probably from about July last year if that helps??
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 01 / May / 2015, 01:08:07
The oly thing I could find the referenced it's filename is cchdk3 .... is that what you meant??

it was probably from about July last year if that helps??
Go to the CHDK menus -> Miscellaneous Stuff -> Show Build Info  and tell me what it says for CHDK Ver :  and Revision :

Or just download the current stable version from the autobuild (http://mighty-hoernsche.de/) )or better yet download and install it via STICK. (http://zenoshrdlu.com/stick/stick.html))  Let me know if that make the problem go away.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 01 / May / 2015, 03:58:08
EDIT: Forget what I typed below have just re done it using stick and seems to be running fine, can't wait to actually try this absolutely brilliant !!!!!!

Are the default settings generally considered best or are there better settings for a UAV for shutter speed etc

Forget from here on have since edited!!!

I'd re-installed it manually rather than using stick whilst you were typing and tried again.

The current is showing as CHDK 1.3.0 Ref 4152

I now get a different message

e.preload ['propcase']ono
file @A/CHDK/SCRIPTS/pro
pcase.lua'onofile 'A/CH
DK/LUALIB/propcase.lua'
***TERMINATED***

In case it has any relevance the simple countdown intervalometer works fine
Title: KAP & UAV Exposure Control Intervalometer Script: PWM USB REMOTE CONTROL
Post by: seabasscropper on 01 / May / 2015, 20:43:55
I am having an issue with the PWM USB control option in Version 3.4, with a Canon Powershot s110.

I keep getting "* USB Pulse Width Error".

I am utilizing an Arduino Nano to convert from an RC PWM output to the required USB power pulse. I have tested the output on my oscilloscope and it's outputting the correct pulse widths.

I have also tested the output with Dave Mitchell's CHDK2Tester.bas, and it all seems to work fine.

I have been looking through KAP 3.4 and noticed it's using get_usb_power(2), i tried changing this to get_usb_power(0), and now i get one correct pulse width before the error.

I am very much a newbie when it comes to CHDK programming, so just wondering if anyone has solved this or could hep to solve it?
Title: Re: KAP & UAV Exposure Control Intervalometer Script: PWM USB REMOTE CONTROL
Post by: waterwingz on 01 / May / 2015, 21:13:56
I keep getting "* USB Pulse Width Error".
Be aware that the "stock" USB PWM code is just something I threw together as a demo of how you can add PWM input to the script. It has not exactly had a lot of user testing in the real world.

In the demo,  the error message is displayed when the script checks  the CHDK USB PWM control code for the width of the most recent pulse received and is told it's 20 mSec or more.  This is an oversight on my part - when the demo code was added,  the CHDK high speed timer option was not available so the pulse width values in the demo code are off by a factor of 10.  The original intent was for that error to trigger if a pulse of more than 200 mSec was received.

Quote
I am utilizing an Arduino Nano to convert from an RC PWM output to the required USB power pulse. I have tested the output on my oscilloscope and it's outputting the correct pulse widths.
To confirm what I have written above, it will help a lot  if you tell me what pulse widths your Arduino is producing !

Quote
I have been looking through KAP 3.4 and noticed it's using get_usb_power(2), i tried changing this to get_usb_power(0), and now i get one correct pulse width before the error.
Not really sure what is happening here.   

Using get_usb_power(0) gets the most recent pulse width but it's unbuffered.  You could lose pulses.   

More info about all that here :  USB Remote Scripting Interface (http://chdk.wikia.com/wiki/USB_Remote#.E2.80.8BScripting_Interface)

Quote
I am very much a newbie when it comes to CHDK programming, so just wondering if anyone has solved this or could hep to solve it?
I think we can probably drag up someone who is somewhat familiar with that script  ::)   Once I know what pulse widths you are actually using,   modifying the PWM detection code in the script should be trivial.  Sorry for not catching that sooner.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 02 / May / 2015, 07:07:35
With this script running does it take "total" control of the camera?
I know you obviously set the shutter speed / aperture etc so it controls those but if you have things in the camera set like photo stabiliser and choosing colour preferences for various scenes like highlighting blues for sky and sea pictures will they still work depending what mode the camera's in or are they overwritten??
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / May / 2015, 07:31:49
With this script running does it take "total" control of the camera?
I know you obviously set the shutter speed / aperture etc so it controls those but if you have things in the camera set like photo stabiliser and choosing colour preferences for various scenes like highlighting blues for sky and sea pictures will they still work depending what mode the camera's in or are they overwritten??
The script only controls the shutter speed, aperture, ISO sensitivity and ND filter position.  And obviously the shutter button.   It attempts to disable the built-in flash and the "flash assist" lamp.  Other than that, everything else is controlled  by the Canon menu settings.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 02 / May / 2015, 11:39:20
Thanks again waterwingz, is appreciated, really can't wait to go give this a proper try, am just waiting for some parts to be shipped from abroad ... and the sunshine to come back again  :D
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / May / 2015, 14:55:01
Script updated to 3.4b (minor update) so that the LCD is turned off when the user defined startup delay is enabled (if the Backlight Off option is also enabled).

Background in this thread :  http://chdk.setepontos.com/index.php?topic=12353.msg122044#msg122044 (http://chdk.setepontos.com/index.php?topic=12353.msg122044#msg122044)

Title: Re: KAP & UAV Exposure Control Intervalometer Script: PWM USB REMOTE CONTROL
Post by: seabasscropper on 03 / May / 2015, 03:04:52
I keep getting "* USB Pulse Width Error".
Be aware that the "stock" USB PWM code is just something I threw together as a demo of how you can add PWM input to the script. It has not exactly had a lot of user testing in the real world.

In the demo,  the error message is displayed when the script checks  the CHDK USB PWM control code for the width of the most recent pulse received and is told it's 20 mSec or more.  This is an oversight on my part - when the demo code was added,  the CHDK high speed timer option was not available so the pulse width values in the demo code are off by a factor of 10.  The original intent was for that error to trigger if a pulse of more than 200 mSec was received.

Quote
I am utilizing an Arduino Nano to convert from an RC PWM output to the required USB power pulse. I have tested the output on my oscilloscope and it's outputting the correct pulse widths.
To confirm what I have written above, it will help a lot  if you tell me what pulse widths your Arduino is producing !

Quote
I have been looking through KAP 3.4 and noticed it's using get_usb_power(2), i tried changing this to get_usb_power(0), and now i get one correct pulse width before the error.
Not really sure what is happening here.   

Using get_usb_power(0) gets the most recent pulse width but it's unbuffered.  You could lose pulses.   

More info about all that here :  USB Remote Scripting Interface (http://chdk.wikia.com/wiki/USB_Remote#.E2.80.8BScripting_Interface)

Quote
I am very much a newbie when it comes to CHDK programming, so just wondering if anyone has solved this or could hep to solve it?
I think we can probably drag up someone who is somewhat familiar with that script  ::)   Once I know what pulse widths you are actually using,   modifying the PWM detection code in the script should be trivial.  Sorry for not catching that sooner.

Thanks WaterWingz.

I am using standard values from the CHDK tutorial on Arducopter. I have attached a JPEG of their specs.
http://copter.ardupilot.com/wiki/common-optional-hardware/common-cameras-and-gimbals/common-chdk-camera-control-tutorial/ (http://copter.ardupilot.com/wiki/common-optional-hardware/common-cameras-and-gimbals/common-chdk-camera-control-tutorial/)

The Arduino Nano is outputting 4.85 Volt pulses of 30, 60, 90, 120, 150 and 180 milliseconds. I did look at the script to make sure they would be suitable. I read somewhere the script values were in centi-seconds.

Thanks again.
Title: Re: KAP & UAV Exposure Control Intervalometer Script: PWM USB REMOTE CONTROL
Post by: waterwingz on 03 / May / 2015, 08:14:28
I did look at the script to make sure they would be suitable. I read somewhere the script values were in centi-seconds.
When I updated the script to use precision timing,  I also increased the resolution to milli-seconds.   That was probably a mistake.

If you want to revert to the timing described in that article,  change line 573 in the current script from :
Code: [Select]
set_remote_timing(1000)to
Code: [Select]
set_remote_timing(10000)
Update :  for backwards compatability, and with some reluctance,  I've updated the downloadable version of the script to use centiseconds rather than milliseconds  (while still using the new high precision timing)

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: seabasscropper on 04 / May / 2015, 06:01:13
Awesome!

I personally don't mind either way, as long as it's noted somewhere in the wiki.

Thanks WaterWingz.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 04 / May / 2015, 08:22:01
I personally don't mind either way, as long as it's noted somewhere in the wiki.
I'm testing the next script release now.  In that version there is a new user parameter that lets you specify the USB remote precision to use (defaults to centiseconds).   And the PWM code adjusts to that setting so the you always specify the pulse lengths in milliseconds (with defaults set for the fight controller article you linked).
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 05 / May / 2015, 17:20:03
Hello Waterwingz ,

During my trials I have tried also the 3DR EAI script : https://github.com/diydrones/ardupilot/blob/master/Tools/CHDK-Scripts/Cannon%20S100/3DR_EAI_S100.lua

but I received a weird error (picture attached).

Could you please help me to solve this issue ?

Thank you.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 05 / May / 2015, 18:11:36
but I received a weird error (picture attached).
char(239) is the first character of the UTF-8 BOM (http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8). Try saving your script files as plain text (ANSI, ASCII), not UTF-8 or Unicode.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 05 / May / 2015, 19:58:45
but I received a weird error (picture attached).
char(239) is the first character of the UTF-8 BOM (http://en.wikipedia.org/wiki/Byte_order_mark#UTF-8). Try saving your script files as plain text (ANSI, ASCII), not UTF-8 or Unicode.
Here you go.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: AdamDynamic on 19 / May / 2015, 18:01:22
Hey,

I've just updated this script from v3.3, for some reason on my A560 any video I record seems to only last 1 second? (I have the video duration set to 10 seconds). It continues taking still images after each video just fine, thought I'd mention it as a possible bug though.

As a secondary point, if I wanted to alter the file to a) Increase the number of still images that the script took before shooting video, and b) wanted to increase the length of the video that the script took, what would be the upper limit of either variable? (I tried altering the length of the video to 9999 and got an error message?)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / May / 2015, 22:00:19
I've just updated this script from v3.3, for some reason on my A560 any video I record seems to only last 1 second? (I have the video duration set to 10 seconds). It continues taking still images after each video just fine, thought I'd mention it as a possible bug though.

This video interleave functionality works fine using v3.5 on my normal test camera (an A1200)

So I dug out my old beaten up A560 and tried it too.   Worse than your situation,  the camera actually crashes when it goes to start a video.   I've attached the resulting ROMLOG for reference.

Looking at the code,  the only thing that might be wonky is the statement:
Code: [Select]
capmode.set('VIDEO_STD')I'll have to play with it - maybe the A560 does not have a valid value for VIDEO_STD.

Quote
As a secondary point, if I wanted to alter the file to a) Increase the number of still images that the script took before shooting video, and b) wanted to increase the length of the video that the script took, what would be the upper limit of either variable?

To extend the number of images taken between each video clip,  change the 100 value here :

Code: [Select]
@param     v Video Interleave (shots)
  @default v 0
  @values  v Off 1 5 10 25 50 100
to what ever shot interval you want.   Then change the 100 value here to the same number  :

Code: [Select]
    video_table     = { 0, 1, 5, 10, 25, 50, 100 }

To extend the video time,  change the 300 value here:

Code: [Select]
@param     w Video Duration (sec)
  @default w 10
  @range   w 5 300
to the number of seconds you want.

Quote
(I tried altering the length of the video to 9999 and got an error message?)

Well,  9999 seconds is almost 3 hours.  Exactly what error message did you receive?

The script parameter input function should have limited your selection to something between 5 and 300 seconds. Regardless, you are not going to get three hours of video time.


Update :  my A560 only crashes if the mode dial is in AUTO mode.   In M mode it takes the 1 second videos you are seeing but after that shooting becomes a bit erratic (might be due to being indoors at night)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / May / 2015, 09:34:10
I've just updated this script from v3.3, for some reason on my A560 any video I record seems to only last 1 second? (I have the video duration set to 10 seconds). It continues taking still images after each video just fine, thought I'd mention it as a possible bug though.
This seems to have slipped in with the focus at infinity changes in 3.4.     The A560 does video interleave correctly with v3.3.

Can you confirm that the problem only happens when you do not have the  Focus @ Infinity  enabled?

Update :   it appears that all of these symptoms can be fixed by inserting a short delay between when the script switches the camera to video mode and when the script does a "shoot_full" to starts recording.   I'll post an updated script tonight.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: AdamDynamic on 20 / May / 2015, 16:23:34
I've just updated this script from v3.3, for some reason on my A560 any video I record seems to only last 1 second? (I have the video duration set to 10 seconds). It continues taking still images after each video just fine, thought I'd mention it as a possible bug though.
This seems to have slipped in with the focus at infinity changes in 3.4.     The A560 does video interleave correctly with v3.3.

Can you confirm that the problem only happens when you do not have the  Focus @ Infinity  enabled?

Update :   it appears that all of these symptoms can be fixed by inserting a short delay between when the script switches the camera to video mode and when the script does a "shoot_full" to starts recording.   I'll post an updated script tonight.

Seems like I missed a lot of activity since I last posted :)

I'll play around with the code to extend the number of shots etc. I changed the number to 9999 but I didn't select that time - once you release your new script I'll try it again with some more sensible numbers and let you know if I get the error again.

Thanks again for taking a look at the script.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / May / 2015, 22:03:15
Script updated to version 3.4d with fixes for video interleave.  It appears older cameras need a lot more time to switch modes and to save things to the SD card.   

Script modified to accommodate this - now works well on my A560.

Update available from the usual download link :  kap_uav.lua (https://app.box.com/files/0/f/0/1/f_11162762030)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: AdamDynamic on 21 / May / 2015, 18:04:49
Script updated to version 3.4d with fixes for video interleave.  It appears older cameras need a lot more time to switch modes and to save things to the SD card.   

Script modified to accommodate this - now works well on my A560.

Update available from the usual download link :  kap_uav.lua (https://app.box.com/files/0/f/0/1/f_11162762030)

Many thanks for this! I'll try it and let you know if I find any more bugs.

Adam
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: AdamDynamic on 21 / May / 2015, 18:56:46

Quote
As a secondary point, if I wanted to alter the file to a) Increase the number of still images that the script took before shooting video, and b) wanted to increase the length of the video that the script took, what would be the upper limit of either variable?

To extend the number of images taken between each video clip,  change the 100 value here :

Code: [Select]
@param     v Video Interleave (shots)
  @default v 0
  @values  v Off 1 5 10 25 50 100
to what ever shot interval you want.   Then change the 100 value here to the same number  :

Code: [Select]
    video_table     = { 0, 1, 5, 10, 25, 50, 100 }

To extend the video time,  change the 300 value here:

Code: [Select]
@param     w Video Duration (sec)
  @default w 10
  @range   w 5 300
to the number of seconds you want.



Following from your post above, I tried to change the code to extend the number of shots and the duration of the video (the relevant section of the code is below), when I run the script I get an error right away saying "uBasic:1 Unk stmt"? This is the same if I edit the file in normal Windows notepad of in Notepad++

This post (http://chdk.setepontos.com/index.php?topic=457.0) suggests it could be caused by the character set (not sure how I would change this?) or blank lines at the start of the script (there aren't any?) Any advice on what I might be doing wrong would be appreciated!

Code: [Select]
@param     v Video Interleave (shots)
  @default v 0
  @values  v Off 1 5 10 25 50 400
@param     w Video Duration (sec)
  @default w 10
  @range   w 5 1200

I get an error message saying:
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / May / 2015, 19:47:04
Following from your post above, I tried to change the code to extend the number of shots and the duration of the video (the relevant section of the code is below), when I run the script I get an error right away saying "uBasic:1 Unk stmt"? This is the same if I edit the file in normal Windows notepad of in Notepad++
If the script is written in Lua then it must have an extension of  .lua   e.g.  kap_uav.lua

Anything else is assumed to be a script written in uBASIC.  As you are getting an error that says :"uBasic:1 Unk stmt" it seems likely that you have the wrong file extension.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 25 / May / 2015, 12:08:06
Script updated to v3.5.   

Updated documentation and the usual download link here : KAP_UAV Exposure Control Script (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: hab_hab on 02 / June / 2015, 05:56:12
Thanks for the update to the script. I am planning to use this script on my Canon IXUS115 on a high altitude balloon flight. I have installed the script and testing it now.

I am facing one problem - I have disabled the display to conserve battery. But I see that the camera shows the countdown until next image (images every 15 seconds). Because of this, the screen is never off even though I want it to be off and I have enabled the setting to do so.

Is there a way to stop the countdown and so save the battery life?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / June / 2015, 08:15:42
Is there a way to stop the countdown and so save the battery life?
I'm guessing that you have not disabled the Shot Review setting in the Canon Menu (i.e. set it to Off) ?  That's the Canon setting that determines how long a copy of your most recent image taken is displayed after the shot completes.  It needs to be set to Off for the script to be able to disable the LCD.

If that's not causing the problem, I'll post a link to a short test script that will tell us if there is a problem with the set_lcd_display(0) function on your camera.

Edit :  link to test script :  http://chdk.setepontos.com/index.php?topic=9969.msg120923#msg120923 (http://chdk.setepontos.com/index.php?topic=9969.msg120923#msg120923)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: hab_hab on 02 / June / 2015, 10:19:50
Thank you! You are right. It was the canon camera menu. To access it, I had to remove the SD-card and then go back into shooting mode to disable it.

Now I am investigating the photo quality issue. On a bright sunny day, photos taken from my balcony are all dark. Isnt the default setting supposed to get us the best possible pictures? I have not changed any of the default settings except for enabled the infinity focus.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / June / 2015, 10:41:36
To access it, I had to remove the SD-card and then go back into shooting mode to disable it.
You should have been able to just exit CHDK <ALT> mode and use the Canon menus normally.

Quote
Now I am investigating the photo quality issue. On a bright sunny day, photos taken from my balcony are all dark. Isnt the default setting supposed to get us the best possible pictures? I have not changed any of the default settings except for enabled the infinity focus.
This sound like it might be an issue with the camera's ND filter and thus a possible porting problem with the IXUS115.   

Would you please attach the script's log file ( kap.log ) that you will find in the root directory of your SD card (assuming you did not disable logging in the script parameters).  It would also be good to have one of the images taken with the script so I can compare to its entry in the log file.  Due to this forum's limitations on file size, you will need to upload the original image to a file sharing site like box.com rather than attach it here.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: hab_hab on 02 / June / 2015, 11:04:15
Thanks! Here is one of the images - https://www.anony.ws/image/DKUR (https://www.anony.ws/image/DKUR)

I have attached the log file also.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / June / 2015, 12:01:13
Thanks! Here is one of the images - https://www.anony.ws/image/DKUR (https://www.anony.ws/image/DKUR)

I have attached the log file also.
Thanks.  Some interesting things happening in the log that I will need to study more closely.  It looks like the script tries to force the camera's ND filter out so that it can shoot at a higher shutter speed / lower ISO setting.  But if the ND filter does not actually retract and is still in the light path,  your images will be underexposed by about three f-stops.  And that's about what I see in the image you posted.

Meanwhile,  there is a timeout anomoly also indicated in the logs.  Do you by any chance have RAW/DNG enabled?

Edit : I've attached a test script for just the ND filter so we can see if that is in fact the problem with your camera.  The script takes two shots (one with the filter in and the other with the filter out) and tries to match the exposure on each.  It will create a log file of the results in the CHDK/LOGS directory on the SD card.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: hab_hab on 03 / June / 2015, 10:22:41
Thank you for the test script. I installed on my SD card and let it take 2-3 photos. But there are no log files in the CHDK/Logs folder! What am I doing wrong?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: hab_hab on 03 / June / 2015, 11:25:47
Tried again and got the following in the logs:

ND Test : avmode= 1
 ND out tv=992 av=294 sv=499 bv=830 exp=42
 ND in tv=704 av=294 sv=499 bv=837 exp=47
...done
*** FINISHED ***
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 03 / June / 2015, 11:35:10
Thank you for the test script. I installed on my SD card and let it take 2-3 photos. But there are no log files in the CHDK/Logs folder! What am I doing wrong?
The script will take exactly two photos.

There should be a file called LOG_0002.TXT in the CHDK/LOG folder on your SD card.

What messages do you see in the CHDK log window on your camera's LCD screen?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 03 / June / 2015, 11:37:56
Tried again and got the following in the logs:

ND Test : avmode= 1
 ND out tv=992 av=294 sv=499 bv=830 exp=42
 ND in tv=704 av=294 sv=499 bv=837 exp=47
...done
*** FINISHED ***
That's better.

Do the two images taken by the script look like they are exposed the same?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: hab_hab on 03 / June / 2015, 14:56:22
Here are the two images:

https://www.anony.ws/image/DK6U (https://www.anony.ws/image/DK6U)
https://www.anony.ws/image/DK6p (https://www.anony.ws/image/DK6p)

It also took the corresponding raw image. I should disable the setting for raw files, right? We only want jpg images here?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 03 / June / 2015, 17:52:17
Here are the two images:
https://www.anony.ws/image/DK6U (https://www.anony.ws/image/DK6U)
https://www.anony.ws/image/DK6p (https://www.anony.ws/image/DK6p)
Well, two images look to be exposed identically.  Yet the exif info reports two very different exposures :

1/160s ƒ/2.8 ISO200   vs    1/1250s ƒ/2.8 ISO200

The only way that can happen is if CHDK was able to successfully insert the ND filter for the image with the 1/160 s exposure time.

All of which tells me that ND filter control appears to be working correctly on your camera.   And that I need to find another explanation of why the exposure is so dark in the original images you posted.


Quote
It also took the corresponding raw image. I should disable the setting for raw files, right? We only want jpg images here?
For the purposes of the test strip,  RAW images are not needed.  But they don't hurt anything.

For the purposes of your previous test,  having RAW images enabled explains the timeout shooting errors I was seeing.  I've increased the timeout value to compensate for shooting with RAW enabled.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 04 / June / 2015, 10:04:48
All of which tells me that ND filter control appears to be working correctly on your camera.   And that I need to find another explanation of why the exposure is so dark in the original images you posted.
I've now retested the ND filter logic of kap_uav.lua on my trusty A1200 (which like your camera has an ND filter and not an adjustable aperture). 

Everything works as expected when I setup the script parameters so that the camera uses the ND filter when the Canon logic would not have used it,  and it works as expected when I setup the script parameters so that the camera does uses the ND filter when the Canon logic would have used it.

Looking at the log again, and your posted images,  I am completely convinced that the under exposure is a result of the ND filter being engaged in the light path when the script specifically tried to remove it.

With over 3200 downloads and the script in common usage in the KAP and UAV community,  your exact issue has not been reported by anyone else.  There have been changes in the latest script version but nothing that should affect ND filter operation. 

All of which suggests either something in the way the camera is setup,  something unique about the IXUS115, or something is "sticky" in your camera.  But confounding that is the fact that your camera worked properly in the ND filter test.

To test all of this, I've updated the kap_uav.lua v3.6 beta version (https://app.box.com/s/1h5nef5ru1fy31amlu4m72toe1a67kje) of the next release of the script to include a delay after the ND filter is moved.  If you could test this it would be interesting to know the results.  I'd rather not make that a permanent change as it slows down the time between reading the exposure and taking the actual shot - bad news on a moving kite or UAV.

tl;dr : On a technical note,  there is a slight difference between the test script and the kap_uav script in the way the shot actually happens.  The test script sets the exposure parameters and then calls the shoot() function.   The kap_uav script sets the exposure parameters inside of the "shoot_half" prior to the "shoot_full_only".  I suppose it's possible that it takes a few milliseconds for the ND filter to move and the kap_uav filter does the "shoot_full_only" before the filter has finished moving.  All depends on the timing through the action stack.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: hab_hab on 04 / June / 2015, 11:31:45
Thanks. I was able to take some pictures. Here is one from today: https://www.anony.ws/image/DKTZ (https://www.anony.ws/image/DKTZ)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 04 / June / 2015, 12:42:06
Thanks. I was able to take some pictures. Here is one from today: https://www.anony.ws/image/DKTZ (https://www.anony.ws/image/DKTZ)
Thanks.

Still about 3 f-stops dark.   Assuming you used the new version of the script,  adding a delay after setting the ND filter did not solve the problem.

One thing I have noticed in your logs is that your camera has both Continuous Autofocus and  Servo Autofocus enabled in the Canon settings.   At a minimum,  this will interfer with the script's ability to lock focus at infinity.  It's also remotely possible that it's affecting the ND filter control too.

I'd suggest putting the the camera into P mode rather than Auto (slider switch on top of camera) to disable Continuous Autofocus.  Then go into the Canon menus and turn off Servo AF. Set AF Frame to Center (not Tracking Autofocus).  You might also want to disable image stabilization (IS-mode).   

See if that makes a difference in the ND filter control?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: hab_hab on 05 / June / 2015, 04:40:26
Thanks again! I was able to set the camera to the settings you recommended. Here is a latest image:

https://www.anony.ws/image/DKCA (https://www.anony.ws/image/DKCA)

Looks much better compared to last time but still not perfect. What do you think is going on?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 05 / June / 2015, 10:46:13
Looks much better compared to last time but still not perfect. What do you think is going on?
Looks pretty close to perfect to me.  8)

Can you do one more test where you let the script take a couple of photos, halt the script, restart the camera (power off/on) to clear all settings,  and then take a couple of picture in "P" mode shooting normally.  Post the results -  I would be very interested to see how those image compare.

Meanwhile, the reported aperture in the exif says f2.8.   Which might mean the camera was not going to insert the ND filter anyway and so the exposure is better by accident.   Would you please post the most recent log file so I can see what the script was doing?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: hab_hab on 05 / June / 2015, 11:09:57
Looking at the latest images, I agree with you. The images look very good! :)

Here are the two images one before and one after shutting off the script and power cycling the camera. The black bar at the bottom of the before image is just the floor under the camera...

https://www.anony.ws/image/DKej (https://www.anony.ws/image/DKej)
https://www.anony.ws/image/DKe7 (https://www.anony.ws/image/DKe7)

I have also attached the KAP.log.

When I pressed menu to stop the script, It showed a "log file open error". Do not know what this means.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 05 / June / 2015, 16:12:35
Here are the two images one before and one after shutting off the script and power cycling the camera. The black bar at the bottom of the before image is just the floor under the camera...
The images look identical but the exif info indicates the f-stops are three apart.

Script  Image : IMG 5451 (https://www.anony.ws/image/DKe7)
1/1500s ƒ/8 ISO100

Canon Image : IMG 5454 (https://www.anony.ws/image/DKej)
1/1500s ƒ/2.8 ISO100

I believe that both image are taken with the ND filter out.  The CHDK script image reports f8 is really f2.8.  I'm also suspicious of the Canon image settings - they are too much like the Script settings even though you did a power cycle between the two pictures.

Quote
I have also attached the KAP.log.  When I pressed menu to stop the script, It showed a "log file open error". Do not know what this means.
Unfortunately,  it means the script was unable to open the log file as it existed (camera too busy doing other I/O) and thus did not write out the log data.  When this happens during normal shooting,  the script just carries on and retries later.  On script exit it does not get the chance to retry though - I will have to fix that.

Meanwhile, that means I don't have data from our last posted images.   I'll dig back through the log for the entries correcsponding to some of the earlier images you posted.

Edit :
Thanks again! I was able to set the camera to the settings you recommended. Here is a latest image:
https://www.anony.ws/image/DKCA (https://www.anony.ws/image/DKCA)
I searched the log file and the entry for this image is missing.  Did you shoot it with the script?  (If so, then we had another log file write error on exit ..)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: hab_hab on 06 / June / 2015, 09:36:03
Hello

Sorry! I made a mistake in my previous test. When I power cycled the camera, I forgot to switch off the KAP script. So the second image is also taken with the script running! This time, I did it right.

Here are the two images (one with script running and then switched off the camera, turned off the script by making the SD card RW and then using the P mode of the camera to take the picture):

https://www.anony.ws/image/D6Dx (https://www.anony.ws/image/D6Dx)
https://www.anony.ws/image/D6Dz (https://www.anony.ws/image/D6Dz)

The images look pretty identical..

I have also uploaded the log.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / June / 2015, 10:12:49
Sorry! I made a mistake in my previous test. When I power cycled the camera, I forgot to switch off the KAP script. So theecond image is also taken with the script running!
I thought something like that must have happened.  Thanks for checking.

Also, from the log files it appears you are no longer running the test version of the script that I posted ?

Latest download link > kap_uav.lua 3.6 beta 3 (https://app.box.com/s/1h5nef5ru1fy31amlu4m72toe1a67kje)


Quote
Here are the two images (one with script running and then switched off the camera, turned off the script by making the SD card RW and then using the P mode of the camera to take the picture):  The images look pretty identical..
Different exposures though ...
CHDK : IMG 5456 : 1/1500s ƒ/8 ISO100
Canon: IMG 5457 : 1/1250s ƒ/8 ISO500

I'd suggest that for KAP, UAVs, or just normal shooting,  CHDK made a better choice than Canon!

We still have not found the original issue.  In these two shots,  both Canon & CHDK left the ND filter engaged (reported as an f8 aperture setting).   Your original problem came when CHDK did not want the ND filter and Canon did.  That's only going to happen over a limited range of brightness - on either side of that both programs will pick the same ND filter position and we won't see an issue.

Edit :  looking at the exposure settings again,  its clear that the CHDK setting (despite the exif info) have the ND filter out and the Canon settings have it in.  So I think that with the camera in P mode, things are working.

I'll try testing on my ixus120 today instead of my A1200.  Maybe I can simulate the problem that way.

Quote
I have also uploaded the log.
The image information is missing again - likely due to the script being unable to open the log file while it is exiting.  Maybe it's because the previous image is still being saved - especially if you have RAW enabled.  Can you wait an additional 5 seconds next time before and after exiting the script?   Meanwhile, I've updated the test script with code that should prevent that.

Update :  I can reproduce the problem on my ixus120(sd940) if I pick a fixed ISO value in the Canon menu (not Auto).  This may be a problem on some cameras and not others : CHDK ISO override. (http://chdk.setepontos.com/index.php?topic=6713.0)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: hab_hab on 08 / June / 2015, 07:57:49
Hello

Yes, I was indeed using the regular KAP script. I was able to run some tests today with your latest test script. Here are the results:

https://www.anony.ws/image/D6tD (https://www.anony.ws/image/D6tD)
https://www.anony.ws/image/D6tJ (https://www.anony.ws/image/D6tJ)

I did wait 5 seconds after stopping the script to see if the error would occur and it did not.

On a side note:

Yesterday, I had let the regular KAP script run for sometime and when I checked it in the middle of recording a video (I think), it was showing me this error:

https://www.anony.ws/image/D6t5 (https://www.anony.ws/image/D6t5)

I have attached the two log files for you to review. Let me know what you find.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / June / 2015, 08:27:16
I have attached the two log files for you to review. Let me know what you find.
The second attached file ( LOG_0002.TXT ) is from the test script.  I you have a log file from after the issues with video mode?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: hab_hab on 08 / June / 2015, 09:28:38
When the video recording error occurred, I was using regular KAP script. I did attach the KAP log also with my previous post. Here is it again. Are you looking for a different log file? I did not find any other log file either in the root folder of SD card (I did find this KAP.log in the root folder which I have attached) or in the logs folder.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / June / 2015, 11:36:39
Are you looking for a different log file?
My mistake - the log messages related to video recording are in the log you posted.  I just did not look far enough back.

What seems to be happening is the script is not waiting long enough for the camera to actually complete writing the video file to the SD card.  I'm not sure right now what to do about that.  I could insert a really long delay after you leave video recording mode to give the camera time to complete saving the video to the SD card.  But that will slow the script down a lot if the extra delay time is not actually needed.

I'll see if I can find a way to determine when writing to the SD card has completed.  Maybe looping until the script can open the log file also indicates that the write operations for the video file have completed?

Meanwhile,  the new set of images you posted earlier look good of course.  Perhaps we can mark this 'solved' if you have the camera in P mode - I've updated the wiki documentation to include a camera setup section that says this.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: hab_hab on 09 / June / 2015, 05:09:01
I agree that this problem is solved. Appreciate your help through this!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: hab_hab on 09 / June / 2015, 17:03:55
Hopefully last question. Should I use the beta version of the script or the regular version? I am assuming that you felt that the problem is solved in the beta version. Am I right?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / June / 2015, 18:20:45
Hopefully last question. Should I use the beta version of the script or the regular version? I am assuming that you felt that the problem is solved in the beta version. Am I right?
The "fix" is to run the camera in P mode (along with the other settings mentioned here (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script#Camera_Settings).  So either version of the script will work for you.

The beta version tried to improve the logging.  I'll encorporate those changes into the next release. I'm still adding a change so that you don't get those warning messages about the log file failing to write after video recording finishes.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 11 / June / 2015, 14:31:04
I'm trying to figure out how to use shutter release using a TX / Receiver and what settings I need / what they mean??

In the KAP Script menu near the bottom there's USB Shot Control and the options toggle between none, On/Off, OneShot, and PWM, I'm guessing this needs to be enabled but I wouldn't know which setting to select and is I need a 3 position switch and if so whether the 1st click would focus it and the 2nd take the shot???

I also tried to put the Shot Interval down to 0 but the lowest it'll go is 2 seconds, will it still continue taking shots of it's own accord or is there another way I can switch that off to use a manual trigger rather than the intervalometer??

I also found in the Main CHDK menu, CHDK Settings, Remote Parameters and the 3 further headings

Remote enable ... I'm guessing I need to enable this??

Switch type ... Options ... None, OnePush, TwoPush, CA-1  I'm not sure what these mean and if I should do anything with them????

Control Mode ... Options ... None, Normal, Quick, Burst, Bracket, Zoom .... again I've no idea what these are and if I need any of them ???

Also can I use the zoom with this and again any idea how to set it up??

Any help would be much appreciated!!!!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / June / 2015, 14:56:15
I'm trying to figure out how to use shutter release using a TX / Receiver and what settings I need / what they mean?? In the KAP Script menu near the bottom there's USB Shot Control and the options toggle between none, On/Off, OneShot, and PWM, I'm guessing this needs to be enabled.
As is happens, somebody wrote a little bit of documentation (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script) for the script.  The section about Parameter Setup (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script#Parameter_Setup) covers much of what you are looking for.

Quote
I wouldn't know which setting to select and is I need a 3 position switch and if so whether the 1st click would focus it and the 2nd take the shot???
There are several ways to set things up but the default is for the script to manage the complete shot when the USB 5V pin goes to 5V.

Quote
I also tried to put the Shot Interval down to 0 but the lowest it'll go is 2 seconds, will it still continue taking shots of it's own accord or is there another way I can switch that off to use a manual trigger rather than the intervalometer??
The shot interval will not go lower than 2 seconds because for the most part, Canon Powershots cannot complete a shooting cycle any faster without using the camera's continuous mode.   And using continuous mode has its own complications, although I have considered adding it as a script option.

However, if you enable the USB controller OneShot or PWM modes then the timer is ignored,  so setting USB Shot Control [ OneShot ]  will do what you want.

Quote
I also found in the Main CHDK menu, CHDK Settings, Remote Parameters and the 3 further headings
Remote enable ... I'm guessing I need to enable this?? Switch type ... Options ... None, OnePush, TwoPush, CA-1  I'm not sure what these mean and if I should do anything with them????  Control Mode ... Options ... None, Normal, Quick, Burst, Bracket, Zoom .... again I've no idea what these are and if I need any of them ???
All of those options are essentially only for shooting via a USB remote switch when you are not using a script.  The kap_uav.lua script ignores them so it makes no difference how they are setup (although Enable Sync [ ] should probably not be enabled).

Quote
Also can I use the zoom with this and again any idea how to set it up??
The script will let you set a fixed zoom position to use when shooting.  If you want to be able to zoom in and out then you need USB Shot Control [ PWM ]  and a suitable flight controller like a pixhawk (http://www.tuffwing.com/support/pixhawk_camera_trigger_cable.html) than can send pulse width modulated signals.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 11 / June / 2015, 17:30:10
waterwingz,
Brilliant and thank you again, I'll work through those in the morning and hopefully should be there :D
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 11 / June / 2015, 18:09:44
Quote
I wouldn't know which setting to select and is I need a 3 position switch and if so whether the 1st click would focus it and the 2nd take the shot???
There are several ways to set things up but the default is for the script to manage the complete shot when the USB 5V pin goes to 5V.


I've got it all working, it's on a 3 position switch and I have to move it 2 clicks to get it to take a shot, can I set it so it'll trigger the shot on 1 click ..... I'm guessing it's probably something in the TX that I need to change???

Not the end of the world if I can't but the switch is in quite an awkward place to reach and it'd jut make it that smidge easier.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / June / 2015, 18:40:07
I've got it all working, it's on a 3 position switch and I have to move it 2 clicks to get it to take a shot, can I set it so it'll trigger the shot on 1 click
Sorry - I'm not sure what you are describing here.   What kind of switch are you using?  A data sheet, link, diagram, or just post a picture here might help.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 12 / June / 2015, 07:02:03
I've got it all working, it's on a 3 position switch and I have to move it 2 clicks to get it to take a shot, can I set it so it'll trigger the shot on 1 click
Sorry - I'm not sure what you are describing here.   What kind of switch are you using?  A data sheet, link, diagram, or just post a picture here might help.

I'm using a Futaba Transmitter / receiver on a multirotor so a standard switch that's built into the transmitter some of which are 2 position and some of which are 3 positions switches.

Any idea as well at beyond what distance you're best off using the infinity setting, I'm guessing if most of the shots I'm doing are going to be beyond 20 mtrs then it's probably going to select infinity anyway even if it was set to auto focus.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: zeno on 12 / June / 2015, 07:10:56
It sounds as though that 3 position switch works like a joystick with just up, center and down positions. In that case, why don't you leave the switch in the middle position (shutter off) and then you'll only have to move it one click to trigger the shutter.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 12 / June / 2015, 07:26:37
I'm using a Futaba Transmitter / receiver on a multirotor so a standard switch that's built into the transmitter some of which are 2 position and some of which are 3 positions switches.
The more important question then is what receiver are you using and what output channels does the receiver have?  Only three wire servo output control or does it have on/off ( 5v/0v ) outputs?

Quote
Any idea as well at beyond what distance you're best off using the infinity setting, I'm guessing if most of the shots I'm doing are going to be beyond 20 mtrs then it's probably going to select infinity anyway even if it was set to auto focus.
It should select infinity anyway,  but focusing takes time and slows down your maximum shot rate.  And if your kite or UAV is moving much,  it may have trouble actually locking the focus.  Which will either result in it not focussing or in it taking a long time to focus.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 12 / June / 2015, 07:30:18
Zeno,
If there's no other way then that may be a good alternative although the only reason it bothers me is I can keep my fingers on the throttle to push it up to the half way / middle position but have to take them off to go to the top position, it really is that close a call and if I'm taking lots of photos don't really want to keep relinquishing full control.
I may try and reverse the servo and see if I can get my finger round to pull it down easily and then push it back up to the half way.

Longer fingers would be another alternative  :D
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 12 / June / 2015, 07:35:31
I'm using a Futaba Transmitter / receiver on a multirotor so a standard switch that's built into the transmitter some of which are 2 position and some of which are 3 positions switches.
The more important question then is what receiver are you using and what output channels does the receiver have?  Only three wire servo output control or does it have on/off ( 5v/0v ) outputs?

Cheers for the infinity that makes sense!!!!!

The RX is a Futaba R7008SB, I'm just googling the specs as well to see if I can make head or tale of it!!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: zeno on 12 / June / 2015, 09:42:18
If you don't mind a bit of DIY you could always relocate the switch. Most TX switches are easy to unscrew and have a fair bit of cable attaching them to the circuit board. You could try drilling a new hole in a more convenient position.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 12 / June / 2015, 13:18:02
The very 1st time I tried it last night I was getting a waiting for USB input signal I think I re-started the camera and then it worked.
Today I can't get it to respond at all and nothing has changed. I've tried unplugging the USB, re-plugging it in, staring the camera with the USB in and without it in and it just sits and says waiting for USB input signal.
I tried switching it to PWM in case that makes a difference and again nothing ...... any ideas???
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 12 / June / 2015, 18:12:40
The very 1st time I tried it last night I was getting a waiting for USB input signal I think I re-started the camera and then it worked.
Today I can't get it to respond at all and nothing has changed. I've tried unplugging the USB, re-plugging it in, staring the camera with the USB in and without it in and it just sits and says waiting for USB input signal.
I tried switching it to PWM in case that makes a difference and again nothing ...... any ideas???
Well, my guess would be that the script is waiting for a USB signal  ::)

When any of the USB remote modes are enabled, the script will wait until it sees a USB pulse (or 5V level) before it extends the lens and starts shooting.   This is to keep the lens retracted when you launch your kite or UAV.

So to get things started,  you need to supply a valid USB signal.  In the current code, it might miss pulses less than 100 mSec in length while waiting for to start shooting.  I'll have to fix that.  If you are sure your RX is signalling the script then that might be the problem?

To test,  try plugging your camera into a USB cable that is connected to your PC. This will provide the necessary voltage level to start the script.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 13 / June / 2015, 06:29:26
Just discovered it was me having a complete brain [admin: avoid swearing please] so all up and running now ... too embarrassed to say what I did wrong :-[

My pictures though are awful and very unclear, I really wanted to get a decent depth of field so set my target AV at 7.1 and shutter at 1/800 which is throwing the ISO up to around 800, maybe that's the issue, I'll wind the AV back to 4.0 and the shutter speed up and see what effect.

Thanks again for all the help though getting it up and working!!!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 13 / June / 2015, 09:54:33
My pictures though are awful and very unclear, I really wanted to get a decent depth of field so set my target AV at 7.1 and shutter at 1/800 which is throwing the ISO up to around 800, maybe that's the issue, I'll wind the AV back to 4.0 and the shutter speed up and see what effect.
Please be more descriptive than just saying "awful".  Are they badly exposed?  (i.e. too dark or too bright).  Or are they out of focus?  Or are they blurry?  Or too noisy at the pixel level? Were you testing while holding the camera still on the ground or was the camera shooting on a moving UAV?

Did you configure your S110 using these settings : Camera Settings (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script#Camera_Settings) ?

How is your camera mounted to your UAV?  Vibrations can be a big problem - especially for the Canon S series, that have a "floating lens" focus mechanism.

FWIW, your S110 will get "decent" depth of field at any aperture setting (f-stop) if the focus distance is set at infinity so don't worry too much about that setting.     And a 1/800 shutter speed is probably the slowest speed you want to be using - 1/1000 or faster is usually better.  On the S110,  an ISO800 setting should still look pretty good but any higher than that will start to appear noisy at the pixel level.

I'm not sure why you are trying to force specific settings on the script.  Getting the best image without your "help" is what it was designed to do as long as you give it a range of values to use (via the script parameters).

In future,  it will help a lot if you attach the log file that the script makes to your post.   You will find it in the root (top) folder on your SD card - it's called KAP.log.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 14 / June / 2015, 17:46:40
Sorry I've been a bit quiet, just after I posted the last post I thought I'd take the other UAV up with the GoPro camera with a non fish eye lens in the same lighting conditions as I just done the shots with the S110 to get a direct comparison ..... I was hoping the Canon would improve on the GoPro shots and I had a complete fly away over the roof of my house and beyond some trees so I had no idea where it went heading towards fields opposite.

2 days searching with another UAV taking still pics and blowing them up and found it with camera and UAV totally undamaged in one of the crops which obviously helped give it a soft landing  :D .... doesn't answer SWHY it flew away though!!!

The pictures are blurry, very blurry and add insult to injury before the UAV decided it had a will of it's own and ran away I got a couple of pics for comparison and they're much clearer than the Canon.

I've attached the log and a pic from each.

The gimbal for the S110 is a servo driven one
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Witterings on 14 / June / 2015, 17:47:47
Could only attach 2 things so here's the log
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 14 / June / 2015, 18:50:10
Sorry I've been a bit quiet, just after I posted the last post I thought I'd take the other UAV up with the GoPro camera with a non fish eye lens in the same lighting conditions as I just done the shots with the S110 to get a direct comparison ..... I was hoping the Canon would improve on the GoPro shots and I had a complete fly away over the roof of my house and beyond some trees so I had no idea where it went heading towards fields opposite.
What happens if you try a side-by-side comparison of the GoPro and S110 sitting stable on the ground, pointed at an outdoor scene with object several humdred feet away?  (Make sure to adjust the zoom so the images are framed the same way - in your posted pix the GoPro is using quite a bit longer focal length than the S110)?

Quote
The pictures are blurry, very blurry and add insult to injury before the UAV decided it had a will of it's own and ran away I got a couple of pics for comparison and they're much clearer than the Canon.
Having looked at many KAP and UAV pix online,  I would not describe either of these as "very blurry".  The GoPro image only appear clearer partly because it is using a longer focal length.   Again, a comparison to what those two cameras can do when stationary on the ground is probably the next step.

Also,  the S110 is only shooting at 1/800.   Speeds of 1/2000  might be better - you will need to change the target Tv to that and lower the target Av to f3.5.

Quote
The gimbal for the S110 is a servo driven one
Your biggest challenge here is how good your vibration absorbing mounting is.  Apparently the S110 image stabilization mechanism "floats" the lens - even when it's off.  So any vibration from the UAV motors can be very problematic.  More info here : Let's talk Canon cameras (http://diydrones.com/forum/topics/lets-talk-canon-cameras)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 16 / June / 2015, 15:42:32
The pictures are blurry, very blurry and add insult to injury before the UAV decided it had a will of it's own and ran away I got a couple of pics for comparison and they're much clearer than the Canon.

I've attached the log and a pic from each.
In addition to what waterwingz said: The images you posted 1280x720, which is far less than the resolution of the s110 sensor. Original resolution would be much more useful to understand where any blurring is coming from. If the files are too large to post here, use a file hosting site like dropbox, google drive etc, or crop out a section at 1:1 zoom.
Title: s110 shot interval under 1.5s
Post by: netptl39 on 19 / June / 2015, 06:44:22
Hi all,
I have a built a UAV specially for a mission but in order to actually do the mission I need to get the shot interval of my Canon S110 under 1.5s.

Can anybody tell me how can that be done?
Thanks in advance!
Tom
Title: Re: s110 shot interval under 1.5s
Post by: waterwingz on 19 / June / 2015, 07:51:28
I have a built a UAV specially for a mission but in order to actually do the mission I need to get the shot interval of my Canon S110 under 1.5s.  Can anybody tell me how can that be done?
How much under 1.5 seconds?   With most Canon Powershots, the fastest you can cycle a complete focus, set exposure, shoot, save image sequence is about 2 seconds.   

If that is adequate, then this script is probably all you need: url=http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script]kap_uav.lua[/url]

To go much faster,  you basically have to either use whatever Canon built-in continuous shooting mode you camera supports or a script like this : 
Fast Shooter Intervalometer (http://chdk.wikia.com/wiki/Fast_Shooter_Intervalometer). 

Note that the script will set the exposure on the first shot and use the same exposure for all subsequent shots.    This might be a problem if your lighting changes but might also be good if you want to merge all your images in post processing and have them shot at the same exposure.   

Finally, you can shoot continuously with exposure adjustment using the experimental version of CHDK (1.4.0) and the experimental script discussed here : 
Re: proposal - script shooting hooks (http://chdk.setepontos.com/index.php?topic=11081.msg119265#msg119265)

I have started looking into adding continuous shooting modes to the kap_uav.lua script.  Can you tell me more about what would work for your application?
Title: Re: s110 shot interval under 1.5s
Post by: netptl39 on 19 / June / 2015, 08:43:39
Thanks waterwingz!
I will get back to you shortly, once I have merged this with a little PWM control and have the results.

I need 1.4s interval. Pictures will be merged.
If I keep the shot button pushed the interval is 1.2s. that is about 5meter difference in the air. I just have to get the script right now.

Title: Re: s110 shot interval under 1.5s
Post by: waterwingz on 19 / June / 2015, 08:56:49
Thanks waterwingz!
I will get back to you shortly, once I have merged this with a little PWM control and have the results.  I need 1.4s interval. Pictures will be merged. If I keep the shot button pushed the interval is 1.2s. that is about 5meter difference in the air. I just have to get the script right now.
Do you want to try this yourself or would you be willing to test a beta version of the kap_uav.lua script that does this? 

I assume you are okay (or even prefer) the exposure to stay "locked" once you start continuous shooting?
Title: Re: s110 shot interval under 1.5s
Post by: netptl39 on 19 / June / 2015, 10:08:21
Man you read mind or what?
I also started putting the 2 scripts together, but probably you have more insight than I do so if you have a beta I will
test it tomorrow morning.
A terrain follow mission at 80m above tree level in the hills at 20m/s speed.
will that work?

Title: Re: s110 shot interval under 1.5s
Post by: waterwingz on 19 / June / 2015, 12:02:11
A terrain follow mission at 80m above tree level in the hills at 20m/s speed.
will that work?
I'll get you something tonight ( 10 hrs from now plus/minus ).  I assume at this point that your flight controller will send +5V to the camera USB port when it wants continuous shooting?   We could use a PWM encode message (which the pixhawk type controllers will support) but that will take a little more testing.

WWZ

@reyalp :  if you have a moment today,  would you please move this thread to the  kap_uav.lua thread (http://chdk.setepontos.com/index.php?topic=10822) ?  TIA
Title: Re: s110 shot interval under 1.5s
Post by: netptl39 on 19 / June / 2015, 12:23:37
I have the gentlewire as I was using APM previously.
I will also need to stop the shooting and shut down the camera before landing so I would like to keep using the the gentlewire.

I am really looking forward to test the script!
Many thanks in advance!

Title: Re: s110 shot interval under 1.5s
Post by: waterwingz on 19 / June / 2015, 13:48:39
I have the gentlewire as I was using APM previously. I will also need to stop the shooting and shut down the camera before landing so I would like to keep using the the gentlewire.
Using just the USB signal,  I have it setup to shoot when USB is asserted (powered on) and switch to playback mode (i.e. lens retracted) when USB is off.  This allows you to enable shooting on a pass by pass basis and still have the lens safely retracted on landing.   With the Gentwire cables we have more options - start continuous shooting, pause continuous shooting, goto playback mode and complete shutdown being the most obvious one.

Edit :  beta version of script 3.6 attached (https://app.box.com/s/2896pjtbxfgxrbnp2fh5f1glp914yr3a).  Set the shot interval to 0 seconds and the script will run in "continuous mode".  I also included the fastshot.lua script so that you can test the max shot rate of your camera with a simple script.  Results with my old cameras are around 2 seconds per shot - or about 1 second faster than without continuous mode.   My S100 runs at about 1.1 to 1.2 seconds per shot.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 20 / June / 2015, 13:20:01
WWZ,

As per PM I have started the testing of the 3.6. so far the test rig was an RC receiver + gentlewire + S110
ch1up - works as it should: with interval set to 0 it makes sets shooting parameters and then it starts shooting at 1.05s interval with the same settings. if camera moved picture quality degrades.
ch1mid and ch1down I am not sure how it should work.
I will hook up the camera to the pixhawk. that way i can have precise PWM signals and know more.

I plan to chek back in about an hour with that. 
below is the KAP.log:
Code: [Select]

2015Jun20 16:23:33    KAP 3.6 started - press MENU to exit
2015Jun20 16:23:33    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun20 16:23:33    Mode:PLAY,Continuous_AF:0,Servo_AF:0
2015Jun20 16:23:33     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2015Jun20 16:23:33     Av:4.0 minAv:2.8 maxAv:8.0
2015Jun20 16:23:33     ISOmin:100 ISO1:400 ISO2:800 M:800
2015Jun20 16:23:33     Focus:OFF  Video:0 USB:3 Tmo:0
2015Jun20 16:23:33     AvM:3 int:0 Shts:0 Dly:0 B/L:0
2015Jun20 16:23:33    Warning : camera ISO not in AUTO mode
2015Jun20 16:23:34    waiting on USB signal
2015Jun20 16:23:34    Menu key exit request
2015Jun20 16:23:34    Loggger : log file updated.
2015Jun20 16:31:16    KAP 3.6 started - press MENU to exit
2015Jun20 16:31:16    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun20 16:31:16    Mode:PLAY,Continuous_AF:0,Servo_AF:0
2015Jun20 16:31:16     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2015Jun20 16:31:16     Av:4.0 minAv:2.8 maxAv:8.0
2015Jun20 16:31:16     ISOmin:100 ISO1:400 ISO2:800 M:800
2015Jun20 16:31:16     Focus:OFF  Video:0 USB:3 Tmo:0
2015Jun20 16:31:16     AvM:3 int:0 Shts:0 Dly:0 B/L:0
2015Jun20 16:31:16    Warning : camera ISO not in AUTO mode
2015Jun20 16:31:18    waiting on USB signal
2015Jun20 16:31:23    USB start signal received
2015Jun20 16:31:26    Mode switched to M
2015Jun20 16:31:26    Loggger : log file updated.
2015Jun20 16:31:59    KAP 3.6 started - press MENU to exit
2015Jun20 16:31:59    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun20 16:31:59    Mode:PLAY,Continuous_AF:0,Servo_AF:0
2015Jun20 16:31:59     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2015Jun20 16:31:59     Av:4.0 minAv:2.8 maxAv:8.0
2015Jun20 16:31:59     ISOmin:100 ISO1:400 ISO2:800 M:800
2015Jun20 16:31:59     Focus:OFF  Video:0 USB:3 Tmo:0
2015Jun20 16:31:59     AvM:3 int:0 Shts:0 Dly:0 B/L:0
2015Jun20 16:31:59    Warning : camera ISO not in AUTO mode
2015Jun20 16:32:00    waiting on USB signal
2015Jun20 16:32:01    USB start signal received
2015Jun20 16:32:04    Mode switched to M
2015Jun20 16:32:04    Loggger : log file updated.
2015Jun20 16:33:10    KAP 3.6 started - press MENU to exit
2015Jun20 16:33:10    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun20 16:33:10    Mode:PLAY,Continuous_AF:0,Servo_AF:0
2015Jun20 16:33:10     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2015Jun20 16:33:10     Av:4.0 minAv:2.8 maxAv:8.0
2015Jun20 16:33:10     ISOmin:100 ISO1:400 ISO2:800 M:800
2015Jun20 16:33:10     Focus:OFF  Video:0 USB:3 Tmo:0
2015Jun20 16:33:10     AvM:3 int:0 Shts:0 Dly:0 B/L:0
2015Jun20 16:33:10    Warning : camera ISO not in AUTO mode
2015Jun20 16:33:11    waiting on USB signal
2015Jun20 16:33:19    USB start signal received
2015Jun20 16:33:23    Mode switched to M
2015Jun20 16:33:23    Loggger : log file updated.
2015Jun20 16:33:47    KAP 3.6 started - press MENU to exit
2015Jun20 16:33:47    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun20 16:33:47    Mode:PLAY,Continuous_AF:0,Servo_AF:0
2015Jun20 16:33:47     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2015Jun20 16:33:47     Av:4.0 minAv:2.8 maxAv:8.0
2015Jun20 16:33:47     ISOmin:100 ISO1:400 ISO2:800 M:800
2015Jun20 16:33:47     Focus:OFF  Video:0 USB:3 Tmo:0
2015Jun20 16:33:47     AvM:3 int:0 Shts:0 Dly:0 B/L:0
2015Jun20 16:33:47    Warning : camera ISO not in AUTO mode
2015Jun20 16:33:49    waiting on USB signal
2015Jun20 16:33:50    USB start signal received
2015Jun20 16:33:53    Mode switched to M
2015Jun20 16:33:53    Loggger : log file updated.
2015Jun20 16:50:46    KAP 3.6 started - press MENU to exit
2015Jun20 16:50:46    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun20 16:50:46    Mode:PLAY,Continuous_AF:0,Servo_AF:0
2015Jun20 16:50:46     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2015Jun20 16:50:46     Av:4.0 minAv:2.8 maxAv:8.0
2015Jun20 16:50:46     ISOmin:100 ISO1:400 ISO2:800 M:800
2015Jun20 16:50:46     Focus:OFF  Video:0 USB:3 Tmo:0
2015Jun20 16:50:46     AvM:3 int:0 Shts:0 Dly:0 B/L:0
2015Jun20 16:50:46    Warning : camera ISO not in AUTO mode
2015Jun20 16:50:47    waiting on USB signal
2015Jun20 16:51:09    USB start signal received
2015Jun20 16:51:12    Mode switched to M
2015Jun20 16:51:12    Loggger : log file updated.
2015Jun20 16:55:17    KAP 3.6 started - press MENU to exit
2015Jun20 16:55:17    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun20 16:55:17    Mode:PLAY,Continuous_AF:0,Servo_AF:0
2015Jun20 16:55:17     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2015Jun20 16:55:17     Av:4.0 minAv:2.8 maxAv:8.0
2015Jun20 16:55:17     ISOmin:100 ISO1:400 ISO2:800 M:800
2015Jun20 16:55:17     Focus:OFF  Video:0 USB:3 Tmo:0
2015Jun20 16:55:17     AvM:3 int:0 Shts:0 Dly:0 B/L:0
2015Jun20 16:55:17    Warning : camera ISO not in AUTO mode
2015Jun20 16:55:18    waiting on USB signal
2015Jun20 16:55:19    Menu key exit request
2015Jun20 16:55:19    Loggger : log file updated.
2015Jun20 17:12:20    KAP 3.6 started - press MENU to exit
2015Jun20 17:12:20    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun20 17:12:20    Mode:PLAY,Continuous_AF:0,Servo_AF:0
2015Jun20 17:12:20     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2015Jun20 17:12:20     Av:4.0 minAv:2.8 maxAv:8.0
2015Jun20 17:12:20     ISOmin:100 ISO1:400 ISO2:800 M:800
2015Jun20 17:12:20     Focus:OFF  Video:0 USB:3 Tmo:0
2015Jun20 17:12:20     AvM:3 int:0 Shts:0 Dly:0 B/L:0
2015Jun20 17:12:20    Warning : camera ISO not in AUTO mode
2015Jun20 17:12:21    waiting on USB signal
2015Jun20 17:12:50    USB start signal received
2015Jun20 17:12:53    Mode switched to M
2015Jun20 17:12:53    Loggger : log file updated.
2015Jun20 17:39:15    KAP 3.6 started - press MENU to exit
2015Jun20 17:39:15    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun20 17:39:15    Mode:PLAY,Continuous_AF:0,Servo_AF:0
2015Jun20 17:39:15     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2015Jun20 17:39:15     Av:4.0 minAv:2.8 maxAv:8.0
2015Jun20 17:39:15     ISOmin:100 ISO1:400 ISO2:800 M:800
2015Jun20 17:39:15     Focus:OFF  Video:0 USB:3 Tmo:0
2015Jun20 17:39:15     AvM:3 int:0 Shts:0 Dly:0 B/L:0
2015Jun20 17:39:15    Warning : camera ISO not in AUTO mode
2015Jun20 17:39:16    waiting on USB signal
2015Jun20 17:39:16    Menu key exit request
2015Jun20 17:39:16    Loggger : log file updated.
2015Jun20 17:41:20    KAP 3.6 started - press MENU to exit
2015Jun20 17:41:20    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun20 17:41:20    Mode:M,Continuous_AF:0,Servo_AF:0
2015Jun20 17:41:20     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2015Jun20 17:41:20     Av:4.0 minAv:2.8 maxAv:8.0
2015Jun20 17:41:20     ISOmin:100 ISO1:400 ISO2:800 M:800
2015Jun20 17:41:20     Focus:MF  Video:0 USB:3 Tmo:0
2015Jun20 17:41:20     AvM:3 int:0 Shts:0 Dly:0 B/L:0
2015Jun20 17:41:20    Warning : camera ISO not in AUTO mode
2015Jun20 17:41:21    waiting on USB signal
2015Jun20 17:42:14    USB start signal received
2015Jun20 17:42:17    Loggger : log file updated.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / June / 2015, 13:34:28
ch1up - works as it should: with interval set to 0 it makes sets shooting parameters and then it starts shooting at
1.05s interval with the same settings. if camera moved picture quality degrades.
Can you be a little more specific? Is the focus off?  Or the exposure?   Remember,  when shooting in continuous mode,  the script locks the focus & exposure after the first shot.  If you point the camera somewhere different, the script does not adjust.  This should probably not be a problem when mappping if you start your shooting sequence once the UAV is on station but may seem confusing on the ground.

Once CHDK 1.4.0 is released,  I'll add the ability to have the exposure adjust "on the fly" but I can't do that in 1.3.0  effectively.

Quote
ch1mid and ch1down I am not sure how it should work.
I don't have a pixhawk so that code was just a guess.  In your PM you mentioned "ch1mid - gives me lens error and is shuts down".  It would be interesting to see the ROMLOG.LOG file for your camera - can you go to the CHDK debug menu, dump the log,  and post it here?

Note that I see something like that on my A1200 but not S100 when the script tries to shut itself down.  I think it has something to do with the script trying to do things while a 'half press' is active but I have not been able to narrow it down.

Quote
Code: [Select]
2015Jun20 17:41:20    KAP 3.6 started - press MENU to exit
2015Jun20 17:41:20    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun20 17:41:20    Mode:M,Continuous_AF:0,Servo_AF:0
2015Jun20 17:41:20     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2015Jun20 17:41:20     Av:4.0 minAv:2.8 maxAv:8.0
2015Jun20 17:41:20     ISOmin:100 ISO1:400 ISO2:800 M:800
2015Jun20 17:41:20     Focus:MF  Video:0 USB:3 Tmo:0
2015Jun20 17:41:20     AvM:3 int:0 Shts:0 Dly:0 B/L:0
2015Jun20 17:41:20    Warning : camera ISO not in AUTO mode
2015Jun20 17:41:21    waiting on USB signal
2015Jun20 17:42:14    USB start signal received
2015Jun20 17:42:17    Loggger : log file updated.
Strange that no image data is recorded.   If you are getting a crash in the ch1mid code then that could explain it - the log file only writes to the SD card occasionally and never when continuously shooting.  I did not want the delay from writing a big file to throw off the fast shot rate.  Might need to reconsider that if the log buffer gets too large.

Note that the script is complaining about you having your camera's ISO setting not in AUTO.  That can cause problems on some models - YMMV.

I'm looking at allowing Canon continuous mode shooting.  On high end models like the S110 that might let you go even faster and the script should still be able to accurately time stamp each image if I get it right.

Meanwhile,  back to looking at that crash in ch1mid.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / June / 2015, 14:06:29
Incidentally,  I think that the gentwire decoding logic should probably be this :
Code: [Select]
function ch1up()
   printf(" * usb pulse = ch1up")
   shot_request = true                                 -- single shot unless interval = 0 causes continuous shooting
end
function ch1mid()                                       -- put camera into shooting mode and lock the focus
   printf(" * usb pulse = ch1mid")
   if ( get_mode() == false ) then
        switch_mode(1)
        lock_focus()
   end
end
function ch1down()
    printf(" * usb pulse = ch1down")
    if ( get_mode() ~= false ) then       
        shot_request = false                             -- cancel in case interval = 0 is causing continuous shooting
        switch_mode(0)
    end
end

with the intent being :

So in theory you can just move the CH1 level up to shoot and down to stop shooting.  I hope.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 20 / June / 2015, 14:50:11
WWZ,
both KAP and ROMLOG are attached.
I hooked it up to the autopilot so I can give the "wire" precise PWM input.
there is a small issue.
I commented out all commands for PWM control so when I modify PWM input it should have only printed the commands on the screen, but it triggers the continuous shooting then it freezes.
Logs are empty.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 20 / June / 2015, 15:34:02
Quote
Can you be a little more specific? Is the focus off?  Or the exposure?

both, but it doesn't really matter as we will mostly have focus at infinity and approximately identical light conditions.
your 1-2-3 step logic is correct.
as I can control the PWM pretty accurately, I can modify those commands without risking false input.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / June / 2015, 16:47:57
both KAP and ROMLOG are attached.
The ROMLOG shows that the last crash was on June 12th.  The dates in your KAP log are correct (i.e today's date) so the ROMLOG is old.  Meaning that whatever else is happening,  its not CHDK crashing the camera.

Meanwhile. the last sequence in your ROMLOG shows a perfect run :

2015Jun20 20:20:56    KAP 3.6 started - press MENU to exit
2015Jun20 20:20:56    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun20 20:20:56    Mode:PLAY,Continuous_AF:0,Servo_AF:0
2015Jun20 20:20:56     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2015Jun20 20:20:56     Av:4.0 minAv:2.8 maxAv:8.0
2015Jun20 20:20:56     ISOmin:100 ISO1:400 ISO2:800 M:800
2015Jun20 20:20:56     Focus:MF  Video:0 USB:3 Tmo:0
2015Jun20 20:20:56     AvM:3 int:0 Shts:0 Dly:0 B/L:0
2015Jun20 20:20:56    Warning : camera ISO not in AUTO mode
2015Jun20 20:20:57    waiting on USB signal
2015Jun20 20:21:09    USB start signal received
2015Jun20 20:21:12    Mode switched to M
2015Jun20 20:21:15    Loggger : log file updated.
2015Jun20 20:21:16.620 1) IMG_0226.JPG
2015Jun20 20:21:17.980 2) IMG_0227.JPG
2015Jun20 20:21:19.070 3) IMG_0228.JPG
2015Jun20 20:21:20.160 4) IMG_0229.JPG
2015Jun20 20:21:21.260 5) IMG_0230.JPG
2015Jun20 20:21:22.360 6) IMG_0231.JPG
2015Jun20 20:21:23.460 7) IMG_0232.JPG
2015Jun20 20:21:24.560 8  IMG_0233.JPG
2015Jun20 20:21:25.660 9) IMG_0234.JPG
2015Jun20 20:21:26.760 10) IMG_0235.JPG
2015Jun20 20:21:27.860 11) IMG_0236.JPG
2015Jun20 20:21:28.960 12) IMG_0237.JPG
2015Jun20 20:21:30.060 13) IMG_0238.JPG
2015Jun20 20:21:31.160 14) IMG_0239.JPG
2015Jun20 20:21:32.260 15) IMG_0240.JPG
2015Jun20 20:21:33.360 16) IMG_0241.JPG
2015Jun20 20:21:34.460 17) IMG_0242.JPG
2015Jun20 20:21:35.560 18) IMG_0243.JPG
2015Jun20 20:21:36.660 19) IMG_0244.JPG
2015Jun20 20:21:37.760 20) IMG_0245.JPG
2015Jun20 20:21:38.860 21) IMG_0246.JPG
2015Jun20 20:21:39.960 22) IMG_0247.JPG
2015Jun20 20:21:41.060 23) IMG_0248.JPG
2015Jun20 20:21:42.160 24) IMG_0249.JPG
2015Jun20 20:21:43.260 25) IMG_0250.JPG
2015Jun20 20:21:43     * usb pulse = ch1down
2015Jun20 20:21:44.360 26) IMG_0251.JPG
2015Jun20 20:21:45.460 27) IMG_0252.JPG
2015Jun20 20:21:45     * usb pulse = ch2up
2015Jun20 20:21:46.560 28) IMG_0253.JPG
2015Jun20 20:21:47.660 29) IMG_0254.JPG
2015Jun20 20:21:47     * usb pulse = ch2down
2015Jun20 20:21:48.760 30) IMG_0255.JPG
2015Jun20 20:21:49.860 31) IMG_0256.JPG
2015Jun20 20:21:49     * usb pulse = ch1mid
2015Jun20 20:21:49    MENU exit key pressed.
2015Jun20 20:21:49    script halt requested
2015Jun20 20:21:50    Loggger : log file updated.



Quote
I hooked it up to the autopilot so I can give the "wire" precise PWM input.
I have an Arduino clone that generates servo type PWM signals that I used to write the USB pulse width code.  I'll hook it back up and do some testing too.

Quote
there is a small issue.  I commented out all commands for PWM control so when I modify PWM input it should have only printed the commands on the screen, but it triggers the continuous shooting then it freezes
Well,  the way the logic works in USB modes,  the script waits for the first pulse and then just starts shooting.  That makes sense in the first two USB modes but probably not in the PWM mode.   I'll work on that.

Meanwhile,  congratulations on getting close to 1 shot per second!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / June / 2015, 00:22:59
Got my Arduino clone working and generating PWM signals.  Tuned up the kap_uav.lua PWM code to work the way we discussed and made a few other clean-ups.   

I have not tested all modes yet but the PWM mode you need seems to be running smoothly (famous last words).

Updated script version is here :  kap_uav.lua r3.6 b5 (https://app.box.com/s/nqn3gmvo56ybap1ttn0ixk8ho21zyw3y)

I also played with a custom CHDK build that allows me to run the high precision timer faster so that I can attempt to measure a raw servo pulse ( 1mSec = -90 deg,  1.5mSec=0 deg,  2.0mSec=+90 deg).   It actually looks quite promising.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 21 / June / 2015, 03:17:22
Hi WWZ!
Nice work!  KAP.log attached.

PWM inputs are now correctly identified. Actions are taken correctly.

occasionally I get an invalid PWM input at 210 but I think that is due to the gentlewire.
so far the testing has been done only on the ground but tomorrow morning I will fly the mission. 
Many many thanks! I could have not done it so fast without your help!

I will get back on final results tomorrow after the flight.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / June / 2015, 09:34:19
KAP.log attached.
Looks really good!  I can see that the gentwire sends the same pulse repeatedly?  But they are mostly ch2up? I assume that is due it simply repeating the servo command pulses from the RC receiver and ch2 up is something you leave active ?   I guessed that might happen when I rewrote the PWM logic but  I'll probably want to filter the log entries that result from that.

Quote
occasionally I get an invalid PWM input at 210 but I think that is due to the gentlewire.
Might be the gentwire but I've seen the same thing with my arduino test rig.  I'm pretty sure it will happen if CHDK gets two pulses too close together and misses the gap between them.  But it could be something else. 

If the gentwire can actually sending continuous pulse streams at each lever position (up, mid,down) then it would be easy to add error correction by requiring three valid pulses in a row before taking any action.  Also, it's probably worth looking for really short pulses and generating an error when that happens too.  Right now they will be treated as ch1up.

Quote
so far the testing has been done only on the ground but tomorrow morning I will fly the mission.  Many many thanks! I could have not done it so fast without your help!  I will get back on final results tomorrow after the flight.
Thanks for all your testing.  I can simulate things all I like with my test rig but there is nothing like taking the script out into the real world.   I'll keep plugging away looking for glitches and "bumps in the night".    I also want to take a look at shooting in Canon continuous mode.  On some cameras, that might be even faster!

Also,  it will be interesting to see how well the locked focus & exposure setting works.   Do you plan to fly multiple passes and set the camera into idle mode (ch1mid) between passes?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 22 / June / 2015, 07:25:28
Depending on how risky is the mission I pu shut_down on ch2. if something goes bad I shut the camera down. That way it has higher chances of survival. Today I didn't use it.

Genlewire gets 1100/1500/1900 PWM from the autopilot on each channel.  From gentlewire we have the pulses you are familiar too. I feel too that the pulse error comes from the missing gap.
I mainly get that when the system is desarmed. GW gets 5 volts, but no signal. I can live with it for now.

kap log is attached. pictures turned out a little blurry.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 22 / June / 2015, 07:42:13
WWZ,
please see attached the KMZ for today's flight.
there were actually 2 flights but this is the important one.
I have uploaded the pics to google drive, I will PM you the link.
I think, that due to the speed of the aircraft and the wind turbulence  we need higher shutter speed, but I am not sure what the speed was now.
Can you please advise the shutter speed used?
Thanks! 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 22 / June / 2015, 07:51:49
On a deeper look I got a little puzzled.
The pictures from earlier flights were 6.xxMB, these are around 4.5MB.
can this script modify the resolution?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / June / 2015, 18:31:09
please see attached the KMZ for today's flight.
My version of 'marble' doesn't want to open your file.  Is there another program I should be using?

Quote
I think, that due to the speed of the aircraft and the wind turbulence  we need higher shutter speed, but I am not sure what the speed was now. Can you please advise the shutter speed used?
I tried to setup the logging so that complete exposure information is included with the first shot.  Looking at the log, I failed to get that right.  I'll fix it in the next update.

Meanwhile, the exif information in your images tells us the shutter speed was 1/1000.  You might want to bump up the target shutter to 1/2000 and raise the 2nd ISO limit to 1600 or so.   But as I have pointed out before,  shutter speed cannot really compensate for any vibration of the UAVs motors.  Only good vibration isolation of your mount will do that.   That might be causing you problems?

On a deeper look I got a little puzzled.  The pictures from earlier flights were 6.xxMB, these are around 4.5MB.  can this script modify the resolution?
To the best of my knowledge, that has nothing to do with the script.  Are you sure you did not change anything in the Canon menus?   Also, these pictures are mostly green trees - they might compress better than your whatever you were previously shoooting?  Just a guess.

Edit :  looking again at some of your picture,  there is a strong smearing from the upper left to lower right on many of them.  Here a screen shot of a full zoom of some tree :
(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2Fcv6mXv1.png&hash=0443af9feb22aaeb8ef300946da889cd)
This suggests motion blur due to camera movement.  Is the direction of blur consistent with the UAV direction?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 23 / June / 2015, 04:01:49
WWZ,

let me add numbers to the issues as I believe it is more efficient than quoting.

1.) KMZ is best opened with Google Earth.

2.) I will do the modifications: shutter speeed to 1/2000, ISO to 1600, focus is already at infinite so if you can get the aperture to adjust on the fly we are there  :D

3.)the airspeed was 25m/s, sidewind was 6-12m/s gust at 45-60deg to flight line from the mountain top side. as a result ground speed varied between 16- 30m/s.  with the low shutter speed and the heading correction of the plane we might have the explanation to the smearing direction.

4.)vibrations:  this is a foamy burned, dropped, crashed and revived more times than I can count. Today is raining, so flight is cancelled. I will do the vibration test on the ground and get back to you with the results.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 23 / June / 2015, 06:36:20
5. bug: I cannot get out of the script by pushing menu button once script is started.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 23 / June / 2015, 08:23:26
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 23 / June / 2015, 09:27:11
4. Yes, it is a fixed wing. I did a test and it seems that no significant vibration is transmitted to the camera.

6. further testing reveals that regardless what setting I have in the script it still overrides and goes to lower shutter speeds. I have "TV Min" and "Target TV" both set at 1/2000 and script is still able to shoot with 1/640.

7. SHouldn't CHDK override all camera settings? I get "Camera ISO not in AUTO mode" when the knob on the top is turned to Manual. I don't get that when it is in auto mode. However in both cases the ISO is 1600.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 23 / June / 2015, 10:33:52
5. Yea - I noticed that too.  I've made a number of "usability" changes in the PWM code and fixed that too.  I'll post an updated script tonight after I do a little more testing. 

Can you PM me the gentwire PWM code you are using with the script ?

6.  I'll need to see the script log as that is not what is supposed to happen.  Unfotunately, your version does not log the exposure settings - something else fixed in the new version.

7. THe script will override all camera settings but there are reports of some cameras not accepting ISO setpoints when the camera is not in ISO Auto mode.  The message you get is just a warning that you can ignore if you are in M mode.   If you put the camera in P mode,  the message should go away and everything will still work.   I don't reccomend using AUTO mode as this enables autofocus on some cameras and interfers with the camera's ability to focus at infinity.


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 23 / June / 2015, 12:29:28
Hello,

After a break I have done some trials using my wing and KAP 3_5 version.

From my point of view the quality of the pictures could be improved - for me are blurry-  but I do not know with what parameter I must play , any advice ?

Attached some pictures and kap.log file.

Thank you.

 http://fastupload.ro/6896760a1a8baba368bb6f844dbc0473.html (http://fastupload.ro/6896760a1a8baba368bb6f844dbc0473.html)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 23 / June / 2015, 13:41:48
From my point of view the quality of the pictures could be improved - for me are blurry-  but I do not know with what parameter I must play , any advice ?
CHDK cannot make your camera better than it is.  But it can help you get the most out of your camera.

Blurry images with UAV shooting are principally caused by four things.  These are :

1) In your KAP log, the shutter speed for your images is 1/2000.  Which is about as high as you can reasonably expect the camera to shoot and should be good enough.

2) Your focus is reported to be set at infinity.  Unfortunately,  while this normally works well, we have seen several examples of cameras that do not actually focus at infinity when told to do so.  If yours is like that (see below) then you should probably disable the  Focus @ Infinity option and let the camera attempt to auto focus.

3) Vibration can be a big problem for UAV's.  See below for a suggestion on how to pointpoint this as a possible problem.  Also, as you are using an S100,  you might find this link interesting : Let's talk Canon cameras (http://diydrones.com/forum/topics/lets-talk-canon-cameras)

4) As far as camera settings go,  your CHDK 3.5 log does not report all the settings we care about. But it does tell me that you have continuous autofocus and servo autofocus enabled.  Which suggests you have the camera in AUTO mode rather than P mode?  And that servo autofocus is enabled in the Canon menus?  As complete list of recommended camera setting is here : Camera Settings (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script#Camera_Settings)

Testing
To identify possible issues with focus and vibration,  it is important to test on the ground.  Go outdoors, tip your UAV on its side,  point it at some distant scenery or buildings, and let the script take several photos.   Examine the results for sharpness and blur.  Disable the Focus @ Infinity setting and repeat the test.  If the second test is better than the first then your camera is not really focussing at infinity so disable that option.  If all the pictures still look good on the ground then you need to look seriously at the vibration mounting for your camera.

HTH



Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 23 / June / 2015, 17:04:35
Many thanks for the guidelines!

Tomorrow I will do some flights in Auto and P mode with and without the Focus @ infinity enabled/disabled.

I will come back with the feedback.

Thank you again.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 23 / June / 2015, 17:08:30
I suggest that you NOT use Auto mode.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 23 / June / 2015, 17:43:49
I suggest that you NOT use Auto mode.

OK, understood :) , I will do only P mode with the Focus @ infinity enabled/disabled.

Thank you.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 23 / June / 2015, 17:50:23
Genlewire gets 1100/1500/1900 PWM from the autopilot on each channel.  From gentlewire we have the pulses you are familiar too. I feel too that the pulse error comes from the missing gap. I mainly get that when the system is desarmed. GW gets 5 volts, but no signal. I can live with it for now.
I just noticed this in the gentWIRE-USB2 manual (http://www.gentles.ltd.uk/gentwire/Manual-usbc2.pdf) :

"In addition to the above, a 210mS pulse will be sent every 5 seconds if neither servo is connected to a RC receiver"

I'm not sure what James meant by using the word "neither" rather than "either" but it might explain all those extra entries in the log.

I do have a question about the gentWIRE-USB2 that you might be able to answer.  Does it send a single pulse when the RC receiver servo channel changes or continual pulses for the current servo position?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 23 / June / 2015, 18:29:37
...OOOOPS I didn't get that far in the user manual  :( I stopped at the table above that note.

RC recevier / autopilot is providing continuously the PWM value not only when change happens. that is why you see so many CH2MID in my logs: ch2 trim is set to 1500.
at the begining of each shooting session you will see many 210s .
before I activate the output the wire gets only 5 volts and no signal.

I am really looking forward to test the new version!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 23 / June / 2015, 23:08:57
RC recevier / autopilot is providing continuously the PWM value not only when change happens.
Yes, that's pretty much standard for every RC system.  It's basically an old semi-analog system where servos need constant position updates.  My question, repeated below, is whether the gentwire-usb2 also provides continuous PWM values (suitably modified) to the camera?  Or does it just provide one pulse each time the control lever position on the transmitter changes?

Quote
at the begining of each shooting session you will see many 210s . before I activate the output the wire gets only 5 volts and no signal.
That's what the gentwire-usb2 documentation says you should see too.  That part  is clear.

Quote
that is why you see so many CH2MID in my logs: ch2 trim is set to 1500.
This is the part that confuses me.  Does the gentwire-usb2 sent only one single pulse each time the servo position for either ch1 or ch2 changes?  Or does it continually send pulses over and over with length determined by the last change made?  And. why does it send so many CHD2MID pulses but only one CH1UP and CH1MID each time?

Quote
I am really looking forward to test the new version!
New version :  kap_uav.lua v3.6 beta6 (https://app.box.com/s/8s9oxzdwpem5mughte7665281o2avluk)   I have enhanced the PWM code quite a bit.  Note that on line 420 is says :

Code: [Select]
PWM_required_repeats = 0The value set here determines how many identical pulses in a row are needed to trigger any action.  This extra bit of error proofing should almost competely eliminate false actions due to a single pulse error.  However, it only works if the gentwire-usb2 sends multiple pulses at each channel position.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 24 / June / 2015, 03:03:31
Hi WWZ,

B6 test pictures are here:
https://drive.google.com/folderview?id=0Bz9RWJnTBrzIfjRFUlJVMVVRR1VhTnBnMi1jRjFET3ItLXY2R3NaZ25VT0NoeXVGT1ZzX3c&usp=sharing

6-10 have been taken in AUTO camera mode
11-14 Manual Mode
15-19 P mode
(settings on the camera knob)
what really puzzles me is the difference between the first and the 2-5 picture of each batch. I do not see any difference in exif data but there is a significant difference in the looks of the JPG.
Please let me know what you think!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 24 / June / 2015, 03:24:04
Quote
Does the gentwire-usb2 sent only one single pulse each time the servo position for either ch1 or ch2 changes? 
Good question! and I can only answer from experience: yes and no.
let me explain:
I have no Idea how it should work but what I see looks like:
- the G-wire is continuously sends signals to the camera.
- the camera is getting only part of those pulses and not 100%.
- RC PWM output to G-wire ranges between 1499.5 - 1500.5
- the repeats in the Camera input pulses seem to be too erratic (ex.: many CH2MIDs with no changes but only 1 CH1 pulse when it changes.)
Question: does that 1 pwm RC output fluctuation trigger a new impulse from  the G-wire to the camera?

Due to the delays I have in my equipment I cannot identify the source of the camera input changes. I can only speculate based on what I see on the screen and the logs.

If you know the G-wire guys, maybe you can ask them how it should work.
Sorry if I wasn't much of a help! :(
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 24 / June / 2015, 05:14:16
Quote
The value set here determines how many identical pulses in a row are needed to trigger any action.  This extra bit of error proofing should almost completely eliminate false actions due to a single pulse error.  However, it only works if the gentwire-usb2 sends multiple pulses at each channel position.

I set the
Code: [Select]
PWM_required_repeats = 3  .

Judging form the logs it looks like the G-wire cycles the output thru the 2 values (60/150mSec).
The camera needs more than 5 seconds to gather the 3 repeats which suggests some delay / gap between the cycles. Camera did not actually do anything just listed the inputs.

I would be happy to dig deeper into the PWM issue, but I have 2 demo flights this week and I need the script to make good quality photos. Right now there are 2 main issues:

1. the camera parameter set from the first picture do not persist to the rest of the series.
2. the parameters of the KAP_UAV script are disregarded.

workarround(all issues): in P I set ISO to auto and the F to the widest range possible. that will force the camera to  keep shutter speed  and use the ISO and aperture to compensate. I hope that will be enough durring a sunny day too.


Code: [Select]
2015Jun24 09:41:15     * usb pulse = idle pulse (210 mSec)
2015Jun24 09:41:16     * usb pulse = ch2mid (150 mSec)
2015Jun24 09:41:16     * usb pulse = ch1mid (60 mSec)
2015Jun24 09:41:22     * usb pulse = idle pulse (210 mSec)
2015Jun24 09:41:23     * usb pulse = ch2mid (150 mSec)
2015Jun24 09:41:25     * usb pulse = idle pulse (210 mSec)
2015Jun24 09:41:25     * usb pulse = ch2mid (150 mSec)
2015Jun24 09:41:27     * usb pulse = ch1mid (60 mSec)
2015Jun24 09:41:30     * usb pulse = idle pulse (200 mSec)
2015Jun24 09:41:30     * usb pulse = ch2mid (150 mSec)
2015Jun24 09:41:31     * usb pulse = ch1mid (60 mSec)
2015Jun24 09:41:35     * usb pulse = idle pulse (210 mSec)
2015Jun24 09:41:36     * usb pulse = ch2mid (150 mSec)
2015Jun24 09:41:37     * usb pulse = ch1mid (60 mSec)
2015Jun24 09:41:50     * usb pulse = idle pulse (210 mSec)
2015Jun24 09:41:50     * usb pulse = ch2mid (150 mSec)
2015Jun24 09:41:51     * usb pulse = ch1mid (60 mSec)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 24 / June / 2015, 07:10:12
I'll take a look at the log today. I'll also ping James Gentles - I have his email address somewhere.

I keep forgetting to remind you to delete the log file from your SD card occasionally. Each flight & test I'd just added you the end off the existing log so the file is getting quite large note.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 24 / June / 2015, 08:07:56
6-10 have been taken in AUTO camera mode
11-14 Manual Mode
15-19 P mode
I took a quick look but the image names in your upload don't seem to match the image names in the log.  When I try to match up timestamps, they are slightly off.  I need a little more study to discover the sequence.  According to the log file, the darker correctly exposed image is the second picture in each sequence for example


Quote
what really puzzles me is the difference between the first and the 2-5 picture of each batch. I do not see any difference in exif data but there is a significant difference in the looks of the JPG.
You have the script exposure setting set strangely.   You have ISO pegged very high the shutter speed locked at 1/2000.  I guess it's possible that the camera cannot actually keep up with the requests of the script.  But that's just a guess.

What happens when you reshoot the sequence in P mode only (which gets rid of the various auto focus interactions) and use :

Tv min :         1/100
Target Tv :    1/1000
Tv max:         1/1600

Av low :         2.8
Av Target     2.8
Av Max :       8.0

ISO Min :      100
ISO Max1:    800
ISO Max2:  1600

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 24 / June / 2015, 11:09:04
Quote
What happens when you reshoot the sequence in P mode only (which gets rid of the various auto focus interactions) and use :

Below is the log for 3 tests:
1. exact settings that you suggested,
2. exact settings that you suggested  + ISO in P mode set to auto
3. settings that you suggested but all TV values set to 1/2000+ ISO in P mode set to auto
Pics are on the Drive.

Code: [Select]
2015Jun24 16:58:00.600 1) IMG_0170.JPG
2015Jun24 16:58:00     meter : Tv:1/1250 Av:4.0 Sv:1600 609:609
2015Jun24 16:58:00     actual: Tv:1/1000 Av:2.8 Sv:500
2015Jun24 16:58:00             AvMin:2.8 NDF:NDout foc:infinity
2015Jun24 16:58:02    timeout on hook_shoot.is_ready
2015Jun24 16:58:02.800 2) IMG_0186.JPG
2015Jun24 16:58:03.000 3) IMG_0186.JPG
2015Jun24 16:58:04.020 4) IMG_0187.JPG
2015Jun24 16:58:05.040 5) IMG_0188.JPG
2015Jun24 16:58:05    Total shots count reached.
2015Jun24 16:58:05    script halt requested
2015Jun24 16:58:05    Loggger : log file updated.
015Jun24 17:01:27    KAP 3.6b6 started - press MENU to exit
2015Jun24 17:01:27    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun24 17:01:27    Mode:P,Continuous_AF:0,Servo_AF:0
2015Jun24 17:01:27     Tv:1/1000 max:1/2000 min:1/100 ecomp:0.0
2015Jun24 17:01:27     Av:2.8 minAv:2.8 maxAv:8.0
2015Jun24 17:01:27     ISOmin:100 ISO1:800 ISO2:1600 M:0
2015Jun24 17:01:27     Focus:MF  Video:0 USB:0 Tmo:0
2015Jun24 17:01:27     AvM:3 int:0 Shts:5 Dly:0 B/L:0
2015Jun24 17:01:30    Loggger : log file updated.
2015Jun24 17:01:31.550 1) IMG_0189.JPG
2015Jun24 17:01:31     meter : Tv:1/200 Av:2.0 Sv:n/a 677:677
2015Jun24 17:01:31     actual: Tv:1/1000 Av:2.8 Sv:320
2015Jun24 17:01:31             AvMin:2.8 NDF:NDout foc:infinity
2015Jun24 17:01:32.600 2) IMG_0190.JPG
2015Jun24 17:01:33.610 3) IMG_0191.JPG
2015Jun24 17:01:34.630 4) IMG_0192.JPG
2015Jun24 17:01:35.640 5) IMG_0193.JPG
2015Jun24 17:01:35    Total shots count reached.
2015Jun24 17:01:35    script halt requested
2015Jun24 17:01:36    Loggger : log file updated.
2015Jun24 17:03:24    KAP 3.6b6 started - press MENU to exit
2015Jun24 17:03:24    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun24 17:03:24    Mode:PLAY,Continuous_AF:0,Servo_AF:0
2015Jun24 17:03:24     Tv:1/2000 max:1/2000 min:1/2000 ecomp:0.0
2015Jun24 17:03:24     Av:2.8 minAv:2.8 maxAv:8.0
2015Jun24 17:03:24     ISOmin:100 ISO1:800 ISO2:1600 M:0
2015Jun24 17:03:24     Focus:MF  Video:0 USB:0 Tmo:0
2015Jun24 17:03:24     AvM:3 int:0 Shts:5 Dly:0 B/L:0
2015Jun24 17:03:28    Mode switched to P
2015Jun24 17:03:30    Loggger : log file updated.
2015Jun24 17:03:32.700 1) IMG_0194.JPG
2015Jun24 17:03:32     meter : Tv:1/200 Av:2.0 Sv:n/a 671:671
2015Jun24 17:03:32     actual: Tv:1/2000 Av:2.8 Sv:640
2015Jun24 17:03:32             AvMin:2.8 NDF:NDout foc:infinity
2015Jun24 17:03:33.710 2) IMG_0195.JPG
2015Jun24 17:03:34.730 3) IMG_0196.JPG
2015Jun24 17:03:35.770 4) IMG_0197.JPG
2015Jun24 17:03:36.790 5) IMG_0198.JPG
2015Jun24 17:03:36    Total shots count reached.
2015Jun24 17:03:36    script halt requested
2015Jun24 17:03:37    Loggger : log file updated.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 24 / June / 2015, 12:37:16
Those pictures look a little better.   I think those setting should work for your coming demonstration if we don't find anything else first.

Unfortunately,   you changed the camera position with each shot so it's hard to compare the exposures between them.  But IMG_0186 & IMG_0187 are almost the same scene and 187 looks a little darker than 186 even though the EXIF exposure information is the same.  And to make things stranger,  the exif time stamp information says the images were taken 3 seconds apart - even though you shot rate was pretty close to one second per shot?

The image numbers in the log are also off by one - I have a theory that I can test on my S100 for that issue.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 24 / June / 2015, 13:13:32
Found the problem with the image numbering! 

And it's very possible that the same bug was throwing off the exposure between shots. 

FWIW,  there was a bug preventing the script's continuous shooting mode from waiting for each shot to finish writing to the SD card prior to starting the next shot.  I fixed that and for reasons I don't fully understand,  my S100 is shooting at about 900 mSec per shot!  Bonus!

download link > kap_uav.lua 3.6 beta7 (https://app.box.com/s/n08xom51ubyzeq1yhfaai89cjy77zvvg)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 24 / June / 2015, 23:48:45
I suggest that you NOT use Auto mode.

OK, understood :) , I will do only P mode with the Focus @ infinity enabled/disabled.

Thank you.

Hello,

2 flights done yesterday , the quality of the pictures is better in P mode than in Auto mode. Regarding the quality of the pictures for P mode with Focus @ infinity enabled/disabled I do not see a big difference , please find below the results from yesterday.

http://fastupload.rol.ro/88895d79027f234fc1916b10cdfdc6ca.html (http://fastupload.rol.ro/88895d79027f234fc1916b10cdfdc6ca.html)

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 24 / June / 2015, 23:58:58
2 flights done yesterday , the quality of the pictures is better in P mode than in Auto mode. Regarding the quality of the pictures for P mode with Focus @ infinity enabled/disabled I do not see a big difference , please find below the results from yesterday.
Can you link to one or two representative pictures and the kap.log files?  Your huge download file is going to take over 20 minutes at the rate it's coming from the server site you use.


Edit :  never mind - it finally downloaded.  Some of those pictures are quite good - IMG_4859.JPG or IMG_4928.JPG for example.  Doesn't seem to matter much if the camera was in AF mode or AFL mode.

You have the shutter speed locked at 1/2000 for Tv target, max, and min values.  You might want to drop the min value to 1./500.  The script won't use anything that slow unless it gets dark enough that it can't get the exposure any other way.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 25 / June / 2015, 02:22:10
@waterwingz,

b7 log attached, pictures are uploaded onto the Drive.
there are 2 sets of pictures:
1. same direction handheld 1-5 - batch illumination problem solved I would say.
2. I was spinning like hell. 6-10 - I wanted to get TV 1/5000 but I only got 1/2000.
Log says 1/5000 EXIF says 1/2000

@mirax7
 is it a multicopter or a fixed wing?
What altitude were you flying at?

I am going out to the forest...
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 25 / June / 2015, 07:17:12
  The image EXIF info is not always correct when you use CHDK to extend the exposure range.  The only way to tell if you can get 1/5000 is to override the shutter, aperture, ISO, and NDFilter from the CHDK menu at different exposure settings and examine the resulting images of the same subject and illumination for brightness at different Tv values. People report changes up to at least 1/10000 on cameras far less expensive than your S110!

Edit : You could also take a couple of shots with the script while varying the Tv target setting between 1/1000, 1/2000, and 1/5000 and observe the effect.

Note that on your S110,  you probably should set the minAv and tartget Av values to f2.0 to maximize shutter speed and minimize ISO setting used.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 25 / June / 2015, 12:22:08

@mirax7
 is it a multicopter or a fixed wing?
What altitude were you flying at?

I am going out to the forest...

Yes it is a fixed wing flying at 100 m altitude , cruise speed around 55km/h.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 25 / June / 2015, 13:34:44
Pictures of today's flight have been uploaded to the folder. KAP log attached.
the camera did not start with the
Code: [Select]
PWM_required_repeats = 1 setting the camera did not start to work just listed the input readings.
After changing to 0 camera worked.
Did you change anything else?
pictures are larger than ever, and the time between the shots went from 1.1 to 1.3+ seconds. I need to go to 1.1 or under.
Is there any delay that I can decrease?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 25 / June / 2015, 13:48:20
the camera did not start with the
Code: [Select]
PWM_required_repeats = 1 setting the camera did not start to work just listed the input readings. After changing to 0 camera worked.
This is correct.  I heard from James Gentles about the gentwire-USB2 device and it only sends one pulse per servo channel PWM change. 

So PWM_required_repeats = 0 is the correct setting when using that device.

I don't understand why you get so many ch2mid pulses though?  According to what I learned about the gentwire-USB2 you should not be seeing that.  If you don't have an explanation of something you are doing to cause that I will contact James again.

Quote
Did you change anything else?  pictures are larger than ever, and the time between the shots went from 1.1 to 1.3+ seconds. I need to go to 1.1 or under.
I have not changed anything that would affect file size of the JPG images.  And there should be nothing in the script that will affect file size either.  Are you sure you have not changed anything in the Canon menus?  I am currently getting shooting rates just under 1 second per picture on my S100.

Update :  I just looked at a couple of your images - one from yesterday shot on the ground and the other from today of the forest.  Today's JPG is 8M and yesterday's JPG is only 4M.  Looking at the EXIF data,  the only two things that change are the orientation and ISO setting.  The smaller picture was at ISO500 while the larger picture was at ISO1600.   Typically ISO values over 400 start to get noisy and then get really noisy above ISO1200.  So I wonder if it's possible that the ISO1600 JPG's just do not compress as well due to all the noise in the image?

(Note - dropping the Av values to f2.0 will help the script run at lower ISO settings).

Quote
Is there any delay that I can decrease?
Not that I know of - I've already been down that route and eliminated or shortened every delay I could find.

Are you starting with an empty SD card each time?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 25 / June / 2015, 16:50:17
You are right! The pictures from today looked much better than the previous ones. I surely have to get the f2.0 set and hope for the best. Some of today's forest images are too bright.

Today I started out with a clean SD card, but I have a 32GB - 90Mb/s write speed SD card so that should not be the bottleneck. Do you have any suggestions how I could go back to under 1.1s interval or what caused the increase?

Input PWM on ch2 are stable at 1500. maybe I need to trim that a little up or down. I'll play with that in the weekend.

We have to somehow give back the shot control to the autopilot for each shot and still have the ~1s interval. Even if the same settings of the first picture persist throughout the entire session. Do you see any chance for this?

Otherwise I cannot get the GPS and IMU data injected into the EXIF or have any kind of correlation between flight and pictures.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 25 / June / 2015, 16:52:54
Do you have any suggestions how I could go back to under 1.1s interval or what caused the increase?
High ISO typically adds significant processing time.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 25 / June / 2015, 17:28:02
Thanks!

Tapatalk-kal küldve az én GT-P5110-el

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 25 / June / 2015, 17:52:59
You are right! The pictures from today looked much better than the previous ones. I surely have to get the f2.0 set and hope for the best. Some of today's forest images are too bright.
But f2.0 will make things even brighter.   You are probably better off letting the script do its job providing the fastest shutter speed at lowest acceptable ISO by giving it a range of values to work with  Set the  min & max Av range  to f2.0 to f8.0. Set Av target to f2.  Same goes for the ISO values -  ISO min =100,  ISO threshold 1 = 400, ISO threshold = 1600.  And the shutter speeds at Tv target 1/1000,  Tv min 1/500,  Tv max 1/5000.

Quote
Do you have any suggestions how I could go back to under 1.1s interval or what caused the increase?
As discussed, shooting at ISO1600 is a problem if you want 1 second speeds. File sizes get bigger and in-camera processing times go up.

Quote
Input PWM on ch2 are stable at 1500. maybe I need to trim that a little up or down.
But why are ch2mid pulses being generated repeatedly?  Look at the log - this sequence just keeps repeating :
Code: [Select]
2015Jun25 11:03:35     * usb pulse = ch2mid (150 mSec)
2015Jun25 11:03:38     * usb pulse = idle pulse (210 mSec)
2015Jun25 11:03:39     * usb pulse = ch2mid (150 mSec)
2015Jun25 11:03:41     * usb pulse = idle pulse (210 mSec)
2015Jun25 11:03:42     * usb pulse = ch2mid (150 mSec)
2015Jun25 11:03:45     * usb pulse = idle pulse (210 mSec)
Are you doing something to make that happen?

Quote
We have to somehow give back the shot control to the autopilot for each shot and still have the ~1s interval. Even if the same settings of the first picture persist throughout the entire session. Do you see any chance for this?  Otherwise I cannot get the GPS and IMU data injected into the EXIF or have any kind of correlation between flight and pictures.
Hmmm ... a  new requirement  ;) 

The shot's time stamp in the log file is quite precise.  If you can set the camera and flight controller to the same time (or you can calculate the offset) then you should be able to sync them manually.   

Otherwise,  I've worked with bchristal (http://chdk.setepontos.com/index.php?action=profile;u=27439) in this forum thread : Provide USB signal when shutter closes (http://chdk.setepontos.com/index.php?topic=12398) to sync to an Ardupilot using one of the camera's LED's so that it can indicate preciselyl when each shot occurs.  Still a "work in process" with the Ardupilot devs - the kap_uav.lua part is done and in the current production version of the script.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 25 / June / 2015, 23:04:30
Another break through.  2 frames per second !

At least for some camera models,  including the S100 and I expect the S110.

I added a "Canon continuous mode" option where you enable continuous shooting in the Canon shooting menu (the one you get with the FUNC/SET button when the camera in in shooting mode).   It works like the script continuous mode option and tracks exact shutter open times, flashes the sync LED, etc.   Just a whole lot faster.

At first I was worried that I was getting a short burst that would slow down. But it kept the shootingt up for 50 shots in my test so I think it will go forever that way.

As usual,  there are a couple of little things that need to be smoothed out and I'm not sure what we give up in that mode.  But an apparent 2x speed up is impressive.


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 26 / June / 2015, 14:15:00
@WWZ,
FANTASTIC! Absolute Impressive!
let me tell you what that means for me:
flying at 180 Km/h (~110+mph) and still getting the 80% overlap needed for mapping.  :D
At that speed I will need 1/5000 or 1/10000 shutter speed but I believe S110 might be able to do it.

The problem is I need a new airplane (3 month for build and testing)... so that is for the future.

I still have 1.2s and I absolutely need 1.0-1.1s for this job. I admit it was  pretty dark outside.
Shutter speed was 1/5000 (exif: 1/2000). Which one should I believe?

Code: [Select]
2015Jun26 08:30:20    KAP 3.6b7 started - press MENU to exit
2015Jun26 08:30:20    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jun26 08:30:20    Mode:PLAY,Continuous_AF:1,Servo_AF:2
2015Jun26 08:30:20     Tv:1/5000 max:1/10000 min:1/2000 ecomp:0.0
2015Jun26 08:30:20     Av:2.0 minAv:1.8 maxAv:8.0
2015Jun26 08:30:20     ISOmin:100 ISO1:800 ISO2:800 M:0
2015Jun26 08:30:20     Focus:MF  Video:0 USB:0 Tmo:0
2015Jun26 08:30:20     AvM:3 int:0 Shts:5 Dly:0 B/L:0
2015Jun26 08:30:24    Mode switched to AUTO
2015Jun26 08:30:27    Loggger : log file updated.
2015Jun26 08:30:28.640 1) IMG_0001.JPG
2015Jun26 08:30:28     meter : Tv:1/500 Av:2.2 Sv:n/a 805:805
2015Jun26 08:30:28     actual: Tv:1/5000 Av:2.0 Sv:320
2015Jun26 08:30:28             AvMin:2.0 NDF:NDout foc:infinity
2015Jun26 08:30:29.860 2) IMG_0002.JPG
2015Jun26 08:30:31.080 3) IMG_0003.JPG
2015Jun26 08:30:32.280 4) IMG_0004.JPG
2015Jun26 08:30:33.480 5) IMG_0005.JPG
2015Jun26 08:30:33    Total shots count reached.
2015Jun26 08:30:33    script halt requested
2015Jun26 08:30:34    Loggger : log file updated.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 26 / June / 2015, 18:16:06
WWZ,

can I get a copy of the new script?
I would like to test it in flight tomorrow.

Thanks in advance!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 26 / June / 2015, 20:32:52
can I get a copy of the new script? I would like to test it in flight tomorrow.
link > kap_uav.lua v3.6 beta 8 (https://app.box.com/s/b9zmzm4zk83ayme036843akye7l1mdt6)

I'll keep testing it this weekend so let me know anything strange that you find?  Sometimes it doesn't like to stop shooting and hangs for a couple of seconds.

Set the Shot Interval time to 0 in the CHDK script parameters and enable Continuous shooting in the Canon Func/Set Shooting menu.   Taking pictures of leaves outside my window slows the shot rate down to about 0.8 seconds per shot but that's better than the best rate I can get  (1.2 seconds per shot) otherwise.

Any ISO value over 1600 really slows down the shot rate a lot!  You can observe that just shooting normally without CHDK even loaded.   And my JPG's are about 4M each at high ISO (>1600) and less than 2M with ISO < 800. I really have no idea why yours are 8M but it will definitely tend to slow things down when they get that big.

Finally, 

Edit : fixed the hang on exit - need to allow the raw shooting hook to essentially unload
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 27 / June / 2015, 05:30:22
Ground test results: .55-.56 fps.
but : I am a little concerned about the picture luminosity. I need to set TV to 1/2000 at least cam takes target f and  matches ISO. 
I have to confess that I had no time to read the algorithm though it looks like the it takes target values and only ISO is really modified as shot needs it.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / June / 2015, 07:35:48
The script tries to use the target values  but trades off ISO and f-stop to maintain shutter speed.  But it can't change the laws of physics.

What is your concern?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 27 / June / 2015, 13:57:56
Just a small concern about the pictures being to dark in cloudy weather.
Right now I am more concerned about the shutter control being controlled not by numbers and not autopilot.

Do you see any chance of getting the autoopilot back in control without sacrificing the speed?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / June / 2015, 14:26:40
Just a small concern about the pictures being too dark in cloudy weather.
Like I said,  the script can't change the physics of photography.  The exposure is a function of available light, shutter speed, lens aperture, and the ISO sensitivity setting.  For any given illumination, if the shutter speed goes up then the aperture must open more or the ISO must go up to maintain the correct exposure.  These little Canon P&S cameras are never going to replace the aerial reconnaissance cameras used by the military.
(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Ftinyurl.com%2Fobe9ueo&hash=f6e9d54cfd908d96152c4548685e6695)

Quote
Right now I am more concerned about the shutter control being controlled not by numbers and not autopilot.  Do you see any chance of getting the autoopilot back in control without sacrificing the speed?
Well, there is one more hack that might work.   

I think we can have the script pause the shooting sequence even when the camera is in Canon continuous mode.  So if the flight controller can toggle the +5V power connection at the USB port of the camera  for maybe 100 mSec on when it wants to shoot,  you would get fairly well sync'd shots.   This will work as long as the camera/script gets back to waiting for the next signal prior to the controller actually wanting to shoot again.   

For fast cameras like the S100 & S110, I think that .75 to .85 seconds for a complete shot is manageable based on current testing.  So as long as the controller does not ask for shots faster than once per second it should work.

But this is definitely pushing the current limits of what CHDK can make a camera do.


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 27 / June / 2015, 15:36:16
OK, with all these modifications we had in the last week or so, how much did we sacrificed from the original functionality?

I just attempted a 30 minute series as I was concerned about battery and general endurance.
As far as pictures go, I have 1250+2000- 85(from this morning), which I would say is fantastic.

Problem is that this is about double of what I need.
Double in volume, double in processing time. This is the main reason why I am asking if we could give back the shot control to the AP.
the other reason is that the AP takes shots based on travelled distance.
so if my airspeed is 25 and I get a head wind of 12.5 that means plane only travels with 12.5 compared to the ground of which the shot are taken. 

Right now the math says that I need a shot every 0.8s, so at 0.55s I get an ~30% excess. if plane slows down to half (ground speed) I get an additional 50% excess. :(

At #1153 for some reason the perfect .5-.6 interval went to 1.5. I was sitting with my back to the camera so I only noticed a little late that the speed has reduced from the sound.


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / June / 2015, 15:54:26
OK, with all these modifications we had in the last week or so, how much did we sacrificed from the original functionality?
Nothing - everything we have done is good stuff that I will roll into the next official release.

Quote
Right now the math says that I need a shot every 0.8s, so at 0.55s I get an ~30% excess. if plane slows down to half (ground speed) I get an additional 50% excess. :(
So I'm assuming by this that you want to try the hack I proposed in my previous post?  Do you want to try USB 5V on/off control or continue to use the gentwire-USB2?

Quote
At #1153 for some reason the perfect .5-.6 interval went to 1.5. I was sitting with my back to the camera so I only noticed a little late that the speed has reduced from the sound.
That's a bit concerning. Did the actual images change at all? Are the file sizes all the same?

One thing we discovered last year was that  SD card write time will periodically slow down - see this post :
http://chdk.setepontos.com/index.php?topic=10822.msg116123#msg116123. (http://chdk.setepontos.com/index.php?topic=10822.msg116123#msg116123.)   
The theory here is that the SD card controller periodically needs to "clean up" the cards directory / storage somehow and while it is doing this, it runs slow.

I changed the script logging after that so that it does not write to the SD card after every shot,  thereby decreasing the number of write cycles by a lot.   But I wonder if you are hitting the same limit shooting at close to 2 fps.   If so, starting and stopping shooting at each "pass" of the UAV might be necessary?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 27 / June / 2015, 17:28:48
I would prefer to keep the gentwire

Image size did change, but i can do a rerun inthe morning with a digital clock in the picture. That will provide objectivity.

I got the 2fps in normal operatin.

When can I test the AP controlled version?

Tapatalk-kal küldve az én GT-P5110-el

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / June / 2015, 20:19:36
I would prefer to keep the gentwire
Here's how the new sequence will look based on my understanding of the gentwire-USB2 and how it interacts with your flight controller   :

Does that work for you?

Quote
When can I test the AP controlled version?
Working on it now - should be done tonight.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / June / 2015, 20:46:31
By the way, what make and model of flight controller are you using?

Edit :  updated script attached.   Works as per my most recent post as far as gentwire-USB2 pulses needed.

link > kap_uav.lua r3.6 beta 9 (https://app.box.com/s/ufy3c9bg03xqk0465km4pr8pizf1d67e)

If this works,  I need to do some more testing & code cleanup to make sure I didn't corrupt any of the other modes.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 28 / June / 2015, 02:52:18
I am flying with a 3DR Pixhawk.
Sequence logic looks perfect. 

I forgot to mention that I changed the gentwire and as you can see in the log the ch2mid repeat stopped.

Next week, I hope, i will be able to repair the big wing.  With that I will be able to do all the testing you require to get script in finished.

Tapatalk-kal küldve az én GT-P5110-el

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 28 / June / 2015, 09:36:55
I forgot to mention that I changed the gentwire and as you can see in the log the ch2mid repeat stopped. Next week, I hope, i will be able to repair the big wing.  With that I will be able to do all the testing you require to get script in finished.
Let me know if beta 9 works for you?  And you forgot to attach the log  :-[
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 28 / June / 2015, 13:09:34
Unfortunately I was unable to go out and do the field test. Probably Tuesday....

Tapatalk-kal küldve az én GT-P5110-el

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 30 / June / 2015, 17:38:01
WWZ,

I went out testing today I made 3 flights and not a single picture from B9.   :(

I just came back and set up a test rig: fully analog, no chance of error... B9 freezes.  :o
I reload the B8  workand it works...
I go again through the settings and I it strikes me: Gentwire is not capable to work with PWM inputs less then .7 seconds. I connect the AP  and I get my confirmation: once I go at .6s camera stops shooting (only the 10 second shots are taken).   >:(

After a cigarette, I decide to test the capability of the AP. Can it output .1s PWM signal?  :o NO it cannot,  no matter what I try!?

I will run another round at the Pixhawk forum, but so far I see no possibility of actually using the the autopilot as shot controller.

Please accept my apologies for the detour!
Please let me know, how would you like to continue!
P.S.: Maybe somebody with another autopilot will be able to use it.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 30 / June / 2015, 19:21:44
Edit : looking at the logs, this is starting to look like a possible issue with the pixhawk configuration / programming?  It does not seem to be sending  "ch1up" signals on the 1st channel connected to the gentwire-USB2 device?  So the gentwire-USB2 is never asking the script to releaes the next sync'd shot.

Rereading you comments,  are you trying to tell me that the pixhawk can only generate a ch1up pulses slower than once a second?  Is there a handy pixhawk programming guide somewhere?

Note :  you might want to set the script parameter labelled USB Timer Precision (msec) to 1 rather than 10.  This enable more precise timing of the signal from the gentwire-USB2.

I went out testing today I made 3 flights and not a single picture from B9.   :(
So I assume you did not test things on the ground first?

Quote
I just came back and set up a test rig: fully analog, no chance of error... B9 freezes.  :o
Can you be more specific than "freezes" ?  Does it get past the initial "waiting on USB signal" message?  If so, it should loop slowly taking picture every 10 seconds if pulses are not received more quickly than that.

Quote
I reload the B8  workand it works...
B8 just starts and runs as fast as it can until it it told to stop.  No sync with the flight controller or anything else to wait for.

Quote
I go again through the settings and I it strikes me: Gentwire is not capable to work with PWM inputs less then .7 seconds.
I'm confused here.   The gentwire-USB2 will take a servo pulse signal  between 1 mSec and 2mSec repeated ever 20 mSec and convert that into a pulse between 20 mSec and 180 mSec.   Where does .7 seconds come into this discussion?

Quote
I connect the AP  and I get my confirmation: once I go at .6s camera stops shooting (only the 10 second shots are taken).   >:(
Hmmm .. are you sure that the pixhawk is changing it's servo output so that it should cause the gentwire to send ch1up and then ch1mid and then ch1up again?

Quote
After a cigarette,
Tobacco ?   :D

Quote
I decide to test the capability of the AP. Can it output .1s PWM signal?  :o NO it cannot,  no matter what I try!?
Again, I'm confused. Please draw me a diagram of what you mean by .1s PWM signal ? 

Quote
I will run another round at the Pixhawk forum, but so far I see no possibility of actually using the the autopilot as shot controller.
Can you post a link to the Pixhawk forum where you are having this discussion?  Might be easier to follow there.Found it - although it seems to be going offline a lot tonight.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: mirax7 on 01 / July / 2015, 00:13:04
P.S.: Maybe somebody with another autopilot will be able to use it.

Hello ,

I have a different type of autopilot , can do some trials but please specify what are the steps to follow.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 01 / July / 2015, 02:56:22
I 'll do a drawing this afternoon. Meanwhile: I went and flew a test mission with B8 this morning and some of the pictures came out really bad. It looks like I am the first to need vibration dampening on a foamy or a new motor and prop balanced.... I will review logs this afternoon.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 01 / July / 2015, 08:00:54
I 'll do a drawing this afternoon. Meanwhile: I went and flew a test mission with B8 this morning and some of the pictures came out really bad. It looks like I am the first to need vibration dampening on a foamy or a new motor and prop balanced.... I will review logs this afternoon.
I wish I knew more about the pixhawk programming (and had one to play with).

Looking at this :

copter.ardupilot.com/mission command list/#Do-Set-Relay (http://copter.ardupilot.com/wiki/mission-planning-and-analysis/mission-command-list/#Do-Set-Relay)

and

ardupilot.com/forum Pixhawk servos power options/clarification (http://ardupilot.com/forum/viewtopic.php?t=5669&p=9310)

it seems there should be a way to do this without using PWM & the gentwire-USB2.   All you really need is one signal to enable the next shot and a single digital output (relay) should be enough.  The script can be set to only switch to shooting mode (lens extends) on the first pulse and to switch back to play mode (lens retracts) when no more pulses come from the flight controller (after a user define delay).

I saw your post here : expert help please camera control at 8s interval (http://diydrones.com/forum/topics/expert-help-please-camera-control-at-8s-interval) but your question may be too vague (lacking details) to attract a good answer?

For reference, some other links of some interest :

shutter_configuration_with_pixhawk (http://copter.ardupilot.com/wiki/common-optional-hardware/common-cameras-and-gimbals/common-camera-shutter-with-servo/#shutter_configuration_with_pixhawk)
common-chdk-camera-control-tutorial/ (http://copter.ardupilot.com/wiki/common-optional-hardware/common-cameras-and-gimbals/common-chdk-camera-control-tutorial/)
common-apm-to-chdk-camera-link-tutorial/ (http://copter.ardupilot.com/wiki/common-optional-hardware/common-cameras-and-gimbals/common-apm-to-chdk-camera-link-tutorial/)

and especially

using-aux-pins-as-relays-for-chdk (http://diydrones.com/forum/topics/using-aux-pins-as-relays-for-chdk)

The last one is a huge thread devoted mostly to this topic.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: ludiga on 02 / July / 2015, 04:10:02
Hello everyone,
it is just that I bought a Ixus 125HS, and I installed the CHDK with the script KAP & UAV, all to improve the photos that I will do my multicopter for photogrammetry.

I start to get the test, I read the various posts, but if someone could describe specifically the best configuration parameters for the camera, the general setup menu canon, setup in CHDK and KAP & UAV ..... ..

I am grateful.

thanks a lot
Luca
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / July / 2015, 05:46:27
I start to get the test, I read the various posts, but if someone could describe specifically the best configuration parameters for the camera, the general setup menu canon, setup in CHDK and KAP & UAV ..... ..
Camera setup recommendations are given here : Camera Settings (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script#Camera_Settings).  That wiki page also contains some other good advice that might be worth reading.

Script parameters settings are also described on the page linked above.   In general, the default values are pretty good but they were picked for KAP applications. For a UAV you might want to change the following settings to the values given here:

Tv Target (sec)  :     1/2000
Tv Max (sec) :    1/5000
ISO Max1 : 800
ISO Max2 : 1600

After that, it's a question of experimenting and looking at the result.   I'd recommend testing image quality by shooting on the ground while outdoors at your flying site first.

Finally, make sure that your UAV includes good vibration isolation for the camera.   

Safe flying !
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: chespi on 02 / July / 2015, 14:12:33
Hi Waterwingz
First of all want to to say this script ROCKS. thanks a lot for all your effort.

I have been testing it around, and I've found I can start a script with my simplePush usb remote controller. what I cannot find, is a way to stop the script execution with the remote controller. Is it possible to start and later stop the script with the  USB remote?

thanks !
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / July / 2015, 14:22:30
I have been testing it around, and I've found I can start a script with my simplePush usb remote controller. what I cannot find, is a way to stop the script execution with the remote controller. Is it possible to start and later stop the script with the  USB remote?
It depends somewhat on the design of your remote.  If you are using a simple two position switch,  the script can be setup so that it shoots continuously when the switch is in the "On" position and not shoot when the switch is in the "Off" position.   But if you have a momentary contact pushbutton then you can only start shooting with it.

I'm currently doing a lot of work on USB remote control modes for UAV use.   Adding a mode that start & stops with each USB switch press would be easy to add as well.   I guess my only question would be how you keep track of whether the script is shooting or not when your kite / uav is up in the air  (i.e. if you lose track of how many times the remote has been pressed).   I suppose it would be possible to only start shooting if the switch is held down for 0.1 to 2.0 seconds and to stop shooting any time the switch is held down for more than 2.5 seconds?

How do you anticipate using a simple switch in your application?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 04 / July / 2015, 10:39:13
WZZ,

is there a 3.6b10?

Attached is the sketch I promised a few days back.
I am doing some brainstorming as I find hard to believe the current situation: Pixhawk can generate microsecond level PWM signal, but I cannot get millisecond level output directly to camera.
Gentwire was the easy solution that should still work, but it doesn't work for some reason under .7 seconds.





Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 04 / July / 2015, 11:05:44
What is the difference between Gentwire and Tuffwing trigger cable?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 04 / July / 2015, 11:18:16
What is the difference between Gentwire and Tuffwing trigger cable?
AFAIK  the Tuffwing Trigger Cable (http://www.tuffwing.com/store/store.html#PixHawk_Camera_Trigger_Cable) simply converts the 3.3V output level of a flight controller digital output (relay) to the 5V level expected on the camera's USB port.

The gentwire-USB (http://www.gentles.ltd.uk/gentwire/Manual-usbc.pdf) converts a servo output from a flight controller or RC receiver to the 5V level expected on the camera's USB port.

The gentwire-USB2 (http://www.gentles.ltd.uk/gentwire/Manual-usbc2.pdf) converts one or two servo outputs from a flight controller or RC receiver to 5V pulses proportional to the position of the servos (ch1up,ch1mid,ch1down,ch2up,ch2mid,ch2down).
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 04 / July / 2015, 11:42:51
is there a 3.6b10?
not yet  :P

Quote
Attached is the sketch I promised a few days back.
I am doing some brainstorming as I find hard to believe the current situation: Pixhawk can generate microsecond level PWM signal, but I cannot get millisecond level output directly to camera.
Gentwire was the easy solution that should still work, but it doesn't work for some reason under .7 seconds.

Does this help ?  (props to bchristal (http://chdk.setepontos.com/index.php?action=profile;u=27439) for the image)

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2Fb2XIUrO.png&hash=2f162a1e063cc3c36ddee5d207d0f6fb)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 04 / July / 2015, 12:34:31
Exactly, that is what I am talking about.
If CAM_DURATION is set below 7(=.7sec) the Gentwire sends no signal to the camera.
Theoretically the CAM_SERVO_ON PWM should be sent for .1s and then the CAM_SERVO_OFF PWM should be sent to the Gentwire. Gentwire should convert these to signals for the camera.
I just reviewed the on-board log log from the Pixhawk and it issues the CAM_SERVO_ON signal for .1s(or under) and CAM_SERVO_OFF as long as needed.
As you have already talked to Mr. Gentles, can you please check with him if there is a minimum time for the input signal under which signals are disregarded?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 04 / July / 2015, 21:57:59
As you have already talked to Mr. Gentles, can you please check with him if there is a minimum time for the input signal under which signals are disregarded?
Sent him another email.  He is usually pretty responsive so I expect an answer shortly.   He is probably celebrating British Thanksgivings Day,   help on July 4th every year.
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / July / 2015, 12:45:29
As you have already talked to Mr. Gentles, can you please check with him if there is a minimum time for the input signal under which signals are disregarded?
Sent him another email.  He is usually pretty responsive so I expect an answer shortly.   He is probably celebrating British Thanksgivings Day,   help on July 4th every year.
I just received a very detailed answer from James.  The gentWire-usb2 needs to see five cycles of servo PWM readings at the same value before it outputs a pulse the the camera.  So with a standard servo signal repeat rate of 20 mSec that means 100mSec of active signal.  That's right on the threshold of what you are trying to get the flight controller to do.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 06 / July / 2015, 15:39:28

So with a standard servo signal repeat rate of 20 mSec that means 100mSec of active signal.

100ms = .1s.
Exactly!
Now, I did some ground testing today, but it wasn't conclusive. I will post  an update as soon as the camera battery recharges.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / July / 2015, 20:42:56
So with a standard servo signal repeat rate of 20 mSec that means 100mSec of active signal.
100ms = .1s.  Exactly!  Now, I did some ground testing today, but it wasn't conclusive. I will post  an update as soon as the camera battery recharges.
I'm starting to question the validity of trying to operate at 1 fps this way.  If the flight controller has to send servo pulses for at least 100 mSec  ( 5 x 20mSec per pulse cycle) and then the gentwire-USB2 needs to send a pulse between 30 and 180 milliseconds and then the script needs to recognize and act on that (another 100 mSec by my guess) then we have a latency of around  1/3 of second between when the flight controller says to shoot and when the actual shot happens.

Seems like it would be better to use the digital output relay mode from the flight controller and skip the gentwire all together?

If the pixhawk ArduPilot software is open source I suppose it might be worth taking a look to see what it actually does?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 07 / July / 2015, 07:53:43
we have a latency of around  1/3 of second between when the flight controller says to shoot and when the actual shot happens.
If that latency is constant it doesn't bother me as I can calculate with it during processing.

Seems like it would be better to use the digital output relay mode from the flight controller and skip the gentwire all together?

If the pixhawk ArduPilot software is open source I suppose it might be worth taking a look to see what it actually does?
I've been having the same bad feeling for a while, but I hoped I don't have to mess with the pixhawk source code.
can you please check and advise the minimum PWM Canon cameras can react to? Is it not possible that it could react under 2ms?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / July / 2015, 10:43:56
we have a latency of around  1/3 of second between when the flight controller says to shoot and when the actual shot happens.
If that latency is constant it doesn't bother me as I can calculate with it during processing.
It will vary some - as much as +/- 50 mSec would be my educated guess.


Quote
I've been having the same bad feeling for a while, but I hoped I don't have to mess with the pixhawk source code.
I'd (again) suggest that you try using a 3.3-to-5 V conversion device and run the pixhawk camera control in DO (relay) output mode rather than PWM mode via the genwire.

Quote
can you please check and advise the minimum PWM Canon cameras can react to? Is it not possible that it could react under 2ms?
As reported here, http://chdk.setepontos.com/index.php?topic=10822.msg123037#msg123037 (http://chdk.setepontos.com/index.php?topic=10822.msg123037#msg123037) my initial tests are promising.  It needs a custom build that allows the CHDK high performance timer code to run faster than the current 1mSec limit and that could have serious impact on camera performance - especially on lower spec cameras.  And it will require some level of filtering / error correction to be reliable.  Using pixhawk DO relay output camera control seems like a better option.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 07 / July / 2015, 14:55:23
Getting there...just not sure where...  :-[

I successfully forced my will on the pixhawk and I got the PWM up to 32767 which is 32ms for the Canon.

I will go home in a couple days and I will buy a relay to see if the logs tell me the truth.

I also have no idea what relay I should use. Which one can work with under ms precision.

for this mission I need only 3 positions: shoot/halt/shut_down. (<10 / 10-20 / 20<).
Can you please check if your s100 can work with these ms values? 
Thanks in advance!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / July / 2015, 19:23:33
I successfully forced my will on the pixhawk and I got the PWM up to 32767 which is 32ms for the Canon.
Interesting.  Standard servo pulses only range from 1 to 2 ms in duration.  This is quite an increase.

Quote
I also have no idea what relay I should use. Which one can work with under ms precision.
It doesn't need to be under a millisecond.

Here's the DYI Drones thread on this :  using aux pins as relays for chdk (http://diydrones.com/forum/topics/using-aux-pins-as-relays-for-chdk).   Be careful - some of the things posted are wrong but you have to read subsequent posts to figure that out.

This device can be build fairly easily or you can purchase one from tuffwing. (http://www.tuffwing.com/store/store.html#PixHawk_Camera_Trigger_Cable)

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fapi.ning.com%2Ffiles%2Fdb4JtL%2AUowEd224CN5ZtsY6nQzewbIeuUkd0lDHA8aEwYbFefItU%2AKz74OaqZWQuldQFcS63Blf9dOrDhX0b80ieB6uzMyD8%2FCanon5vTrigger1.JPG&hash=0c42f544b9ecf6050118311a9ac98414)
And small signal NPN transistor will do - the 2N222 is pretty common if you can't find a B547.

These should work well too : SparkFun Logic Level Converter - Bi-Directional (https://www.sparkfun.com/products/12009).  Let me know if you need a schematic.

Quote
for this mission I need only 3 positions: shoot/halt/shut_down. (<10 / 10-20 / 20<).  Can you please check if your s100 can work with these ms values? 
As long as the script's USB Timer Precision (msec) value is set to 1 then accurately measuring 10 mSec vs 15 mSec vs 20 mSec will not be a problem.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 08 / July / 2015, 01:41:55
For the moment I will stick with the DIY version as the others will take a week to get here. I will go today and try to find the components in the nearest city.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / July / 2015, 06:49:11
For the moment I will stick with the DIY version as the others will take a week to get here. I will go today and try to find the components in the nearest city.
There are several other circuit diagram in the link I posted (http://diydrones.com/forum/topics/using-aux-pins-as-relays-for-chdk) that will also work but the one I posted the schematic for is the simplest.  There are also some construction suggestions (http://diydrones.com/forum/topics/using-aux-pins-as-relays-for-chdk?commentId=705844%3AComment%3A1923812) posted there is you have not done a lot of DIY electronics assembly.

One detail that all of the DYI and purchased solutions need is a +5V power source - typically from a BEC connected to the middle row of pins of the pixhawk.  The pixhawk will not provide the necessary +5V without this.  If this instruction is not completely clear to me, please let me know and I will elaborate.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / July / 2015, 22:36:04
I successfully forced my will on the pixhawk and I got the PWM up to 32767 which is 32ms for the Canon.
Would you mind posting screen shots of what you setup in the Arduplane Mission Planner software to do this?

Edit :  I'm doing a little digging into the ardupilot world (the firmware that runs on pixhawk and other flight controllers).  It looks like you could actually edit the MAVLink file and change the DO_SET_SERVO second paramter value to something outside of its normal range of 1000 to 2000. That would let you use values up to 65 mSec.  The ardupilot code just passes that through to the flight controller hardware so if the hardware can do it then longer values seem possible.  Or I could have this completely wrong.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 09 / July / 2015, 09:13:50
That would let you use values up to 65 mSec. 
YOu got that right and I did go up to 65000 initially and it was stable BUT at the first restart it automatically rewrote to 32767.
Even though I can only speculate, as I am neither a computer nor an electronics expert, the 32*1024 on a 32 bit CPU looks to me as some system limit that I don't want to mess with.

I have made the circuit ready but it is not working correctly for some reason. It gets some PWMs, but it doesn't make sense.
Code: [Select]
--[[
@title PWM Tester
--]]

set_console_layout(1, 1, 44, 10)
print("USB pwm test started")
set_config_value(121,1) -- make sure USB remote is enabled
count=0
repeat
    x=get_usb_power(0)
    if ( x > 0 ) then
        print("width ="..(x*1).." mSec")
        count=count+1
    end
until is_pressed("menu")
set_config_value(121,0) -- make sure USB remote is disabled

Could you please throw together a minimal script that list and logs the PWM inputs exactly as the camera receives it?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / July / 2015, 10:38:19
YOu got that right and I did go up to 65000 initially and it was stable BUT at the first restart it automatically rewrote to 32767.
How did you set that?  In Mission Planner? Or manually editing the MAVLink file?

Quote
Even though I can only speculate, as I am neither a computer nor an electronics expert, the 32*1024 on a 32 bit CPU looks to me as some system limit that I don't want to mess with.
32767 is the largest positive 16 bit signed number.  The code I looked at was using unsigned 16 bit numbers but somewhere in there some piece of code is probably switching between signed and unsigned.

Quote
I have made the circuit ready but it is not working correctly for some reason. It gets some PWMs, but it doesn't make sense.
Thie script needs to enable precision timing.    Add this to the start of your code
Code: [Select]
set_remote_timing(1000)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 09 / July / 2015, 12:11:56
YOu got that right and I did go up to 65000 initially and it was stable BUT at the first restart it automatically rewrote to 32767.
How did you set that?  In Mission Planner? Or manually editing the MAVLink file?
Both telemetry and on-board log confirmed .
See attachment on how.
Quote
Even though I can only speculate, as I am neither a computer nor an electronics expert, the 32*1024 on a 32 bit CPU looks to me as some system limit that I don't want to mess with.
32767 is the largest positive 16 bit signed number.  The code I looked at was using unsigned 16 bit numbers but somewhere in there some piece of code is probably switching between signed and unsigned.

Quote
I have made the circuit ready but it is not working correctly for some reason. It gets some PWMs, but it doesn't make sense.
Thie script needs to enable precision timing.    Add this to the start of your code
Code: [Select]
set_remote_timing(1000)
[/quote]

YESSSS!!!! That little code fragment solved the precision problem!
I am getting 18-19 input @19000 output. Occasionally there is a 37-38 but I guess that is when it misses a pause. 
Over 19000 it stops listing any PWMs. When l pulled the USB out it gave me 3000ms.
If we work with PWM ranges of 1-5,6-10,11-15,16-20, we still have 4 command slots @3,8,13,18 and safe distances  .

Precision could be better, but that can come from the DIY electronics or the Camera.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 09 / July / 2015, 12:12:21
I have been thinking if we should fork this to a KAP_UAV_HS(high speed) as the HS part of it is still pretty far from stable, code has been heavily altered, and will work for extreme UAVs flying very low and/or very fast and also the logic is somewhat altered/reduced.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / July / 2015, 12:49:47
The code alterations are relatively minor and there is not likely to be other talk about the rest of the script so I would not favour a split.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 09 / July / 2015, 13:10:03
The code alterations are relatively minor and there is not likely to be other talk about the rest of the script so I would not favour a split.
OK.  :)

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / July / 2015, 13:59:34
Occasionally there is a 37-38 but I guess that is when it misses a pause. 
What determine the time between pulses?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 09 / July / 2015, 14:53:11
Occasionally there is a 37-38 but I guess that is when it misses a pause. 
What determine the time between pulses?
It might sound strange, but I have no idea. I will look into it once I have a little time.

Meanwhile:

I have altered the code a little and ran a short test :
Code: [Select]
function pwm1(pwidth)
        if( repeat_check("mode=2",pwidth ) >= PWM_required_repeats ) then
           usb_shooting_mode = 2                                      -- request the next shot
        end
    end

    function pwm2(pwidth)
        if( repeat_check("mode=1",pwidth ) >= PWM_required_repeats ) then
          usb_shooting_mode = 1                                                       -- neutral position - do nothing
        end
    end

    function pwm3(pwidth)
        if( repeat_check("nothing",pwidth ) >= PWM_required_repeats ) then 
            --usb_shooting_mode = 1                                     -- set camera as waiting to shoot
        end
    end

    function pwm4(pwidth)
        repeat_check("shut down",pwidth)
        shut_down()
-- = 0                                          -- put camera into playback / sleep mode
    end



    function pwm_mode()                                                -- sample PWM code for Gentles gentwire-usb2 - note that values are in milliseconds
        local pw = get_usb_power(2) * usb_precision
        if  pw > 0  then
            if   ((pw < 1) or (pw > 20)) then repeat_check("invalid pulse",pw)
            elseif pw < 5  then pwm1(pw)
            elseif pw < 10  then pwm2(pw)
            elseif pw < 15 then pwm3(pw)
            elseif pw < 20 then pwm4(pw)
            elseif pw < 225 then repeat_check("idle pulse",pw)
            end
        end
   end

I would like to ask you to use this in the next beta version.
I made a small test 130+ pictures were taken and I have a feeling that the PWM control worked.

there are also a few bugs in B9:
Log was not updated
Screen was not updated
Menu button did not finish the script running
Shoot button did not interrupt the script running

I would like to ask you to add precise time stamp both for the picture and the camera PWM. Least for the beta testing. 

For Brainstorm:
Pixhawk generates output continuously so Camera continuously gets PWM input.
If each input is considered as executable we will have a huge backlog pile-up. this might be a problem.
The idea of executing only the first and disregard subsequent identical shoot inputs within 0.55s (so far the minimum shot interval I have seen) seems necessary.
Unfortunately this cannot be the same for the pause(usb_shooting_mode = 1 ) as 0.6-0.7s shot interval should be usable.

I will do a car-test with this tomorrow with both B8 and B9 and B??(if available). :-)
Let me know if there are any specific scenarios that you would like me to test.

Many thanks in advance!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / July / 2015, 17:39:56
Quote
What determine the time between pulses?
It might sound strange, but I have no idea. I will look into it once I have a little time.
Looking at the ardupilot source code,  the internal calls to the hardware abstraction layer pass the pulse width required (the stuff you set) but no setting for pulse frequency.   I'll do some more digging.

Quote
Pixhawk generates output continuously so Camera continuously gets PWM input.
If each input is considered as executable we will have a huge backlog pile-up. this might be a problem.
The idea of executing only the first and disregard subsequent identical shoot inputs within 0.55s (so far the minimum shot interval I have seen) seems necessary.   Unfortunately this cannot be the same for the pause(usb_shooting_mode = 1 ) as 0.6-0.7s shot interval should be usable.
The existing code handles receiving the same pulses repeatedly.  And there is risk of backlog pile-up in any case - requests are not queued.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / July / 2015, 20:48:08
there are also a few bugs in B9:
  • Log was not updated
  • Screen was not updated
  • Menu button did not finish the script running
  • Shoot button did not interrupt the script running
This is not really a bug.  In beta9,  once you start shooting continuously the script stays locked waiting for a pulse to start the next shot.  There is a timeout after 10 seconds of waiting without receiving a pulse so if you press MENU and just wait it should eventually exit the script and save the log.   Once we get the basics working I'll see if I can improve on this.

I have altered the code a little and ran a short test :
Code: [Select]

function pwm4(pwidth)
     repeat_check("shut down",pwidth)
     shut_down()
end
This is a pretty bad idea.  If you just shut the camera down like this,  you will lose everything not yet saved from the log file and the next time CHDK starts the USB remote will be enabled. I'd suggest calling the restore( ) function before issuing the shut_down( ).


What determine the time between pulses?
It might sound strange, but I have no idea. I will look into it once I have a little time.
Here's a improved version of your PWM test script that will tell you how long the pulse & spaces are :
Code: [Select]
--[[
@title PWM Tester
@chdk_version 1.3
--]]
print_screen(123)
set_console_layout(1, 1, 44, 10)
set_remote_timing(1000)
print("USB pwm test started")
set_config_value(121,1) -- make sure USB remote is enabled
count=0
repeat until get_usb_power(2) == 0
repeat
    x=get_usb_power(2)
    if ( x > 0 ) then
        count=count+1
        print(count..") pulse="..x.." mSec")
    elseif (x < 0 ) then
        x=0-x
        print(count..") space="..x.." mSec")   
    end
until is_pressed("menu")
set_config_value(121,0) -- make sure USB remote is disabled
Note that this test script creates a log file of its output.  You can find it on the SD card as A/CHDK/LOGS/LOG0123.TXT   Please post the log here when you get some testing done?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 10 / July / 2015, 00:47:23
Thanks for the script!
Log attached.
It looks like the total signal is constant at 19ms, pulse+space.
My gut-feeling is that it is actually set to 20ms somewhere.

I continuously learn new things  from you! Many-many thanks!
 added  before shut_down()
Code: [Select]
restore( )
sleep(2000)

Sorry, but I am not sure I understand.  Is there or is there no pile-up risk?
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 10 / July / 2015, 07:14:55
20 mSec is the standard period for an RC servo so that makes sense.  I did not see any pulses longer than 18 mSec in the log file.  Can you try the 32 mSec setting that you reported earlier?

Pixhawk generates output continuously so Camera continuously gets PWM input.
I'm afraid that this could be a problem  if the pixhawk cannot generate a few distinguishable PWM pulses at each waypoint / distance travelled over the ground so that the next shot can be trigggered. 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 10 / July / 2015, 23:00:29
What determine the time between pulses?
It might sound strange, but I have no idea. I will look into it once I have a little time.
I think I found this answer.   From :

http://copter.ardupilot.com/wiki/common-optional-hardware/common-cameras-and-gimbals/common-camera-shutter-with-servo/ (http://copter.ardupilot.com/wiki/common-optional-hardware/common-cameras-and-gimbals/common-camera-shutter-with-servo/)

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fplanner.ardupilot.com%2Fwp-content%2Fuploads%2Fsites%2F5%2F2014%2F03%2Fmissionplannercameragimbalscreen.jpg&hash=ad824565fdc3ed8c10e0a3e898e720a7)

The duration value shown is 10 (or one second).  Changing that to some value below 5 and then changing the Pushed : 1800 to 25000 and the the  Not Pushed : 1100 to 12000 (for example) should allow direct connection to the script? 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 11 / July / 2015, 02:34:08
Mine is set to 1 with the following ranges
Code: [Select]
    elseif pw < 5  then pwm1(pw)
            elseif pw < 10  then pwm2(pw)
            elseif pw < 15 then pwm3(pw)
            elseif pw < 20 then pwm4(pw)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 11 / July / 2015, 03:26:31
Dear Waterwingz,

Mission settings: DO_SET_CAM_TRIGG_DIST=17meter (like @ ~80m altitude)

Timing  works like a charm!

I reached the mission start point at picture 31.
I was going 50-60Km/h till I exited the village, that is picture 95.
I accelerated to 90Km/h held it there for a while and then accelerated to 110Km/h.

Then mission finished.
The pause between the pictures can be can be seen by the     mode=1 repeated xx

There is only one modification that is absolutely needed : please take out the 10s interval picture taking, as first picture (the one that sets the focus and other things ) needs to be taken at mission operation start, above the target area.

I used the slightly modified version with the altered PWM ranges.
It is like :xmas for me!!!

Oh, Question: Should I use ND filter or not? I need crisp crystal clear images.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / July / 2015, 08:48:22
Mission settings: DO_SET_CAM_TRIGG_DIST=17meter (like @ ~80m altitude)
I'm going to do a wikia "how to" write-up about this once the next script revision is released.  So I'm trying to keep track of the necessary setup steps for the pixhawk (ardupilot). I'll also add some code to allow picking either a gentwire-USB2 or an Ardupilot from the script parameters and using good default values / code for each.

Should I assume your setup is all done with the Mission Planner software?  And that you only need to setup the "Optional Hardware -> Camera Gimbal"  and then use DO_SET_CAM_TRIGG_DIST in the Flight Plan section?

Quote
Timing  works like a charm!  I reached the mission start point at picture 31. I was going 50-60Km/h till I exited the village, that is picture 95.  I accelerated to 90Km/h held it there for a while and then accelerated to 110Km/h. Then mission finished. The pause between the pictures can be can be seen by the mode=1 repeated xx
Good!

Quote
There is only one modification that is absolutely needed : please take out the 10s interval picture taking, as first picture (the one that sets the focus and other things ) needs to be taken at mission operation start, above the target area.
I don't really want to do that because if the flight controller stops sending pulses once continuous shooting starts, the script will appear to hang.  That is going to confuse a lot of people trying to use the script.

What is supposed to happen is for the flight controller not to start sending pulses to the camera until it is over the target area and ready to shoot.   This will leave the lens retracted and the camera idling in a low power standby mode  (i.e. playback) prior to the first shot.

Also, when a timeout occurs,  the camera should refocus & reset the exposure on the next shot.   That appears to not be working so I will fix that.

Does that sound better than simply disabling the timeout?

Quote
I used the slightly modified version with the altered PWM ranges.
Pushed : 7500 and Not Pushed : 3500  ?

Quote
Oh, Question: Should I use ND filter or not? I need crisp crystal clear images.
The ND filter can be left as Yes.  The script will only use it if the Maximum Tv and minimum ISO setting that you allow in your other settings will result in an overexposed picture.  Which is not likely given your settings.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 11 / July / 2015, 10:33:22
I used the Mission Planner, but on the "Optional Hardware -> Camera Gimbal" screen you will not be able to set these values.
For Pixhawk:
You need to go to Config/Tuning -> Param Tree -> Cam
CAM_DURATION - 1
CAM_SERVO_OFF - 8000
CAM_SERVO_ON - 3000
CAM_TRIGG_DIST - 0
CAM_TRIGG_TYPE - 0

THEN

Pick an RC channel you would like to control the shutter (I used RC7):
RC7_FUNCTION - 10
RC7_TRIM - 8000
RC7_MAX - 32767 (you will get a warning signal saying that you are above the 2000 max. You have to confirm that you want to change the value)

That is about it.

Correct: DO_SET_CAM_TRIGG_DIST you set when you plan the mission in Flight Plan

I don't really want to do that because if the flight controller stops sending pulses once continuous shooting starts, the script will appear to hang.  That is going to confuse a lot of people trying to use the script.

What is supposed to happen is for the flight controller not to start sending pulses to the camera until it is over the target area and ready to shoot.   This will leave the lens retracted and the camera idling in a low power standby mode  (i.e. playback) prior to the first shot.

Also, when a timeout occurs,  the camera should refocus & reset the exposure on the next shot.   That appears to not be working so I will fix that.

Does that sound better than simply disabling the timeout?

Once the Pixhawk PWM is activated it will only send the CAM_SERVO_OFF = RC7_TRIM value until otherwise needed. For the camera that means mode=1 right now.
If flight controller stops sending the signals that will most probably render the whole set useless anyway so the flight must be repeated. There is no point in having a picture every 10 seconds when you need a picture every 0.55s.
First thing after touch-down and disarm is check the picture count.
Anyway, when the controller stops sending pulses the pictures are the smallest problem, because then the plane goes down. Period.

If you ever find and get that plane together again that can only be flown after extensive debugging.

Bottom line is setting focus F-stop ISO and other things has to be done at the operations area for the operations area.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / July / 2015, 11:08:51
Bottom line is setting focus F-stop ISO and other things has to be done at the operations area for the operations area.
Getting rid of the 10 second timeout will not make this happen.   

However, resetting the focus & exposure on a timeout will (should you happen to accidentally start shooting in continuous mode prior to reaching the target area).
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 11 / July / 2015, 12:10:06
Bottom line is setting focus F-stop ISO and other things has to be done at the operations area for the operations area.
Getting rid of the 10 second timeout will not make this happen.   

However, resetting the focus & exposure on a timeout will (should you happen to accidentally start shooting in continuous mode prior to reaching the target area).
I will do a test flight on Monday.
let's wait and see how that tuns out with the script as is.
I am flying @25m/s so the worst case scenario is that the setting is done 250m before reaching the op.area. Conditions should be similar in any case. I will check and delete the pictures taken in time-out before processing.

Can you fix the reset by then? 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / July / 2015, 15:03:45
You need to go to Config/Tuning -> Param Tree -> Cam
  • CAM_DURATION - 1
  • CAM_SERVO_OFF - 8000
  • CAM_SERVO_ON - 3000
  • CAM_TRIGG_DIST - 0
  • CAM_TRIGG_TYPE - 0
then pick an RC channel you would like to control the shutter (I used RC7):
  • RC7_FUNCTION - 10
  • RC7_TRIM - 8000
  • RC7_MAX - 32767

I notice that you set CAM_SERVO_OFF to the same value as RC7_TRIM.   What does the pixhawk generate if you make them different ( say 8000 and 11000 ) ?

Quote
Can you fix the reset by then?

I can show you how to disable it but I'd rather find a more complete solution.  The answer to my question above might help there.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 12 / July / 2015, 03:16:07

I notice that you set CAM_SERVO_OFF to the same value as RC7_TRIM.   What does the pixhawk generate if you make them different ( say 8000 and 11000 ) ?

Durring initialization for a moment the TRIM kicks in, but as firmware is loaded the CAM_SERVO_OFF is transmitted. On the shutter control channel 2 PWMS are transmitted only: CAM_SERVO_ON and CAM_SERVO_OFF.
I am still trying to figure out a way around that.

I also tested the 220 ohm version but the signal still fluctuates.
I tried to move from 8000 to 8500 but, rarely though, I still get a 9ms and a 7ms.

Let's keep the 10 second logic for the moment. Could you focus on the reset debugging so it makes the reset every 10 seconds?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 12 / July / 2015, 23:14:48
Could you focus on the reset debugging so it makes the reset every 10 seconds?
kap_uav.lua 3.6 Beta 10 (https://app.box.com/s/zmhm2cvatwp3ez2umhegpiihjudrvx9q)

Changes in this version :
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 13 / July / 2015, 02:57:53
Could you focus on the reset debugging so it makes the reset every 10 seconds?
kap_uav.lua 3.6 Beta 10 (https://app.box.com/s/zmhm2cvatwp3ez2umhegpiihjudrvx9q)

Changes in this version :
  • The PWM code changed for ardupilot use (gentwire-USB2 temporaily remove)
  • Camera waits in playback mode until first pwm1 pulse received  ( 3 mSec)
OK!
Quote
  • If camera is in Canon continuous mode then shots are released as each pwm1 pulse is received
You mean 1 shot, right?
Quote
  • if camera is shooting in continuous mode and no pwm1 pulses are receive for 10 second then continuous shooting stops
  • continuous shooting restarts (with focus & exposure reset) at the next pwm1 pulse
  • pwm2 to pwm 6 modes are ignored
this can be changed back, right?
Quote
[/list]

I made some indoor photos (with outdoor settings, true) but they all came out dark.
when the camera was waiting resetting itself the reset worked and the picture on the LCD looked fine. but by the time it got saved the picture became dark. Is this OK?

Something to bare in mind for final debugging: I cannot get my camera with PWM signal from Playback mode do any other mode as it will ask "Change Battery" it does that even with a newly charged battery. I can work around this by starting the script after camera lens are out so it is not that urgent.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 13 / July / 2015, 09:15:18
You mean 1 shot, right?
Yes.

Quote
this can be changed back, right?
Not so much changed back (I think the pwm1 message works well now) but added to.  The code to shutdown the camera is still there for example - we just currently have no way to generate the necessary pulse width to make it happen.

Quote
I made some indoor photos (with outdoor settings, true) but they all came out dark.
when the camera was waiting resetting itself the reset worked and the picture on the LCD looked fine. but by the time it got saved the picture became dark. Is this OK?
I don't know if its okay - I'd have to see the log file.  But if you have the minimum settings locked up high to drive fast shutter speeds then it is quite possible the script is unable to get a correct exposure in dark conditions.

Quote
Something to bare in mind for final debugging: I cannot get my camera with PWM signal from Playback mode do any other mode as it will ask "Change Battery" it does that even with a newly charged battery. I can work around this by starting the script after camera lens are out so it is not that urgent.
Strange.  None of my cameras do that.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 17 / July / 2015, 03:26:47
B10 works correctly. Still have my reserves on the ISO and F-Stop choice, but that is another issue.

I have soldered a 3000mAh RC battery cell to the camera battery so now I can shoot about 200k picture without worrying about the battery getting depleted.

Log is attached.
I had 4 short flights as I was mainly testing the vibration dampers and KAP.log is the main thing that's telling us the script performance anyway. In the first 3 flights I had speeds set between 20-25m/s, camera was set to take pictures every 17 meters
Last Flight at 25m/s (no wind whatsoever) the camera was set to take pictures every 17 meters. That means one picture every 0.68s. 
Notice, that the pictures in the last session were taken mostly at .8s intervals. While the .8s interval still offers a 78% overlap that we can work with, it is not perfect. 
Speculation:
The CAM_SERVO_ON=3500 is held for CAM_DURATION=0.1s. now the Pixhawk log is not accurate enough to determine if this is the real cause, but it surely provides the explanation for the ~0.1s loss.
Now, reverse engineering the problem:
CAM_DURATION=0.1s(100ms)- this means the the counting for the next shot is not starting from the moment CAM_DURATION began but from the moment CAM_DURATION ended. So 0.68+0.1=0.78 (~0.8).
If we can work the CAM_DURATION down to 0.02s which is the exact width of one pulse+pause the next speed development would have to be when mapping planes fly at 250m/s .  (Probably when we start mapping other planets @80m AGL.)
Final note
All in all I say the timing delays have reached an acceptable level that can be worked with, and if needed it can be compensated for during planning.

Waterwingz, that was hell of a job! CONGRATS!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 17 / July / 2015, 03:43:55
Now, for the Photo part: this is probably because of my ignorance in the matter.

I have pictures of this flight ranging from 6M to 9M and the EXIF data is TV=1/2000 + AV=2 + ISO=800.
Code: [Select]
2015Jul16 08:43:43    KAP 3.6b10 started - press MENU to exit
2015Jul16 08:43:43    CHDK 1.3.0-4132 s110 102b Mar 31 2015
2015Jul16 08:43:43    Mode:P,Continuous_AF:0,Servo_AF:0 Drive:1
2015Jul16 08:43:43     Tv:1/5000 max:1/10000 min:1/5000 ecomp:0.0
2015Jul16 08:43:43     Av:2.0 minAv:2.0 maxAv:8.0
2015Jul16 08:43:43     ISOmin:100 ISO1:400 ISO2:800 M:0
2015Jul16 08:43:43     Focus:OFF  Video:0 USB:3 Tmo:0
2015Jul16 08:43:43     AvM:3 int:0 Shts:0 Dly:0 B/L:0
2015Jul16 08:43:44    waiting on USB signal
2015Jul16 08:43:59     * usb pulse = pwm2 idle (8 mSec)
2015Jul16 08:46:32    pwm2 idle repeated 7590 times
2015Jul16 08:46:32     * usb pulse = pwm1 shoot (3 mSec)
2015Jul16 08:46:32    USB start signal received
2015Jul16 08:46:32    Logger : log file updated.
2015Jul16 08:46:33.580 1) IMG_0001.JPG
2015Jul16 08:46:33     meter : Tv:1/640 Av:2.0 Sv:50 771:771
2015Jul16 08:46:33     actual: Tv:1/5000 Av:2.0 Sv:400
2015Jul16 08:46:33             AvMin:2.0 NDF:NDout foc:2.8m
2015Jul16 08:46:33     * usb pulse = pwm2 idle (8 mSec)
2015Jul16 08:46:34    pwm2 idle repeated 12 times
2015Jul16 08:46:34     * usb pulse = pwm1 shoot (3 mSec)
2015Jul16 08:46:34.200 2) IMG_0002.JPG

Can you please tell me the focus distance, is it really 2.8m?
EXIF ISO=800
log Sv= 400 - which is real?
Can ND Filter cause increase in file size?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / July / 2015, 11:44:15
The CAM_SERVO_ON=3500 is held for CAM_DURATION=0.1s. now the Pixhawk log is not accurate enough to determine if this is the real cause, but it surely provides the explanation for the ~0.1s loss.
Unless I am very much mistaken,  when you set CAM_SERVO_ON=3500 and CAM_DURATION=0.1s, then what you get is 5 pulses of 3.5 mSec each with a 16.5 mSec gap between each pulse.

The script will trigger a shot when the first pulse occurs and essentially ignore the other pulses while it is busy completing the shooting process. The time to complete the shooting process is essentially the same as the rate that the camera will shoot in Canon continuous mode without CHDK loaded.  Part of that time is pre-shot processing time while the rest is mostly for JPEG correction and saving to the SD card.    My tests with USB remotes indicate that the pre-shot time can be as much as 100 mSec.

Edit : looking at the script's log file,  I don't see the five 3 mSec pulses I was expecting.  There appears to have only been one produced. 

Now, for the Photo part: this is probably because of my ignorance in the matter.

Code: [Select]
2015Jul16 08:43:43     Focus:OFF  Video:0 USB:3 Tmo:0
Can you please tell me the focus distance, is it really 2.8m?
You have the "Focus at Infinity option turned off.  Why ?

Code: [Select]
...
2015Jul16 08:43:43     Focus:OFF  Video:0 USB:3 Tmo:0
...
2015Jul16 08:46:33             AvMin:2.0 NDF:NDout foc:2.8m
...
The camera seems to have picked 2.8m as a result. This might be good enough given the depth of field of the little lens & sensors on the camera.


Quote
EXIF ISO=800 log Sv= 400 - which is real?
I believe the value in the log is real.  CHDK overrides do not alway get properly saved in the EXIF info.  Although I'm not sure when that does or doesn't happen.  It should be easy enough to experiment with on a desktop though and figure it out.

Quote
Can ND Filter cause increase in file size?
I would not expect so. Not unless it gets inserted and the ISO setting goes above 800 to compensate, thereby giving a more noisy image which will compress less.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: exposeIT on 17 / July / 2015, 12:34:57
Hi,
Quote
Quote
Can ND Filter cause increase in file size?
I would not expect so. Not unless it gets inserted and the ISO setting goes above 800 to compensate, thereby giving a more noisy image which will compress less.

That depends...
JPG given.
More details in the picture give larger filesizes.
So, if the exposure is "better" - with more details - you will get bigger filesizes.
But it has nothing to do with NDfilter in or out,
ND In can give bigger filesize than ND Out or vice versa
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / July / 2015, 12:40:57
That depends... JPG given. More details in the picture give larger filesizes. So, if the exposure is "better" - with more details - you will get bigger filesizes. But it has nothing to do with NDfilter in or out, ND In can give bigger filesize than ND Out or vice versa
More detail based on "better" exposure will certainly cause some file size variation.  However, the changes that netptl39 was seeing were file sizes going from about 2M to 8M.   I would expect something  a lot more dramatic than a "better" exposure would be needed to cause that.  High ISO settings are one example.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 17 / July / 2015, 13:14:16
@waterwingz
The complete log is attached to the first note from today.  :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 23 / July / 2015, 21:08:40
Update :  I've reluctantly taken the conversation in this thread somewhat off-line (to emails) to resolve how to configure a pixhawk so that it will work with the script and take pictures at shot rates faster than once per second that are sync'd to the UAV's position as it travels over the ground.

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Ftinyurl.com%2Fq4t9cb6&hash=bb464bb76c91b1c1e300f19b9327ec03)

I'm happy to report that we have had success and are up to beta release 15 of the script.   I'm working on getting this all documented on the wiki and a final release candidate completeted but if you want to try things as they stand right now and can work with minimal instructions them please PM me here for an interim release.
Title: power consumption
Post by: hab_hab on 24 / July / 2015, 05:19:00
Hello

I will be using this script for a HAB launch. I noticed that the battery (760 mAH) dies after 90 minutes of shooting. I have the screen turned off but still the max time I can run the script is 90 minutes. I replaced the battery with a 1000mAH one and I got not more than 100 minutes! Not sure what is the cause of this. Any tips to get the camera to run 3-4 hours?

Thanks
Title: Re: power consumption
Post by: waterwingz on 24 / July / 2015, 08:34:50
Any tips to get the camera to run 3-4 hours?
Battery life is a function of the power used by the camera in idle plus the power used taking each shot.  Taking a shot actually consumes a lot of power so the only way to really extend battery life in your circumstance is to shoot less frequently.

You can get some idea about the difference this makes in this forum post : Battery Intervalometer (http://chdk.setepontos.com/index.php?topic=9049.0)

Also be aware that battery performance will drop with temperature so you may see reduced life at high altitude.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netcat65 on 05 / August / 2015, 14:25:52
Hello - I am also planning to use this great script on my Powershot A560 for a High Altitude Ballon Project.

The cam contains an ND Filter but I am wondering if this mechanical in/out process will work in -40° to -70° C. cold environment. The easiest solution would be to keep the nd filter permanently out because most of the flight the cam will be in bright areas.

Would the script still calculate the pic shooting correctly if the nd filter is permanently activated?

PS: I asume that the camera mechanic gets frozen anyway, but the electronic is able to shoot pics - a frozen nd filter would probably ruin the complete shooting.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 05 / August / 2015, 16:44:05
The cam contains an ND Filter but I am wondering if this mechanical in/out process will work in -40° to -70° C. cold environment.
FWIW, these cameras use a mechanical shutter when shooting still images, so if the mechanical parts get frozen, it probably won't work. I don't recall other HAB flights reporting problems with a frozen shutter or ND.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 05 / August / 2015, 16:50:28

I don't recall other HAB flights reporting problems with a frozen shutter or ND.
FWIW I've noticed that most people enclose the camera in a thick insulated foam box to mitigate the temperature effect.  Of course the box also helps to protect the camera on "landing ".
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netcat65 on 06 / August / 2015, 12:47:28
Thanks for your reply - yes the cam is coated in foam and a special crafted box  - more Details here
http://netcat.de/nearspace-ballon/ballon-kamera-canon-powershot-a560/ (http://netcat.de/nearspace-ballon/ballon-kamera-canon-powershot-a560/).

My concerns about the Freeze problem are based on other resources who say that this will happen. But your script is working perfectly and it looks like it meets all requirements for a HAB flight expecially the brightness and movement issue. Looks like i should give it a try.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / August / 2015, 13:38:54
My concerns about the Freeze problem are based on other resources who say that this will happen.
One of the script parameter options is  Allow use of ND filter ?   If you set that to [ No ] then the script will never try to engage it and it should stay out of the light path.  So if it also freezes up, that won't matter.  As long as your Tv Max is set high (1/5000) and your ISO Min is low (80) then you should be okay with that.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netcat65 on 06 / August / 2015, 16:06:26
Quote
As long as your Tv Max is set high (1/5000) and your ISO Min is low (80) then you should be okay with that.

A560 can handle a max TV of 1/2000 - Iso 80 is possible. Which leads me to my inital question - any impact when i leave the nd filter in permanently to reduce the Chance of getting overestimated pics?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / August / 2015, 18:21:18
A560 can handle a max TV of 1/2000 - Iso 80 is possible. Which leads me to my inital question - any impact when i leave the nd filter in permanently to reduce the Chance of getting overestimated pics?
The script does not support leaving the ND filter in so you would have to change the code if that is what you want to do.  One caution I might suggest is to test and make sure that the ND filter actually stays in and does not reset between shots.
Title: KAP & UAV Exposure Control Intervalometer Script - AEB functionality
Post by: azery on 17 / August / 2015, 11:22:54
I use a powershot A2500 for KAP. This is obviously not the most advanced or expensive camera. In a single KAP session, I can have some pictures which are over-exposed and some other pictures which are under-exposed. This made me wondering if the script would allow AEB (exposure bracketing which exists on canon EOS bodies): a single push of the shutter button (or in my case a trigger via usb) would result in three pictures: one at normal exposure, one overexposed and one underexposed (eg +1f and - 1f, but ideally the value can be set via the menu)

I dived into the script code to see if I could add this myself, but my programming skills are rather rusty and my knowledge on the internal working of a camera non-existant, so i did not immediately see a way. Inspiration could come from the HDR scripts, because for HDR, AEB is an essential component.

Any chance such function could be added?
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / August / 2015, 12:07:22
Any chance such function could be added?
It would be fairly simple to add that.

However, I'm wondering how useful it would be? The three shots will take 3 to 6 seconds to complete (depending on the camera type and setup).  During that time, a camera swinging below a kite might move enough to make the third exposure invalid just based on the scene changing beneath it.  Is this a valid concern?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: azery on 17 / August / 2015, 16:36:57
some thoughts:
I currently take a shot every five seconds, but this interval can be adapted (I'm using a gentles clickpan-pro), so the total time to take the three pictures would bother me less.
The displacement of the camera, resulting in another view, does also not bother me personally because:

It might be true that the gain in practice is less than one could hope for on paper (eg no HDR application), but if the cost would only be the need for a larger memory card and more time, I think I would in many occasions still use the option.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / August / 2015, 17:01:07
It might be true that the gain in practice is less than one could hope for on paper (eg no HDR application), but if the cost would only be the need for a larger memory card and more time, I think I would in many occasions still use the option.
Okay - I'll add it to the next release.   I'm a little busy right now with another project but if you PM me a real email address I'l shoot you a Beta test copy when I have a minute to spare.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: M141 on 19 / August / 2015, 16:06:39
I also like to try bracketing. When shooting sunsets or similar changing situations would be handy to have some variation in exposure control between images. HDR images would be tough, but maybe possible with some luck (lots of images), good gimbal + drone and no wind.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / August / 2015, 16:13:55
I also like to try bracketing. When shooting sunsets or similar changing situations would be handy to have some variation in exposure control between images. HDR images would be tough, but maybe possible with some luck (lots of images), good gimbal + drone and no wind.
Plan is to update the latest beta with that early next week.  Stay tuned.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 04 / September / 2015, 16:40:19
One final update before the official release of v3.6.   

link > kap_uav.lua v3.6 Beta 15 (https://app.box.com/s/7676zpex9yym9sxjldgdyfpoq7dswbih)

Changes are :

I've done a bunch of regression testing using my servo simulator but the script is now complex enough that I don't really have 100% test coverage.

The next update will likely jump to v4.0 when CHDK 1.4.0 is released,  allowing a number of nice new scripting tricks.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: M141 on 04 / September / 2015, 19:13:22
One final update before the official release of v3.6.   

Quick indoor test with CHDK 1.3.0-4228 ixus220_elph300hs 100c:
-Bracketing works nicely :)
-Script exit doesn't work. Camera hangs and power off with lens out everytime. Same thing happen if using Menu button, 1 min timeout or number of shots to end script. In Kap log end i see nothing for this problem?:
2015Sep05 01:55:18    Script time-out reached.
2015Sep05 01:55:18    script halt requested
2015Sep05 01:55:18    Logger : log file updated.


V3.5 is ok and exit works.

Regards Jani

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 04 / September / 2015, 20:32:01
-Script exit doesn't work. Camera hangs and power off with lens out everytime. Same thing happen if using Menu button, 1 min timeout or number of shots to end script. In Kap log end i see nothing for this problem?
I can't reproduce this on my A1200.  But maybe you have some settings different than mine.

To help find the problem,  would you use the  Load default param values  menu option in the Script menu to reset all your parameters,  change only the  Total Shot (0=infinite)  setting to [ 3 ] , and then run the script and report what happens?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: M141 on 05 / September / 2015, 06:15:59
To help find the problem,  would you use the  Load default param values  menu option in the Script menu to reset all your parameters,  change only the  Total Shot (0=infinite)  setting to [ 3 ] , and then run the script and report what happens?
No difference. Camera takes 3 shots and hangs.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: blueSTAR on 05 / September / 2015, 08:33:28
On the wiki page you say:

Quote
7. IS Mode Off (may not be necessary for KAP but should be off for UAV)

Why would you disable IS (that is image stabilisation, right?) for use on a UAV. I would think the contrary would result in better images. Is a camera without IS better for UAV? or is it only for optical vs. for digital?

What camera model would you recommend?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 05 / September / 2015, 08:57:19
On the wiki page you say:
Quote
7. IS Mode Off (may not be necessary for KAP but should be off for UAV)
Why would you disable IS (that is image stabilisation, right?) for use on a UAV. I would think the contrary would result in better images. Is a camera without IS better for UAV? or is it only for optical vs. for digital?
That advice comes from several places on the various UAV forums (that I can't find a link to right now of course).  I believe the theory is that  image stabilization is designed for the kind of motion you get from shaky hands.  You'll note that the Canon camera manuals usually recommend turning it off if you are using a tripod as apparently the IS system gets confused if there is no motion at all.  For a UAV,  I think its the same issue - the types of vibration (high frequency) and movement are not what the IS system expects to see.

Quote
What camera model would you recommend?
The ixus220 ,  sx260 , s100 and s110 are all CHDK enabled cameras that seem popular for that application.  YMMV.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: azery on 05 / September / 2015, 09:16:04
I very briefly tested the new beta with braceting function. In summary: it works on my camera (powershot A2500)

The longer story:

test 1
First attempt failed with the error:
started
:158 attempt to call global 'get_sd_over_modes' (
a nil value)
terminated
kap uav 3.6b15

As I was running an older chdk version (chdk 1.3.0-3416), I upgraded to the latest version (4228) and tested again.

test2 (now on chdk build 4228)
with default parameters (no bracketing): script works

test3 (now on chdk build 4228)



I'll take it out on my kite if the weather gets nicer (which will not be in the comming days according to the forecasts), to test it on my kap rig with my most often used parameters (as above, but with screen off, triggered by usb). As one burst of shots now almost takes 5s, I'll also have to check how to set the timing of the usb-trigger to avoid taking pictures while the rig is moving.

Thank you very much for implementing the feature...

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 05 / September / 2015, 09:25:21
To help find the problem,  would you use the  Load default param values  menu option in the Script menu to reset all your parameters,  change only the  Total Shot (0=infinite)  setting to [ 3 ] , and then run the script and report what happens?
No difference. Camera takes 3 shots and hangs.

I just tested with four different cameras (A1200, G10, S100, Powershot N) using the configuration I described and I still can't reproduce your issue.   

To make it more "interesting",  the code that runs after the last message you show in your log :

Code: [Select]
2015Sep05 01:55:18    Logger : log file updated.is identical to the code in v3.5 (that you report as working).

One thing that has changed between v3.5 and v3.6 is that the script has become a little larger.  I did a quick scan of the porting thread for the ixus220_elph300hs and it does not seem to have a lot of memory compared to some other cameras.  Let's try a "loader" script - a small script that loads a larger script such that it takes up a lot less memory.  This will no longer be needed in CHDK 1.4.0 (when it finally gets released) but will work for 1.3.0.   Simply install the loader script like you would any other script on your SD card (in the same folder as the kap_uav.lua script) and run it. 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 05 / September / 2015, 09:32:18
As I was running an older chdk version (chdk 1.3.0-3416), I upgraded to the latest version (4228) and tested again.
Thanks for that note.   The script tries to check that the CHDK version used is new enough but I must have missed updating that check when I added the get_sd_over_modes( ) call.  I'll fix that in the official release.

Quote
the camera takes almost continously pictures: taking an writing the pictures to memory card is indeed not very fast on my little camera
The best most Powershots will do taking normal picture (i.e. not in continuous or Canon burst modes) is about 2 seconds per shot.  Cheap ones are a little slower than expensive models but not by much (a few 1/10s of a second maybe).  The script tried to take all three bracketing shots as quickly as possible by holding the "half press" down and using the initial exposure and focus info to set exposure for all three shots.  But it really can't make the camera work any faster than that.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: azery on 05 / September / 2015, 11:13:36
I do not think the speed (or lack thereof) will be an issue.

On the other hand, I could try to use it as an excuse to get a better camera :-)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: M141 on 06 / September / 2015, 17:07:25

One thing that has changed between v3.5 and v3.6 is that the script has become a little larger.  I did a quick scan of the porting thread for the ixus220_elph300hs and it does not seem to have a lot of memory compared to some other cameras.  Let's try a "loader" script - a small script that loads a larger script such that it takes up a lot less memory.  This will no longer be needed in CHDK 1.4.0 (when it finally gets released) but will work for 1.3.0.   Simply install the loader script like you would any other script on your SD card (in the same folder as the kap_uav.lua script) and run it.

That's it! Now it works :D Thanks waterwingz! I tried multiple times with different settings and no more freezing. Script seems to work very well and can't wait to try it in air soon. Today couldn't because of bad weather and raining.

Btw. is there any drawbacks using this loader?

ps. Extra thx for pm reminding :)

Regards Jani
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / September / 2015, 17:22:49
Btw. is there any drawbacks using this loader?
None beyond the complication of needing two files for one program.  And that's why the loader functionality is now built into the Lua script engine by default in CHDK 1.4.0.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: dowallin on 14 / September / 2015, 17:10:17
Greetings. I'm using an S100 for UAV work. I just loaded the KAP_UAV.lua (version 3.6) Exposure control script and also the kloader.lua script. I'm using CHDK 1.3.0.4245.

I can get it to run (with or without using kloader) but I have two problems:

1.Focus: with the Focus@Infinity set to either [ ] or

2. Shot Interval: I can't seem to take photos any faster than once every 4 seconds or so. I've tried setting the shot interval to 2 and I've also tried setting it to "Fast". Either way, the best I can get is an interval of about 4 seconds. This simple isn't fast enough to get overlapping photos with the fixed-wing UAV that I'm using. Note that I've also tried the basic Interval.lua script but this also gives me a shot interval of about 4 seconds.

My guess is that these two issues may be related in that refocusing every shot takes time and may result in the longer shot interval? I'm flying at 400 feet above ground level so locking the focus at infinity would be fine I'd think.

Any suggestions would be greatly appreciated!

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 14 / September / 2015, 21:15:24
1.Focus: with the Focus@Infinity set to either [ ] or
  • distant images are quite blurry, yet close up images (things within ~12 inches) are quite sharp. After stopping the script, I get a brief confirmation onscreen of key parameters and regardless of whether the Focus @ Infinity option is set to [ ] or
  • , it always tells me that focus is set to infinity. But the images are NOT consistent with this. Again, photos of distant landscapes are blurry and photo consisting only of things close in are quite sharp. I have all of the AF settings set to off (using the Canon menu) and I've also shut off the Image stabilization feature.
Getting an S100 to focus at infinity using CHDK has been an ongoing issue. 
http://chdk.setepontos.com/index.php?topic=12062.70 (http://chdk.setepontos.com/index.php?topic=12062.70)
It was  so bad that I bought an S100 myself (refurbished so the price was right) just so I could work on the problem. My S100 turned out to have no such problems and focuses well with the  Focus @ Infinity [ * ]   setting.  Some other people have reported focus problem but others report no problem.  It's a mystery.

So the only thing I can suggest here is to not select the scripts focus at infinity option and instead use the built-in manual focus capability of the S100 and set it to infinity.

Update : you could try and verify that you have a "focus at infinity" problem by using the script to shoot from a stable position on the ground.  With the camera sitting still,  let it take a few of shots of some distant scene that's not moving using the script's Focus @ Infinity [ * ] option.   If those look good,  you might want to check that your camera's vibration isolation in its mounting on your UAV is adequate.   The S100 focus mechanism is prone to bad focus in the presence of vibration.

See : DYI Drones : Let's talk Canon Cameras (http://diydrones.com/forum/topics/lets-talk-canon-cameras)

Quote
2. Shot Interval: I can't seem to take photos any faster than once every 4 seconds or so. I've tried setting the shot interval to 2 and I've also tried setting it to "Fast". Either way, the best I can get is an interval of about 4 seconds. This simple isn't fast enough to get overlapping photos with the fixed-wing UAV that I'm using. Note that I've also tried the basic Interval.lua script but this also gives me a shot interval of about 4 seconds.
That's a bit slow for an S100.  I can get  a 2 second per shot rate quite easily with mine.  Two things that will change that is saving RAW/DNG images and using high ISO values ( >400 IIRC).   Also, if you do not have focus locked it will take a little longer to shoot each time.

If you have seen the "Fast" setting in the Shot Interval parameters then I assume you are running the v3.6 beta 15 version of the script?  That will also shoot in continuous mode if you have some way to control shooting from your R/C rig or flight controller.  It was tested and found to get about two shots per second using that feature.  Using a pixhawk flight controller we were even able to sync shooting to actual position over the ground.   I need to document how to set that up prior to the official release of 3.6
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: dowallin on 15 / September / 2015, 18:02:04
Thanks Waterwingz! Very helpful.

RE the focus@infinity issue: I have 5 S100s (long story) I took your suggestions and took a bunch of photos today from the ground. I used the same SD card with KAP_UAV loaded on it and ran it in each camera. All canon settings the same in all 5 cameras. Focus@infinity set to

The results were pretty clear. For 4 of the cameras, the distant images were sharp and the close-up was blurry but not super bad. For 1 camera, the distant images were blurry and the close-up images were sharp. I flew this camera last week in my Aeromao Aeromapper fixed-wing UAV and less than 5% or the images were sharp with the rest very poor. The week before I flew one of the other S100s and I'd say that 95-98% of the images were sharp and clear. In both cases I was using the older interval.lua script. My conclusion is that i have one "problem" camera. This camera has had a hard life. I crunched the lens in a previous crash and recently replaced the lens myself. This repair was surprisingly cheap ($25 for a new lens) and easy using online instructions. But it now seems likely that I either got a defective replacement lens or that I did something wrong in my first ever camera repair. Or maybe this is just one of those problematic S100s and that this is unrelated to my repair.

RE the trigger interval: After re-reading the camera settings posted on the KAP_UAV page, I noticed the "Review" setting. I had skipped over this one and had it set at the default 2 seconds rather than the 0 seconds specified in the KAP_UAV instructions. When I made this change, I'm now getting trigger intervals of around 2 seconds; just what I need.

I'm now eager to see if I can get the autopilot in my UAV to trigger the camera. My UAV uses the APM2.6 autopilot. I have previously tried following the instructions posted here to do this:
http://diydrones.com/profiles/blogs/apm-to-chdk-camera-link-tutorial (http://diydrones.com/profiles/blogs/apm-to-chdk-camera-link-tutorial)
or here:
http://planner.ardupilot.com/wiki/common-apm-to-chdk-camera-link-tutorial/ (http://planner.ardupilot.com/wiki/common-apm-to-chdk-camera-link-tutorial/)

I made the cable described here along with the script created by Event38 but could not get it to work.

I'll now try it using the KAP_UAV script. I assume that I do this by setting the USB Shot Control to One shot. Correct?

I'd be interested in hearing from others who have used this successfully.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 15 / September / 2015, 18:46:07
But it now seems likely that I either got a defective replacement lens or that I did something wrong in my first ever camera repair. Or maybe this is just one of those problematic S100s and that this is unrelated to my repair.
Does the problematic camera focus successfully at infinity on the ground with the camera in Autofocus mode?

One of my pet theories is that the auto focus mechanism adjusts the lens in a feedback loop to get the sharpest focus.  That lens position might not correspond to what the camera is calibrated to think is infinity.  As such, it will autofocus correctly and 99.9% of all camera owners will never know the distance calibration is inaccurate.  With your replaced lens mechanism, that might be what is happening?

Quote
I made the cable described here along with the script created by Event38 but could not get it to work.
AFAIK, that cable only sources 3.3V from the pixhawk,  which may not be enough to trigger your camera.  There is a long thread about this on the diydrone forum (http://diydrones.com/forum/topics/using-aux-pins-as-relays-for-chdk?commentId=705844%3AComment%3A2092854&xg_source=msg_com_forum) leading to this circuit that you can build yourself or source from tuffwing (http://www.tuffwing.com/store/store.html)
(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fapi.ning.com%2Ffiles%2Fyi0TCIBaEFVPNgGbR5HZ8FObU-5yANEEySzvU%2ArtZZPz8HJFY3RqyylUyS7g2hcNrOs0MBdDjE8rTini5YPz1vdMuuK8SaF7%2FCanon5vTriggerCircuitReuben.JPG&hash=f8eb23ae9378995a9b3ec4cffd6e9246)
Quote
I'll now try it using the KAP_UAV script. I assume that I do this by setting the USB Shot Control to One shot. Correct? 
There are several ways to interface a flight controller to the script  using the USB Shot Control Setting :
If one shot every two seconds is good enough for what you want,  any mode will do.  To get one shot per second or faster you really need the Shot Interval set to  Burst and  Pixhawk mode operational.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 15 / September / 2015, 19:55:20
Quote from: waterwingz
Quote from: dowallin
I made the cable described here along with the script created by Event38 but could not get it to work.
AFAIK, that cable only sources 3.3V from the pixhawk,  which may not be enough to trigger your camera.  There is a long thread about this on the diydrone forum (http://diydrones.com/forum/topics/using-aux-pins-as-relays-for-chdk?commentId=705844%3AComment%3A2092854&xg_source=msg_com_forum) leading to this circuit that you can build yourself or source from tuffwing (http://www.tuffwing.com/store/store.html)
[SNIP]
WW, I believe dowallin isn't using a pixhawk, but an APM 2.6. I believe the APM hardware has 5v relays, so no circuit is needed for his hardware.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: dowallin on 17 / September / 2015, 20:22:41
Thanks for the feedback Waterwingz and Naccio!

RE my "problem" camera: Yes, ground-based photos on Auto (with AF settings on) produce sharp photos at infinity and close up as well. So maybe this is consistent with your theory? But not sure that I'll be able to use this camera in my UAV. As I said, in my last flight with this camera and using the older "interval.lua" script and with the camera on Auto (with all AF settings on) I got lousy photos. Do you have any ideas to "fix" the problem?

RE attempting to use KAP_UAV linked to my APM2.6 for Distance-based triggering: I can't get it to work.

I have my camera running KAP_UAV with:
Shot Interval: Fast
USB Shot Control: One Shot
USB Timeout: (I've tried both 0 and 1)

On the CHDK, Main menu->CHDK Settings->Remote Parameters -> Enable Remote setting is checked.”

I start KAP_UAV and get a "Waiting on USB" message. But the lens remains closed and no pictures are taken.

Backing up, here is what I've done:

 I made the cable based on instructions here:
1. http://diydrones.com/profiles/blogs/apm-to-chdk-camera-link-tutorial (http://diydrones.com/profiles/blogs/apm-to-chdk-camera-link-tutorial)

Servo plug connected to A9 on my APM2.6.

I've also referred to these two pages for additional set up info:

2. http://planner.ardupilot.com/wiki/common-apm-to-chdk-camera-link-tutorial/ (http://planner.ardupilot.com/wiki/common-apm-to-chdk-camera-link-tutorial/)

3. http://planner.ardupilot.com/wiki/common-camera-shutter-with-servo/#shutter_configuration_with_apm_2x (http://planner.ardupilot.com/wiki/common-camera-shutter-with-servo/#shutter_configuration_with_apm_2x)

I'm stumped. One thing that was a bit confusing from these 3 pages. Page #1 talks about going into the Full Parameters List in the Config/Tuning tab and entering several parameters, which I've done. And, as suggested for testing purposes, I've set the Cam_Trigg_Dist to 1. Zooming in on the Flight Data page in Mission Planner, I can see my plane "wandering" by several meters every few seconds due to GPS error. So this should be enough to trigger the camera.

Webpages #2 and #3 also mention going to the Camera Gimbal Configuration Screen and selecting RELAY in the Shutter dropdown list. I've done this, HOWEVER, I note that if I go to any other page in Mission Planner and then come back to the Camera Gimbal Configuration Screen, my selection of RELAY on the Shutter dropdown list seems to be lost. Maybe this is my problem? Is there something that I need to do to lock or save my selection of RELAY?

I'd be most grateful for any suggestions that you might have.

Regards,


 


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 17 / September / 2015, 22:04:44
Do you have any ideas to "fix" the problem?
If AF works at "infinite" distance, then it's possible you can get the distance it thinks it's focused at using get_focus() or the DOF calculator OSD and set it later using set_focus().

Alternately, you might be able to AF at a distant object and set AF Lock.

Integrating either option with waterwingz script (edit: if they work, which is not a given) is left as an exercise ;)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / September / 2015, 22:23:01
RE my "problem" camera: Yes, ground-based photos on Auto (with AF settings on) produce sharp photos at infinity and close up as well. So maybe this is consistent with your theory?
Thanks for that update.  I continue to think my theory about CHDK being able to focus a camera at infinity is pretty much determined by whether the built-in Canon focus distance information is correct.  And that Canon AF does not use those values to pick the best focus.

Quote
But not sure that I'll be able to use this camera in my UAV.
Well,  you do have four more .....

Quote
As I said, in my last flight with this camera and using the older "interval.lua" script and with the camera on Auto (with all AF settings on) I got lousy photos. Do you have any ideas to "fix" the problem?
Simply answer?  Don't use interval.lua.  That script was purposely included in the default CHDK build several years ago as the simplest example of an intervalometer script.  And so that's what it does - shoots in AUTO mode at a defined interval.

OTOH,  kap_uav.lua works very hard to shoot at the highest possible shutter speed for the range of ISO values you are comfortable with.   Over the last couple of years,  a few more features have been added.  Okay, more than a few - it's probably one of the top 20 CHDK scripts in terms of sophistication. But fundamentally all that is extra and it's about getting the best exposure / focus possible on a moving platform.


Quote
RE attempting to use KAP_UAV linked to my APM2.6 for Distance-based triggering: I can't get it to work.
Sorry .. not sure I can help here in a CHDK forum.  The script works AFAIK - how your flight controller works is virgin territory for me.  Still,  I'm willing to try and help.

Quote
I have my camera running KAP_UAV with:
Shot Interval: Fast
USB Shot Control: One Shot
USB Timeout: (I've tried both 0 and 1)
Sound okay.   You might set USB timeout to something like 10 seconds during testing but 0 (or none) should work too.

Quote
On the CHDK, Main menu->CHDK Settings->Remote Parameters -> Enable Remote setting is checked.”
The script does not care what you set in the CHDK Menus.   It will configure things as needed for it to run and then reset things when done to match your CHDK menu settings.

Quote
I start KAP_UAV and get a "Waiting on USB" message. But the lens remains closed and no pictures are taken.
Given your settings,  that says that the script is pretty much waiting for any  0V to 5v to 0V transistion on the USB +5V pin bfore it will start.   If it's stuck there ... it's not seeing the signal.

Quote
Backing up, here is what I've done:
 I made the cable based on instructions here:
1. http://diydrones.com/profiles/blogs/apm-to-chdk-camera-link-tutorial (http://diydrones.com/profiles/blogs/apm-to-chdk-camera-link-tutorial)
Do you have a volt meter (or other testing device like an oscilloscope) that can confirm that the flight controller is actually sending signals to the cameras?

Quote
Servo plug connected to A9 on my APM2.6.  I've also referred to these two pages for additional set up info:
2. http://planner.ardupilot.com/wiki/common-apm-to-chdk-camera-link-tutorial/ (http://planner.ardupilot.com/wiki/common-apm-to-chdk-camera-link-tutorial/)
3. http://planner.ardupilot.com/wiki/common-camera-shutter-with-servo/#shutter_configuration_with_apm_2x (http://planner.ardupilot.com/wiki/common-camera-shutter-with-servo/#shutter_configuration_with_apm_2x)
I'm stumped. One thing that was a bit confusing from these 3 pages. Page #1 talks about going into the Full Parameters List in the Config/Tuning tab and entering several parameters, which I've done. And, as suggested for testing purposes, I've set the Cam_Trigg_Dist to 1. Zooming in on the Flight Data page in Mission Planner, I can see my plane "wandering" by several meters every few seconds due to GPS error. So this should be enough to trigger the camera.
Webpages #2 and #3 also mention going to the Camera Gimbal Configuration Screen and selecting RELAY in the Shutter dropdown list. I've done this, HOWEVER, I note that if I go to any other page in Mission Planner and then come back to the Camera Gimbal Configuration Screen, my selection of RELAY on the Shutter dropdown list seems to be lost. Maybe this is my problem? Is there something that I need to do to lock or save my selection of RELAY?
Sorry .. I have no knowledge about APM setup so I can't help more at this point.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / September / 2015, 22:49:16
If AF works at "infinite" distance, then it's possible you can get the distance it thinks it's focused at using get_focus() or the DOF calculator OSD and set it later using set_focus().
We've been down that route several times unsuccessfully in the Setting focus from scripts or menus (http://chdk.setepontos.com/index.php?topic=11078.0) forum thread.

Quote
Alternately, you might be able to AF at a distant object and set AF Lock, Integrating either option with waterwingz script (edit: if they work, which is not a given) is left as an exercise ;)
Early versions of the script did just that.  You were supposed to point the camera at a distant object when you started the script and it would do a set_aflock( ) at that point to lock the focus.  Would not be hard to add that back as a customized hack - not sure I'd want it as a supported feature though.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 18 / September / 2015, 01:29:57
Quote from: dowallin
RE attempting to use KAP_UAV linked to my APM2.6 for Distance-based triggering: I can't get it to work.
To test your setup you will need a voltmeter. The idea is to configure your APM to raise relay A9 to 5v for 1 second whenever the GPS senses a 1m movement. In order to do this you will configure everything entirely from the "full parameter list" screen, as these are the real values read by APM (the other configuration screens modify these values and show you "pretty" descriptions).

Params values needed:
CAM_TRIGG_TYPE: 1 (relay)
CAM_DURATION: 10 (1 second)
CAM_TRIGG_DIST: 1 (shoot when the plane moves 1 meter)
CAM_RELAY_ON: 1 (raise voltage when it moves 1m)
RELAY_DEFAULT: 0 (default state for the relay is off)
RELAY_PIN: 13 (use relay A9 to signal the camera)

In the "full parameter list"screen, whenever you modify a parameter, you need to write the modified values to the APM (through the button labeled "write params"), if you don't do this your changes will not affect anything.

Once you configure your APM with these values, you must arm it, and test the "s" and "-" pins of the A9 relay with a voltmeter. Whenever the APM senses a 1m movement it should send 5v for 1 second.

Please do this and report your results.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / September / 2015, 10:19:04
CAM_DURATION: 10 (1 second)
CAM_TRIGG_DIST: 1 (shoot when the plane moves 1 meter)
Is this actually going to take a shot once per meter?  The S100's maximum shot rate (when not in continuous mode) is about one shot every two seconds.   That would mean the aircraft needs to be moving slower than 30 meters/minute  (or 1.8 kph).  Can a fixed wing fly that slow over the ground without a huge headwind?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 18 / September / 2015, 11:41:04
Quote from: waterwingz
Is this actually going to take a shot once per meter?  The S100's maximum shot rate (when not in continuous mode) is about one shot every two seconds.   That would mean the aircraft needs to be moving slower than 30 meters/minute  (or 1.8 kph).  Can a fixed wing fly that slow over the ground without a huge headwind?
This is only to test if his APM hardware outputs 5v on the relay pins, to start troubleshooting. I used 1m to take advantage that the GPS drifts when inside, so the relay fires without need to move the platform.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Cereal_Killer on 21 / September / 2015, 16:09:23
Hello folks, new here (well I joined at the start of the summer flying season but dont recall posting yet)...

I'm using KAP&UAV on 3 different cameras, a pair of NDVI modded A2200's and [my main drone camera] an A2300.

I have just built myself a USB switch using an arduino nano (accepts the radios ch9 servo output and toggles the USB plug on when the servo PWM pulse is <1500uSec). This all tests fine using other devices (also using the USB plug on pin D13 so I have visual confirmation of it switching on / off). The issue is I cant figure out how to make KAP&UAV do what I'm after using the USB remote.

I have read the wiki several times, I've also done a lot of experimenting (including getting the camera stuck in "waiting for USB" mode so bad I had to format the card and do a full reinstall lol).




Let me tell you how I want it to work and you can tell me if it's even possible:
(Please see my edit below)

1.I'd like to set it up on the ground, camera on but lens retracted. I dont mind manually starting the script but I'd like the lens to stay retracted during take off till power is applied.

2. I'd like it to monitor for USB power, once power is applied I'd want it to immediately extend the lens and start snapping pictures. I have time limit and number limits both set to zero.

3. I'd like it to take pictures (at the interval defined in the setup [I prefer 2sec]) untill I switch the USB power off via radio command, at this point I'd like it to retract the lens. I dont mind if the camera stays on as long as the lens is retraced for protection during landings.

*I would also like to be able to have the display off to save battery power, my 27" motor to motor tricopter is capable of staying in the air for >20 minutes and I often make 4 or 5 packs worth of flights per job. I see this setting in the script setup menu but when I tick it to turn the display off I get even more confused about what it is [or isnt] doing.


So far [when manually starting the script) I'm able to get it to wait for USB power to begin taking the pictures however it extends the lens right away. I can not get it to stop taking them when power is removed. It also doesnt retract the lens (I would assume that's obvious but just want to post as much info as I have).

I have tried all three USB trigger options, I have also tried it with the main remote box checked and unchecked. The instructions (please no one take this as offensive, they are written very well) are written for someone who already knows how to use CHDK and makes several assumptions that the user already knows how to do some stuff. I do not, I am totally new to programmable cameras and using CHDK and this kind of stuff... If someone could walk me threw what I need to setup / change / enable / disable to get it to function how I'm wanting I would be extremely greatful! Thanks in advance and thanks for everything so far!


Edit:
I have done some reading, I've now got the A2200's functioning exactly as I describe wanting them to behave above. The issue I'm having now is that the A2300 will NOT retract it's lens after I remove USB power. It stays in the script running and "waiting for USB power" phase. It doesnt power down and retract the lens. This is the most important part as I need the lens to be protected during landing.

The A2200 does this, it takes about half dozen more pictures after I cut the power but it does shut down and retract the lens. I have copied all settings from the A2200's over to the A2300 yet nothing I do get's it to shut all the way down and pull the lens in.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Cereal_Killer on 21 / September / 2015, 16:53:40
Here is a video I took of it not working. Maybe I'm just making some basic mistake...

http://youtu.be/wY9VxTUdO-U (http://youtu.be/wY9VxTUdO-U)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / September / 2015, 18:01:51
The issue I'm having now is that the A2300 will NOT retract it's lens after I remove USB power. It stays in the script running and "waiting for USB power" phase. It doesnt power down and retract the lens. This is the most important part as I need the lens to be protected during landing.
Lens retraction requires that the Lens Retract time in the Canon menu be set to 0 sec.  Do you have it that way on your A2300? (I'm guessing it is set that way on your other cameras).

I read the rest of your post but can't tell if you have any other issues?   If so,  post here and please attach a copy of the KAP.LOG file from the top level folder of your SD card.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: dowallin on 24 / September / 2015, 19:53:06
Naccio,
OK I've run the test you suggested. On the "Full Parameters List page, I've set all of the parameters as you instructed, EXCEPT, I can't find the "CAM_RELAY_ON:" parameter. See attachment for my options in the "CAM" and "RELAY" section of the "Full Parameters List" page. I hit the "Write Parameters" button to save these selections. I then hooked up a voltmeter directly to the Signal ("S") and ground (-) pins of A9 on the APM.

Periodically, I did get a 5 volt reading as the GPS coordinates bounced around. So, it appears that I have all the parameters set correctly (even without the "CAM_RELAY_ON" parameter).

Next step is to hook up the camera. With the KAP_UAV script set up as previously instructed, I depress the shutter release. When I do so, the lens does not open but on the LCD on the back of the camera, I get a message in red that says "Waiting on USB, Press Menu to Exit".

So, this suggests to me that I've started KAP_UAV correctly but no signal is reaching the camera right? Or is there something else that needs to be done with the settings or buttons on the camera? The only other thing I can think of is that perhaps I did not make the cable correctly. To test this I'd need to hook up the voltmeter to the pins on the mini-USB but doing this is challenging due to the tiny size of everything and, I'm not sure which pins are supposed to have this 5 volt signal. Any ideas?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 24 / September / 2015, 20:12:37
With the KAP_UAV script set up as previously instructed, I depress the shutter release. When I do so, the lens does not open but on the LCD on the back of the camera, I get a message in red that says "Waiting on USB, Press Menu to Exit". So, this suggests to me that I've started KAP_UAV correctly but no signal is reaching the camera right?
Correct.

That's exactly what is supposed to happen.   

You have succesfully loaded, configured, and started the script.  And the script is waiting intently for something (pretty much anything) to happen at the +5V power pin on the USB port.  If it sees that, it will continue and new messages will appear on the LCD.

Quote
Or is there something else that needs to be done with the settings or buttons on the camera?
Nope.  Nothing at all.  Assuming you have still used the settings reported earlier :

Shot Interval: Fast
USB Shot Control: One Shot

Quote
The only other thing I can think of is that perhaps I did not make the cable correctly. To test this I'd need to hook up the voltmeter to the pins on the mini-USB but doing this is challenging due to the tiny size of everything and, I'm not sure which pins are supposed to have this 5 volt signal. Any ideas?
I have a really simple script that simply reports the state of the camera USB +5V on the camera LCD.  Nothing to setup, nothing to configure, nothing to go wrong. Pretty much a "poor man's" voltmeter but if it does not see anything happening,  either your cable or flight controller setup is wrong.   I'll try to find and post it here.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 24 / September / 2015, 20:49:14
Naccio,
OK I've run the test you suggested. On the "Full Parameters List page, I've set all of the parameters as you instructed, EXCEPT, I can't find the "CAM_RELAY_ON:" parameter. See attachment for my options in the "CAM" and "RELAY" section of the "Full Parameters List" page. I hit the "Write Parameters" button to save these selections. I then hooked up a voltmeter directly to the Signal ("S") and ground (-) pins of A9 on the APM.

Periodically, I did get a 5 volt reading as the GPS coordinates bounced around. So, it appears that I have all the parameters set correctly (even without the "CAM_RELAY_ON" parameter).
Excellent. Your APM is configured correctly, and as it outputs 5v you only need your custom USB cable to connect your APM to your camera.

Quote
Next step is to hook up the camera. With the KAP_UAV script set up as previously instructed, I depress the shutter release. When I do so, the lens does not open but on the LCD on the back of the camera, I get a message in red that says "Waiting on USB, Press Menu to Exit".

So, this suggests to me that I've started KAP_UAV correctly but no signal is reaching the camera right? Or is there something else that needs to be done with the settings or buttons on the camera? The only other thing I can think of is that perhaps I did not make the cable correctly. To test this I'd need to hook up the voltmeter to the pins on the mini-USB but doing this is challenging due to the tiny size of everything and, I'm not sure which pins are supposed to have this 5 volt signal. Any ideas?
Your cable is probably not built correctly. If you look at the mini USB plug in such a way that you see the connectors, you must build it so that the "S" pin on relay A9 is connected to the leftmost USB connector (pin 1 on the attached image), and the "-" pin on relay A9 is connected to the rightmost connector (pin 4 on the attached image). I would suggest using a continuity tester (most digital voltmeters have them, the voltmeter buzzes when its two contacts are shorted) to check.

If you can verify that your cable is built correctly but still can't get it to work, you will have to ask WaterWingz for further assistance, as he probably knows a bit more than I do about the KAP/UAV script. :lol

PS: WW, is troubleshooting APM and Pixhawk hardware too off-topic for this thread? I don't want to break rules, just trying to help...
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: dowallin on 25 / September / 2015, 19:01:38
Naccio,
Success! The idiot who made up the cable (me) did a lousy soldering job. The ground wire broke. I redid the cable and everything seems to be working great! I plan to fly tomorrow. I can't wait to give it a try and I'll let you know how it works.

Thanks very much for all of your help and patience in trouble shooting this issue.

Sincerely
Title: KAP & UAV Exposure Control Intervalometer Script : release v3.6 is available
Post by: waterwingz on 26 / September / 2015, 11:20:33
I've decided that the beta phase of release 3.6 of this script is over. 

As such,  I've updated the file from the script download link (https://app.box.com/files/0/f/0/1/f_11162762030) with the official v3.6 release.

Principal changes are the addition of exposure bracketing, continuous shooting modes, and USB remote support for a direct pixhawk / flight controller sync to position over the ground.

I've updated the script's wiki page (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script) and am adding a new section to describe all the USB modes.

Next release of this script other than bug fixes will await the official release of 1.4.0 (http://chdk.wikia.com/wiki/Releases#1.4) (so I can take advantage of all of the new scripting goodies).
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 28 / September / 2015, 20:42:39
WW, I can't believe how advanced this script has gotten. I cannot thank you and the other CHDK developers enough.
Title: Canon Powershot S110 using KAP 3.6... Blurry images from flying wing.
Post by: kona on 06 / October / 2015, 23:11:26
Thank you for creating such a great script.  It super charged my S110.
I was wondering if it's possible to adjust a few settings to get a sharper image from my camera.  I'm flying a winged plane between 50-100 meter grid missions.  It seems to me that the adjustments are off a bit.  I followed the instructions for the camera and set the Kap 3.6 settings to burst, pixhawk and checked focus on infinity.  All other settings are default.  Any suggestions to get a sharper image from my Canon S110 would be greatly appreciated.  I attached a photo and kap.log file.  Thank you again.
Title: Re: Canon Powershot S110 using KAP 3.6... Blurry images from flying wing.
Post by: waterwingz on 06 / October / 2015, 23:37:29
It seems to me that the adjustments are off a bit.  I followed the instructions for the camera and set the Kap 3.6 settings to burst, pixhawk and checked focus on infinity.  All other settings are default.  Any suggestions to get a sharper image from my Canon S110 would be greatly appreciated.  I attached a photo and kap.log file.
Thanks for including the log file.  Actually, your one posted image does not look too bad to me.  Are some of the others you took better than the others or are they all about the same?

A couple of things I see in the log file (which could be bugs in the log file I suppose)


Unrelated to camera settings,  your vibration mount can make a big difference.  What are you doing there ?

Finally,  here's a note about Canon cameras - and specifically the S90-S120 series : Let's Talk Canon Cameras (http://diydrones.com/forum/topics/lets-talk-canon-cameras)


Note :  I've asked for this thread to be merged into the main  kap_uav.lua  (http://chdk.setepontos.com/index.php?topic=10822)thread


edit : typo - disabled rather than disabled should read  disabled rather than enabled
Title: Re: Canon Powershot S110 using KAP 3.6... Blurry images from flying wing.
Post by: kona on 07 / October / 2015, 00:22:59
Thank you so much for the fast reply.  Most of my photos look like the one I posted.  Most of the photos are about the same as what I posted.  I would like to get just a little sharper image.

I will update the settings you suggested.  I wonder why the focus on infinity shows disabled when there is a dot next to it.  You are talking about the setting in the KAP script, right?

I have the camera mounted to a foam block that is velcroed to coroplast.  The camera also shoots through a 1- 1/2 square piece of double strength clear glass (approx 1/8" thick).   This glass is mounted between the camera lens and the bottom of the plane.  Perhaps I need to redesign my camera mount to help cut down on vibration.

I really appreciate your suggestions.  I look forward to taking more photos in the morning.  Thanks again.
 
Title: Re: Canon Powershot S110 using KAP 3.6... Blurry images from flying wing.
Post by: waterwingz on 07 / October / 2015, 20:03:17
I wonder why the focus on infinity shows disabled when there is a dot next to it.  You are talking about the setting in the KAP script, right?
My mistake - your setting are correct.    The log file you posted has data from 27 different runs of the script.  In the first 16 of those,  you had  "Focus @ Infinity" disabled - in the last 11 runs you had it enabled.
Title: Canon Powershot S110 using KAP 3.6... Blurry images from flying wing.
Post by: kona on 05 / November / 2015, 00:29:55
I'm still having trouble getting the script to be in focus with my Canon S110.  If I use autofocus the photos are good.  If I turn off autofocus and set the radial button in the script to focus on infinity the photos are slightly blurred.  See attachments.  I would leave autofocus on but I get less photos during the mission.  Maybe I'm missing a step?  I already tried going into the camera settings and manually set the camera to infinity prior to flying but end up with the same slightly blurred photos.

Any help would be greatly appreciated.

Thank you.
Title: Canon Powershot S110 using KAP 3.6... Blurry images from flying wing.
Post by: kona on 05 / November / 2015, 00:38:17
Forgot to include the KAP.LOG
Title: Re: Canon Powershot S110 using KAP 3.6... Blurry images from flying wing.
Post by: waterwingz on 05 / November / 2015, 09:48:54
Maybe I'm missing a step? 
I don't think you have missed anything,  but see my last comment below.

It is my opinion that we are dealing with a fundamental limitation with trying to use MF on Powershot cameras.  I've suggested my theory about this before - your most recent observations seem to add confirmation.

Quote
I already tried going into the camera settings and manually set the camera to infinity prior to flying but end up with the same slightly blurred photos.
This is the key.  It's not related to the script settings if  using Canon MF mode also has the same problem.

Simply put, the distance values (especially infinity) that you enter in Canon MF mode (or via a CHDK override) don't really work well.  The camera focus mechanism is not well calibrated,  if it's even calibrated at all.  So when you give the camera a focus distance,  it moves the lens to a fixed position that it looks up in a table and interpolates for.   If this position is not correct, then the focus will not be good.   In the case of your pictures,  I would suggest the focus is close but not perfect, which is consistent with my theory.

So why does autofocus work so much better?  Well, in autofocus mode the camera does not care about or use distance. It simply moves the lens focus mechanism until it finds the sharpest focus (based on "crispness" of observed image edges at the pixel level).  The selected focus is then at the best position, but distance is not known or needed.

Quote
I would leave autofocus on but I get less photos during the mission.
So I see you are using the new pixhawk mode?    I have not completed the documentation on that so I'm curious about how you have it setup. Thank for posting the log file.

You should be able to leave the camera in autofocus mode when setup for pixhawk shooting and only the first shot in a shooting sequence will focus.  The rest will use the focus & exposure settings from the first shot and you should be able to get about two shots per second that way. 

Also, from the log, I see that you have the camera set to Canon continuous shooting mode (which is fine) but I wonder what happens if you leave it in single shot mode, set the script's shot interval to zero in the script, and let the script manage shooting continuously?  You should get the same frame rate but the camera might handle focus resetting differently ?



Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 06 / November / 2015, 10:02:37
Hey WW! Quick question: When using the new Pixhawk mode, I just have to connect the camera to one of the RC out channels, right? If that is the case, with a few script modifications (amount of PWM pulses needed for each action) I could connect it directly to the RC receiver and control the camera just with my RC transmitter, bypassing the pixhawk? That would mean the script would be ready to be used by any kind of flight controller, as they all have at least four RC PWM outputs...
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / November / 2015, 11:40:48

Hey WW! Quick question: When using the new Pixhawk mode, I just have to connect the camera to one of the RC out channels, right?
Correct.

Quote
If that is the case, with a few script modifications (amount of PWM pulses needed for each action) I could connect it directly to the RC receiver and control the camera just with my RC transmitter, bypassing the pixhawk?

That will not work - good try though. 

The pixhawk setup that we discovered somewhat by trial and error generates pulses in the range of about 4 mSec to 20 mSec, which CHDK can discriminate if high precision USB timing is enabled.   The servo output of your RC radio generated pulses shorter than 2 mSec, too fast for CHDK to read.

Quote
That would mean the script would be ready to be used by any kind of flight controller, as they all have at least four RC PWM outputs...
I did some experimenting with this to try and get CHDK to read servo outputs directly. I was able to almost discriminate three stick positions - down, center, up - but it was not extremely reliable.  Doing some averaging over multiple pulses helped with that but it was very processor intensive and would likely not have worked well with low end cameras.  I'll see if I can find the post where I reported the results.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: c_joerg on 06 / November / 2015, 12:57:44
I’m not sure if this is helpful:

I have also an S110 and manual focus setting does not work very well.

Autofocus works very well. Only think which I notice: I got absolute unrealistic values with get_focus, like object distance is 4m, I got 1.2m with get_focus. This is not happens on my G1x. These values are more realistic.

Also when I look in the EXIF Data on my S110 pictures with infinity objects. All pictures are sharp. But I don’t find infinity values in EXIF (May be 1 in 200 pictures).

This is totally different on my IXUS500HS, G1X and SX230HS. Here I find a lot of infinity values in EXIF.
Setting manual focus (like hyperfocal distance) works very well on G1X and SX230HS, but not on S110.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 06 / November / 2015, 13:06:48
The pixhawk setup that we discovered somewhat by trial and error generates pulses in the range of about 4 mSec to 20 mSec, which CHDK can discriminate if high precision USB timing is enabled.   The servo output of your RC radio generated pulses shorter than 2 mSec, too fast for CHDK to read.
Ok, so you modify the pixhawk settings to produce out of spec RC PWM values... Did anybody check with the Pixhawk developers if that could have any repercussions on the pixhawk hardware (physical damage, I suppose there is very low chance) or software (sofware crash midflight  :'()?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / November / 2015, 15:22:54
Did anybody check with the Pixhawk developers if that could have any repercussions on the pixhawk hardware
No.

Although I did read through the source code - it's open source and available for anyone to download.  From what I could see, using the values we "discovered" should not cause any issues.

One of the kap_uav.lua users was trying unsuccessfully to engage in a dialog about the application with the pixhawk team.  If you have a contact there feel free to reach out to them?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / November / 2015, 19:14:38
I have also an S110 and manual focus setting does not work very well.
And yet manual focus seems to work really well on my S100.   

Other people I have talked to who own several S100's report at MF works well on some but not others.   

Like I said earlier,  I believe it's something that is not well calibrated.  If you get lucky, then the MF value you specify sets the lens to the right position.  If you don't get lucky, it does not. 

It's possible that cameras in the more expensive G series are actually calibrated - or the lens mechanism does not need calibration.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 06 / November / 2015, 20:42:04
Although I did read through the source code - it's open source and available for anyone to download.  From what I could see, using the values we "discovered" should not cause any issues.
I tried to follow the code but couldn't get past the HAL. I suppose the important code will be on the PX4 middleware.

ardupilot/libraries/AP_Camera/AP_Camera.cpp
Code: [Select]
/// Servo operated camera
void
AP_Camera::servo_pic()
{
RC_Channel_aux::set_radio(RC_Channel_aux::k_cam_trigger, _servo_on_pwm);

// leave a message that it should be active for this many loops (assumes 50hz loops)
_trigger_counter = constrain_int16(_trigger_duration*5,0,255);
}

ardupilot/libraries/RC_Channel/RC_Channel_aux.h
Code: [Select]
/*
  set radio_out for all channels matching the given function type
 */
void
RC_Channel_aux::set_radio(RC_Channel_aux::Aux_servo_function_t function, int16_t value)
{
    if (!function_assigned(function)) {
        return;
    }
    for (uint8_t i = 0; i < RC_AUX_MAX_CHANNELS; i++) {
        if (_aux_channels[i] && _aux_channels[i]->function.get() == function) {
_aux_channels[i]->radio_out = constrain_int16(value,_aux_channels[i]->radio_min,_aux_channels[i]->radio_max);
            _aux_channels[i]->output();
}
    }
}

ardupilot/libraries/RC_Channel/RC_Channel.cpp
Code: [Select]
void RC_Channel::output() const
{
    hal.rcout->write(_ch_out, radio_out);
}

ardupilot/libraries/AP_HAL/RCOutput.h
Code: [Select]
    /*
     * Output a single channel, possibly grouped with previous writes if
     * cork() has been called before.
     */
    virtual void     write(uint8_t ch, uint16_t period_us) = 0;

Quote from: waterwingz
One of the kap_uav.lua users was trying unsuccessfully to engage in a dialog about the application with the pixhawk team.  If you have a contact there feel free to reach out to them?
Unfortunately I don't have any contacts. I did find that Lucas De Marchi is currently working on almost all the relevant sections of the APM code, and will try to contact him.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: eponymous on 12 / November / 2015, 14:47:03
It's possible that cameras in the more expensive G series are actually calibrated - or the lens mechanism does not need calibration.

On this related note, is the G-series then the least expensive line in which you don't have to worry about this problem with "infinity" possibly not really working correctly?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 12 / November / 2015, 18:50:22
It's possible that cameras in the more expensive G series are actually calibrated - or the lens mechanism does not need calibration.
On this related note, is the G-series then the least expensive line in which you don't have to worry about this problem with "infinity" possibly not really working correctly?
I really have no idea.  The G-series is the most expensive line of P&S cameras that Canon sells.  So it seems likely that if any of their cameras have accurate calibration of manual focus setting it would be those ones.  But I have no data (or easy way to collect any data) to support the proposition.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: kona on 19 / November / 2015, 13:16:48
It turns out that my S110 won't focus on infinity.  The lens calibration is off.  I tested two Canon S110 cameras with the exact same settings using KAP_UAV and the infinity button active.  One camera takes perfect photos and the other camera produces blurry photos.  Go figure...It wasn't the script.  It's the darn cameras.  Some are calibrated to work and some won't.

The KAP & UAV script and support is awesome!  Too bad I can't say that about the gear we use it in.

Thanks again for all you guys do.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / November / 2015, 21:02:23
It turns out that my S110 won't focus on infinity.  The lens calibration is off.  I tested two Canon S110 cameras with the exact same settings using KAP_UAV and the infinity button active.  One camera takes perfect photos and the other camera produces blurry photos.  Go figure...It wasn't the script.  It's the darn cameras.  Some are calibrated to work and some won't.
Thanks for reporting this.  It's very consistent with my theory that Canon P&S manual focus settings are often poorly calibrated - even on cameras that claim to offer MF capability.  And the reason you don't see this in autofocus mode is that the camera adjusts the lens position via a closed loop feedback system until it sees the sharpest image.  It has no concept or need for physical distance values.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 19 / November / 2015, 21:21:42
Just FWIW, prior to this http://chdk.setepontos.com/index.php?topic=12103.msg125325#msg125325 (http://chdk.setepontos.com/index.php?topic=12103.msg125325#msg125325) setting distances >64k on S100 through CHDK probably didn't work correctly. This would only affect CHDK overrides, it would not explain problems when setting the focus entirely through the Canon MF UI.

The Canon "focus at infinity" mode present in some Canon firmware is documented in the manuals as only being a suggestion.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / November / 2015, 21:28:20
Just FWIW, prior to this http://chdk.setepontos.com/index.php?topic=12103.msg125325#msg125325 (http://chdk.setepontos.com/index.php?topic=12103.msg125325#msg125325) setting distances >64k on S100 through CHDK probably didn't work correctly.
I've struggled with this.   Given the depth of field of these little camera lenses, and the concept of hyperfocal distance,  it seems strange that values  < 64K like 50,000 or 30,000 do not appear to give sharp focus out to infinity.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 19 / November / 2015, 21:37:43
I've struggled with this.   Given the depth of field of these little camera lenses, and the concept of hyperfocal distance,  it seems strange that values  < 64K like 50,000 or 30,000 do not appear to give sharp focus out to infinity.
I seem to have deleted my test shots, but the differences was pretty noticeable on sx160 at the long end of the zoom (~440mm equivalent)
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / November / 2015, 22:29:21
I seem to have deleted my test shots, but the differences was pretty noticeable on sx160 at the long end of the zoom (~440mm equivalent)
I was not trying to suggest that the bug was not an issue.  I'm just not sure it explains why some S100's work with CHDK SD overrides and others, using identical settings, do not?

Edit : I'll see if the two people I worked with on this who had suspect cameras using SD overrides can get them to work with the latest version of CHDK.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 20 / November / 2015, 01:53:20
I was not trying to suggest that the bug was not an issue.  I'm just not sure it explains why some S100's work with CHDK SD overrides and others, using identical settings, do not?
Sorry, I didn't mean to suggest that it completely explains it, only that it may have been one confounding factor.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 20 / November / 2015, 12:08:03
It turns out that my S110 won't focus on infinity.  The lens calibration is off.  I tested two Canon S110 cameras with the exact same settings using KAP_UAV and the infinity button active.  One camera takes perfect photos and the other camera produces blurry photos.  Go figure...It wasn't the script.  It's the darn cameras.  Some are calibrated to work and some won't.
Thanks for reporting this.  It's very consistent with my theory that Canon P&S manual focus settings are often poorly calibrated - even on cameras that claim to offer MF capability.  And the reason you don't see this in autofocus mode is that the camera adjusts the lens position via a closed loop feedback system until it sees the sharpest image.  It has no concept or need for physical distance values.
I wonder if anybody with those problem cameras has tried setting a much closer distance to get sharp pictures.

I already mentioned this, but (for example) my sx280 reaches infinity at around 1000 mm, setting native manual focus beyond that gives increasingly blurred pictures (that means, focus goes beyond infinity). This is at wide angle of course.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / November / 2015, 20:51:10
I wonder if anybody with those problem cameras has tried setting a much closer distance to get sharp pictures.  I already mentioned this, but (for example) my sx280 reaches infinity at around 1000 mm, setting native manual focus beyond that gives increasingly blurred pictures (that means, focus goes beyond infinity). This is at wide angle of course.
During testing,  we used a script to run the focus out from about 20cm to infinity in steps.   I'm trying to find the test photos - what you are suggesting is that the best focus at infinity might occur at 1 meter SD override value! That's certainly interesting. 

But confounding that information is the fact that the test on several cameras of the same model show that some cameras work correctly and some do not.  I suppose it could just be down to lack of calibration.

Update :  found one of the test sequences.   Sure enough, at wide angle with a 0.4 m SD override setting,  pretty much everything is in focus.  And this setting also seems to give the best focus for objects out at "infinity". As the focus setting moves out past 0.5 meters, the focus of everything quickly deteriorates.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OS401 on 06 / December / 2015, 15:44:32
Hi,

I have two Powershot A560 cameras that I have been trying to use this script on to do high altitude balloon photography this week, but have had trouble executing the script on both cameras. I had previously run this on an sd750 and was able to get that working fine.

Here are the steps I took:
1. Updated the firmware to CHDK version 1.3.
2. Added the kap_uav.lua file to the scripts folder
3. Made sure the SD card was in "locked" position

The problem I'm facing is once I enter alt mode and select kap_uav.lua, I see the following screen in the image:

The issue here is that unlike when I ran this on the sd750, I don't see any area to enter the parameters that I'd like to set for the duration of the script such as shot interval or target TV. There are no further options to scroll to below the line that says "._kap_uav.lua".

Has anyone had this issue before or know how I could solve it? Thanks in advance.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / December / 2015, 16:34:53
The issue here is that unlike when I ran this on the sd750, I don't see any area to enter the parameters that I'd like to set for the duration of the script such as shot interval or target TV. There are no further options to scroll to below the line that says "._kap_uav.lua".
There seems to be something wrong with the script file you are trying to load.   If you use the current version of the script,  you should see the words KAP UAV 3.6 in the Script screen - not ._kap_uav.lua   I'm guessing there is a file called ._kap_uav.lua on your SD card and it's not the  kap_uav.lua script you want to use (note the period & underscore at the start of the invalid filename.)

Delete the _kap_uav.lua file from the scripts folder and copy the file from this link :  kap_uav.lua (https://app.box.com/s/a5tbl1xasp8m3a57fclx)  there instead.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: zeno on 06 / December / 2015, 18:23:54
This is a Mac problem. OSX creates little files with names starting with a period - it's part of the spotlight search mechanism I think. Anyway on the Mac they are hidden files, but if you copy real file to a card, the hidden file gets copied too and the camera OS doesn't realise that it's meant to be hidden. It's a pain when scrolling through a directory on the camera - you have to skip over all these non-files.
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / December / 2015, 18:32:17
This is a Mac problem.
Thanks - I wondered about that. So the actual script file should be in the SD card - the OP just loaded the wrong file?

Quote
It's a pain when scrolling through a directory on the camera - you have to skip over all these non-files.

Or you could use the CHDK file browser to delete them.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 06 / December / 2015, 21:28:51
Ww...I updated to ver 3.6 and my previously functioning 330HS on ver 3.5 now will not save the pic... my Iris fires the script... it opens the lens and the red af beam lights... but no pic. I'm able to save a pic using the camera shutter release.
Perplexed.
I deleted my ver 3.5....would you have that version available for me to download so I can troubleshoot?

Your code is a work of art IMHO.

Tks
Dave
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OS401 on 06 / December / 2015, 21:50:42
Thanks so much Waterwingz and Zeno for the prompt response! You were both right, I had loaded the wrong script from my camera menu and by scrolling down further I found the correct script titled "KAP_UAV.LUA" instead of the previously mentioned one. It works great now.

Btw, my school's space balloon team used your script to get some great shots of the curvature of the earth, so we appreciate you sharing it.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / December / 2015, 21:51:38
Ww...I updated to ver 3.6 and my previously functioning 330HS on ver 3.5 now will not save the pic... my Iris fires the script... it opens the lens and the red af beam lights... but no pic. I'm able to save a pic using the camera shutter release.
Iris = flight controller? 

It would be good to know your setup - can you post the KAP.log file from the root folder of your SD card?

Quote
I deleted my ver 3.5....would you have that version available for me to download so I can troubleshoot?
attached

Quote
Your code is a work of art IMHO.
link > work of art (https://en.wikipedia.org/wiki/The_Scream)
(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fwww.sothebys.com%2Fcontent%2Fdam%2Fsothebys%2FEvents%2FMiscellaneous%2FMunch_320px.jpg&hash=8214e7b0b90108b69ded4b117b5fe257)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 06 / December / 2015, 23:14:22
Iris+ is a quad-copter uav from 3dr with a pixhawk controller. Attached the kap log.
Thanks for the 3.5 file.
Dave
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 07 / December / 2015, 18:02:15
WW- Update...
I'm not getting any pic saved using KAP 3.5 either. Really scratching my head now.  attached the latest KAP log update as well.
I need to go back to school on this apparently.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 07 / December / 2015, 18:31:41
WW - UPDATE #2.
The attached KAP - wtf happened file shows that with a setting change to "on/Off" apparently I then got the script to take the pic each time the USB was turned on - I "triggered" using a power strip and a phone charge attached to the camera.
Still not understanding what I'm doing, apparently.

Insight?

tks
Dave
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / December / 2015, 19:24:39
I'm not getting any pic saved using KAP 3.5 either.
Okay - finally had a chance to look at the logs.  There is a bunch of older log information from this summer showing successful shooting with KAP 3.5 (as well as some really old 3.4 log info from last winter).  So it was working with your camera at one point.

What I see in the log files is the script timing out while waiting for the shooting hook.  The relevent code snippet is this :
Code: [Select]
                hook_shoot.set(10000)
                press('shoot_full')
                wait_timeout(hook_shoot.is_ready, true, 2000, 10, "timeout on hook_shoot.is_ready") 
This part is a bit complicated to explain so I'm hoping reyalp will chime in later.  What is supposed to happen in each line is :

In the log I can see the timeout - the shot never gets to the hook and then no picture is taken.

So the question here is why does the press('shoot_full') not work? Or if it works, why does it not hit the hook?

I need to study this some more - nothing obvious comes to mind.  The log shows you are not using Canon continuous shooting mode - that was a possible issue.  I wonder if there is some other camera setup or mode that might be causing this?  After all, it did work a few month ago.  If the script didn't change and CHDK didn't change then it pretty much has to be something in the Canon setup that has changed.

Edit :  are you trying to test this indoors?  Possibly in a relatively dark room? The luminance values recorded in the log files are all very dark. Is it possible that the camera is just refusing to shoot as it's not getting enough light?
 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 07 / December / 2015, 21:37:47
Quote
This part is a bit complicated to explain so I'm hoping reyalp will chime in later.
Haven't really digested the code, but I noticed this in the log before the hook timeouts
Quote
2015Dec07 16:10:13    Mode:PLAY,Continuous_AF:0,Servo_AF:0
Suggests the camera hasn't switched to rec, which might explain the timeout. I would expect the shoot_full press to make it switch though, as long as the camera doesn't think USB is connected.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / December / 2015, 21:41:38

Quote from: reyalp
Suggests the camera hasn't switched to rec, which might explain the timeout. I would expect the shoot_full press to make it switch though, as long as the camera doesn't think USB is connected.
The script explicitly switches to shooting mode only when it is ready to shoot if you start it in playback.  Which is something you generally want to do when launching a kite or UAV.   The log file indicates when that happens.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 07 / December / 2015, 22:20:21
The log file indicates when that happens.
I'm probably missing something, but I don't see any "Mode switched to...", although it looks like switch_mode(1) should be called, and should print that line if it thinks it needed to switch.

Code: [Select]
2015Dec07 16:11:00    KAP 3.5 started - press MENU to exit
2015Dec07 16:11:00    CHDK 1.3.0-4152 ixus255_elph330hs 100f Apr 15 2015
2015Dec07 16:11:00    Mode:PLAY,Continuous_AF:0,Servo_AF:0
2015Dec07 16:11:00     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2015Dec07 16:11:00     Av:4.0 minAv:2.8 maxAv:8.0
2015Dec07 16:11:00     ISOmin:100 ISO1:400 ISO2:800
2015Dec07 16:11:00     Focus:OFF  Video:0 USB:1 Tmo:0
2015Dec07 16:11:00     AvM:2 int:4 Shts:0 Dly:0 B/L:0
2015Dec07 16:11:06    timeout on hook_shoot.is_ready
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / December / 2015, 22:33:01
I'm probably missing something, but I don't see any "Mode switched to...",
...
although it looks like switch_mode(1) should be called, and should print that line if it thinks it needed to switch.
The 3.6 version of the script does that but the 3.5 does not.  Just another little thing that got cleared up along the way.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 09 / December / 2015, 11:37:13
OK gents - I appreciate this insight...so I tested today by backtracking the Canon standard camera presets...the KAP website says use "P" mode...but when I switched back to "Auto", the camera accepted each and every USB trigger event I manually injected thru the Pixhawk. Go figure. Now I got these results using ver 3.5.
I also just loaded the ver 3.6 script, and it also ran without issue in the camera's "Auto" mode.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 09 / December / 2015, 15:39:44
OK gents - I appreciate this insight...so I tested today by backtracking the Canon standard camera presets...the KAP website says use "P" mode...but when I switched back to "Auto", the camera accepted each and every USB trigger event I manually injected thru the Pixhawk. Go figure. Now I got these results using ver 3.5.
I also just loaded the ver 3.6 script, and it also ran without issue in the camera's "Auto" mode.
This is a bit odd, generally I'd expect Auto to be more likely to refuse to shoot than P.

One thing that might be worth checking is the flash setting in the Canon firmware for each of these modes. If it isn't already off for P mode, I'd suggest trying with it off.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 09 / December / 2015, 18:32:02
For what its worth...just tested ver 3.6 after shutting off auto flash .. which covered Auto and P modes.  Placed camera in P mode and it fired without incident.  nice pics too at ISO 800 etc.
Attached the KAP log file.
Seems like progress has been made.
This is a great capability. Will let y'all know how the pics look after I fly and capture some property survey shots tomorrow.

Dave
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / December / 2015, 19:43:06
One thing that might be worth checking is the flash setting in the Canon firmware for each of these modes. If it isn't already off for P mode, I'd suggest trying with it off.
The script attempts to disable the built-in flash by setting a propcase

Code: [Select]
  set_prop(props.FLASH_MODE, 2)   -- disable built-in flash
AFAIK,  the main difference between P and AUTO modes is that P mode allows the user to set things like ISO, Whit e balance, Coloration schemes, and some features of the built-in flash.     I guess it's possible on some cameras,  in P mode and in low light situations, that setting the FLASH_MODE prop blocks taking an actual shot?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 09 / December / 2015, 20:37:38
The script attempts to disable the built-in flash by setting a propcase

Code: [Select]
  set_prop(props.FLASH_MODE, 2)   -- disable built-in flash
AFAIK,  the main difference between P and AUTO modes is that P mode allows the user to set things like ISO, White balance, Coloration schemes, and some features of the built-in flash.     I guess it's possible on some cameras,  in P mode and in low light situations, that setting the FLASH_MODE prop blocks taking an actual shot?
Other possibilities: Flash mode propcase is wrong on that camera, or uses a different value for disable.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / December / 2015, 22:30:18
For what its worth...just tested ver 3.6 after shutting off auto flash .. which covered Auto and P modes.  Placed camera in P mode and it fired without incident.  nice pics too at ISO 800 etc.
Attached the KAP log file.
Seems like progress has been made.
This is a great capability. Will let y'all know how the pics look after I fly and capture some property survey shots tomorrow.
@davefolts : There are a few things that could be tested if you have the time.


If this turns out to be just an issue with indoor testing and not the intended usage of the script,   I'll post a warning of some sort on the wiki page for the script.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 10 / December / 2015, 09:01:57
Other possibilities: Flash mode propcase is wrong on that camera, or uses a different value for disable.
Or setting that propcase sets the flash mode in a way that the camera does not respect during shooting (i.e. flash disabled but the exposure firmware still waits for the flash to be ready prior to releasing the actual shot).
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 27 / December / 2015, 11:28:30
Guys-
took me a while to get back in the air - bad weather and other things to do.  I did not attempt to get into the LUA code after spending some time on the LUA site...so I just went outside and flew and tested.
The ver 3.6 script is running quite nicely, as can be seen with this composite I made of the 56 shots taken over the span of 4 minutes or so by my Iris+' scan flight over my house.



One thing I noted is that on a sunny day the pictures (both jpg & .DNG) need to be color-corrected in Photoshop as they appear somewhat over exposed. I will try and get out at noon and see if sun angle makes a difference. (I suspect it does ease the shadow issues somewhat.)

I also note that the script will allow the pixhawk to signal a shutter release about every three seconds...not bad for speed.  I did have focus set at infinity and zoom is @ 20%
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 31 / December / 2015, 11:35:41
One thing I noted is that on a sunny day the pictures (both jpg & .DNG) need to be color-corrected in Photoshop as they appear somewhat over exposed. I will try and get out at noon and see if sun angle makes a difference. (I suspect it does ease the shadow issues somewhat.)
I can take a look at this and comment if you post your log file as an attachment here.  Look in the top folder of your SD card for a file called kap.log


Quote
I also note that the script will allow the pixhawk to signal a shutter release about every three seconds...not bad for speed.  I did have focus set at infinity and zoom is @ 20%
FWIW - the latest script version lets you shoot in continuous mode (sync'd to the pixhawk position over the ground) at rates approaching 2 fps on most cameras.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 02 / January / 2016, 16:58:08
Thanks WW....I attached the KAP log labelled - 23 December
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / January / 2016, 08:56:03
Thanks WW....I attached the KAP log labelled - 23 December
I had a quick look at that and didn't see anything obvious.  I was looking for shots where the exposure setting hit a hard limit and could not correctly expose an image.  I did not find any.

Here's a typical example of a shot.  The first line show what the camera wanted to do.  The second line show what the script changed it to.
Code: [Select]
2015Dec23 15:03:57.580 10) IMG_0400.JPG
2015Dec23 15:03:59     meter : Tv:1/80 Av:3.2 Sv:80 535:535
2015Dec23 15:03:59     actual: Tv:1/800 Av:- Sv:800
This should work unless the camera was trying to also insert the ND filter. With a report Av:3.2 that should not be the case and the script holds it out.  But if it actually was to be inserted, that would cause a three stop exposure error in the final image.

Meanwhile,  there is also this thread to consider :
 Problems using CHDK with Canon S110  (http://chdk.setepontos.com/index.php?topic=12681).

I may very well be facing a new bug.  Can you post one of the affected jpeg's that's found in the log (IMG_0359.JPG thru IMG_0446.JPG) ?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 09 / January / 2016, 15:03:56
Hi WWZ,

Thanks for the POLOLU idea! Works nice with RC controller directly. I will hook it up to the Pixhawk on Tuesday or Wednesday.

May I ask you for one line of code?
The "update_zoom(xx)" seem to set the zoom at a certain value.
I would like to have the camera zoom in and out step-by-step (let's say by +-10) at each pwm5/pwm7 received
Code: [Select]
function pwm5(pwidth)
        update_zoom(50)
end
Many thanks in advance!
Tom
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / January / 2016, 16:12:35
Thanks for the POLOLU idea! Works nice with RC controller directly. I will hook it up to the Pixhawk on Tuesday or Wednesday.
Thanks! Naturally I can't remember what idea that was and a quick search of this thread does not shed any light. Refresh my memory?

Quote
May I ask you for one line of code?  The "update_zoom(xx)" seem to set the zoom at a certain value.
I would like to have the camera zoom in and out step-by-step (let's say by +-10) at each pwm5/pwm7 received
Lacking any better idea about what to do with that signal, I'll make an addition (or at least post how to do that here).  It's going to be a little more than one line - naturally.

Do you plan to use this "blind" while flying?  Or do you have some sort of real time video streaming from your UAV?  Also adding a PWM signal to reset to the zoom = 0 position might make some sense.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 10 / January / 2016, 02:31:59
WWZ,
the idea came thru e-mail last July while we were beta testing the 3.6.  ;)
You are absolutely right: zooming blind would not do too much good.
I have a 3 channel video source switcher with a video transmitter (not tested yet but it should work.). One of these sources is planned to be the Canon.
zoom=0 is already in.  :)

Looking forward for the zooming code.
Title: Minimum shot interval on IXUS 140/ELPH 130
Post by: jacques.eloff on 10 / January / 2016, 15:03:32
Hi

I am posting on this forum for the first time and still fairly new to CHDK. A big thank-you to all the developers and everyone else who has helped bring these features out. I am using a Canon Ixus 140 (Elph 130) on a fixed wing mapping drone. The KAP script is running very well in tests I have done so far, however I cannot seem to get the interval down below 3 sec. Even when it is set to 2 sec it is still giving me 3 sec. This will require me to fly higher and at 100m I will only get around 50% in track overlap which is a bit low for an unstabilized camera.

Any thoughts? Is this perhaps a limit on the camera?

Finally, does anyone have any opinons on using this camera for mapping vs some of the other Canons (100,120, 260, etc.)? I bought it mainly because it is one of the lightest of all the CHDK-capable cameras.

Thanks,
Jacques
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 10 / January / 2016, 15:21:08
Bonjour Jacques,

Welcome!
To have a better understanding can you please specify the Airframe/stall speed, the Autopilot, the triggering cable?
Thansk!
Tom
Title: Re: Minimum shot interval on IXUS 140/ELPH 130
Post by: waterwingz on 10 / January / 2016, 16:42:47
Any thoughts? Is this perhaps a limit on the camera?
Most of the Canon Powershots take a little over two seconds to focus, set exposure, shoot, and save the resulting image to their SD card.   A fast SD card helps a bit here but not much. Keeping the ISO setting below 800 also helps. Finally, you also don't want to be saving as RAW/DNG - that really slows things down.

To go faster, run the script in continuous mode by selecting Pixhawk for the USB Shot Control? setting. In that mode,  the camera takes an initial exposure for the first shot and uses that setting for all subsequent shots.  It will shoot each time the USB signal from your flight controller toggles - people have reported getting two shots per second this way !   The process resets each time the script stops seeing pulses from the flight controller.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: jacques.eloff on 11 / January / 2016, 15:02:06
Bonjour Jacques,

Welcome!
To have a better understanding can you please specify the Airframe/stall speed, the Autopilot, the triggering cable?
Thansk!
Tom

Hi Tom - I am flying a Skywalker X-5 with a Pixhawk. Stall speed is around 11m/s, so I have set ARSPD_FBW_MIN to 12.5m/s. For the moment I am running the KAP script with intervalometer but I do have a trigger cable which I will try.

Thanks,
Jacques
Title: Re: Minimum shot interval on IXUS 140/ELPH 130
Post by: jacques.eloff on 11 / January / 2016, 15:05:25
Any thoughts? Is this perhaps a limit on the camera?
Most of the Canon Powershots take a little over two seconds to focus, set exposure, shoot, and save the resulting image to their SD card.   A fast SD card helps a bit here but not much. Keeping the ISO setting below 800 also helps. Finally, you also don't want to be saving as RAW/DNG - that really slows things down.

To go faster, run the script in continuous mode by selecting Pixhawk for the USB Shot Control? setting. In that mode,  the camera takes an initial exposure for the first shot and uses that setting for all subsequent shots.  It will shoot each time the USB signal from your flight controller toggles - people have reported getting two shots per second this way !   The process resets each time the script stops seeing pulses from the flight controller.

Hi waterwingz - I am using a Samsung 8Mb Evo card. At the moment I am using the intervalometer option but I'll give the cable a try with USB shot control as you say.

Cheers,
Jacques
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 12 / January / 2016, 22:25:05
WW_ quick reply to #690...the files are 4MB and it doesn't seem like the forum will allow a file attach of that size...or?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 12 / January / 2016, 23:19:24
www.box.com?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 13 / January / 2016, 14:03:25
Good Point WW - Here is the link to three jpegs for you to examine:

https://onedrive.live.com/redir?resid=A960581B471EBCB!111525&authkey=!AFtwo-r0BiuLh8s&ithint=folder%2c

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 14 / January / 2016, 21:54:33
Good Point WW - Here is the link to three jpegs for you to examine:
I took a look and compared to the log you posted earlier.  I can't see anything wrong or even unusual.

As far as the images go, this is a lot of contrast due to the extreme lighting conditions.  The sun on the swimming pool, tall trees and rooftops makes them clearly over exposed.  But the bushes in the gardens along the house wall are perfectly exposed, as are a lot of the other details (and you with your remote in your hand).

So I guess I don't have anything else to offer up here.  Sorry.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 16 / January / 2016, 10:33:15
I have a 3 channel video source switcher with a video transmitter (not tested yet but it should work.). One of these sources is planned to be the Canon.
You might want to check your camera.  Most of the Powershots sold over the last several years will not output "live" video in shooting mode.  Some of the older ones apparently do.

Quote
Looking forward for the zooming code.
Here you go - tested offline as I don't currently have my PWM test setup running.

Code: [Select]
function ch2up(pwidth)
    if( repeat_check("ch2up",pwidth) >= PWM_required_repeats ) then
        if (get_zoom() < get_zoom_steps()) then set_zoom_rel(1) end
    end
end

function ch2down(pwidth)
    if( repeat_check("ch2down",pwidth) >= PWM_required_repeats ) then
        if (get_zoom() > 0) then set_zoom_rel(-1) end 
    end
end
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 16 / January / 2016, 20:07:27
Good Point WW - Here is the link to three jpegs for you to examine:
I took a look and compared to the log you posted earlier.  I can't see anything wrong or even unusual.

As far as the images go, this is a lot of contrast due to the extreme lighting conditions.  The sun on the swimming pool, tall trees and rooftops makes them clearly over exposed.  But the bushes in the gardens along the house wall are perfectly exposed, as are a lot of the other details (and you with your remote in your hand).

Thanks WW-
I'll try and do my next shootings with the sun more overhead (as best I can do this time of year) and see what I get.  As I said, Photoshop does a nice job of compensating for long shadows etc.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Toshopo on 24 / January / 2016, 06:55:10
Hi

I'm a newbee in CHDK.
I tried to use this script with my Ixus 105 (SD1300) under CHDK 1.4.1 to use for a stratospheric balloon.

At run i'be got the message :
A/CHDK/SCRIPTS/WRAP13
IB/WRAP13.LUA
TERMINATED

No picture are taken.

Is someone can help me ?

Best granting


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 24 / January / 2016, 08:48:33
At run i'be got the message :
A/CHDK/SCRIPTS/WRAP13
IB/WRAP13.LUA
TERMINATED
This means that you do not have CHDK correctly installed on your SD card.  The script is looking for a file called wrap13.lua on the SD card in the folder named  A/CHDK/LUALIB but cannot find it.

What procedure did you follow to install CHDK?

Complete instructions are here :  Prepare Your SD Card (http://chdk.wikia.com/wiki/Prepare_your_SD_card)

Note that your IXUS105 was released prior to the year 2011 and so needs to be configured with two partitions if you want to use the "SD card lock" autobooting method to start CHDK running using an SD card larger than 4G.

The simplest way to load CHDK correctly for all cameras is to use the STICK utility :  < download link > (http://zenoshrdlu.com/stick/stick.html).  It will download the correct version of CHDK for you camera, format and configure your SD card correctly, and then install CHDK correctly on the card.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Toshopo on 24 / January / 2016, 10:49:33
I used acid software to have the good CHDK version. I use a 16 Go SD card without autoboot method.

I've tried many intervalometer scripts. Those on Ubasic work fine, those under Lua don't.

Is stick utility very different from acid ?

Thanks

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 24 / January / 2016, 12:38:56
I used acid software to have the good CHDK version. I use a 16 Go SD card without autoboot method.
If CHDK starts then you have the correct CHDK version for your camera.

Quote
I've tried many intervalometer scripts. Those on Ubasic work fine, those under Lua don't.
That's because you have not installed CHDK correctly and are missing some required files.  Lua is quite a bit more sophisticated than uBASIC and uses more files.  uBASIC has limited features and does not need any additional files.

How did you install CHDK?   Tell us the exact name of the file you downloaded. You need to use the Complete or Full version - not the Small version.  For example, ixus105_sd1300-100b-1.4.1-4360-full.zip (not ixus105_sd1300-100b-1.4.1-4360.zip)

For "firmware update" loading method, you can use a 16G card with a single partition but you need to extract all of the files in the CHDK download with the folder structure maintained.   If the files are not located in the correct place on the SD card,  Lua and many other CHDK features will not work.

Are you using a Mac or a PC to setup the SD card ?   If its a Mac then this might help : Mac - Still Having Trouble (http://chdk.wikia.com/wiki/FAQ/Mac#Still_Having_Trouble.3F)

Quote
Is stick utility very different from acid ?
ACID simply tells you what firmware version you have. 

STICK will download the correct version of CHDK for your camera, format and configure your SD card correctly, and then install CHDK correctly on the card.

Both utilities were written by the same person.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Toshopo on 25 / January / 2016, 13:59:01
Ok !  :)

I went back under Boot Camp / Windows7. I found the ictus 105-100d full files (as you say) and unstuff on my cards.
A lot of LIB wasn't there before.

Now, every scripts work fine ! I'll test the KAP one tomorrow. It's night now.

Thank you very much for your help.

Best granting
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 02 / February / 2016, 16:53:03
WW-  Quick one: Regarding the video segment interval between stills in KAP 3.6.  I'm trying to shoot a "miniature faking" segment (using the standard settings on the camera) between stills and in testing, altho the KAP script requests video shooting, the display simply goes blank on my 330HS and no video is recorded. Display comes back after the segment of 5 seconds is over.

Do I need to configure something under chdk settings to get video to record? I note that there are very few video settings on the 330HS chdk build, so does that mean I'm SOL on video shooting via CHDK&KAP?

tks

Dave
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / February / 2016, 19:10:13
WW-  Quick one: Regarding the video segment interval between stills in KAP 3.6.  I'm trying to shoot a "miniature faking" segment (using the standard settings on the camera) between stills and in testing, altho the KAP script requests video shooting, the display simply goes blank on my 330HS and no video is recorded. Display comes back after the segment of 5 seconds is over.
How do you know that the script requests video shooting?  Does it say Video recording started on the LCD?  It might help if you post the log file although video mode does not really log much.

What happens if you make the video segment time longer?  Maybe 30 seconds?

The only other thing that comes to mind off the top of my head is that the get_video_button()  for the 330hs port returns the wrong result. I can post a quick test script to find that out once I get the answer to my previous questions.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 03 / February / 2016, 11:36:26
WW- Indeed it says Video Recording Started. I have the display left on so I can see what KAP is doing. The screen goes blank after "Video Recording Started". Comes back after its done.
Attached the 2 Feb log entries.

tks
Dave
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Toshopo on 03 / February / 2016, 13:29:56
Hi waterwings

Still my mind with my balloon project. I wonder how to modifiy your script for recording lens temperature.
I saw that other scripts (hAPPY's , UGGY 's intervalometer) can do it but I prefer yours for its abilities to control shutter speed.

Is there a way to have this function ?

Best granting
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 03 / February / 2016, 16:02:20
(Traveling today ... I'll respond to both recent posts tonight)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 03 / February / 2016, 16:38:43
WW- Indeed it says Video Recording Started. I have the display left on so I can see what KAP is doing. The screen goes blank after "Video Recording Started". Comes back after its done.
Attached the 2 Feb log entries.

tks
Dave

WW- I suspect the issue is that the 330HS uses a separate button to start/stop video recording. I came about this suspicion when I looked at an older CHDK manual where the remote functions were described in detail. "If camera has a dedicated video button, will start and stop video using that button rather than the shutter switch."

So, I'm going to see if I can actually mod an existing script to send a "video-shoot" button press rather than a shutter press.
As well, in troubleshooting, I cannot find a way to get CHDK to start the video shooting on the 330HS using its switch settings in the Remote Parameters menu. Possibly, the build for this camera has left out some functionality for video shooting.

df
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 03 / February / 2016, 19:27:15
I suspect the issue is that the 330HS uses a separate button to start/stop video recording. I came about this suspicion when I looked at an older CHDK manual where the remote functions were described in detail. "If camera has a dedicated video button, will start and stop video using that button rather than the shutter switch."
Thanks for that hint. The port was missing a definition, should be corrected (https://www.assembla.com/spaces/chdk/subversion/commits/4415) in releases r4415 and newer.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 03 / February / 2016, 21:46:38
I suspect the issue is that the 330HS uses a separate button to start/stop video recording. I came about this suspicion when I looked at an older CHDK manual where the remote functions were described in detail. "If camera has a dedicated video button, will start and stop video using that button rather than the shutter switch."
Thanks for that hint. The port was missing a definition, should be corrected (https://www.assembla.com/spaces/chdk/subversion/commits/4415) in releases r4415 and newer.

Thank you srsa_4c.... now I'll load the latest version and test...... tomorrow.
DF
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 03 / February / 2016, 23:32:48
The script handles cameras with a separate video button differently than those without a separate button.  As I suggesterd earlier, that only works if the CHDK port is setup correctly for the camera. I'm glad srsa_4c spotted the missing definition as it saved me posting a test script to prove this out.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 03 / February / 2016, 23:44:19

I wonder how to modifiy your script for recording lens temperature.
Is there a way to have this function ?
All you need is a very simple change to the script's logging function.  I'll post a modified script in a day or two after I find my camera to test the change.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 04 / February / 2016, 12:35:41
The script handles cameras with a separate video button differently than those without a separate button.  As I suggesterd earlier, that only works if the CHDK port is setup correctly for the camera. I'm glad srsa_4c spotted the missing definition as it saved me posting a test script to prove this out.

OK- I see a r4416 now up on the download site....so I'm going to download and go for it....and its working quite nicely!...records video...takes a few seconds to set-up tho....very nice.

thanks guys

df
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / February / 2016, 11:42:19
Still my mind with my balloon project. I wonder how to modifiy your script for recording lens temperature.
Is there a way to have this function ?
Added in release 3.7 of script.   Available at the usual download address (https://app.box.com/s/a5tbl1xasp8m3a57fclx).
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: davefolts on 07 / February / 2016, 13:42:31
OK Guys- here is my first test of "Miniature faking using a Canon P&S camera running CHDK & KAP-UAV script". Camera mounted on my Iris+ quadcopter's hard-mount 160 feet above ground.

https://youtu.be/7YiLr1NjcZE (https://youtu.be/7YiLr1NjcZE)

Thanks to all of you who helped me get started with this. There were some gremlins this AM, on the drone side, and the camera wanted to use the vertical strip instead of my desired in-focus horizontal strip....likely due to the downward pointing angle of at least 40 degrees.
Next step is to get a gimbal to eliminate the bouncing caused by wind buffeting the camera (acts like a spoiler making the Pixhawk autopilot/FMS perform constant corrections)

Dave
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Toshopo on 10 / February / 2016, 00:34:44
Added in release 3.7 of script.   Available at the usual download address (https://app.box.com/s/a5tbl1xasp8m3a57fclx).

Great ! Thank you very much. I'll test during the week !
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Toshopo on 12 / February / 2016, 16:07:25
Hi waterwings

I've tried your new script. I've a trouble that i already had before with your first scrip , but now it's stronger.

My first tests was with 1 shoot / 5s. The scrip was sometimes crashing after 11 shoots. when it was (often) working, the ixus worked for 2h by -25°C in fridge (with light for exposure shutter).
I'v tried with 10 s and 7s. It always crash after few shoots.
So i've tried again with your last script with 10 s and it always crash too.

I believe Troubles can come for this two reasons :
1- CHDK start on the SD card. Chdk is it more stable with firmware update.
2- I just drag and drop your downloaded script under OS X 10.11 on SD card

I'm sorry for my bad english but I quite perfectly understand your answers !

best granting
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 12 / February / 2016, 16:55:31
My first tests was with 1 shoot / 5s. The scrip was sometimes crashing after 11 shoots. when it was (often) working, the ixus worked for 2h by -25°C in fridge (with light for exposure shutter).
When you say the script is crashing, do you mean the script ends, or the whole camera shuts down?

If the camera shuts down, you should get a ROMLOG http://chdk.wikia.com/wiki/Debugging#Camera_crash_logs_.28romlog.29 (http://chdk.wikia.com/wiki/Debugging#Camera_crash_logs_.28romlog.29)

If the script is ending, there should be some error displayed.
Quote
1- CHDK start on the SD card. Chdk is it more stable with firmware update.
This would be unusual. Normally, it shouldn't make any difference, and in the cases where there are problems it's usually the firmware update that has them.

Quote
2- I just drag and drop your downloaded script under OS X 10.11 on SD card
This should not make the script unstable. If it runs at all, it shouldn't matter how you copied it.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 12 / February / 2016, 17:08:29
I've tried your new script. I've a trouble that i already had before with your first scrip , but now it's stronger.
My first tests was with 1 shoot / 5s. The scrip was sometimes crashing after 11 shoots. when it was (often) working, the ixus worked for 2h by -25°C in fridge (with light for exposure shutter).
I'v tried with 10 s and 7s. It always crash after few shoots. So i've tried again with your last script with 10 s and it always crash too.
In addition to reyalp's comments, I'd like to suggest that your problems are most likely not related to the script. To prove or disprove this,  please rerun your refrigerator test using the simple interval.lua script that comes with CHDK at a 10s interval and see what happens.

 
(Edit : there may be a clue in your description.  When you shoot quickly, the camera uses more power and stays warmer.  When you slow down the shot rate, the camera will draw less power. As all the power drawn essentially ends up as heat, drawing less power means that the camera gets colder.  As a temperature of -25 deg C is well outside of the camera's operating range, this might be significant.)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Toshopo on 14 / February / 2016, 04:54:49
the camera message is
a camera error was detected
will shut down
restart your camera.


The ROMLOG is
ASSERT!! WBFace.c Line 455
Occured Time  2011:11:14 03:11:16
Task ID: 23461937
Task name: WBCtrl
SP: 0x002FBFB0

I've got the same trouble with the basic CHDK intervalometer.


???
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 14 / February / 2016, 05:01:14
the camera message is
...
Occured Time  2011:11:14 03:11:16
Task ID: 23461937
Is the clock set correctly on your camera? If it is, then this is an old romlog unrelated to the current errors.

It's quite possible your error isn't generating a romlog, usually crashes that generate a romlog don't show anything on the screen.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Toshopo on 14 / February / 2016, 05:14:39
the occured time is strange … cause the the clock is set correctly.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 14 / February / 2016, 09:11:45
the camera message is
a camera error was detected
will shut down
restart your camera.
I have a suspicion. Your cam might be broken. Try using it without CHDK for more than a minute.

To retrieve the camera's error list, use the following short Lua script (copy the 2 lines to a plain text file, name it errlist.lua, copy it to the card and execute it).
Code: [Select]
call_event_proc("UI.Create")
call_event_proc("UIFS_WriteFirmInfoToFile",0)
This will produce a text file in the root of the card.

You need to enable "Lua native calls" in the Miscellaneous menu before running the script.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 14 / February / 2016, 10:11:08
I have a suspicion. Your cam might be broken. Try using it without CHDK for more than a minute.
Or his camera simply may not work well at -25 deg C  (as I suggested a couple of posts earlier).

Seems like a simple test is to run either intervalometer with the camera at room temperature.  Does it also crash?

If so, you will need some good insulation around the camera when you attempt your balloon project.  Also,  I recently read about a "GoPro" balloon flight by a high school student - he solved the temperature problem using Hand Warmers (http://www.amazon.com/HotHands-Hand-Warmers/dp/B00PX20LO0) to wrap the camera.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Toshopo on 14 / February / 2016, 10:39:24
I have a suspicion. Your cam might be broken. Try using it without CHDK for more than a minute.

Well see srsa4. The camera shutdown after 1 minute with a E32 error  >:(
Thank you for you help !
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 14 / February / 2016, 18:31:12
Well see srsa4. The camera shutdown after 1 minute with a E32 error  >:(
That's what I suspected - E32 means there's a problem with the image stabilizer. As far as I know, it's usually caused by a broken flex cable inside the lens unit (see ebay item 251353559253). That flex cable is also responsible for operating the mechanical shutter and the ND filter - if it breaks completely, you'll lose them too.

However, with CHDK it's possible to prevent camera shutdown caused by E32. If you'd like to keep using it, you can ask for a special CHDK build. (I wouldn't use that camera for an important mission like yours, though.)


(note to others: the hacky E32 patch I posted in the forum is no longer usable on current CHDK source, I'm working on a proper one)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 20 / February / 2016, 15:12:36
Hello people,
Been setting up my canon IXUS 240HS with KAP UAV for a while now, and have a couple of notes/questions to ask.
First of all my photos were all over-exposed with default settings- What is the best way to reduce the exposure to normal levels? Is Exposure Compensation the way to go?
Secondly I run an NDVI filter on one of my cams, should I use the ND Filter setting or that would alter the results?

Thanks in advance! 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / February / 2016, 15:31:53
First of all my photos were all over-exposed with default settings-
This is the second time this has been reported as an apparent issue.  See :
http://chdk.setepontos.com/index.php?topic=10822.msg126149#msg126149 (http://chdk.setepontos.com/index.php?topic=10822.msg126149#msg126149)
Having looked at the images there, I saw a lot of contrast which I believe can be a challenging shooting situation of you want everything correctly exposed.

Please post the kap.log file from the top level folder on your SD card and a link to one of the overexposed photos saved on a download site (like box.com).

Quote
What is the best way to reduce the exposure to normal levels? Is Exposure Compensation the way to go?
Obviously it would be best to figure out why the pictures appear to be overexposed.  Do you have that issue using the script to take images in normal lighting on the ground or just when the camera is "airborne"?

Quote
Secondly I run an NDVI filter on one of my cams, should I use the ND Filter setting or that would alter the results?
Assuming the filter is mounted in front of the lens, you should probably set the ND Filter option in the script menu to Off.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 20 / February / 2016, 16:06:47
Thank you for the answer, pictures appear brighter than normal even when the camera is on the ground, airborne photos (cam pointing downwards) however are even brighter and often over-exposed.
I have attached the log file.
Here's a photo with default settings : https://www.dropbox.com/s/uned8y5y2j5nlca/IMG_0048.JPG?dl=0 (https://www.dropbox.com/s/uned8y5y2j5nlca/IMG_0048.JPG?dl=0)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / February / 2016, 16:58:27
I have attached the log file.
There are several potentially interesting things in the log indicating that the camera / script was having trouble setting the exposure.

Please describe in detail how you are triggering the camera?  It looks like you are trying to use a USB remote connected signal?  What setup are you using to create that?

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 20 / February / 2016, 18:10:01
The camera was mounted on a quadcopter and was indeed being triggered by a usb cable. I am using a Pixhawk autopilot that also controls the camera trigger and shoots at regular distance intervals. The usb cable I used is the one sold by http://www.tuffwing.com/ (http://www.tuffwing.com/) .
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / February / 2016, 20:02:52
The camera was mounted on a quadcopter and was indeed being triggered by a usb cable. I am using a Pixhawk autopilot that also controls the camera trigger and shoots at regular distance intervals. The usb cable I used is the one sold by http://www.tuffwing.com/ (http://www.tuffwing.com/) .
I'm not a pixhawk expert but it would be good to know how you set it up to trigger the camera.

The log file is strange - it looks like the camera tries to shoot, fails, and tries again.  Over and over.  And each shot attempt causes a timeout.
Code: [Select]
2016Feb16 14:21:23    CHDK 1.4.1-4381 ixus240_elph320hs 101a Jan 27 2016
2016Feb16 14:21:23    Mode:PLAY,Continuous_AF:0,Servo_AF:0 Drive:0
2016Feb16 14:21:23     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2016Feb16 14:21:23     Av:4.0 minAv:2.8 maxAv:8.0
2016Feb16 14:21:23     ISOmin:100 ISO1:400 ISO2:800 M:0
2016Feb16 14:21:23     Focus:OFF  Video:0 USB:2:1 Tmo:0
2016Feb16 14:21:23     AvM:2 int:1 Shts:0 Dly:0 B/L:0
2016Feb16 14:21:24    waiting on USB signal
2016Feb16 14:22:42    USB start signal received
2016Feb16 14:22:46    Mode switched to P
2016Feb16 14:22:46    Logger : log file updated.
2016Feb16 14:22:53    timeout after shoot full
2016Feb16 14:22:47.500 1) IMG_0048.JPG
2016Feb16 14:22:53     meter : Tv:1/200 Av:2.8 Sv:100 649:649
2016Feb16 14:22:53     actual: Tv:1/1000 Av:- Sv:400
2016Feb16 14:22:53             AvMin:2.8 NDF:NDout foc:infinity
2016Feb16 14:22:55    timeout on hook_shoot.is_ready
2016Feb16 14:22:55.760 2) IMG_0048.JPG
2016Feb16 14:22:58     meter : Tv:1/1000 Av:2.8 Sv:400 649:649
2016Feb16 14:22:58     actual: Tv:1/1000 Av:- Sv:400
2016Feb16 14:22:58             AvMin:2.8 NDF:NDout foc:infinity
2016Feb16 14:23:12    timeout after shoot full
2016Feb16 14:23:06.790 3) IMG_0049.JPG
2016Feb16 14:23:12     meter : Tv:1/200 Av:2.8 Sv:100 646:646
2016Feb16 14:23:12     actual: Tv:1/1000 Av:- Sv:400
2016Feb16 14:23:12             AvMin:2.8 NDF:NDout foc:infinity
2016Feb16 14:23:15    timeout on hook_shoot.is_ready
2016Feb16 14:23:15.050 4) IMG_0049.JPG
2016Feb16 14:23:17     meter : Tv:1/1000 Av:2.8 Sv:400 646:646
2016Feb16 14:23:17     actual: Tv:1/1000 Av:- Sv:400
2016Feb16 14:23:17             AvMin:2.8 NDF:NDout foc:infinity
2016Feb16 14:23:25    timeout after shoot full
2016Feb16 14:23:19.180 5) IMG_0050.JPG
2016Feb16 14:23:25     meter : Tv:1/200 Av:2.8 Sv:100 623:623
2016Feb16 14:23:25     actual: Tv:1/1000 Av:- Sv:500
2016Feb16 14:23:25             AvMin:2.8 NDF:NDout foc:infinity
2016Feb16 14:23:27    timeout on hook_shoot.is_ready
2016Feb16 14:23:27.440 6) IMG_0050.JPG
2016Feb16 14:23:30     meter : Tv:1/1000 Av:2.8 Sv:500 623:623
2016Feb16 14:23:30     actual: Tv:1/1000 Av:- Sv:500
2016Feb16 14:23:30             AvMin:2.8 NDF:NDout foc:infinity
2016Feb16 14:23:38    timeout after shoot full
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 21 / February / 2016, 04:28:38
Oh ok this was caused because the save RAW param was active (CHDK bug would always select it after changing other settings) , thus taking mutch longer to shoot a photo and often missing the next trigger. I guess this is what you were seeing.
What about the exposure issue? What do you think causes it?

Pixhawk triggers the cam by sending a 5v pulse through the usb.
This is how I set it up: http://www.tuffwing.com/support/pixhawk_camera_trigger_cable.html (http://www.tuffwing.com/support/pixhawk_camera_trigger_cable.html)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / February / 2016, 11:28:59
CHDK bug would always select it after changing other settings
AFAIK, this is not a bug that anyone else has reported.   However, it is very easy to enable it accidentally while working in <ALT> mode - CHDK has an annoying keyboard shortcut feature that can't be fully disabled.

See : CHDK User Manual : Shortcut Keys (http://chdk.wikia.com/wiki/CHDK_User_Manual#Key_Shortcuts)

Maybe I'll add a warning at script startup if RAW is enabled.  Either that or allow a script parameter to be used to let you specify if RAW should be enabled (and override the CHDK setting if necessary).

Quote
What about the exposure issue? What do you think causes it?
Do you get the same problem when you shoot without RAW enabled?

To make things easier to diagnose,  I can post a small test script that is basically an extract of the script's exposure logic.That would make it easier to determine if it's a script issue,  a camera setup issue, or a CHDK port issue.  If you can run some tests that would help.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 21 / February / 2016, 12:33:56
Ok it seems the RAW was getting enabled when I was accidentally pressing the debug button (it's a touchscreen).
The over-exposure issue happens whether with raw enbaled or not. Today did a couple of flights with exposure comp. set at -0.66 and that pretty mutch corrected it, but I'm worried it may alter the quality of the pics.

The second camera onboard running the NDVI filter (infront of sensor and behind lens) also had a serious over exp. issue and had to correct that by setting the exp comp at -1. 

Also in both cases the camera seems to "think" that the over exp picture is OK, as the ISO levels are often high along with f values of 2.7.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / February / 2016, 13:16:27
Ok it seems the RAW was getting enabled when I was accidentally pressing the debug button (it's a touchscreen).
The over-exposure issue happens whether with raw enbaled or not. Today did a couple of flights with exposure comp. set at -0.66 and that pretty mutch corrected it, but I'm worried it may alter the quality of the pics.
Correcting the exposure should only improve the "quality" of the pics.

Can you try the attached script ??  The script will take two shots - one with Canon's exposure setting and the other with the shutter speed and ISO both increased by one stop using the kap_uav.lua's exposure setting mechanism.   Use it to shoot at anything outdoors.

The resulting two images should appear to be exposed exactly the same.  Are they?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 21 / February / 2016, 13:54:55
I'll have to wait till tommorow, it's almost 9pm here.
So I only copy the script in the scripts folder and just activate it?

Here is the result after setting the exposure comp to -0.66 : https://www.dropbox.com/s/135par85djmm6f7/IMG_0181.JPG?dl=0 (https://www.dropbox.com/s/135par85djmm6f7/IMG_0181.JPG?dl=0)

Also one more question, most flights are done between 40-60m do you think enabling focus at infinity would be a good idea? Some pics with default auto focus turn out a bit blurry.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / February / 2016, 14:19:26
I'll have to wait till tommorow, it's almost 9pm here.
No problem.

Quote

So I only copy the script in the scripts folder and just activate it?
Yes.  Point the camera at something and launch the script.  It will switch to shooting mode if necessary and immediately take the two shots.

Quote
Here is the result after setting the exposure comp to -0.66 : https://www.dropbox.com/s/135par85djmm6f7/IMG_0181.JPG?dl=0 (https://www.dropbox.com/s/135par85djmm6f7/IMG_0181.JPG?dl=0)
I was a little worried that the ND filter is not being handled correctly but the exposure comp needed would need to be a lot more than -0.66 if that was so.

Quote
Also one more question, most flights are done between 40-60m do you think enabling focus at infinity would be a good idea? Some pics with default auto focus turn out a bit blurry.
I would definitely recommend using focus at infinity for KAP and UAV work.

However, you might want to test how well it works (even just shooting on the ground at a landscape).   Some cameras don't focus well using that option - we don't really know why for sure.   It's very camera dependent - my S100 works well for example but a few other S100's don't.   But if it works for you, it will speed up shooting and lessen some "unsharp" photos where it can't quite find focus automatically.

There is a long thread about this here :  Manual Focus @ Infinity not working (https://chdk.setepontos.com/index.php?topic=12062.0)

Edit :   also  Setting focus from scripts or menus (https://chdk.setepontos.com/index.php?topic=11078.0) if you are having trouble sleeping.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 21 / February / 2016, 16:29:27
@WW
The ixus240/elph320 port doesn't redefine CAM_MARKET_ISO_BASE. Could that be the cause of wrong exposure?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / February / 2016, 16:47:50
@WW
The ixus240/elph320 port doesn't redefine CAM_MARKET_ISO_BASE. Could that be the cause of wrong exposure?
Hmmm ... that would certainly explain it.   The result of having that #define missing when it's needed would be a one f-stop overexposure when CHDK attempts to set the SV96 value.  I was hoping to see something like that with the test script I posted but tracking it down without your hint here would have been hard!

The other camera that has been reported to overexpose slightly is the  ixus255_elph330hs and it also does not have CAM_MARKET_ISO_BASE defined. Further, neither camera is reported as having been tested  here : CAM_MARKET_ISO_BASE - please test (https://chdk.setepontos.com/index.php?topic=12170.0)

If the test script shows the one stop offset,  or OhSnap can run the isobase.lua script (attached) we should be able to nail it down by changing that #define and rebuilding.

Thanks.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 22 / February / 2016, 04:40:55
Here are the results of running the test script on a bright sunny day:

https://www.dropbox.com/s/l2fnm1wx5hhqf82/IMG_0223.JPG?dl=0 (https://www.dropbox.com/s/l2fnm1wx5hhqf82/IMG_0223.JPG?dl=0) - Photo 1
https://www.dropbox.com/s/bvyr7i4ye8i96fx/IMG_0224.JPG?dl=0 (https://www.dropbox.com/s/bvyr7i4ye8i96fx/IMG_0224.JPG?dl=0) - Photo 2

I can clearly see a difference between the two, if that's what we're looking for.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / February / 2016, 05:21:00

I can clearly see a difference between the two, if that's what we're looking for.
Thanks.  That pretty much confirms a problem with the port.  To confirm the source of that problem, can you please run the test script I posted above and report the results? Fixing the camera port will be easy if that confirms the cause.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 23 / February / 2016, 04:14:56
I run the above script but it doesn't take a picture it just focuses and displays some ISO levels, If that's ok?

Here's a pic: https://www.dropbox.com/s/yq222rztxl9tcsg/20160223_105636.jpg?dl=0 (https://www.dropbox.com/s/yq222rztxl9tcsg/20160223_105636.jpg?dl=0)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 23 / February / 2016, 08:30:56
I run the above script but it doesn't take a picture it just focuses and displays some ISO levels, If that's ok?
That's perfect - thanks!  It confirms that the ixus240/elph320  (and almost certainly the ixus255/elph330 based on previous posts) need to redefine CAM_MARKET_ISO_BASE in their platform_camera.h build files.

Rather than me submitting a tiny patch, maybe srsa_4c, reyalp, or philmoz can just make the small changes necessary in the stable and dev branches?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 23 / February / 2016, 13:59:09
Good to know I helped!

Something else I noticed about the way the code works -at least for me. It always tries to correct the exposure by changing the shutter speed or the ISO levels and almost never the aperture f, I'm no camera expert but shouldn't that be the other way round? First "f" then ISO and as last resort shutter speed?

The vast majority of the pics have a set aperture of f/2.7.
Is it the way it's supposed to work?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 23 / February / 2016, 14:24:45

It always tries to correct the exposure by changing the shutter speed or the ISO levels and almost never the aperture f, I'm no camera expert but shouldn't that be the other way round? First "f" then ISO and as last resort shutter speed?

The vast majority of the pics have a set aperture of f/2.7.
Is it the way it's supposed to work?
That's because your camera does not have an adjustable aperture.

When you see variations in the reported fstop it's either because the neutral density filter has engaged or because you have changed the zoom position. 

On cameras with an adjustable aperture the script works much like you have suggested.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 25 / February / 2016, 07:54:16
Oh ok, thanks for the help! 

Just FYI tried the focus at infinity for the 240HS and it falls in the category of non working. All the pics turn out blurry.

Let me know if I can help with anything more.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 25 / February / 2016, 14:47:17

Just FYI tried the focus at infinity for the 240HS and it falls in the category of non working. All the pics turn out blurry.
On cameras where this happens, it's usually worst at wide angle lens settings.   The script tries to set the focus at 50 metres (50000mm) but the setting that works best might be as close as one or two metres (1000mm).

If you want to try this, you can change the setting for "infinity" at line 141 in the current version of the script.  Edit the 50000 to 1000 or 2000 and see what happens?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 25 / February / 2016, 15:21:27
Ok good I'll give it a try!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 28 / February / 2016, 06:56:25
Any updates on the fixed code for the 240HS?
I'd really help me if I had the corrected version as currently depending on the light conditions the camera often drops the shutter speed alot trying to "correct" what it considers under-exposed. And it makes it hard to have the same settings for all light conditions.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 28 / February / 2016, 07:48:33
Any updates on the fixed code for the 240HS?
The issue has been fixed, please upgrade to the most current (http://mighty-hoernsche.de/) official release.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 02 / March / 2016, 15:36:20
Hello guys again, I'm having another issue now related with the trigger part of the system.
I use a double camera system on my quadcopter and have Pixhawk send a pulse trough usb at regular distance intervals.
Problem is that sometimes one of the cams (or both) fail to trigger and just "ignore" the command without doing anything.
About one photo is missing ever 30 pics taken.
This is enough to cause trouble with the geotagging...


Do you have an idea on that?


I have attached the log of one of the cams incase that helps
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / March / 2016, 18:44:48
About one photo is missing ever 30 pics taken  ... I have attached the log of one of the cams incase that helps
For the camera that produced that log file,  can you please tell me the image name (e.g. IMG_0284.JPG) that you think is before (or after) one of the missing images? 

That would narrow things down a lot.

Edit :  Meanwhile, it looks like your pixhawk is trying to take a picture approximately every two seconds.  This is about the fastest most Powershots can shoot unless they are in a "continuous" mode.   While the kap_uav.lua continuous mode has the drawback of locking exposure at the start of each shooting sequence,  it can get most cameras down close to two shots per second or better.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 08 / March / 2016, 16:33:33
Thanks for the answer, I have been playing around alot with the servo mode and different pixhawk settings on relay mode.
This is what I have so far:


Relay mode, approx one photo missing from each camera no matter the time interval between the photos.
Pretty consistant at -1 pic on every fight.
Servo mode, mutch higher trigger speeds- less shutter lag. However in this case extra photos are a common scenario,
 the numbers vary, from +1,+2 to -1 on every flight. 


It almost looks like there is no way around it ?


Also is there a way to set the lens to extract once turning on the camera? Right now the lens extract upon first usb command which
increases the shutter lag of the first photo alot.


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / March / 2016, 19:44:35
Relay mode, approx one photo missing from each camera no matter the time interval between the photos.  Pretty consistant at -1 pic on every fight.
As per my previous request, if you can identify the file name of the photo that occurred before the one that is missing it would help me to interpret the log that you posted.

Quote
Servo mode, mutch higher trigger speeds- less shutter lag. However in this case extra photos are a common scenario,  the numbers vary, from +1,+2 to -1 on every flight. 
Extra photos?  I'm not sure that I understand what an extra photo is?  Again, image file names that I can cross reference with the log would help a lot here.

Quote
It almost looks like there is no way around it ?
With over 5000 downloads of the script, I think it's fair to say it is pretty stable. So we just need to figure out what is happening here in your specific case.

Generally speaking, this usually comes down to timing or camera setup (Canon modes).   That's why I want to see in the log where the extra/missing images are occurring.  With the help of a few dedicated UAV owners,  we got this script to run reliably at 2 frames per second.  I'm pretty sure we can fix your issue(s) too.

Quote
Also is there a way to set the lens to extract once turning on the camera? Right now the lens extract upon first usb command which  increases the shutter lag of the first photo alot.
Well,  you could start the camera in shooting mode in the first place?  Just press and hold the On/Off button until you hear the lens extend when you power up the camera.  Or half-press the shutter button to switch to shooting mode prior to launching your aircraft.     I could add something to activate the lens when the script starts but that would have to be an additional option as most people seem to prefer the lens retracted during take-off and landing phases of a flight (for obvious reasons).
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 13 / March / 2016, 12:22:07
Problem is that I don't know exactly which photo is missing. When trying to geottag the software reads the Pixhawk flight log and identifies the camera trigger commands. If the tirgger command number and the picture number don't mutch then geottag is impossible.


By extra photo I mean the pixhawk may send for example 25 camera trigger commands but there are 26 photos taken.


Is there a line I could add/ or modify to extend the lens prior to takeoff? Because right now the lens extend on the first camera trigger command and that
increases the shutter lag of the first pic to around 2.5s





Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 13 / March / 2016, 12:37:33
Problem is that I don't know exactly which photo is missing. When trying to geottag the software reads the Pixhawk flight log and identifies the camera trigger commands. If the tirgger command number and the picture number don't mutch then geottag is impossible.
Does the geottag software not give an error message that identifies the image it can't find?  Or can we look at the pixhawk flight log and CHDK script's log and figure it out for ourselves?

Quote
Is there a line I could add/ or modify to extend the lens prior to takeoff? Because right now the lens extend on the first camera trigger command and that increases the shutter lag of the first pic to around 2.5s
Sure,  but did you read my previous response for two options that don't require modifying the script?

Well,  you could start the camera in shooting mode in the first place?  Just press and hold the On/Off button until you hear the lens extend when you power up the camera.  Or half-press the shutter button to switch to shooting mode prior to launching your aircraft.   

But if you really want to mod the script,  delete lines 711 - 718 in the v3.7 release of the script.  This code :
Code: [Select]
          if ( wait_for_usb_active() == false) then                  -- can we start ?
                printf("Menu key exit request")
                restore()
                return
            else
                printf("USB start signal received")
                usb_shooting_mode = 2
            end
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 13 / March / 2016, 13:59:47
The geottag software doesn't give any information unfortunately. The first action it does is check the number of photos in the file and the number of commands in the flight log and in the case they don't match it halts the procedure there.
The flight log - as far as cams are concerned only records cam_trigger commands and GPS co-ordinates.
The geottag software then assumes the first pic in the file belongs to the first cam trigger command the 2nd to the 2nd and so on.



I will do a flight and send you a fresh cam and pixhawk log tommorow.


I tried holding the on/off button and half pressing the shutter but it has no effect, the lens remain closed.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 13 / March / 2016, 14:15:12
I tried holding the on/off button and half pressing the shutter but it has no effect, the lens remain closed.
Sorry - should have been clearer.  You need to do either of those things prior to entering <ALT> mode and starting the script.  In the case of the On/Off button, you should be able to turn the camera on in shooting mode (i.e. lens extended) by holding down the On/Off button rather than just pressing it quickly.   The half press trick works when the camera is NOT in <ALT> mode (and the script not running).

I suppose I could tweak the next version of the script so that any key press lets the script escape from the delay for first USB signal.  Right now it only responds to the MENU key in that state - and it terminates the script.

The flight log - as far as cams are concerned only records cam_trigger commands and GPS co-ordinates.
Does it time stamp each record?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 13 / March / 2016, 14:42:02
 Ok no prob. I will probably edit the code anyway, as I have both CHDK and script on autostart so as not to have to take the camera off before the flight.
The flight log does time stamp every action recorded. Using GPS time.

 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 13 / March / 2016, 14:46:53
The flight log does time stamp every action recorded. Using GPS time.
Perfect.  Should be possible to match up the "missing" shot if that's the case - the kap log is timestamped to .001 seconds.  Once you align the first shot,  the rest should fall in line until the miss or extra shot shows up.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 14 / March / 2016, 05:50:22
Just tried the code modification you suggested (Deleted the exact lines you posted). The lens do exctract but only for about 4 seconds and then retract back again.
This is how the action goes:
 Press on/off button->
***Autostart***
KAP 3.6 started- pess menu to exit ->
(now lens extract)->
~4s later (lens retract)
USB halt requested
waiting on USB signal 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 14 / March / 2016, 08:53:41

Just tried the code modification you suggested (Deleted the exact lines you posted). The lens do exctract but only for about 4 seconds and then retract back again.
There is a script parameter that you can set to control this.  No code modifications required.  It's called

USB Timeout (secs 0=off)

Set it to zero.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 16 / March / 2016, 11:06:38
It is already set at 0 when tha's happening.
Here's a vid to show you exactly what's it doing.
https://drive.google.com/file/d/0B-Ks32HaA8XZSk4yQmhGSlJfek0/view?usp=docslist_api (https://l.facebook.com/l.php?u=https%3A%2F%2Fdrive.google.com%2Ffile%2Fd%2F0B-Ks32HaA8XZSk4yQmhGSlJfek0%2Fview%3Fusp%3Ddocslist_api&h=kAQHhgbS9)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / March / 2016, 12:14:29

It is already set at 0 when tha's happening.
Yea, deleting that code also requires one more small change to work properly.

Change line 144 from
       usb_shooting_mode = 0
to
       usb_shooting_mode = 1

Sorry for the mixup.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 18 / March / 2016, 18:24:25
No problem, it works fine now -thanks
Now I can do some proper testing on the number of photos without worrying that I'm gonna miss one in the beginning.
Will keep you updated on the results.


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 20 / March / 2016, 06:27:13
I have a photo number discrepancy again.
Pixhawk commanded 36 pics to be taken but 38 were actually shot.
Here is the link to the Flight log and KAP log : https://drive.google.com/folderview?id=0B-Ks32HaA8XZelJZYW1TZFdmelU&usp=sharing
Fist pic is: IMG_1811 Last pic: IMG_1848
I'd appreciate if you could take a look.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: ahmet on 20 / March / 2016, 08:01:49
Hi,
I set the camera activate and retract by rc radio. However, lens retract after 60 sec. I would like the lens response without a delay. Any suggestion will be appriciated.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 20 / March / 2016, 08:12:57
I set the camera activate and retract by rc radio. However, lens retract after 60 sec. I would like the lens response without a delay.
You can find that setting in the Canon menu.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / March / 2016, 11:20:13
I set the camera activate and retract by rc radio. However, lens retract after 60 sec. I would like the lens response without a delay.
You can find that setting in the Canon menu.
To be a little more specific,  the setting is usually in the Canon menu with the tools icon and says Lens Retract. Set it to 0 sec.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / March / 2016, 13:31:35
I have a photo number discrepancy again.  Pixhawk commanded 36 pics to be taken but 38 were actually shot.
Here is the link to the Flight log and KAP log : https://drive.google.com/folderview?id=0B-Ks32HaA8XZelJZYW1TZFdmelU&usp=sharing
Fist pic is: IMG_1811 Last pic: IMG_1848. I'd appreciate if you could take a look.
Thanks for posting those logs.  It took a bit of work to figure out the pixhawk log but I eventually got it.  And I'm pretty sure I know what is happening.

When operating the script in pixhawk mode, the first "shoot" pulse from the pixhawk starts the camera shooting in a simulated continuous mode (i.e. the script half-presses the shutter and holds it that way).  Each subsequent shoot pulse causes a full-press sequence.  This sequence repeats until either a cancel pulse is issued by the pixhawk or the pixhawk stops sending any pulses for five seconds.

The five second timeout was picked to be long enough based on the assumption the pixhawk would be shooting quite a bit faster than one frame every two seconds.

When I look at your pixhawk & script logs, I can see that the pixhawk calls for shots every two to three seconds. Sometimes it delays for a bit more than four seconds.  And sometimes it stops sending any pulsed for about five seconds.  So I think we are on what engineers call "the hairy edge" (http://www.urbandictionary.com/define.php?term=hairy+edge) from a timing perspective.

If I'm correct here,  this should be easy to fix - with one caveat.

Simply change the 5000 value in line 823 of the script to something like 20000.
Code: [Select]
                    if not wait_for_shoot_pulse(5000) then
But here's the rub - you will always end up with one extra shot right at the end.  Easy enough to delete if you are aware of what happened.  When shooting in continuous mode,  the script sets up the next shot immediately and then waits for the pixhawk to release it.  If no signal from the pixhawk arrives then the script times out and releases the final shot.  Unfortunately, there is no easy way to cancel that shot - it's already setup and waiting to go.  But it should be easy to deal with "post shooting".

EDIT : IIRC, the other reason for the five second timeout was to allow the pixhawk to "reset" exposure & focus at the end of each aerial photo pass.  Whether that's beneficial or not depends on your shooting needs and situation I guess.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 23 / March / 2016, 15:05:08
Thank you alot for all the help and work. I tried what you suggested and I believe this will certainly help with the issue.
I also added a shut_down() function after the same "if" statement for the camera to shut down after the mapping is complete and protect the lens.
I'll try to have a test flight tommorow and post results.


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 24 / March / 2016, 09:19:36
I also added a shut_down() function after the same "if" statement for the camera to shut down after the mapping is complete and protect the lens.
That will cause the camera to power down with the shooting "half-press" still engaged.  You will also lose the last parts of the log file and any configuration things modified by the script will not be reset.

A better choice would be to call a release('shoot_full') followed by the scripts' restore() function.

Or alternatively,  just enable the USB Timeout (secs 0=off) script parameter with a long timeout (30 seconds maybe).
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 25 / March / 2016, 06:39:31
Yeah I was suspecting something like that.
Went with calling the two functions as you suggested and it works just as good.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 31 / March / 2016, 18:15:11
Hello, I'm using KAP 3.7 on 2 Canon S110 with CHDK 1.4.1
Trigger by USB transistor (Pixhawk)
it works very well but the display off function let the display go on every time it takes a picture, then goes off again, is this normal or I made some mistakes? I use 2 identical cameras at the same time.
Below my script parameters.

Thank you very much

Code: [Select]
--[[
  KAP UAV Exposure Control Script v3.7

  Licence: GPL (c) 2013, 2014, 2015, 2016 by waterwingz
  -- with contributions from wayback/peabody & Naccio
  Please check for the latest version (and documentation) at :
     http://chdk.wikia.com/wiki/KAP_%26_UAV_Exposure_Control_Script

@title KAP UAV 3.7
@chdk_version 1.3

@param     i Shot Interval (sec)
  @default i 2
  @values  i Burst Fast 2 3 4 5 10 15 20 30 45 60 90 120 180 240 300

@param     o Shutdown (minutes, 0=never)?
  @default o 0
  @range   o 0 240
@param     s Total Shots (0=infinite)
  @default s 0
  @range   s 0 10000
@param     j Power off when done?
  @default j 0
  @range   j 0 1
@param     b Display Off?
  @default b 1
  @values  b No Yes Delayed
@param     d Start Delay Time (sec)
  @default d 0
  @range   d 0 60000

@param     g Exposure Bracketing
  @default g 0
  @values  g Off +/-0.33 +/-0.66 +/-1.00 +/-1.33 +/-1.66 +/-2.00
@param     e Exposure Comp (stops)
  @default e 5
  @values  e -2.0 -1.66 -1.33 -1.0 -0.66 -0.33 0.0 0.33 0.66 1.00 1.33 1.66 2.00
@param     z Zoom position
  @default z 0
  @values  z Off 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
@param     c Focus @ Infinity
  @default c 1
  @range   c 0 1

@param     y Tv Min (sec)
  @default y 5
  @values  y None 1/60 1/100 1/200 1/400 1/640 1/800 1/1000 1/1250 1/1600 1/2000
@param     t Target Tv (sec)
  @default t 7
  @values  t 1/100 1/200 1/400 1/640 1/800 1/1000 1/1250 1/1600 1/2000 1/5000
@param     x Tv Max (sec)
  @default x 3
  @values  x 1/1000 1/1250 1/1600 1/2000 1/5000 1/10000
@param     f Av Low(f-stop)
  @default f 1
  @values  f 1.8 2.0 2.2 2.6 2.8 3.2 3.5 4.0 4.5 5.0 5.6 6.3 7.1 8.0
@param     a Av Target (f-stop)
  @default a 2
  @values  a 1.8 2.0 2.2 2.6 2.8 3.2 3.5 4.0 4.5 5.0 5.6 6.3 7.1 8.0
@param     m Av Max (f-stop)
  @default m 13
  @values  m 1.8 2.0 2.2 2.6 2.8 3.2 3.5 4.0 4.5 5.0 5.6 6.3 7.1 8.0
@param     p ISO Min
  @default p 0
  @values  p 80 100 200 400 800 1250 1600
@param     q ISO Max1
  @default q 2
  @values  q 100 200 400 800 1250 1600
@param     r ISO Max2
  @default r 3
  @values  r 100 200 400 800 1250 1600
@param     n Allow use of ND filter?
  @default n 1
  @values  n No Yes

@param     v Video Interleave (shots)
  @default v 0
  @values  v Off 1 5 10 25 50 100
@param     w Video Duration (sec)
  @default w 10
  @range   w 5 300

@param     u USB Shot Control?
  @default u 2
  @values  u None On/Off OneShot GntWire Pixhawk
@param     k USB Timeout (secs 0=off)
  @default k 60
  @range   k 0 240
@param     h Shot Sync LED
 @default  h 0
 @values   h Off 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

@param     l Logging
  @default l 3
  @values  l Off Screen SDCard Both

Spares : none

--]]
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 31 / March / 2016, 18:40:58
it works very well but the display off function let the display go on every time it takes a picture, then goes off again, is this normal or I made some mistakes?
The display should stay off and not come back on after each shot when the Display Off function is enabled.  However, you need to set the Review setting in the Canon shooting menu to Off for this to work.  Do you have it set that way ?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 31 / March / 2016, 19:11:01
Yes I have set Review OFF, all the settings here:
Code: [Select]
Camera mode in "P"  or Program (not Auto, M, SCN, or Live)
ISO in Auto
Continuous AF Off (setting the camera in P mode will automatically turn this off on cameras without this menu option)
AF Frame not in Tracking AF
Servo AF Off
Safety MF Off
IS Mode Off (may not be necessary for KAP but should be off for UAV)
Review Off
Lens retract 0 sec.

CHDK reset to default, however I can't remove the disable overrides option, I remove and it returns, maybe the script wants it
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 31 / March / 2016, 19:42:39
Yes I have set Review OFF, all the settings here:
Okay - that's good.   It turned out that was the problem here : link (https://chdk.setepontos.com/index.php?topic=10822.420)

Quote
CHDK reset to default, however I can't remove the disable overrides option, I remove and it returns, maybe the script wants it
The script will work either way.  The reason it turns off is likely the "Disable Overrides on Startup" menu option at the very bottom of the CHDK Enhanced Photo Operations menu. If it is selected then deselect it.

I've tested with your settings (including Shot Review = Off) on my G10 and S100 and both cameras keep the LCD off completely while shooting.

So either the S110 CHDK port works differently or I am missing something else important in your setup.  Can you please post the KAP.LOG file from the top folder on your SD card?

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 31 / March / 2016, 19:59:47
In attachment the file requested and a video too, thank you

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 31 / March / 2016, 21:07:49
In attachment the file requested and a video too, thank you
Thanks for the video and log.  I can reproduce the problem now.  Might take me a bit to fix and test - I'll post something to try shortly and add the fix to the next script updated this weekend.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 31 / March / 2016, 21:20:49
Wow this is great, thank you very much! :xmas

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 31 / March / 2016, 21:25:00
Wow this is great, thank you very much! :xmas
Try this?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 31 / March / 2016, 22:41:23
Try this?
waterwingz (what's your name?) I had packed my equipment and was going to sleep then I saw your message so went back to test the script and it works, problem resolved!
Tomorrow I will go to make some flights, saturday I will come back and let you know if it worked after hundreds of pictures.
Thank you very much, you're great!!!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 31 / March / 2016, 22:45:59
I had packed my equipment and was going to sleep then I saw your message so went back to test the script and it works, problem resolved! Tomorrow I will go to make some flights, saturday I will come back and let you know if it worked after hundreds of pictures.
So,  because I am evil,  I will point out that you are using the USB "OneShot" mode with your Pixhawk UAV.  Which limits you to about one shot every 2 seconds (at best). 

But your Pixhawk and CHDK can get down to 2 shots per seconds!  Depending on what you are doing,  that may not matter.   But if you get to the point when you want to shoot that fast,  check back here?


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 31 / March / 2016, 23:06:37
I had packed my equipment and was going to sleep then I saw your message so went back to test the script and it works, problem resolved! Tomorrow I will go to make some flights, saturday I will come back and let you know if it worked after hundreds of pictures.
So,  because I am evil,  I will point out that you are using the USB "OneShot" mode with your Pixhawk UAV.  Which limits you to about one shot every 2 seconds (at best). 

But your Pixhawk and CHDK can get down to 2 shots per seconds!  Depending on what you are doing,  that may not matter.   But if you get to the point when you want to shoot that fast,  check back here?
Sure I will, very interesting, and if you check the latest apm plane 3.5.1 / 3.5.2 it seems it can log the picture number, I don't know if we can apply it to cameras without external flash, see you soon and thanks again!
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 31 / March / 2016, 23:25:31
Sure I will, very interesting, and if you check the latest apm plane 3.5.1 / 3.5.2 it seems it can log the picture number, I don't know if we can apply it to cameras without external flash, see you soon and thanks again!
Now that is interesting!

Several forum members have attempted to work with the APM (Ardupilot) community on closer integration with CHDK.  For example, the script's Shot Sync LED option was added to the script in anticipation that it would be supported by the flight controller.  That never happened but it remains in the script.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 04 / April / 2016, 13:24:02
Dear waterwingz the script worked flawlessy for 2 days and almost 1000 hectares!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: CharlieR on 05 / April / 2016, 05:14:20
Hi there, just wondering if anyone has any experience using the timestamp information from the kap script log file to do accurate geotagging? I'm using an S100 with the script and geotagging with Pixhawk flight logs and a utility built into Mission Planner GCS but this is limited to 1 second accuracy, which at 8 metres/second could be improved on. I'd love to try using the kap log to provide the time information for geotagging but can't find any software which will accept image time information from an external source - any ideas?

I'd also be very interested in how precise the GPS clock sync on the S100 would be relative to the clock on the Pixhawk (also GPS synced) if anyone happens to know?

Thanks very much!

Charlie
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 05 / April / 2016, 09:33:33
I'd love to try using the kap log to provide the time information for geotagging but can't find any software which will accept image time information from an external source - any ideas?
,
The script log was originally setup to be easy to import into a spreadsheet.  That's still possible but there is now a lot of additional information in there that can be hard to filter out.  Cleaning that up is on my "to-do" list so if you can give me a better idea about what you are trying to do I might be able to help.  I've given some thought to having the option of two logs  - one like the existing one and the other just containing picture info - perhaps formatted as XML.  Seems like it would not be too hard to write a PC script to take that log info and insert it into each image EXIF data for example.

Quote
I'd also be very interested in how precise the GPS clock sync on the S100 would be relative to the clock on the Pixhawk (also GPS synced) if anyone happens to know?
You might be on your own with this one.  Perhaps some on the ground testing with the pixhawk and camera might tell you something if you can figure out a common way to sync.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: CharlieR on 05 / April / 2016, 10:10:44
Unfortunately I don't think the exif data can accomodate sub-second information, at least I haven't been able to add the extra decimal places manually using exif tool. Happy to stand corrected if that's not the case though!

I have posted a query to the Mission Planner devs asking if they could add a feature to import the KAP script log info to their geotag utility, so will see what happens. Ideally I want to be able to geotag images to cm precision whilst flying. A secondary RTK GPS will provide flight path information, either (ideally) from the Pixhawk dataflash logs, or from the GPS system logs with post processing. As I am already using the S100 and CHDK/KAP script for mapping it seems worth putting some time into getting the most out of the hardware - though it will depend how accurately the GPS clocks on the pixhawk and S100 are synced.

If the timestamps from the logs can be into the geotagging process the reprojection error results from Pix4d et. al. should give a good indication of how accurate the tagging process, and thus clock sync etc. is. Will be an interesting test of a very low cost mapping system...

Thanks very much for your help,





Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 05 / April / 2016, 13:51:33
I have posted a query to the Mission Planner devs asking if they could add a feature to import the KAP script log info to their geotag utility, so will see what happens. Ideally I want to be able to geotag images to cm precision whilst flying. A secondary RTK GPS will provide flight path information, either (ideally) from the Pixhawk dataflash logs, or from the GPS system logs with post processing. As I am already using the S100 and CHDK/KAP script for mapping it seems worth putting some time into getting the most out of the hardware - though it will depend how accurately the GPS clocks on the pixhawk and S100 are synced.
If you are going down that path anyway, the idea of having the pixhawk log the exact point at which each photo is taken via a digital input watching one of the camera LEDs might be something to pursue again.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: CharlieR on 07 / April / 2016, 03:14:29
Yep - the next release of Copter (3.3.4) will support triggering of a log message via the hotshoe of a camera so will probably look in that direction. I guess that feature could be adapted to use a photoresistor and the flash sync LED. Got RTK GPS system from Reach setup yesterday, accurate shutter timestamping the last piece of the puzzle!

Cheers - will post here if I come up with a way to use the KAP logs and check the accuracy of the clock sync, for general interest if nothing else.

BR,

Charlie
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / April / 2016, 09:34:36
Yep - the next release of Copter (3.3.4) will support triggering of a log message via the hotshoe of a camera so will probably look in that direction. I guess that feature could be adapted to use a photoresistor and the flash sync LED.
I don't think any Canon P&S cameras have a "flash sync" LED  (i.e. an LED that fires at the exact moment the shutter opens for sync with an external flash).

For cameras with a hotshoe (G series mostly??) the ability to detect the flash trigger signal from a flight controller should be quite accurate - assuming the camera can be configured to actually fire the flash in a bright outdoor lighting situation (and not have exposure issues when there is no actual flash). 

For other CHDK P&S cameras,  the ability to activate the "focus assist" LED via the kap_uav.lua script should be a pretty good option if a phototransistor can be interfaced to the flight controller.



Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 13 / April / 2016, 11:00:20
So,  because I am evil,  I will point out that you are using the USB "OneShot" mode with your Pixhawk UAV.  Which limits you to about one shot every 2 seconds (at best). 

But your Pixhawk and CHDK can get down to 2 shots per seconds!  Depending on what you are doing,  that may not matter.   But if you get to the point when you want to shoot that fast,  check back here?

I'm back!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: CharlieR on 14 / April / 2016, 04:34:02
Just a quick report, I have had some success with accurate geotags using the KAP log time stamps - the time stamping is accurate enough to be useful in combination with post processed RTK GPS data, I have achieved sub metre precision, with the majority of tags within 30cm of the calculated image positions using Pix4d. This is the limit of accuracy of the GPS system at the moment, bu with more accurate position data clock syncing between GPS becomes even more of an issue.

Unfortunately the S100 GPS clock sync is not accurate enough - I have had to use trial and error to discover an offset which works for a given project, not impossible but time consuming.

I guess the S100 internal clock received GPStime, applies the UTC offset and rounds to the nearst second at some point? A shame as it clearly could get an accurate sync in terms of hardware...
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 14 / April / 2016, 09:55:41
@wwz
Sorry for missing out on the fun here!


Can the Canon EOS M3 run the KAP script by default?
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 14 / April / 2016, 10:18:54
Can the Canon EOS M3 run the KAP script by default?
Based on what reyalp reported in the EOS M3 porting thread, the M3 port is incomplete and doesn't support exposure adjustment.  So the value of the kap_uav.lua script would not be much at that point.

Quote
EOS M3 porting
I looked at the existing source a some more and it's less complete than I initially thought. capt_seq was not implemented at all, and it uses propset6 with no modifications. This means that essentially no shooting functions will work.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 14 / April / 2016, 17:52:13
Just a quick report, I have had some success with accurate geotags using the KAP log time stamps - the time stamping is accurate enough to be useful in combination with post processed RTK GPS data, I have achieved sub metre precision, with the majority of tags within 30cm of the calculated image positions using Pix4d. This is the limit of accuracy of the GPS system at the moment, bu with more accurate position data clock syncing between GPS becomes even more of an issue.

Unfortunately the S100 GPS clock sync is not accurate enough - I have had to use trial and error to discover an offset which works for a given project, not impossible but time consuming.

I guess the S100 internal clock received GPStime, applies the UTC offset and rounds to the nearst second at some point? A shame as it clearly could get an accurate sync in terms of hardware...

Does the time wrote by the script differs from the time wrote by the camera in the exif of the photo?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 14 / April / 2016, 21:02:11
Does the time wrote by the script differs from the time wrote by the camera in the exif of the photo?
I would be amazed if the two times were different.  But understand that the script log resolution is better than 0.01 Sec - the exif info is usually only in increments of one second.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: CharlieR on 15 / April / 2016, 06:45:26
The shutter release times in the KAP log are very accurate as far as I can tell - I have improved the post procesing of my gps logs to a precision of a few cm and to reduce the offset beween computed and reported image positions in Pix4d to the point that the largest error is the offset in height between the GPS anetnna and the camera sensor (around 10cm).

If there was a way of getting the GPS time into the KAP log with an accurate time stamp from the S100 clock or something it would be fairly easy to achieve GCP free mapping using this method.

autofocus led with a phototransistor looks the best bet for an accurate sync otherwise.

continue to be very impressed with chdk and the kap script  :D
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 15 / April / 2016, 09:07:29
@WWZ,
I am a little puzzled as my S110 with Pixhawk + Burst does not wait for trigger signal on each photo but rather at the first signal  it starts shooting and it does not stop until it freezes and goes dead.
Most probably I messed up a setting somewhere working on the new interface, but I have no idea where.
can you please help?
I am still using the 3.6b15.   :-[
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 15 / April / 2016, 09:36:39
Most probably I messed up a setting somewhere working on the new interface, but I have no idea where.
Please post your most recent log file as an attachment here.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: geebob on 15 / April / 2016, 10:05:19
been trying this script on a canon a2400 mounted on my q500 quadcopter. I'm a newbie at chkdsk and I've spent the last week trying to find info on how to make changes in a script. I downloaded a freeware program that allows me to make and save changes to the script but without knowing which lines to changes I guess I'm kinda at a loss. The images I have been getting are at least 2 stops overexposed and from the metadata all the images are shot at 2.8 with shutter speeds generally around 1/1000th with variable iso settings. The images from this camera are terribly grainy so I was hoping to lock the iso at 100 and chance a slower shutter speed. If someone could point me in the right direction I would be most appreciative.
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 15 / April / 2016, 10:12:43
The images I have been getting are at least 2 stops overexposed
What version of CHDK are you using?  There is a bug in some versions with ISO settings that is unrelated to the script.

Quote
The images from this camera are terribly grainy so I was hoping to lock the iso at 100 and chance a slower shutter speed. If someone could point me in the right direction I would be most appreciative.
The CHDK script parameters for the kap_ uav.lua script let you specify the ISO range that will be used.  No editing of the code is necessary.  It's all right there in the CHDK script menu if you scroll down far enough.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: geebob on 15 / April / 2016, 10:45:40
Thanks for the quick reply. I dont have the camera with me today but I will check when I get home. I thought it was the latest version but again I will check tonight.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 15 / April / 2016, 15:52:50
What version of CHDK are you using?  There is a bug in some versions with ISO settings that is unrelated to the script.
This camera doesn't have CAM_MARKET_ISO_BASE  set, and probably should since it's DryOS R50.

@geebob Please run the isobase.lua script found in CHDK/SCRIPTS/TEST and report what it prints  on the screen.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: geebob on 17 / April / 2016, 19:33:22
 Im using version   3.7. Isobase says base=200  set can_market_is I_base_200
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / April / 2016, 19:39:08
Im using version   3.7. Isobase says base=200  set can_market_is I_base_200
The fix for your issue was added to CHDK yesterday.  If you download and reinstall CHDK your issue with 2 stop overexposure will be fixed.   You can keep using the same version of the script.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: geebob on 17 / April / 2016, 21:01:50
Great thanks
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: geebob on 17 / April / 2016, 21:43:16
Waterwingz..just to make sure I'm doing this right. If I go back and run stick utility and tell it to download chkdsk again.. obviously using the chkdsk file it already downloaded would be the same file... the file it downloads tonight would have the fix applied? 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / April / 2016, 22:48:27
the file it downloads tonight would have the fix applied?
Yes.  To be certain, you could manually delete the earlier file first.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 18 / April / 2016, 22:54:43
Dear waterwingz, where the script write the options of the KAP_UAV? I want to make backup of mine SD cards and I am only copying the kap_uav_3-7a.lua but I would like to backup  the options I select too, do I have to edit the script and set them as Default?

Thank you

p.s. I am waiting you to reveal the fast shutter method, is the pwm one?

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 19 / April / 2016, 00:22:32
Hi,
Code: [Select]
function ch2up(pwidth)
            if( repeat_check("ch2up",pwidth ) >= PWM_required_repeats ) then
                usb_shooting_mode = 0                                  -- put camera into playback / sleep mode
                in_continuous_mode = false

continuous mode = "Burst", right?

is there a specific reason for the: in_continuous_mode = false
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / April / 2016, 04:31:24
where the script write the options of the KAP_UAV? I want to make backup of mine SD cards and I am only copying the kap_uav_3-7a.lua but I would like to backup  the options I select too, do I have to edit the script and set them as Default?
CHDK saves the parameter values used by any script in the A/CHDK/DATA folder on your SD card.  If you look at the files in that folder,  you will see at least two files for each script you have run that have the same filename as the script. 

One file is very small and has the extension .cfg  (e.g.  kap_uav.cfg).  That file simply stores your selection of which parameter set to store.

The other files will have the extension .0 to .9 .  These are the various versions of the script parameter options you may have stored.   The default is the file with the .0 extension (i.e. kap_uav.0).

So if you save and restore kap_uav.cfg and kap_uav.0 in the A/CHDK/DATA folder you will backup your script settings.   Or simply save and restore everything in that folder.

Script parameter sets are explained here : CHDK User Manual : Script Parameters (http://chdk.wikia.com/wiki/CHDK_User_Manual#Load_default_param_values)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / April / 2016, 04:45:59
continuous mode = "Burst", right?
I'm not sure what you are asking me here and why you are asking. So providing a good answer might be tough.

The script uses the in_continuous_mode variable to indicate that continuous (or burst) shooting has started.  The variable can be either true or false.  When the script is shooting in continuous mode, the exposure is only set at the start of each shooting sequence and the script shoots as quickly as possible - usually under USB Remote control.

Quote
is there a specific reason for the: in_continuous_mode = false
That particular piece of code is called when a specific PWM signal is received (typically from a flight controller). It was intended to allow the flight controller to halt (or reset) a continuous mode shooting sequence.  To do so, it changes a couple of variable that are used to control the shooting state - including the one that indicates the camera is currently shooting in continuous mode.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 19 / April / 2016, 08:49:57
Thanks WWZ!
That is similar to what I experienced.


Question?
 how can I turn off the camera gyro? I have half the pictures as landscape the other half(due to a maneuver in the air ) as portrait.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / April / 2016, 15:05:30
how can I turn off the camera gyro? I have half the pictures as landscape the other half(due to a maneuver in the air ) as portrait.
I don't think the camera records a different image based on orientation.

However it does record it's orientation at the time of the shot in the image's EXIF data.  So what you are seeing is the image display software in your PC rotating the image between portrait and landscape modes. 

You either need to turn that feature off in your PC software or manually edit the EXIF data in each image to remove the orientation information.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 22 / April / 2016, 13:02:33
Thanks WWZ!

Meanwhile since I fried my S110 with 12V I bought an SX200IS, but there are a few differences in how it is working.
My main problem I absolutely need to solve is the shot rate. Right now it is down to 1.9s  with BURST and NO USB CONTROL.
 SD card is a 90MB/s write speed so that cannot be the problem.
Can you please help me get it down to .5s (as the S110)?
Please tell me what flies are needed to ID the problem.


Many thanks in advance!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: msl on 22 / April / 2016, 13:24:24
I bought an SX200IS, ... Can you please help me get it down to .5s (as the S110)?
This is technically not possible. See the specifications for the SX200 (http://www.dpreview.com/products/canon/compacts/canon_sx200is/specifications) - Continuous drive 0.8 fps.

msl
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / April / 2016, 13:32:49
I bought an SX200IS, ... Can you please help me get it down to .5s (as the S110)?
This is technically not possible. See the specifications for the SX200 (http://www.dpreview.com/products/canon/compacts/canon_sx200is/specifications) - Continuous drive 0.8 fps
Well, 0.8 fps is 1.25 seconds per shot. Which is better than 1.8 seconds per shot.

Some of the tricks to try include shot review off, RAW off, and ISO below 800.

You could also try putting the camera into continuous drive mode using the Canon menu. The script should be able to handle that.

But as msl points out, there is a lower limit of what this camera can do.  Sorry.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: netptl39 on 22 / April / 2016, 14:10:07
Damn, I must have missed that during scouting.
I'll call it a day and go back to the interface and building a slower UAV.


Do I absolutely need a DIGIC V with CMOS for the 2fps or there a DIGIC 4s with CCD that can have that?
Many thanks in advance!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 22 / April / 2016, 15:52:31
Do I absolutely need a DIGIC V with CMOS for the 2fps or there a DIGIC 4s with CCD that can have that?
As msl suggested, the Canon specification for continuous shooting will give you an upper bound on the possible shooting rate. CHDK will never be much faster, and depending on the particular script and settings may be significantly significantly slower.

In general, recent low end powershots aren't going to do 2 fps at full resolution. Some shoot faster in special low light or fast shooting modes, but images are half sized (1/4 the number of pixels) and quality is reduced.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 25 / April / 2016, 16:52:37
waterwingz APM PLane software is ready to log from hotshoe feedback:
http://ardupilot.org/plane/docs/common-camera-shutter-with-servo.html?highlight=log#common-camera-shutter-with-servo-enhanced-camera-trigger-logging
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 26 / April / 2016, 08:23:05
waterwingz APM PLane software is ready to log from hotshoe feedback:
I guess if you have a camera with a hotshoe then this could be interesting.  Unfortunately most small cameras suitable UAV work do not have one.  The ability of kap_uav.lua to blink an LED when the shutter opens, coupled with a little extra hardware, might be useful instead.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bchristal on 06 / May / 2016, 13:30:00
Hey WW,


Hope all is well. Along the lines of APM hot shoe feedback, I have a phototransistor cable working with the Shot Sync LED. Works great on my S110. The Shot Sync LED flashes the red eye LED for maybe a tenth of a second for each picture. The phototransistor cable records precise camera location to the Pixhawk. However,  I have a customer with a different S110. His flashes the LED for close to 1 second. That causes extra CAM events in the Pixhawk log. A resistor change may help hold the hi / lo state, but I'd like to figure out why the LED stays on so long on his S110. It's not the shutter speed. That will make the LED stay on if you make it long. Any idea where to start?


Thanks!


Brian
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / May / 2016, 13:59:36
However,  I have a customer with a different S110. His flashes the LED for close to 1 second. That causes extra CAM events in the Pixhawk log. A resistor change may help hold the hi / lo state, but I'd like to figure out why the LED stays on so long on his S110. It's not the shutter speed. That will make the LED stay on if you make it long.
If all the hardware is the same then i guess that leaves two options.

The most likely option would be some difference in either the Canon menu settings or the CHDK settings. I'm not too sure what that might be but having RAW Enabled (either Canon RAW or CHDK RAW/DNG) would certainly do it.

The other option might be a slow SD card, or maybe an almost full one, or one with a really large log file.  The script writes to the log file in between the points where it turns the LED on and off.

Quote
Any idea where to start?
I can add something to log the actual on & off times for the LED if you can get him to run a test version and report back.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bchristal on 06 / May / 2016, 14:03:24
That'd be great. Let me know where to download. Thanks!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / May / 2016, 11:29:37
That'd be great. Let me know where to download. Thanks!
Test version :  https://app.box.com/s/xm53d9wuu8pj2y6go674zx6uw9ckrl1z

Note that while running this on my old G10,  I noticed that the LED stays on for about 1.3 seconds in "normal" or "fast" shooting modes.  In "burst" mode that drops to 0.22 seconds.

It might be possible to have the script produce a shorter pulse but it will require a bit of somewhat tricky code to make the change transparent (i.e. not increase the actual shot time).


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bchristal on 07 / May / 2016, 14:51:48
Thanks!  Will test my customers camera in a few. When you say "fast" and "burst" modes are you talking about  Shot Interval (sec) fast and burst? Also, what should Shot Interval (sec) should be set to if using USB trigger type "OneShot"? There used to be a setting for "0".
(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fwww.tuffwing.com%2Fimages%2FCHDK3.jpg&hash=cc93985ba0ea755e6d2fc0cedfba329d)


Thanks!!


Brian
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / May / 2016, 16:10:31
When you say "fast" and "burst" modes are you talking about  Shot Interval (sec) fast and burst?
Yes.
Quote
Also, what should Shot Interval (sec) should be set to if using USB trigger type "OneShot"? There used to be a setting for "0".
I guess that's not exactly clear.  If you are using any of the USB trigger types,  then setting Shot Interval to Burst will shoot in continuous mode (i.e. with "half-press" maintained and the shots triggered by a full press only.)  Setting it to Fast (or any number) causes each shot to do a full half-press - full-press sequence for each shot.

When I get a minute, I'll see if I can come up with a better way to setup the user parameters so that this is a little more obvious.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bchristal on 07 / May / 2016, 16:40:13
I'm getting extra pictures when the airplane turns even though trigger pulses are stopped at the end of the survey area. See red dots in the attached photo. Also note how close blue dots and green dots are to each other. That is from Pix4D. Blue dots are the georeferenced camera location from the Pixhawk log, green dots are where Pix4D thinks the camera is. There used to be much further spacing, and less accurate maps. Thanks for adding the Shot Sync LED!!!

What do you think is causing the extra un-triggered pictures?

USB Shot "Pixhawk"
Camera set to "Continuous"
Shot Interval set to "Burst"
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / May / 2016, 16:51:08
What do you think is causing the extra un-triggered pictures?
This was discussed recently here  (  https://chdk.setepontos.com/index.php?topic=10822.msg127196#msg127196 )

In order to shoot really quickly, the script waits for each USB pulse just prior to the actual camera shutter opening.  This means it has actually started the next shot as it waits and so when you stop sending "shoot" commands,  it needs to complete the final shot.  This shows up as the extras you see on your SD card.

I don't really have a way to fix that at the moment.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bchristal on 07 / May / 2016, 17:19:08
Ah, okay. The phototransistor feedback cable is a big help in this case. The photos with a red dot are georeferenced, and accounted for in the log. They are red because Pix4D is unable to match them up to the rest of the photos since the airplane is turning and it's a single photo on the end. The LED flashes whether the Pixhawk triggers the photo or it's a superfluous photo at the end.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bchristal on 07 / May / 2016, 18:30:48
Here's the log with LED flash duration. Seems to be well under a second. Not sure why I thought it was slower.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / May / 2016, 18:36:51
Here's the log with LED flash duration. Seems to be well under a second. Not sure why I thought it was slower.
Thanks.  Individual shots clock in at 3/4 of a second - continuous mode shots running 0.4 seconds.

Not bad actually.

Edit : If it's not working for your customer,  do I need to figure how to shorten the LED "on" time? Or is this something the Pixhawk can handle?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bchristal on 07 / May / 2016, 18:42:09
Do you have another recommendation for a point and shoot like the S110 that can be USB triggered? S110s are great, but getting really expensive and hard to find. Other Canon point and shoots just aren't as clear.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / May / 2016, 18:45:59
Do you have another recommendation for a point and shoot like the S110 that can be USB triggered? S110s are great, but getting really expensive and hard to find. Other Canon point and shoots just aren't as clear.
AFAIK every CHDK enabled camera can be USB triggered.  I wrote the code currently in use so there is a 50:50 chance I know what I'm talking about here.  8)   The trick is probably finding a Powershot that is CHDK supported, commercially available, and not brutally expensive.  The Canon refurb store is a great source but it's hit and miss as to what they have available.

Edit : take a look at the IXUS160/ELPH160.  Not the same class as the S90/S110 line but still available and not expensive. 
ex : B&H Photo (http://www.bhphotovideo.com/bnh/controller/home?O=&sku=1110386&gclid=CNSDk-eFycwCFcgjgQodZfcMIA&is=REG&ap=y&m=Y&c3api=1876%2C92051677682%2C&Q=&A=details)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: dopplerx on 09 / May / 2016, 17:30:25
Hi all,

It´s my first post here. I'm using CHDK with a Canon S110 in the "one shot" mode with APM and the results are good.

Searching a way to take more photos (flying faster or at lower altitudes) I found this forum and the "burst" mode used in the Pixhawk.

I would like to know: Does this "burst" mode work for APM?

Thanks!
Max
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bchristal on 09 / May / 2016, 17:36:49
Hi Max,


Set your Pixhawk and S110 like this: http://tuffwing.com/support/Install_KAP_UAV_Exposure_Control_Script.html


Brian
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: dopplerx on 09 / May / 2016, 17:45:15
Hi Brian,

Does it work the same way for the APM? I don't have a Pixhawk.

Thanks!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: bchristal on 09 / May / 2016, 20:24:52
Hmm, I don't know. Try it on an RC out. I haven't looked at an APM in a while.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: aquila_geo on 06 / June / 2016, 16:36:59
Hi there.  I've been using CHDK for UAV mapping for a few years, but I just got a new camera (A2300).  I love this script, but turning off the intervalometer disrupts my practiced workflow..with the camera mounted on a gimbal, it's hard to get to the MENU button to turn it off...in the past, I've just used the shutter button, which would be far easier.  Is there a setting that I'm missing?  Thanks
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / June / 2016, 17:46:03
it's hard to get to the MENU button to turn it off...in the past, I've just used the shutter button, which would be far easier.  Is there a setting that I'm missing?
The default CHDK method of using the shutter button to halt a script essentially stops the script dead in its tracks. So the kap_uav.lua script disables that action. This allows the script time to clean up and close its log file - something not otherwise possible even when the script uses the "restore" functionality.

Having said that, it should be possible to trap a shutter full press and convert it to work like a "menu" key exit.  I'll post an update in the next couple of days.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: flo_vienna on 13 / June / 2016, 02:18:52
Hi

I am using a 3DR Y6 with Pixhawk together with a simpleshutter cable to remotely control a Canon S90.  I tried to setup the shutter as requested on vendors page (http://www.mobilexcopter.com/files/Simple_multi_shutter_Pixhawk_settings.pdf) using AUX2 on Pixhawk with CAM_TRIGG_TYPE 1. I installed the latest CHDK and the latest KAP_UAV Script on the camera and configured it according to the wiki page.
My problem now seems to be how to properly trigger the camera as the script is running and the shutter cable is indicating that it is sending some pulse to the camera. On random occasions the camera takes a picture but most of the time I get a message stating usb pulse =  idle pulse ($ msec) which seems to be the default if the pulse does not match anything known. The pulse length seems to be different no matter what I set the CAM_Duration to. Sometimes the camera takes a picture but then does not seem to react to any further input and does not show any sign of being alive anymore.

How do I need to configure the CAM_Duration to make this work properly ? I tried 0, 1 , 5 , 10  but none of these seem to produce a reproducible result. 
Is this some issue of the shutter cable or does the script need some adjustment to work with that cable and the pulse it sends ?

Greets from Vienna
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 13 / June / 2016, 07:58:31
I tried to setup the shutter as requested on vendors page (http://www.mobilexcopter.com/files/Simple_multi_shutter_Pixhawk_settings.pd
Thanks for the link - I had not seen that page before.

Quote
I installed the latest CHDK and the latest KAP_UAV Script on the camera and configured it according to the wiki page.
Thanks for attaching your log file.  Everything looks correct in your setup but the log entries show that the pulses the camera sees from the pixhawk seem to be somewhat random in length.

Quote
How do I need to configure the CAM_Duration to make this work properly ? I tried 0, 1 , 5 , 10  but none of these seem to produce a reproducible result. 
Is this some issue of the shutter cable or does the script need some adjustment to work with that cable and the pulse it sends ?
As I don't own a pixhawk I will check this with someone who does and uses the script.

Update 1 :  I took a longer look at the link you posted. The setup shown is designed to produce "shoot pulses" that are at least 100 mSec in length (0.1 seconds).  This is not compatabile with kap_uav.lua script's  USB Shot Control Mode = pixhawk.  That's the bad news.  The good new is that if you set the USB Shot Control Mode = OneShot it should work (albeit at a slower shot rate of at least 2 seconds per shot)

I'll look for some better documentation about how to configure the pixhawk for "high speed" shooting.

Update 2 :  link to instructions for high speed shooting http://tuffwing.com/support/Install_KAP_UAV_Exposure_Control_Script.html


Update 3 :  updated link http://tuffwing.com/support/pixhawk_camera_trigger_cable.html
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: flo_vienna on 14 / June / 2016, 17:25:55
Setting it to "OneShot" seems to work at least when manually triggered via Missionplanner ;)

I am going to give it a try soon , thanks for the effort :)

Greets
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cndnflyr on 22 / June / 2016, 12:13:07
I'm using the KAP script to trigger a Canon ELPH 110 HS from a Pixhawk with a Gentwire USB2 cable.  I've looked at and implemented all the links I've seen regarding this, but I've been having tons of trouble getting it working properly though.  Right now, when I have USB Shot Control set to Burst or OneShot the camera starts shooting in Continuous mode and doesn't stop.  I've had it working before, but it was triggering too slowly so I messed around with a bunch of stuff.  I can't for the life of me figure out where this is set or how to change it.  Can someone point me in the right direction?
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / June / 2016, 12:26:44
Can someone point me in the right direction?
The script ignores all of the settings from the CHDK USB remote menu so it does not matter how you set them.

Please post the KAP.LOG file from the root folder of your SD card so that I can take a look at your setup.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cndnflyr on 22 / June / 2016, 12:33:03
Of course!  Meant to and forgot, here's the log.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / June / 2016, 13:25:29
Of course!  Meant to and forgot, here's the log.
Thanks.   I took a quick look and did not see anything wrong with your setup.  There were a lot of changes recently made tuning "pixhawk" mode for sub one second shooting. It's possible something broke in "gentwire" mode as a result.  I don't think many people are using that device so a new bug may not have surfaced yet.   I'll take a closer look tonight at the logic.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cndnflyr on 23 / June / 2016, 01:07:49
I'm not sure it would be an issue with the logic of the script.  It was working for me last week, albeit slowly.  I can't figure out why it would be going into continuous mode.  And I think the way it was working last week isn't working now.  I'm pretty new to using this, sorry i'm not more definite.  I was hoping it would be a no brainer, but maybe not.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Toshopo on 24 / June / 2016, 14:15:18
Hi Waterwings


I was asking you for the Helium baloon,  I launch finaly on 6th of June with my classroom.
Your KAP scripts was perferct and I want really want to thank you.
As a proof of your wonderful script i try to send this pictures about 3.000 and 75.000 feet over the ground.


Glad to met you


Olivier










 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Toshopo on 24 / June / 2016, 14:16:15
75.000 feet !
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Toshopo on 24 / June / 2016, 14:27:37
Of course contact me if your want more informations about this flight !


 :) :) :) :) :) :) :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 24 / June / 2016, 14:36:16
Of course contact me if your want more informations about this flight !
Or you could post an update here?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Toshopo on 24 / June / 2016, 16:39:03
I don't really undestand your questio but I'll reply with pleasure.
Do you want more pictures ? KAP log ?


Thank again
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Toshopo on 24 / June / 2016, 16:44:50
That last picture allow scholars answers (and prooved) 2 questions :


Is the sky dark ?
Is the Earth Plane ou round ?


Thanks ;-)





Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 25 / June / 2016, 00:15:12
I don't really undestand your questio but I'll reply with pleasure. Do you want more pictures ? KAP log ?
The log file would be interesting. 

Along with any information about how high / long the flight went and what images where taken & when?  Maybe an image site with more photos? Details about what the balloon package looked like - how did you build it?  How did you mount and protect the camera?  What else was in the payload?  How did you recover the payload when it returned to earth?  Did you have fun doing this? Who else was on the team?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 25 / June / 2016, 00:16:35
I'm not sure it would be an issue with the logic of the script.  It was working for me last week, albeit slowly.  I can't figure out why it would be going into continuous mode.  And I think the way it was working last week isn't working now.  I'm pretty new to using this, sorry i'm not more definite.  I was hoping it would be a no brainer, but maybe not.
Haven't forgotten this.  I just need to find my Arduino clone kit that simulates a gentwire 2 for testing.  Hang in there.

Update :  took a longer look at your kap.log file.  It appear you have set the script's "Shot Interval (sec)" setting to "Burst".  That tells the script to run in continuous mode once it starts shooting.  For your application,  try setting it to "Fast" instead.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cndnflyr on 04 / July / 2016, 10:43:11
Took me some time to settle into the new office.

Here is a new log, still has the old log info too, so you should be able to compare easily.  I've done some more comparisons, but I can't make sense of what's going on.  I hope you can.

USBShotControl: OneShot
ShotInterval: Fast
It keeps taking a shot, one after the other, but with no input from me.  It says it gets the USB start signal and then it just starts taking pictures. 

USBShotControl: GntWire
ShotInterval: Fast
Receives start signal and takes one shot.  Then doesn't respond to Pixhawk input.

USBShotControl: GntWire or OneShot
ShotInterval: Burst
Receives start signal and takes continuous shots.  It says it's using continuous mode.

If I use Mission Planner to trigger the camera through the Pixhawk, there's no response on the camera.  I don't know how to trouble shoot this since it was working at one point.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 04 / July / 2016, 10:55:07
(snip)
Hello cndnflyr! What board are you using? Can you post you APM configuration parameters?

EDIT: I see you already said you have a pixhawk. Please post your APM configuration parameters, I'm interested in the parameters that contain ¨CAM¨ somewhere in the name.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cndnflyr on 04 / July / 2016, 11:01:48
I'm using a Pixhawk with a Gentwire USB2 (not using the extra wire though, just trying to get simple triggering).  The camera  is an ELPH 110 HS running CHDK 1.4.  I've attached the parameter file.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 04 / July / 2016, 12:01:18
Your APM settings seem to be Ok. As I never used a gentwire cable before, let's try to diagnose what it's doing.

Please connect the gentwire directly to the RC receiver channels 3 (throttle) and 2 (pitch), without using the pixhawk. Download the GentWire test script from http://www.gentles.ltd.uk/gentwire/chdk_sdm/CHDK2Tester.zip, run the script and report back (instructions for the script are at http://www.gentles.ltd.uk/gentwire/chdk_sdm/index.htm). Does the camera report "channel 1 up" when you move the throttle all the way up, "channel 1 middle" when you move the throttle to the middle, "channel 1 down" when you move the throttle down? Do the same with the pitch stick. It should report the same, but with channel 2. Does the script report your actions correctly?
What happens when you connect only one cable to the channel  3 (throttle)? What does the test script report?

Next, modify the test script:
Replace lines 13 to 19 (all the lines that start with "if a  ....") with just a single line: "print a" (without the quote marks).
Save the script, and run it while testing every combination of the throttle & pitch positions (ie: throttle down & pitch down; next throttle down & pitch center; next throttle down & pitch up; then throttle middle & pitch down; etc). What does the script report for every combination? You could also test what the script reports when you only connect one cable to the throttle, and leave the other cable disconnected from the pitch.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 04 / July / 2016, 12:15:05
(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FvyhDkX0.png&hash=ed9f265b954101d4ad198bbc0cf323d5)

I waded through each of the runs in your log.  They all make sense if you assume that the gentwire2 device only ever sends IDLE pulses (i.e. 200 mSec pulses). 

I wrote a much longer description of what happened at each log entry but the forum barfed when I posted and it got lost. >:(

In the end, what each case shows is the the script is only seeing idle pulses from the gentwire2 device.

It will be interesting to see what happens if you follow the testing method suggested by Naccio.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cndnflyr on 04 / July / 2016, 13:32:24
Thank you!  The instructions make sense, I'll be back there tomorrow morning and see what I come up with.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cndnflyr on 06 / July / 2016, 09:20:56
Thank you for the instsructions.  Most helpful.  After connecting the GUSB2 to the RX and running the test script it worked well.  Channel 1 and 2 both worked with the sticks.  One confusing thing was the 1 channel on the RX was the throttle and the 3 channel was the pitch.  It's a Dragonlink v2 basic Rx, but I'm guessing that has nothing to do with the camera triggering, so I ignored it.

After modifying the script, here are the stick and result combinations:
Throttle, Pitch, Result
down, middle, 6
down, down, 8
down, up, 3
middle, middle, 15
up, middle, 12  (keeping the pitch in the middle, as I move the throttle up and down I get values from 12 to 19)

Moving the throttle gives me values between 12 to 19 regardless of where the pitch is set
Same with the Pitch.  Leaving the throttle in one position (doesn't matter which), moving the pitch gives me values between 3 and 9.

I'll see what i get when it's going through the pixhawk.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / July / 2016, 09:33:42
I'll see what i get when it's going through the pixhawk.
You could also connect the gentwire2 directly to the camera and validate that the kap_uav.lua script will work with it directly (it should).
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cndnflyr on 06 / July / 2016, 11:14:11
Didn't have time to try different things today, but the modified test script showed a constant "6" when plugged into the Pixhawk.  I suppose I need to figure out how to get other values. 

One thing I haven't quite understood is the parameters necessary in Mission Planner to get the two channels working.  I haven't come across examples of this yet.  I'm assuming two AUX ports would be set to something, but it won't let me have two set to camera trigger.  Ah well, for tomorrow.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 06 / July / 2016, 11:16:33
After modifying the script, here are the stick and result combinations:
Throttle, Pitch, Result
down, middle, 6
down, down, 8
down, up, 3
middle, middle, 15
up, middle, 12  (keeping the pitch in the middle, as I move the throttle up and down I get values from 12 to 19)

Moving the throttle gives me values between 12 to 19 regardless of where the pitch is set
Same with the Pitch.  Leaving the throttle in one position (doesn't matter which), moving the pitch gives me values between 3 and 9.

Thank you! I think I understand how it works.
It seems you connected channel 1 to the pitch and channel 2 to the throttle.
It looks like the gentWire only registers the last change in any channel, and sends the corresponding pulse. Meaning: if you move the throttle up, and a second later move the pitch up, it will first send a 180mS pulse, then a second later it will send a 90mS pulse, and it will keep sending a 180mS pulse until you move a stick again.

Here are the gentWireUSB2 specifications:
Quote
Movement of the RC Transmitter stick from one extreme to the other will send a single trigger to the camera at either end and in the middle. The example scripts, or user generated scripts, can detect the following pulse lengths on the USB power with the get_usb_power function which counts with 10mS resolution:
Channel 1USB PulseChannel 2USB Pulse
Low position30mSLow position120mS
Mid position60mSMid position150mS
High Position90mSHigh Position180mS

In addition to the above, a 210mS pulse will be sent every 5 seconds if neither servo is connected to a RC receiver. If the RC receiver looses communication with the transmitter and the receiver stops sending pulses to the servos, then the USB output will go high continuously until communication is re-established.
[/t]
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 06 / July / 2016, 11:25:56
Didn't have time to try different things today, but the modified test script showed a constant "6" when plugged into the Pixhawk.  I suppose I need to figure out how to get other values. 

One thing I haven't quite understood is the parameters necessary in Mission Planner to get the two channels working.  I haven't come across examples of this yet.  I'm assuming two AUX ports would be set to something, but it won't let me have two set to camera trigger.  Ah well, for tomorrow.
Try setting these APM params:
RC7_MIN --> 1100
RC7_TRIM --> 1100
RC7_MAX --> 1900
CAM_SERVO_OFF --> 1100
CAM_SERVO_ON --> 1900
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cndnflyr on 06 / July / 2016, 11:54:25
Super!  It works flawlessly now.  Thank you for the suggestion.  Could you explain what the difference was?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Naccio on 06 / July / 2016, 12:22:52
Super!  It works flawlessly now.  Thank you for the suggestion.  Could you explain what the difference was?
Glad I could help!  :)
I believe the param to look out for is RC7_TRIM. That param tells the pixhawk what PWM pulse width to send when idling. You had it set at 1500, equivalent to "channel 1 mid", now it's set at 1100, equivalent to "channel 1 low". WW's script expects "channel 1 low" while waiting for the next shot, and "channel 1 high" as the order to shoot when configured for your setup.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: flo_vienna on 30 / July / 2016, 13:29:50
Hi

I posted earlier about getting the script to work and I managed to get it to work with the SimpleShutter cable from http://www.mobilexcopter.com. I managed to trigger the camera using my pc version of mission planner and my RC (chan7).

I tried to use 3DR Tower software to use the structure scanner to fly over an area and automatically take pictures. As S90 is not available in the Tower software I chose S100 but it does not seem to take any pictures. CHDK is running and the KAP_UAV Script is running as well.

Does anybody have experience with 3DR Tower software on android , CHDK , and the KAP_UAV scripts ?
Do I need the script ?

 :'(


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 30 / July / 2016, 14:30:30
I posted earlier about getting the script to work and I managed to get it to work with the SimpleShutter cable from http://www.mobilexcopter.com. I managed to trigger the camera using my pc version of mission planner and my RC (chan7).

I tried to use 3DR Tower software to use the structure scanner to fly over an area and automatically take pictures. As S90 is not available in the Tower software I chose S100 but it does not seem to take any pictures. CHDK is running and the KAP_UAV Script is running as well.
Please copy the KAP.LOG file from the root folder of your SD card and attach it to a post here.

Quote
Do I need the script ?
It's possible to trigger shots with just the CHDK USB Remote settings.  But it all depends on how you have your flight controller software configured.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: flo_vienna on 30 / July / 2016, 15:31:43
Hi

I actually wanna trigger the camera via the 3DR Tower Software on my android tablet but as there is no S90 to choose, I chose S100 in there. I am not even 100% sure this is the right place but I am a bit unsure how to debug that.

Here is my KAP.log for today:

2016Jul30 15:13:59    KAP 3.8 started - press MENU to exit
2016Jul30 15:13:59    CHDK 1.4.1-4599 s90 100c Apr 18 2016
2016Jul30 15:13:59    Mode:PLAY,Continuous_AF:1,Servo_AF:2 Drive:0
2016Jul30 15:13:59     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2016Jul30 15:13:59     Av:5.0 minAv:2.8 maxAv:8.0
2016Jul30 15:13:59     ISOmin:100 ISO1:400 ISO2:800 M:0
2016Jul30 15:13:59     Focus:AFL  Video:0 USB:2:1 Tmo:0
2016Jul30 15:13:59     AvM:1 int:3 Shts:0 Dly:5 B/L:0
2016Jul30 15:14:00    entering start delay of 5 seconds
2016Jul30 15:14:08    waiting on USB signal
2016Jul30 16:04:39    Menu key exit request
2016Jul30 16:04:39    Logger : log file updated.

Br and thanks :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 30 / July / 2016, 17:11:06
I actually wanna trigger the camera via the 3DR Tower Software on my android tablet but as there is no S90 to choose, I chose S100 in there.
I took a very quick look at the 3DR Tower git repository but it was not clear what the camera setting is supposed to do.  Certainly the code has no way to know if you have an S90 or S100 attached.
Quote
Here is my KAP.log for today:
From your log file, it does not look like your system is toggling the USB line to the camera at all.   So this does not appear to have anything to do with CHDK or the kap_uav.lua script.
Quote
I am not even 100% sure this is the right place but I am a bit unsure how to debug that.
I notice you've posted this issue over on the ardupilot forum (and possibly elsewhere?). That's probably a better place to get an answer.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: flo_vienna on 20 / August / 2016, 14:48:25
Hi

I am still debugging my S90 / Tower app issue. According to the maker of my shutter cable, the pulse sent to the chdk script is hat the pixhawk outputs (like it mirrors it).
How long should a pulse be at least for the OneShot Mode ?

What does this log tell me ? (It shot 1 picture at the beginning but that's all)

2016Aug20 20:32:55    KAP 3.8 started - press MENU to exit
2016Aug20 20:32:55    CHDK 1.4.1-4672 s90 100c Aug 11 2016
2016Aug20 20:32:55    Mode:PLAY,Continuous_AF:1,Servo_AF:2 Drive:0
2016Aug20 20:32:55     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2016Aug20 20:32:55     Av:4.5 minAv:3.2 maxAv:8.0
2016Aug20 20:32:55     ISOmin:100 ISO1:400 ISO2:800 M:0
2016Aug20 20:32:55     Focus:AFL  Video:0 USB:2:1 Tmo:0
2016Aug20 20:32:55     AvM:1 int:2 Shts:0 Dly:5 B/L:0
2016Aug20 20:32:56    entering start delay of 5 seconds
2016Aug20 20:33:04    waiting on USB signal
2016Aug20 20:37:04    USB start signal received
2016Aug20 20:37:08    Mode switched to P
2016Aug20 20:37:11    Logger : log file updated.
2016Aug20 20:37:19    timeout after shoot full
2016Aug20 20:37:13.150 1) IMG_1714.JPG
2016Aug20 20:37:19     meter : Tv:1.0 Av:2.0 Sv:1600 -741:-741
2016Aug20 20:37:19     actual: Tv:10 Av:3.2 Sv:800 Temp:26
2016Aug20 20:37:19             AvMin:3.2 NDF:NDout foc:infinity
2016Aug20 20:38:11    Logger : log file updated.
2016Aug20 20:39:11    Logger : log file updated.
2016Aug20 20:40:11    Logger : log file updated.
2016Aug20 20:41:11    Logger : log file updated.
2016Aug20 20:42:11    Logger : log file updated.
2016Aug20 20:43:11    Logger : log file updated.
2016Aug20 20:43:20    MENU key pressed.
2016Aug20 20:43:20    script halt requested
2016Aug20 20:43:20    Logger : log file updated.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / August / 2016, 15:24:34
Acording to the maker of my shutter cable, the pulse sent to the chdk script is hat the pixhawk outputs (like it mirrors it).
This one ?  Simple Canon shutter - Pixhawk version (http://www.mobilexcopter.com/shop.htm#!/Simple-Canon-shutter-Pixhawk-version/p/53286831/category=15393052)

Quote
How long should a pulse be at least for the OneShot Mode ?
It should catch anything longer that a couple of milliseconds.

Quote
What does this log tell me ? (It shot 1 picture at the beginning but that's all)
Basically,  it tells you what you just said - i.e. it shot 1 picture at the beginning but that's all.

However, the "shoot full" timeout message is interesting.  It looks like there was almost no light - where you shooting in a dark room?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: flo_vienna on 20 / August / 2016, 15:41:04
Hi

Yeah I am using the cable you mentioned.
Right now the pulse is around 1/10 sec long and the cam should shoot as fast as possible. You are indeed correct, the light was not the best here, yet it was not dark but now I know what this error message means.

I am still wondering if it's some issue of the Tower App or the pulse sent or the App doesn't correctly send the commands to trigger but the people there are a bit unresponsive so maybe I need to dive into the app code ...
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / August / 2016, 17:01:19
I am still wondering if it's some issue of the Tower App or the pulse sent or the App doesn't correctly send the commands to trigger but the people there are a bit unresponsive so maybe I need to dive into the app code ...
At this point,  I don't think it the kap_uav.lua script, or how you have set it up,  that is causing the problem.  So I've attached a simple script that measure the width of each USB pulse and prints the result to the camera LCD.  It also reports the time between pulses. You might want to use it to test if pulses are being generated (and how long they are) while you work on your flight controller setup.  Should be accurate down to about 1 mSec resolution.


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: flo_vienna on 20 / August / 2016, 17:16:06
Thanks :)

Going to do some tests :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / August / 2016, 17:28:58
Going to do some tests :)
You can ensure the USB test script is working by using a standard USB cable between your camera & PC.  Just plug & unplug the cable a few times while the script is running and your should see timing values scroll up the screen.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: nuno on 22 / September / 2016, 06:10:27
With Canon IXUS 160

2016Aug28 18:46:20    KAP 3.7 started - press MENU to exit
2016Aug28 18:46:20    CHDK 1.4.1-4634 ixus160_elph160 100a May 27 2016
2016Aug28 18:46:20    Mode:PLAY,Continuous_AF:0,Servo_AF:0 Drive:0
2016Aug28 18:46:20     Tv:1/1000 max:1/2000 min:10 ecomp:0.0
2016Aug28 18:46:20     Av:4.0 minAv:2.8 maxAv:8.0
2016Aug28 18:46:20     ISOmin:100 ISO1:400 ISO2:800 M:0
2016Aug28 18:46:20     Focus:AFL  Video:0 USB:2:1 Tmo:0
2016Aug28 18:46:20     AvM:2 int:15 Shts:0 Dly:0 B/L:0
2016Aug28 18:46:21    waiting on USB signal
2016Aug28 18:49:14    USB start signal received
2016Aug28 18:49:17    Mode switched to P
2016Aug28 18:49:20    Logger : log file updated.
2016Aug28 18:49:27    timeout after shoot full
2016Aug28 18:49:21.490 1) IMG_0384.JPG
2016Aug28 18:49:27     meter : Tv:1/320 Av:3.2 Sv:100 750:750
2016Aug28 18:49:27     actual: Tv:1/1000 Av:- Sv:250 Temp:27
2016Aug28 18:49:27             AvMin:3.2 NDF:NDout foc:1.2m
2016Aug28 18:49:28.040 2) IMG_0385.JPG
2016Aug28 18:49:32     meter : Tv:1/1000 Av:3.2 Sv:250 750:750
2016Aug28 18:49:32     actual: Tv:1/1000 Av:- Sv:250 Temp:27
2016Aug28 18:49:32             AvMin:3.2 NDF:NDout foc:infinity

this set wrong?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / September / 2016, 13:11:22
this set wrong?
That looks like a normal log file. Are you having a problem with using the script?  Can you tell me what is not working? And tell me what equipment you are using?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: nuno on 22 / September / 2016, 18:12:03
I´m using canon ixus 160

The picture (Attachment) is not in focus.
The problem is the set uav.kap or the UAV vibration?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 22 / September / 2016, 19:09:45
The picture (Attachment) is not in focus. The problem is the set uav.kap or the UAV vibration?
Blurred UAV pictures can be caused by several things.  Determining the actual cause can take some time and patience.

In this case,  the shutter speed at 1/1000 is quite fast so this is likely not a problem with motion blur.

The camera is set to focus at infinity using CHDK , but some Powershots do not actually focus well this way.  You can test this by using the script to take pictures of distant objects with camera held steady (tripod?) on the ground.  If distant objects are crisply focussed,  then the script & camera are working properly with focus at infinity.

Try disabling the "Focus @ Infinity" option in the script parameters menu.  Do the photos look better?

If the camera focuses correctly at infinity, that leave UAV vibration as the problem.  How is your camera mounted to the UAV?

The picture might be in focus but vibration makes it appeard blurred.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 25 / November / 2016, 20:48:43
However,  I have a customer with a different S110. His flashes the LED for close to 1 second. That causes extra CAM events in the Pixhawk log. A resistor change may help hold the hi / lo state, but I'd like to figure out why the LED stays on so long on his S110. It's not the shutter speed. That will make the LED stay on if you make it long.
If all the hardware is the same then i guess that leaves two options.

The most likely option would be some difference in either the Canon menu settings or the CHDK settings. I'm not too sure what that might be but having RAW Enabled (either Canon RAW or CHDK RAW/DNG) would certainly do it.

The other option might be a slow SD card, or maybe an almost full one, or one with a really large log file.  The script writes to the log file in between the points where it turns the LED on and off.

Quote
Any idea where to start?
I can add something to log the actual on & off times for the LED if you can get him to run a test version and report back.

Hi waterwingz and friends, I'm very happy using the kap_uav_3-7a.lua waterwingz kindly modified some month ago.
I'm going to install an emlid RTK system, how about using the Canon S110 LED to log picture time, is it possible and how to do it? I bought a cable for Sony hotshoe, easy to remove the hotshoe adapter and the RTK has a logging software.
Thank you
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 26 / November / 2016, 19:56:24
I'm going to install an emlid RTK system, how about using the Canon S110 LED to log picture time, is it possible and how to do it? I bought a cable for Sony hotshoe, easy to remove the hotshoe adapter and the RTK has a logging software.
I'm not sure that I fully understand your request.  The existing script already has the ability to "blink" any of the camera's LEDs at the exact moment the exposure starts (or at least as close as technically possible).  Do you need something else or different?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 26 / November / 2016, 23:25:28
I'm going to install an emlid RTK system, how about using the Canon S110 LED to log picture time, is it possible and how to do it? I bought a cable for Sony hotshoe, easy to remove the hotshoe adapter and the RTK has a logging software.
I'm not sure that I fully understand your request.  The existing script already has the ability to "blink" any of the camera's LEDs at the exact moment the exposure starts (or at least as close as technically possible).  Do you need something else or different?
What is the parameter on the script and how do you catch the "blink" of the led on the S110? Thank you
I found this:
@param     h Shot Sync LED
 @default  h 0
 @values   h Off 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / November / 2016, 01:22:01
What is the parameter on the script
<snip>
I found this:
@param     h Shot Sync LED
 @default  h 0
 @values   h Off 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Every Canon P&S camera is a bit different from the others. But a CHDK script can turn each of the camera's LED's on & off. It does this using the LED number - which is simply a value assigned during CHDK porting to each LED by the developer.  There is no standardization about what number turns on which LED as each camera is different.  So you have to either read the developer's notes (usually in the camera's lib.c file),  or pick the number by trial & error, or use a small script that scrolls through all values slowly allowing you to figure out what number corresponds to each LED.

Quote
and how do you catch the "blink" of the led on the S110? Thank you
I'm not sure that you understand what is intended here? The script will cause your camera (your S110) to turn an LED on when the camera's shutter opens, and off again shortly after it closes.  It's up to your flight controller and its hardware to detect that "blink" and do something with it.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 27 / November / 2016, 11:11:30
Yes mate, I am searching for someone who already did the hardware to detect the "blink"
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / November / 2016, 11:40:11
Yes mate, I am searching for someone who already did the hardware to detect the "blink"
I worked with bchristal (http://chdk.setepontos.com/index.php?action=profile;u=27439) on the original implementation.  You can try sending him a PM and I'll send him an email directly to ask.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 27 / November / 2016, 16:49:15
Yes mate, I am searching for someone who already did the hardware to detect the "blink"
I worked with bchristal (http://chdk.setepontos.com/index.php?action=profile;u=27439) on the original implementation.  You can try sending him a PM and I'll send him an email directly to ask.
PM sent, thank you very much
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 03 / December / 2016, 17:46:38
PM sent, thank you very much
It would be good if you can share anything you learn.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 04 / December / 2016, 05:18:12
PM sent, thank you very much
It would be good if you can share anything you learn.
Brian pointed me to this beautiful cable http://tuffwing.com/support/Install_a_canon_precision_geotag_cable.html
It's made to trig the pixhawk with 5V, Brian was so gentle to explain me that if I need to trig the Reach RTK I need 3.3V and pointed me to a video that explains how phototransistor works so I can make one.
I made some tests with a phototransistor I have removed from a remote, Canon S110 LED blinks too fast for me to catch the Voltage on the meter and trying with the smartphone flash I get only 0.5V so next week I go to the city buying all I need that's still a mistery ahahah
I think the best way to do is using a phototransistor to act as a switch for a circuit that transform 5V to 3.3V, it is a simple job for someone who knows how to do it, anyone here? lol
thank you
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 05 / December / 2016, 19:34:03
I made some tests with a phototransistor I have removed from a remote, Canon S110 LED blinks too fast for me to catch the Voltage on the meter
You could use a simple script to activate the LED for longer periods for testing purposes.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 06 / December / 2016, 00:28:17
Thank you I'll do it.

Be aware that the tuffwing Canon IR cable actually sends 3.3V and not 5V like I said before, my fault
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / December / 2016, 13:52:26
Be aware that the tuffwing Canon IR cable actually sends 3.3V and not 5V like I said before, my fault
Technically the tuffwing Canon IR cable does not "send" anything - 3.3V or 5V.   It contains a phototransistor that acts as a switch that changes to a low impedance state when enough light enters it's lens (causing a base to emitter current that allows a much larger collector to emitter current to flow).  So the three wires in the cable hook to +V, GND, and signal from the flight controller.  I suspect it will work just as well with V=3.3V as it does with V=5V.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 07 / December / 2016, 19:47:51
Be aware that the tuffwing Canon IR cable actually sends 3.3V and not 5V like I said before, my fault
Technically the tuffwing Canon IR cable does not "send" anything - 3.3V or 5V.   It contains a phototransistor that acts as a switch that changes to a low impedance state when enough light enters it's lens (causing a base to emitter current that allows a much larger collector to emitter current to flow).  So the three wires in the cable hook to +V, GND, and signal from the flight controller.  I suspect it will work just as well with V=3.3V as it does with V=5V.
In this case, cable for log photo time, it is the module that sends an on or off signal to the pixhawk (signal) pin.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / December / 2016, 19:55:46
In this case, cable for log photo time, it is the module that sends an on or off signal to the pixhawk (signal) pin.
Agreed!

At the risk of being pedantic (https://www.vocabulary.com/dictionary/pedantic), the module gets 5V or 3.3V from a flight controller and returns that voltage to one of the flight controller's inputs when the camera shutter is open as indicated by the designated camera LED.

My point is that the module does not "source" any power - it simply switches a voltage that it gets from the flight controller back to the flight controller when the camera LED is illuminated.   So the cable should work for flight controllers that use 3.3V or 5V.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 13 / December / 2016, 08:28:29
You're not pedantic, it's my english that is very poor, sorry.
Thank again for precise explanation, I'm not an electronic expert but I can't buy from USA right now so I have to try to make this cable by myself
In the APM wiky I found that it logs a picture when Voltage is on or off (selectable by CAM_FEEDBACK_POL parameter) but doesn't say which voltage is accepted, the central pin is for sure at 5V as the power rail is in parallel.
Tuffwing cable need CAM_FEEDBACK_POL 0 so it seems its voltage goes to 0 during shutter

Can you point me to a script that leaves the S110 LED ON? Thank you

In this case, cable for log photo time, it is the module that sends an on or off signal to the pixhawk (signal) pin.
Agreed!

At the risk of being pedantic (https://www.vocabulary.com/dictionary/pedantic), the module gets 5V or 3.3V from a flight controller and returns that voltage to one of the flight controller's inputs when the camera shutter is open as indicated by the designated camera LED.

My point is that the module does not "source" any power - it simply switches a voltage that it gets from the flight controller back to the flight controller when the camera LED is illuminated.   So the cable should work for flight controllers that use 3.3V or 5V.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 13 / December / 2016, 13:23:46
I'm not an electronic expert but I can't buy from USA right now so I have to try to make this cable by myself
Do you have the circuit diagram that you need?  And a suitable photo-transistor?

Quote
Can you point me to a script that leaves the S110 LED ON?
Simple script attached. 

By default, it will turn on LED "0" when it runs - which I believe from the notes for that camera is the "focus assist" lamp.  You can select other LED's using the script parameter that shows up in the Script menu when you load the script. 

A little "trial & error" might be necessary to identify what number lights which LED.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 13 / December / 2016, 13:38:28
I have some photo diodes (2 legs only) 5 and 8 mm and some BC547 BC557 I usually put on the pixhawk shutter cable circuit, the circuit diagram is what I am trying to discover, the electronic shop is at 5 hours of car, but next week I will travel there, until now I only tested the Diode let pass 6V when smartphone lights it and 0,5V when obscured (using one 6V battery pack).
Thank you for the script!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 13 / December / 2016, 15:57:39
I have some photo diodes (2 legs only) 5 and 8 mm and some BC547 BC557 I usually put on the pixhawk shutter cable circuit, the circuit diagram is what I am trying to discover

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fwww.electronics-tutorials.ws%2Fwp-content%2Fuploads%2F2013%2F08%2Fio61.gif%3Fx98918&hash=1a5a4aa319f7c0c130cffe8239fd6857)

link : Electronics Tutorials : Light Sensors (http://www.electronics-tutorials.ws/io/io_4.html)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 16 / December / 2016, 17:50:32
My interface is done and working with Reach RTK, now I want to test with Pixhawk too, it seems it uses the same TTL logic.
I think Brian used only two resistors as the cable is very thin, maybe next time I try to semplify it.
The circuit input 5V and gives 3,3V in normal state and 0,05V during shutter.
TTL must work <0.8V >2V
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: airfix4 on 19 / December / 2016, 07:58:10
Hello,

This is my first post here. I've done some research, but have not seen an answer to my, hopefully simple, issue.

I am using Pixhawk to trigger a S100 with KAP 3.8.

I get an extra image every time the Pixhawk triggers the camera. Example; the mission calls for 33 images and 66 are taken. Every other image is not called for in the plan and the GPS exif information is the same. I currently am deleting, every other, unwanted, image from the SD card after a flight to post process.

The flight computer is connected to the S100 using a Tuffwing cable assembly. Mission Planner is set to trigger via distance.

Great script. I hope there is an easy fix for this nuisance.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / December / 2016, 08:07:29
This is my first post here. I've done some research, but have not seen an answer to my, hopefully simple,problem.
Please post the kap.log file from the top level folder (root) of your SD card as an attachment here.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 19 / December / 2016, 08:53:37
Dear waterwingz I am upgrading from KAP_UAV 3.7a to 3.8 because of
Quote
added improved LED sync code to create shorter "on time" for syncing with pixhawk flight controller
If you remember you created 3.7a because it was not shutting off the display in 3.7
As I am looking at the parameters again I have a question for you:
What is the difference between USB shot control "One shot" and "Pixhawk"?
I am using One shot with pixhawk by one year with success, I have a circuit that input 5V and 3.3V relais and output 5V to the USB cable, am I outdated with this setup?
Shot Interval is set to Fast is it ok?
Thank you!

p.s. I have the same problem I had with 3.7 the display turn off but turn on again when shooting photo
Comparing 3.7 to 3.7a the only difference is on line 966
        if( not(is_key("no_key")) and not(is_key("remote")) and (backlight_saver>0) and (blite_timer==0)) then
but 3.8 is identical to 3.7a :( ?!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / December / 2016, 19:42:14
What is the difference between USB shot control "One shot" and "Pixhawk"?
In "One shot" mode the camera will focus, set exposure, and shoot each time the USB +5V signal activates. 

In "Pixhawk" mode, CHDK interprets pulse width modulated (PWM) commands received on the USB +5V line - typically from one of the outputs of a flight controller or other microcontroller.

Quote
I am using One shot with pixhawk by one year with success, I have a circuit that input 5V and 3.3V relais and output 5V to the USB cable, am I outdated with this setup?
No.

Quote
Shot Interval is set to Fast is it ok?
Yes.

Quote
p.s. I have the same problem I had with 3.7 the display turn off but turn on again when shooting photo
Comparing 3.7 to 3.7a the only difference is on line 966
        if( not(is_key("no_key")) and not(is_key("remote")) and (backlight_saver>0) and (blite_timer==0)) then
but 3.8 is identical to 3.7a :( ?!
So are you saying that the display would not stay off in 3.7 but 3.7a worked properly?  And now 3.8 does not?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: airfix4 on 19 / December / 2016, 20:56:12
This is my first post here. I've done some research, but have not seen an answer to my, hopefully simple,problem.
Please post the kap.log file from the top level folder (root) of your SD card as an attachment here.

Thanks. Here it is.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / December / 2016, 21:35:55
Thanks. Here it is.
Ummm .. the most recent entry in that log file is from Sept 29 2016?  Which suggests these possibilities :


In any case, that log file does not have any shooting information so it's not going to be any help.  I was really hoping to see what the log said about the script options you selected and to see the very detailed information it keeps about each shot.

If we can't solve this,  you will probably need to get a new log by doing another shooting run so that I can see what's happening.

Best I can offer.  Sorry.



Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 20 / December / 2016, 12:15:32
So are you saying that the display would not stay off in 3.7 but 3.7a worked properly?  And now 3.8 does not?
I have formatted, installed everything from scratch and now it works, sorry for the false alert
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: airfix4 on 20 / December / 2016, 13:50:20
Thanks. Here it is.
Ummm .. the most recent entry in that log file is from Sept 29 2016?  Which suggests these possibilities :

  • the time is set incorrectly in your camera?
  • you accidentally (or purposely?) disabled the script log function using the script parameter choices in the CHDK Script menu?
  • you did not get this log from the card that was actually in your camera when you saw the double exposures?

In any case, that log file does not have any shooting information so it's not going to be any help.  I was really hoping to see what the log said about the script options you selected and to see the very detailed information it keeps about each shot.

If we can't solve this,  you will probably need to get a new log by doing another shooting run so that I can see what's happening.

Best I can offer.  Sorry.

Thanks waterwingz. I have several cameras. Here is another log file with more detail.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / December / 2016, 19:48:38
I have several cameras. Here is another log file with more detail.
That's better - thanks for posting that.  I now understand what is happening. 

This issue has come up before. Rather than repeat myself, please read this post :
https://chdk.setepontos.com/index.php?topic=10822.msg127196#msg127196

What it says is that when shooting with USB Shot Control [ Pixhawk ]  and Shot Interval [ Burst ] ,  the camera expects to shoot many shots in a row really quickly (1 fps or faster).  When shooting stops, an extra shot is triggered as a side effect of using the burst shooting mode.

In your case, your pixhawk is not trying to shoot quickly. It seems to be triggering a shot every 10 seconds.  Unfortunately, you are shooting in Burst mode and the script will "timeout" after five seconds of no activity in that mode - triggering the extra shot.

You have two choices to correct this :

1. edit the script to lengthen the timeout interval to 15 seconds
  or
2. switch Shot Interval [ Burst ]  to Shot Interval [ Fast ]

As long as you don't plan to shoot faster than once every two seconds,  the second choice is easier.  And it will also cause the camera to refocus and reset the exposure before each shot.


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: airfix4 on 20 / December / 2016, 20:13:04
Thanks a ton, waterwingz.  I'll give it a try. Completely appreciate your knowledge, support and responsiveness.
Title: Re: KAP & UAV Exposure Control Intervalometer Script: General Questions
Post by: Hawaiianer on 15 / January / 2017, 18:00:17
Hello dear mapping community,
since this is my first post - a little about me and my project using CHDK/KAP script:
I am working in the agricultural world and I am doing some NDVI analysis and some Mapping in RGB only wavelength.
My platforms are a quadrocopter and a hexacopter running arducopter (Pixhawk). For regular mapping I use a Canon S100 connected with a DIY shutter cable build from this manual (it works great) http://ardupilot.org/copter/docs/common-apm-to-chdk-camera-link-tutorial.html (I am using the setting USB shot controll=2)
So triggering from the pixhawk every 5-10 seconds work, but I want to fly a mission with triggering directly from the script to generate more pictures (everything the S100 could achieve), so here are my questions:

1) I tried the "turn display off" setting but it dos not work. When I have the script triggered from USB or when I have the script on "every 10 seconds", after the first picture the display stays off, but the second picture will turn the display on again and it stays like this. Can this be fixed somehow?

2)Since I want to use the script to trigger a picture after 5-10 seconds I want to geotag the pictures using a photodiode as mentioned in the posts before. I tried some settings and the shot-sync-led: 10 will make the front led to light up 3 seconds after every shot.
Is there any manual how to build a cable for the pixhawk's digital input using a photodiode - I could not find anything?

BR,

Lorenz
Title: Re: KAP & UAV Exposure Control Intervalometer Script: General Questions
Post by: waterwingz on 15 / January / 2017, 18:15:20
1) I tried the "turn display off" setting but it dos not work. When I have the script triggered from USB or when I have the script on "every 10 seconds", after the first picture the display stays off, but the second picture will turn the display on again and it stays like this. Can this be fixed somehow?
I don't have my S100 handy right now but the code has been extensively tested with that camera so I'm very sure the display off function works.  And I just tested this on my G10 and it works as expected there too.

My guess is that you have Shot Review enabled in the Canon menu?  If so, you'll need to turn that off.

Quote
2)Since I want to use the script to trigger a picture after 5-10 seconds I want to geotag the pictures using a photodiode as mentioned in the posts before. I tried some settings and the shot-sync-led: 10 will make the front led to light up 3 seconds after every shot.
Is there any manual how to build a cable for the pixhawk's digital input using a photodiode - I could not find anything.
FWIW, the S100 can shoot at two frames a second continuously using the kap_uav.lua script.   And as it happens, there is currently an active thread here on the forum discussing exactly what you are looking for :
 Canon SX260HS accurate geo-tagging (https://chdk.setepontos.com/index.php?topic=13028.0) .   
I probably should have asked a forum admin to merge that thread here.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Hawaiianer on 15 / January / 2017, 19:02:34
Hello waterwingz,
thank you for the fast reply!

I will read the thread you pointed out and try my luck with the geo-tagging.

But I can not find the Setting Shot Review in the regular Canon menu - or is it within the CHDK menu?

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 15 / January / 2017, 19:11:29
But I can not find the Setting Shot Review in the regular Canon menu - or is it within the CHDK menu?
The Canon menu (the one you get when you press the Menu button) is different in shooting and playback modes.  You need to be in shooting mode (i.e. lens extended) and then look for this :

(https://chdk.setepontos.com/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FbMq4R7N.png&hash=6f832cce1689a48e27273de96dec8887)

Set it to Off

Incidentally,  you can have the pixhawk send shooting signals to the camera (based on GPS position over the ground and your flight plan) and tag the actual shot based on the camera LED blinking at the pretty much exact moment the shutter opens. Lot's of discussion about that in this thread.  (Power user tip : click the Print option at the top of the page to get all the posts of a CHDK forun thread on a single searchable page).
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 15 / March / 2017, 10:57:54
I'm using the latest version of the KAP script (I think 3.8) and I have two cameras, one being an A3400 and the other is an A4000.  When I set the USB Shot Control to Pixhawk (which is what I'm using), the camera trigger only works from the A4000.  The A3400 only seems to work when I set the USB Shot Control to OneShot.  Is the USB shot control for Pixhawk camera model specific?
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 15 / March / 2017, 12:29:08
Is the USB shot control for Pixhawk camera model specific?
There is nothing camera model specific in the script.  Most likely what is happening here is that you have the script configured differently or something in the Canon setup configured differently.  There is also a small chance of a bug in the CHDK port for your A3400.

The first step in figuring this out is to look at the script's log files. Please post the KAP.LOG file from both camera as attachments here.  You will find them in the top level folder of your SD cards..
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 15 / March / 2017, 12:51:36
Is the USB shot control for Pixhawk camera model specific?
There is nothing camera model specific in the script.  Most likely what is happening here is that you have the script configured differently or something in the Canon setup configured differently.  There is also a small chance of a bug in the CHDK port for your A3400.

The first step in figuring this out is to look at the script's log files. Please post the KAP.LOG file from both camera as attachments here.  You will find them in the top level folder of your SD cards..

Here are two files.  The log from the A3400 configured to use USB Shot Control as OneShot and the A3400 configured to use USB Shot Control as Pixhawk.

The working config for the A4000 USB Shot Control Pixhawk will be in the next post since I can only attach 2 files at a time
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 15 / March / 2017, 12:52:18
Is the USB shot control for Pixhawk camera model specific?
There is nothing camera model specific in the script.  Most likely what is happening here is that you have the script configured differently or something in the Canon setup configured differently.  There is also a small chance of a bug in the CHDK port for your A3400.

The first step in figuring this out is to look at the script's log files. Please post the KAP.LOG file from both camera as attachments here.  You will find them in the top level folder of your SD cards..

Here is the log from the A4000 setup for USB Shot Control Pixhawk (which is working)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 15 / March / 2017, 21:20:26
Here are two files.  The log from the A3400 configured to use USB Shot Control as OneShot and the A3400 configured to use USB Shot Control as Pixhawk.
A quick look at those logs shows me that both were run in "One Shot" mode.  Look for :

           Focus:AF  Video:0 USB:2:1 Tmo:0

in the log.  The "USB:2" means one shot mode.  Pixhawk mode is "USB:4".

Please post a log file with your A3400 set to pixhawk mode. It would be nice to see the results of taking a couple of test shots too - don't just stop the script and dump the log please.  (Logs with both One shot and Pixhawk modes selected please).

In the meantime, I'll find one of my debug scripts that dumps a lot more info to the log file so that we can see if your A3400 CHDK port is possibly buggy.

Also, if you look at KAP UAV Exposure Control Script : Camera Settings (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script#Camera_Settings) it is strongly suggested that you turn off Continuous Autofocus and Servo Autofocus in your camera's Canon menu.  In all three logs, you have it turned on.  That's most likely not related to your pixhawk problems but could cause other focus related issues later.

edit : my last comment in this post may explain why your A4000 log has entries that say : Warning:MF enable failed***

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 16 / March / 2017, 05:29:57
Here are two files.  The log from the A3400 configured to use USB Shot Control as OneShot and the A3400 configured to use USB Shot Control as Pixhawk.
A quick look at those logs shows me that both were run in "One Shot" mode.  Look for :

           Focus:AF  Video:0 USB:2:1 Tmo:0

in the log.  The "USB:2" means one shot mode.  Pixhawk mode is "USB:4".

Please post a log file with your A3400 set to pixhawk mode. It would be nice to see the results of taking a couple of test shots too - don't just stop the script and dump the log please.  (Logs with both One shot and Pixhawk modes selected please).

In the meantime, I'll find one of my debug scripts that dumps a lot more info to the log file so that we can see if your A3400 CHDK port is possibly buggy.

Also, if you look at KAP UAV Exposure Control Script : Camera Settings (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script#Camera_Settings) it is strongly suggested that you turn off Continuous Autofocus and Servo Autofocus in your camera's Canon menu.  In all three logs, you have it turned on.  That's most likely not related to your pixhawk problems but could cause other focus related issues later.

edit : my last comment in this post may explain why your A4000 log has entries that say : Warning:MF enable failed***

I will get you the logs today.  These two models of cameras don't have the option in the menu to disable Continuous Autofocus or Servo Autofocus, or if they do, I can't find it. 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 16 / March / 2017, 06:56:22
I found the settings in the A4000.  I'll post the logs shortly.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 16 / March / 2017, 07:44:27
Here are two files.  The log from the A3400 configured to use USB Shot Control as OneShot and the A3400 configured to use USB Shot Control as Pixhawk.
A quick look at those logs shows me that both were run in "One Shot" mode.  Look for :

           Focus:AF  Video:0 USB:2:1 Tmo:0

in the log.  The "USB:2" means one shot mode.  Pixhawk mode is "USB:4".

Please post a log file with your A3400 set to pixhawk mode. It would be nice to see the results of taking a couple of test shots too - don't just stop the script and dump the log please.  (Logs with both One shot and Pixhawk modes selected please).

In the meantime, I'll find one of my debug scripts that dumps a lot more info to the log file so that we can see if your A3400 CHDK port is possibly buggy.

Also, if you look at KAP UAV Exposure Control Script : Camera Settings (http://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script#Camera_Settings) it is strongly suggested that you turn off Continuous Autofocus and Servo Autofocus in your camera's Canon menu.  In all three logs, you have it turned on.  That's most likely not related to your pixhawk problems but could cause other focus related issues later.

edit : my last comment in this post may explain why your A4000 log has entries that say : Warning:MF enable failed***

Ok I know why the log showed USB:2, its because it was the log from the previous attempt when I had it set to OneShot.  When I set it to Pixhawk, no log gets created and the display doesn't get past 'waiting on USB'.  I even tried to plug it into the USB port on my laptop numerous times but the script doesn't go past 'waiting on USB'.  This model does work though when it is set to OneShot. 
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 16 / March / 2017, 11:01:45
Ok I know why the log showed USB:2, its because it was the log from the previous attempt when I had it set to OneShot.  When I set it to Pixhawk, no log gets created and the display doesn't get past 'waiting on USB'.  I even tried to plug it into the USB port on my laptop numerous times but the script doesn't go past 'waiting on USB'.  This model does work though when it is set to OneShot.
So the USB is working.  That's a good start.

I took a quick look at the code and the log buffers don't start writing to disk right away.  That's why you don't get a log. I'll fix that.

It also looks like the internal timers in your camera mau not be accurate.  Or they are just enough different (either fast or slow) to throw off the pulse width measurements that the script performs. We should be able to confirm that once the log issue is resolved.

I'll get back to you tonight.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 16 / March / 2017, 11:22:01
Ok I know why the log showed USB:2, its because it was the log from the previous attempt when I had it set to OneShot.  When I set it to Pixhawk, no log gets created and the display doesn't get past 'waiting on USB'.  I even tried to plug it into the USB port on my laptop numerous times but the script doesn't go past 'waiting on USB'.  This model does work though when it is set to OneShot.
So the USB is working.  That's a good start.

I took a quick look at the code and the log buffers don't start writing to disk right away.  That's why you don't get a log. I'll fix that.

It also looks like the internal timers in your camera mau not be accurate.  Or they are just enough different (either fast or slow) to throw off the pulse width measurements that the script performs. We should be able to confirm that once the log issue is resolved.

I'll get back to you tonight.

Sounds good.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 16 / March / 2017, 21:47:33
I took a quick look at the code and the log buffers don't start writing to disk right away.  T
I took a closer look.  If you press the camera's MENU button while it is waiting for USB pulses (and after you are sure that your pixhawk has sent a few pulses) then the script will write out a log file and stop.   Please do so?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 17 / March / 2017, 05:43:59
I took a quick look at the code and the log buffers don't start writing to disk right away.  T
I took a closer look.  If you press the camera's MENU button while it is waiting for USB pulses (and after you are sure that your pixhawk has sent a few pulses) then the script will write out a log file and stop.   Please do so?

Here it is.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / March / 2017, 07:16:24
Here it is.
Okay - it's not seeing the start pulse.  Please run the attached script on both your cameras with the pixhawk attached and requesting shooting.

You'll see USB pulse width info on the LCD. It will also create a log file ( CHDK/LOGS/LOG_0001.TXT ) on your SD card.  Please attach results from both cameras here.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 17 / March / 2017, 10:21:15
Here it is.
Okay - it's not seeing the start pulse.  Please run the attached script on both your cameras with the pixhawk attached and requesting shooting.

You'll see USB pulse width info on the LCD. It will also create a log file ( CHDK/LOGS/LOG_0001.TXT ) on your SD card.  Please attach results from both cameras here.

Attached
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / March / 2017, 19:49:30
Attached
Both logs look like the pixhawk is just "idling".  There is no "shoot pulse" (i.e. >1 mSec & < 5 mSec) in either log.   Did you actually configure the pixhawk to simulate actual shooting requests?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 18 / March / 2017, 06:24:40
Attached
Both logs look like the pixhawk is just "idling".  There is no "shoot pulse" (i.e. >1 mSec & < 5 mSec) in either log.   Did you actually configure the pixhawk to simulate actual shooting requests?

Yes I did.  After powering the camera and hooking the USB to the pixhawk I turned on the pixhawk (connected via battery) then I hooked it up to laptop and triggered camera through Mission Planner.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / March / 2017, 08:26:51
After powering the camera and hooking the USB to the pixhawk I turned on the pixhawk (connected via battery) then I hooked it up to laptop and triggered camera through Mission Planner.
I'm not sure what to suggest here.

My first thought is that your pixhawk setup is not what the script is expecting for [ Pixhawk ] mode.  The pixhawk can be setup to trigger a camera a number of ways, but to get faster shooting ( < 1 second/shot ) you need to follow these guidelines :
 Pixhawk Camera Trigger Cable (http://tuffwing.com/support/pixhawk_camera_trigger_cable.html). 

When you set the script to [ Pixhawk ] mode, it expects at 3 mSec pulse from the pixhawk to start shooting and another 3 mSec pulse for each additional shot.  According to the test script logs from either camera,  your setup is generating 100 mSec pulses. 

The KAP.LOG file for your A3400 also shows it receiving only 100 mSec pulses - which is why it does not start shooting.

The mystery here is why your A4000 KAP.LOG file shows it shooting?  It must be receiving ~3 mSec pulses - it won't shoot any other way.

Before I try to hack up the script to dump more info about what your A4000 is doing, would you mind repeating the original tests for both cameras with the pixhawk remaining powered between tests.  I can only guess that you maybe lost the correct setup of the pixhawk after you tested the A4000 and before you tested the A3400?

Please accept that I'm not trying to say you've done anything wrong. I just can't figure out what else I might have missed.  Something is different - but what?

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 18 / March / 2017, 08:57:56
After powering the camera and hooking the USB to the pixhawk I turned on the pixhawk (connected via battery) then I hooked it up to laptop and triggered camera through Mission Planner.
I'm not sure what to suggest here.

My first thought is that your pixhawk setup is not what the script is expecting for [ Pixhawk ] mode.  The pixhawk can be setup to trigger a camera a number of ways, but to get faster shooting ( < 1 second/shot ) you need to follow these guidelines :
 Pixhawk Camera Trigger Cable (http://tuffwing.com/support/pixhawk_camera_trigger_cable.html). 

When you set the script to [ Pixhawk ] mode, it expects at 3 mSec pulse from the pixhawk to start shooting and another 3 mSec pulse for each additional shot.  According to the test script logs from either camera,  your setup is generating 100 mSec pulses. 

The KAP.LOG file for your A3400 also shows it receiving only 100 mSec pulses - which is why it does not start shooting.

The mystery here is why your A4000 KAP.LOG file shows it shooting?  It must be receiving ~3 mSec pulses - it won't shoot any other way.

Before I try to hack up the script to dump more info about what your A4000 is doing, would you mind repeating the original tests for both cameras with the pixhawk remaining powered between tests.  I can only guess that you maybe lost the correct setup of the pixhawk after you tested the A4000 and before you tested the A3400?

Please accept that I'm not trying to say you've done anything wrong. I just can't figure out what else I might have missed.  Something is different - but what?

Sure I will re-test but I won't be able to until Monday.  I will note that I am using the 3dr x-8+ with the mapping package.  I think the setup has the port setup as relay. (https://3dr.com/wp-content/uploads/2015/04/Mapping-Package-Instructions-v1.pdf)

The entire reason I want to change from OneShot to Pixhawk is because half the pictures were coming out underexposed and from what I have read, I can get a faster picture rate using the pixhawk setting.  Regardless, I appreciate your help here and I will re-test and post the results on Monday.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / March / 2017, 09:20:35
Sure I will re-test but I won't be able to until Monday. 
I may be less available next week so please excuse any delayed response

Quote
I will note that I am using the 3dr x-8+ with the mapping package.  I think the setup has the port setup as relay. (https://3dr.com/wp-content/uploads/2015/04/Mapping-Package-Instructions-v1.pdf)
That package uses a much older version of the script. It almost certainly does not support the newer & faster [ Pixhawk ] mode - you should be using [ Oneshot ] mode and shooting slower than 2 seconds per shot.   I would not expect the script to work at all when set to  [ Pixhawk ] with their software setting up the pikhawk controller.

Quote
The entire reason I want to change from OneShot to Pixhawk is because half the pictures were coming out underexposed and from what I have read, I can get a faster picture rate using the pixhawk setting. 
Can you elaborate on "half the pictures were coming out underexposed"?  Does that mean every second picture sequentially?  Or were you generalizing to say that sometimes some of the pictures are randomly underexposed? And by how much? 

Are you thus trying to shoot faster to increase the chances of getting good shots?

It would be interesting to see one of the underexposed images and to compare it and it's EXIF info to the settings in the KAP.LOG file.   The way your script is configured (according to the logs) it will not shoot slower than 1/1000 sec and will not raise the ISO above 800.  (Note : neither camera has an adjustable aperture - the f-stop will vary only with the zoom poistion).  On a cloudy day, this could lead to underexposure. 

If the script is in fact hitting an exposure limit, you could lower the Tv min value to something like 1/400 and the ISO2 Max to 1600 and still get acceptable images.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 18 / March / 2017, 09:38:13
Sure I will re-test but I won't be able to until Monday. 
I may be less available next week so please excuse any delayed response

Quote
I will note that I am using the 3dr x-8+ with the mapping package.  I think the setup has the port setup as relay. (https://3dr.com/wp-content/uploads/2015/04/Mapping-Package-Instructions-v1.pdf)
That package uses a much older version of the script. It almost certainly does not support the newer & faster [ Pixhawk ] mode - you should be using [ Oneshot ] mode and shooting slower than 2 seconds per shot.   I would not expect the script to work at all when set to  [ Pixhawk ] with their software setting up the pikhawk controller.

Quote
The entire reason I want to change from OneShot to Pixhawk is because half the pictures were coming out underexposed and from what I have read, I can get a faster picture rate using the pixhawk setting. 
Can you elaborate on "half the pictures were coming out underexposed"?  Does that mean every second picture sequentially?  Or were you generalizing to say that sometimes some of the pictures are randomly underexposed? And by how much? 

Are you thus trying to shoot faster to increase the chances of getting good shots?

It would be interesting to see one of the underexposed images and to compare it and it's EXIF info to the settings in the KAP.LOG file.   The way your script is configured (according to the logs) it will not shoot slower than 1/1000 sec and will not raise the ISO above 800.  (Note : neither camera has an adjustable aperture - the f-stop will vary only with the zoom poistion).  On a cloudy day, this could lead to underexposure. 

If the script is in fact hitting an exposure limit, you could lower the Tv min value to something like 1/400 and the ISO2 Max to 1600 and still get acceptable images.

I'm not using the 3dr version of the script anymore, I am using the latest KAP version (3.8 I think).  It's very random, sometimes the pictures are perfect and then i'll get random underexposed ones (usually in succession).  I tried to slow the frequency of the images to one every 6 seconds, but it doesn't seem to have any impact.

What setting do you suggest in the Pixhawk for the following?

CAM_DURATION to 1 (pulse length in deci-seconds)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / March / 2017, 09:49:36
It's very random, sometimes the pictures are perfect and then i'll get random underexposed ones (usually in succession). 
In most of the script USB modes,  the script measures and resets exposure before each shot.

However, if you are using [ Pixhawk ] mode then the script locks the exposure when it takes the first shot in a sequence.  That's one of the tricks it uses to get cheap little Powershots to shoot faster than two seconds per frame. Exposure is reset only after a USB timeout (no shots withing a defined time interval). Typically this occurs at the end of a shooting pass while the UAV "turns around" for another pass.

How bad is the underexposure?  And can you confirm that the exposure settings are at the specified limit and the image EXIF information also show that?

Quote
I tried to slow the frequency of the images to one every 6 seconds, but it doesn't seem to have any impact.
I would not expect shooting speed to affect exposure in most script modes.

Quote
What setting do you suggest in the Pixhawk for the following?  CAM_DURATION to 1 (pulse length in deci-seconds)
I don't have a pixhawk so can't really comment on settings beyond the link I posted earlier.  I do know that the required [ Pixhawk ] mode settings are a bit of a hack on the flight controller side - the settings required are not something anyone would normally do.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 18 / March / 2017, 09:55:40
It's very random, sometimes the pictures are perfect and then i'll get random underexposed ones (usually in succession). 
In most of the script USB modes,  the script measures and resets exposure before each shot.

However, if you are using [ Pixhawk ] mode then the script locks the exposure when it takes the first shot in a sequence.  That's one of the tricks it uses to get cheap little Powershots to shoot faster than two seconds per frame. Exposure is reset only after a USB timeout (no shots withing a defined time interval). Typically this occurs at the end of a shooting pass while the UAV "turns around" for another pass.

How bad is the underexposure?  And can you confirm that the exposure settings are at the specified limit and the image EXIF information also show that?

Quote
I tried to slow the frequency of the images to one every 6 seconds, but it doesn't seem to have any impact.
I would not expect shooting speed to affect exposure in most script modes.

Quote
What setting do you suggest in the Pixhawk for the following?  CAM_DURATION to 1 (pulse length in deci-seconds)
I don't have a pixhawk so can't really comment on settings beyond the link I posted earlier.  I do know that the required [ Pixhawk ] mode settings are a bit of a hack on the flight controller side - the settings required are not something anyone would normally do.

I don't have the kap.log files from previous flights but here are two images from the same flight. I resize them so I could attach to this post.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / March / 2017, 11:16:16
I don't have the kap.log files from previous flights but here are two images from the same flight. I resize them so I could attach to this post.
Now we are getting somewhere.  Assuming the resize operation did not mangle the internal EXIF info, this is quite interesting.  You've picked two sequential shots with dramaticly different exposures.

Here's the info from the EXIF data :

Code: [Select]
IMG_0569.JPG  Tv :  1/1250   Av: f9.0  Sv: 160
IMG_0570.JPG  Tv :  1/1250   Av: f3    Sv: 200

Same shutter speed, slightly higher sensitivity in the second (brighter) image.  Not enough to explain the exposure difference though.

But notice the Av (aperture value) settings :  f9.0  vs f3!! This is a huge change - enough to completely explain the exposure difference.  But note my previous comment - the A4000 does not have an adjustable aperture. The fixed aperture should be reported as somewhere between F3 & F5.9 depending on the zoom position (the effective aperture gets smaller as you zoom in).  If you are shooting at the widest angle, that would be f3.   So that only leaves one thing - the internal switchable neutral density filter.

In the first image - the underexposed one - the image EXIF information indicates that the internal ND filter was used.  In the second, correctly exposed image it was not. Why?

This is where it would be really nice to have the KAP.LOG file.  I'm pretty certain that the script did not try to insert the ND filter in the first shot.  In fact, it would have tried to force the ND filter to stay out.  But the Canon exposure logic appears to have inserted it - ignoring CHDK's override.

All of which leads me to the conclusion that the script command that controls the ND filter might not work on your A4000.

We can test that if you have time.  I've attached a little script that takes two sequential shots - one in "auto" and the other with the ND filter forced to the opposite state from whatever the camera picks for the first shot.   If you point the camera at something really bright (a 60W light bulb from 12" away for example) and shoot in Canon AUTO mode, it should insert the ND filter.  Let's see if a script can override that in the second shot.  Do the resulting images look the same or different?

Edit 1 :  is seems that I have been down this road before without a clear resolution : ND filter swinging in even when "ND filter state" is "Out" (https://chdk.setepontos.com/index.php?topic=10552.0)  A work-around might be to configure the camera so that it does not try to use the ND filter on its own. Not sure what those settings are though.

Edit 2 :  it looks like nafraf did the A4000 port  (https://chdk.setepontos.com/index.php?topic=9443.0)blind.  I don't see anything in the porting thread that indicates the ND filter override was actually tested.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 18 / March / 2017, 11:31:10
I don't have the kap.log files from previous flights but here are two images from the same flight. I resize them so I could attach to this post.
Now we are getting somewhere.  Assuming the resize operation did not mangle the internal EXIF info, this is quite interesting.  You've picked two sequential shots with dramaticly different exposures.

Here's the info from the EXIF data :

Code: [Select]
IMG_0569.JPG  Tv :  1/1250   Av: f9.0  Sv: 160
IMG_0570.JPG  Tv :  1/1250   Av: f3    Sv: 200

Same shutter speed, slightly higher sensitivity in the second (brighter) image.  Not enough to explain the exposure difference though.

But notice the Av (aperture value) settings :  f9.0  vs f3!! This is a huge change - enough to completely explain the exposure difference.  But note my previous comment - the A4000 does not have an adjustable aperture. The fixed aperture should be reported as somewhere between F3 & F5.9 depending on the zoom position (the effective aperture gets smaller as you zoom in).  If you are shooting at the widest angle, that would be f3.   So that only leaves one thing - the internal switchable neutral density filter.

In the first image - the underexposed one - the image EXIF information indicates that the internal ND filter was used.  In the second, correctly exposed image it was not. Why?

This is where it would be really nice to have the KAP.LOG file.  I'm pretty certain that the script did not try to insert the ND filter in the first shot.  In fact, it would have tried to force the ND filter to stay out.  But the Canon exposure logic appears to have inserted it - ignoring CHDK's override.

All of which leads me to the conclusion that the script command that controls the ND filter might not work on your A4000.

We can test that if you have time.  I've attached a little script that takes two sequential shots - one in "auto" and the other with the ND filter forced to the opposite state from whatever the camera picks for the first shot.   If you point the camera at something really bright (a 60W light bulb from 12" away for example) and shoot in Canon AUTO mode, it should insert the ND filter.  Let's see if a script can override that in the second shot.  Do the resulting images look the same or different?


Edit :  is seems that I have been down this road before without a clear resolution : ND filter swinging in even when "ND filter state" is "Out" (https://chdk.setepontos.com/index.php?topic=10552.0)  A work-around might be to configure the camera so that it does not try to use the ND filter on its own. Not sure what those settings are though.

I will test this Monday and let you know.  Thank you again for all your help.  Keep in mind the exact same thing happened with the A3400 in OneShot mode.  It's 100% hit or miss.  I flew 5 flights that day, the first one was flawless and every image was perfect.  It was roughly the same time of day too, so the brightness shouldn't have changed too much between flights.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / March / 2017, 11:57:09
Keep in mind the exact same thing happened with the A3400 in OneShot mode. 
I can't find anything in the A3400 or A4000 porting thread indicating that the ND filter override was ever tested.  It's possible neither of them work properly - they were probably created from the same code base.  And they were both done as "blind ports" - meaning the CHDK developer did not have access to the camera during the porting process.  Testing was likely left to CHDK beginners and may not have been too complete.

The USB mode used should not be an issue relative to this problem.

Quote
It's 100% hit or miss.  I flew 5 flights that day, the first one was flawless and every image was perfect.  It was roughly the same time of day too, so the brightness shouldn't have changed too much between flights.
The constant brightness makes me wonder why the camera would decide to activate the ND filter on its own.  It really should have set it in or out and left it there - seems unlikely it would change it. But if the script set_nd_filter( ) function is flakey, it could cause changes each shot.

So it's also possible the script has a bug. But with over 7100 downloads to-date,  I would have expected this to have been mentioned before.  And the script logic for controlling the ND filter is pretty simple.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / March / 2017, 12:31:36
I will test this Monday and let you know. 
In addition to the ndtest script, it would be instructive to know if the ND Filter State setting in the CHDK Enhanced Photo Operation menu works properly.

With the camera in Canon AUTO mode,  take three shots of the same subject, changing the setting of that option between shots :  [ Off ]  , [  In ] , [ Out ].  Make sure the Disable Overrides menu option is set to [ No ] and that no other overrides are enabled.

You should see one of the three shots (typically the one corresponding to the [ In ] setting) be much darker than the others.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 20 / March / 2017, 08:57:27
I don't have the kap.log files from previous flights but here are two images from the same flight. I resize them so I could attach to this post.
Now we are getting somewhere.  Assuming the resize operation did not mangle the internal EXIF info, this is quite interesting.  You've picked two sequential shots with dramaticly different exposures.

Here's the info from the EXIF data :

Code: [Select]
IMG_0569.JPG  Tv :  1/1250   Av: f9.0  Sv: 160
IMG_0570.JPG  Tv :  1/1250   Av: f3    Sv: 200

Same shutter speed, slightly higher sensitivity in the second (brighter) image.  Not enough to explain the exposure difference though.

But notice the Av (aperture value) settings :  f9.0  vs f3!! This is a huge change - enough to completely explain the exposure difference.  But note my previous comment - the A4000 does not have an adjustable aperture. The fixed aperture should be reported as somewhere between F3 & F5.9 depending on the zoom position (the effective aperture gets smaller as you zoom in).  If you are shooting at the widest angle, that would be f3.   So that only leaves one thing - the internal switchable neutral density filter.

In the first image - the underexposed one - the image EXIF information indicates that the internal ND filter was used.  In the second, correctly exposed image it was not. Why?

This is where it would be really nice to have the KAP.LOG file.  I'm pretty certain that the script did not try to insert the ND filter in the first shot.  In fact, it would have tried to force the ND filter to stay out.  But the Canon exposure logic appears to have inserted it - ignoring CHDK's override.

All of which leads me to the conclusion that the script command that controls the ND filter might not work on your A4000.

We can test that if you have time.  I've attached a little script that takes two sequential shots - one in "auto" and the other with the ND filter forced to the opposite state from whatever the camera picks for the first shot.   If you point the camera at something really bright (a 60W light bulb from 12" away for example) and shoot in Canon AUTO mode, it should insert the ND filter.  Let's see if a script can override that in the second shot.  Do the resulting images look the same or different?

Edit 1 :  is seems that I have been down this road before without a clear resolution : ND filter swinging in even when "ND filter state" is "Out" (https://chdk.setepontos.com/index.php?topic=10552.0)  A work-around might be to configure the camera so that it does not try to use the ND filter on its own. Not sure what those settings are though.

Edit 2 :  it looks like nafraf did the A4000 port  (https://chdk.setepontos.com/index.php?topic=9443.0)blind.  I don't see anything in the porting thread that indicates the ND filter override was actually tested.

Here are the results of the ndtest.lua.  I made sure that Disable Overrides was set to No. I'll post the log, then the two images.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 20 / March / 2017, 08:59:01
Here are the images
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 20 / March / 2017, 14:36:03

When you set the script to [ Pixhawk ] mode, it expects at 3 mSec pulse from the pixhawk to start shooting and another 3 mSec pulse for each additional shot.  According to the test script logs from either camera,  your setup is generating 100 mSec pulses. 

The KAP.LOG file for your A3400 also shows it receiving only 100 mSec pulses - which is why it does not start shooting.


Good news on the USB Control setting for pixhawk.  The default setting in Mission Planner for CAM_DURATION is 1 (in 10ths of a second).  I changed this setting to .3 to send the 3 millisecond pulse and now both cameras trigger correctly using USB Control = Pixhawk.
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 20 / March / 2017, 22:23:44
I changed this setting to .3 to send the 3 millisecond pulse and now both cameras trigger correctly using USB Control = Pixhawk.
That makes sense. 

But there is still a potential issue with the ND filter. 

The images you posted suggest that it is working - or at least that it can force the filter in. Your mobile phone lamp isn't really bright enough to force the filter in.  A 60w build from 12" away would be a better subject.

Try setting the ISO high with the Canon menu and see if you can get the script's first shot to have the filter inserted? That should produce an over exposed second shot, showing that the filter can also be forced out?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: tokm on 21 / March / 2017, 06:40:22
I changed this setting to .3 to send the 3 millisecond pulse and now both cameras trigger correctly using USB Control = Pixhawk.
That makes sense. 

But there is still a potential issue with the ND filter. 

The images you posted suggest that it is working - or at least that it can force the filter in. Your mobile phone lamp isn't really bright enough to force the filter in.  A 60w build from 12" away would be a better subject.

Try setting the ISO high with the Canon menu and see if you can get the script's first shot to have the filter inserted? That should produce an over exposed second shot, showing that the filter can also be forced out?

Ok I will retest with a brighter object.  I probably won't be able to test today but I will test and post the results ASAP.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: sandysound on 17 / September / 2017, 17:40:55
Hi Everyone, Thankyou waterwingz for the time you spend making this awesome script better and better!
I have a Pixhawk FW APM:Copter V3.5.2 and S100 running CHDK 1.3.0-4228 S100-100e with KAP UAV 3.8 Beta script. My RC is a FrSky Taranis X9D with X8R receiver running latest firmware, OpenTX and FlightDeck.

My setup works successfully when I set it up the "old fashioned way" using my DIY cable to trigger S100 from Pixhawk via USB.
I have been reading up here and in the SH260 forum (https://chdk.setepontos.com/index.php?topic=13028.0 (https://chdk.setepontos.com/index.php?topic=13028.0)) and on the tuffwing page (http://tuffwing.com/support/pixhawk_camera_trigger_cable.html (http://tuffwing.com/support/pixhawk_camera_trigger_cable.html)) about the option in the script to trigger via USB called "PIXHAWK" which gives greater accuracy in the logs for GPS positioning when mapping. I am also interested in the LED feedback for even more precise GPS tagging.
I would like to use these methods, but for now, I don't have a design to build for the feedback cable, and I am currently unable to get the "PIXHAWK" USB Mode working.
So first things first, I need to get the trigger side working.

The following is from the Tuffwing page, listing the parameters to adjust in Mission Planner's Full Parameter List:
CAM_DURATION  1
CAM_SERVO_OFF  8000
CAM_SERVO_ON  3000
CAM_TRIGG_TYPE  0
RC10_FUNCTION  10
RC10_TRIM  8000
RC10_MAX  32767
I can find and adjust all of the parameters except for the RC10_FUNCTION parameter. It just does not exist in the parameters list. I have searched for RC, FUNCTION, even OPT for option. Is this an APM:Plane only setting? Is there a way to use this in Copter?
As a side note I have CH10_OPT set to 9 (Camera Trigger).
I also read in this forum waterwingz gave advice saying that the script is looking for a precise PWM pulse 3mS long, but the CAM_DURATION Parameters are set in 10ths of a second (i.e 1 = 10mS) and trying to input .3 results in a 0... So a pulse 0 seconds long is sent when triggered! That obviously doesn't work lol.

What am I missing?


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 17 / September / 2017, 19:21:44
What am I missing?
I really hate to say this, but I don't think I can help. I don't own a pixhawk (although I'd like to someday) so I can't comment on the software with any knowledge.  Sorry.

Maybe one of the people using the script and still following this forum thread will comment?  The tuffwing support is usually pretty good too.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: sandysound on 18 / September / 2017, 05:04:38
Thanks waterwingz, I have read that you don't own a Pixhawk so was really hoping somebody else could help, I have posted on DIYDrones also. I am rather reluctant to reach out to Tuffwing and bother them considering I haven't bought their product! I would rather make my own cables and learn about the circuitry rather than buy one ready made :-)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: sandysound on 18 / September / 2017, 11:30:42
SO I have made a bit of a breakthrough - the RC10_FUNCTION has been replaced with SERVO10_FUNCTION etc in the new Pixhawk FW, so the Tuffwing page is now outdated and the parameters to change are:

CAM_DURATION  1
CAM_SERVO_OFF  8000
CAM_SERVO_ON  3000
CAM_TRIGG_TYPE  0
SERVO10_FUNCTION  10
SERVO10_TRIM  8000
SERVO10_MAX  32767

I can now control the camera BUT it takes two pictures every time I give it 1 command to take a picture.
I have set the script as per the Tuffwing instructions, BURST mode with PIXHAWK USB Shot Control.
Perhaps my SERVO_OFF and SERVO_ON needs adjusting? Is their a script I can use to see the incoming USB signal strength?

In another note, the SHOT LED SYNC number for my S100 is 1.

EDIT: Copy and paste really makes a mess of the HTML in this forum eh!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: sandysound on 18 / September / 2017, 12:27:25

When I send the command to take a picture, it takes a photo, then the display goes black, until it takes the second picture.This is a picture of the onscreen display after it has taken the 2nd picture.

https://flic.kr/p/XAKAMt (https://flic.kr/p/XAKAMt)


And this what the USB Test 2 lua displays (I found this in these forums somewhere).


https://flic.kr/p/XyGhEW (https://flic.kr/p/XyGhEW)
(https://flic.kr/p/XAKAMt)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / September / 2017, 13:05:09
I can now control the camera BUT it takes two pictures every time I give it 1 command to take a picture.
IIRC, selecting burst mode causes the script to use some tricks to achieve the fastest shot rate possible.  That means it shoots continuously when the USB signal is active.  One drawback to using this mode is that you always get one more shot than you asked for.

Try using Fast mode?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: sandysound on 18 / September / 2017, 13:50:46
Ahh ok, that makes sense regarding the BURST mode, then the camera is operating as it should then :-)

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 09 / October / 2017, 11:02:53
Hello again people, one question... might be silly.

Is there any possible way to write metadata on a picture while/or after triggering it?
Is the CHDK or a script capable of doing so?

It would be great if there was a way to geotag a picture when triggering it, using gps data from pixhawk or other flight controllers.
I believe communicating the coordinates would be possible even with a primitive one bit communication (5v or 0v)
but what about writing it?






Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 09 / October / 2017, 20:41:16
Is there any possible way to write metadata on a picture while/or after triggering it?
Is the CHDK or a script capable of doing so?
That's probably the easiest part of what you propose. See these links :
Write to EXIF data? (https://chdk.setepontos.com/index.php?topic=12519.0)
TagMe, the Lua EXIF tagger (http://chdk.wikia.com/wiki/Lua#TagMe.2C_the_Lua_EXIF_tagger)

Quote
It would be great if there was a way to geotag a picture when triggering it, using gps data from pixhawk or other flight controllers.
Some CHDK supported cameras include built-in GPS (e.g. S100) so there is no real work to do other than enabling it on the camera.

Quote
I believe communicating the coordinates would be possible even with a primitive one bit communication (5v or 0v)
If you had a flight controller that can be a USB "master" then sending data in USB packets to a CHDK script is pretty trivial : ( read_usb_msg( ) (http://chdk.wikia.com/wiki/Lua/PTP_Scripting#read_usb_msg) ). However, it's not likely any commercially available flight controller will include USB master functionality.   :'(

Otherwise, "bit banging" (https://en.wikipedia.org/wiki/Bit_banging) a serial message between the flight controller and camera is quite possible - assuming you have the ability to reprogram your flight controller and understand a bit about writing Lua scripts for CHDK.

Quote
but what about writing it?
Have fun!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 10 / October / 2017, 11:46:49
That's probably the easiest part of what you propose. See these links :
Write to EXIF data? (https://chdk.setepontos.com/index.php?topic=12519.0)
TagMe, the Lua EXIF tagger (http://chdk.wikia.com/wiki/Lua#TagMe.2C_the_Lua_EXIF_tagger)
Thank you for those links, this seems to cover what I'm looking for. I will dwell more on them once I get a bit more time.


Quote
Some CHDK supported cameras include built-in GPS (e.g. S100) so there is no real work to do other than enabling it on the camera.
I prefer to use smaller, more lightweight cameras like the 125HS, additionally the Flight Controller GPS tends to have significantly higher accuracy.

Quote
If you had a flight controller that can be a USB "master" then sending data in USB packets to a CHDK script is pretty trivial : (
read_usb_msg( ) (http://chdk.wikia.com/wiki/Lua/PTP_Scripting#read_usb_msg)
). However, it's not likely any commercially available flight controller will include USB master functionality.Otherwise, "bit banging" (https://en.wikipedia.org/wiki/Bit_banging) a serial message between the flight controller and camera is quite possible - assuming you have the ability to reprogram your flight controller and understand a bit about writing Lua scripts for CHDK.



Hmm I'm not sure what you mean by "master" functionality, the flight controller is capable of sending trigger commands (essentially 5v to cam), or is "master" something else?

[/size]
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 10 / October / 2017, 23:56:29
Hmm I'm not sure what you mean by "master" functionality, the flight controller is capable of sending trigger commands (essentially 5v to cam), or is "master" something else?
A "USB host", like a PC or raspberry pi, as opposed to a "USB device" like the camera. This would be a USB protocol connection, rather than re-purposing the 5v line.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 11 / October / 2017, 00:17:49
Hmm I'm not sure what you mean by "master" functionality, the flight controller is capable of sending trigger commands (essentially 5v to cam), or is "master" something else?
Your request was for some method of sending GPS data from your flight controller to a CHDK enable camera.

Further to reyalp's comment, this describes the basics of how that could be achieved using USB communications (assuming the flight controller takes on the master role and the CHDK enabled camera takes on the slave role) :

USB Facts of Life : USB Is An Unsymmetrical Master/Slave Technology (http://www.tracesystemsinc.com/USB_Tutorials_web/USB/A1_Overview/Books/A3_USB_Facts_of_Life/slide01.htm)

And yes, your flight controller can send "trigger commands" as one of its configurable options.  But that's just a simple on/off signal - the camera is triggered each time the 5v line is asserted.  Trying to send actual GPS position data via the 5V line would involve a lot of custom code on the controller for "bit banging" (https://en.wikipedia.org/wiki/Bit_banging).
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 12 / October / 2017, 10:25:10
Ok I see what you mean. My initial thought was bit-banging, but maybe a proper communication will be possible.
I'll update this topic when/if I make some progress.
Thanks again waterwingz and reyalp for your info.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: lanzo on 26 / April / 2018, 18:41:57
Dear waterwings today I had a problem with this great script I am using from a lot of time with success.

Today I found a lot of pictures very dark and under exposed, then I look in the log and I found that KAP started to use the ND filter, you can see these two very similar pictures, one with and the other without ND:

Code: [Select]
2018Apr26 14:09:50.860 248) IMG_1205.JPG
2018Apr26 14:09:52     meter : Tv:1/1250 Av:7.1 Sv:80 1225:1225
2018Apr26 14:09:52     actual: Tv:1/2000 Av:4.0 Sv:200 Temp:43
2018Apr26 14:09:52             AvMin:2.0 NDF:NDin foc:infinity
2018Apr26 14:09:55.900 249) IMG_1206.JPG
2018Apr26 14:09:57     meter : Tv:1/1250 Av:2.6 Sv:80 1216:1216
2018Apr26 14:09:57     actual: Tv:1/2000 Av:8.0 Sv:100 Temp:43
2018Apr26 14:09:57             AvMin:2.0 NDF:NDout foc:infinity

KAP is v3.8

Tomorrow I will disable the option but my question is: the error of the script was triggering the ND filter or applying a wrong exposure after enabling the filter?

Thank you very much and thank you again for your great work.

P.S.
Are you able to write an APP or know who can do for SONY Alpha cameras? Because the Sony a5100 is a great camera for photogrammetry but has internal flash and no hot shoe, I hope an APP may output a signal for external tagging
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / April / 2018, 22:59:49
Dear waterwings today I had a problem with this great script I am using from a lot of time with success.
Please post the entire log file as an attachment here.  TIA.

Quote
Are you able to write an APP or know who can do for SONY Alpha cameras?
I have not heard of any method of hacking a SONY Alpha.  Sorry.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Devinb86 on 02 / May / 2018, 02:11:02
Waterwingz, i love this script. I've been tinkering with the code a little bit but I'm pretty green with Lua. Maybe if I can explain what I'm trying to do it will make a little more sense. I've been tinkering with the pixhawk code to try to get it to work through a relay output on my pixhawk. From what I understand (unless I'm not setting something up right) the chdk firmware can't natively read the pwm output from the pixhawk because the pulses are too short. So I'm trying to set up pulsed output from the relay using some of the logic switches on my taranis rx. It will not be fast acting because the logic switches from the rx can only be as short as 1ds, but could greatly expand controllability of the script in the air. So now that you have my backstory, here's what I'm trying to get it to do.

I'll be utilizing two 3 position switches and one momentary switch from the taranis. The momentary switch needs to trigger the shutter, regardless of anything else. It's set up now to switch high for 1ds, then off for 6ds.

The first switch will output single nonrepeating pulses of 6, 7, and 8ds to cause the script to enter one of three modes. The second switch will output either 2 or 3 1ds pulses high, then 6ds pulse low, repeating until the switch is off.

The first mode will be a zoom mode. Switch 2 will zoom in or out dependkng on switch position.

The second mode will be exposure correction, switch two will raise or lower the target ev.

The third mode will be a recording mode, switch two will set the framerate. In this mode the trigger should also cause it to begin recording.

I hate to add to your workload, so even if you could just set me up with a direction to move in, that would be great. But i also feel this would be a huge help to anyone using the pixhawk if we could get it right.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / May / 2018, 14:28:16
From what I understand (unless I'm not setting something up right) the chdk firmware can't natively read the pwm output from the pixhawk because the pulses are too short.
IIRC standard servo PWM output pulse widths run over a range of 1 mSec to 2 mSec. Some time ago, I did some experimenting with the CHDK high precision timer feature in Lua and found that you can almost resolve 10 steps between 1 & 2 mSec.  But it's right on the hairy edge of what the camera can do and I would not recommend trying it with anything important.

Quote
So I'm trying to set up pulsed output from the relay using some of the logic switches on my taranis rx. It will not be fast acting because the logic switches from the rx can only be as short as 1ds, but could greatly expand controllability of the script in the air. So now that you have my backstory, here's what I'm trying to get it to do.
I don't know much about  taranis rx units. Do I understand that you are going to ignore your Pixhawk flight controller and hook your camera's CHDK controlled USB port directly to a single relay that is in turn attached to an output from your rx unit? And you want to vary the on/off pattern coming from the relay to create a protocal that triggers your CHDK script to do different things? And your rx unit can be programmed somehow to do all of this?

Quote
I'll be utilizing two 3 position switches and one momentary switch from the taranis.  < snip >
In this mode the trigger should also cause it to begin recording.
I'm not sure I would set things up exactly this way but there may be constraints on what you can do with your taranis rx unit that I am unaware of.  One concern that might make it tricky is making sure the 1d sec shutter trigger pulse does not get mistaken for the 2 or 3 1ds pulses used to switch modes.  It can be done but the code gets more complicated.

By the way, does 1ds mean 100 mIlliseconds?

In any case, you'll want to hack out all the code starting around line 420 where it says

 ====== PWM USB Pulse Controlled Functions ==========

and replace it with your own code.  If you are stuck, I could probably give you a quick and dirty version to try out - debugging would be up to you though.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Devinb86 on 02 / May / 2018, 15:31:53

Quote
IIRC standard servo PWM output pulse widths run over a range of 1 mSec to 2 mSec. Some time ago, I did some experimenting with the CHDK high precision timer feature in Lua and found that you can almost resolve 10 steps between 1 & 2 mSec.  But it's right on the hairy edge of what the camera can do and I would not recommend trying it with anything important.

Is the script already set up to do this using the included sample code for pixhawk? I was reading the timing as 5,10,15, and 20 ms. Am i misinterpretung those or maybe this is from an earlier version of the code?

Quote
I don't know much about  taranis rx units. Do I understand that you are going to ignore your Pixhawk flight controller and hook your camera's CHDK controlled USB port directly to a single relay that is in turn attached to an output from your rx unit?

Not exactly. The pixhawk can be set to use a servo output as a digital relay, the relay can then in turn be programmed to activate on a high pwm input from a channel. Also I misspoke, the Taranis is a handheld tx

Quote
And you want to vary the on/off pattern coming from the relay to create a protocal that triggers your CHDK script to do different things? And your rx unit can be programmed somehow to do all of this?

Exactly. The taranis has some pretty powerful logic circuitry, including timers and such. I was hoping to alter the code to utilize a combination of pulse counting and pulse widths to put as many functions in as short of time as possible. Of course, if im setting up the pixhawk wrong, a pwm input would be much easier to program and alter code on.

Quote
I'm not sure I would set things up exactly this way but there may be constraints on what you can do with your taranis rx unit that I am unaware of.  One concern that might make it tricky is making sure the 1d sec shutter trigger pulse does not get mistaken for the 2 or 3 1ds pulses used to switch modes.  It can be done but the code gets more complicated.

By the way, does 1ds mean 100 mIlliseconds?

In any case, you'll want to hack out all the code starting around line 420 where it says

 ====== PWM USB Pulse Controlled Functions ==========

and replace it with your own code.  If you are stuck, I could probably give you a quick and dirty version to try out - debugging would be up to you though.

Help with either getting the script to work with native pwms or the relay output ive been working on would be awesome. Your script is complicated and i know every piece has a purpose, so even if i knew what i was doing (and i dont) i feel like i would spend more time breaking it then getting it to do what i want.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Devinb86 on 02 / May / 2018, 21:43:28
Also yes, ds for decisecond, so 100ms
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 02 / May / 2018, 21:49:44
Is the script already set up to do this using the included sample code for pixhawk? I was reading the timing as 5,10,15, and 20 ms. Am i misinterpretung those or maybe this is from an earlier version of the code?
The test I mentioned was just that - a test.  I never included the test code in the script.

Quote
The pixhawk can be set to use a servo output as a digital relay, the relay can then in turn be programmed to activate on a high pwm input from a channel. Also I misspoke, the Taranis is a handheld tx
Okay - that makes more sense now.

Quote
Help with either getting the script to work with native pwms or the relay output ive been working on would be awesome. Your script is complicated and i know every piece has a purpose, so even if i knew what i was doing (and i dont) i feel like i would spend more time breaking it then getting it to do what i want.
Might not be able to get to this for a couple of days but I will take a look.  I have an updated version of the script that uses the more recent style for user variables. I keep meaning to release it but it needs testing.  You can be the guinea pig to make sure I did the update correctly.   ;)

Quote
Also yes, ds for decisecond, so 100ms
Thanks
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Devinb86 on 02 / May / 2018, 22:01:36
I'd love to test anything you come up with. I'm using an sx710 with 101a firmware, as I wanted something with a high zoom and 1080 video. It obviously isnt very highly tested, but everything chdk related seems to work so far. I think integrating with pixhawk would be an amazing step forward, as even gentwire is limited to 6 different pulses. When you get a chance, dump a copy of the update and let me know what you want me to test on it and I'll get to work. A little beta testing is the least I can do.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 12 / May / 2018, 09:41:40
I'll be utilizing two 3 position switches and one momentary switch from the taranis. The momentary switch needs to trigger the shutter, regardless of anything else. It's set up now to switch high for 1ds, then off for 6ds.

The first switch will output single nonrepeating pulses of 6, 7, and 8ds to cause the script to enter one of three modes. The second switch will output either 2 or 3 1ds pulses high, then 6ds pulse low, repeating until the switch is off.

The first mode will be a zoom mode. Switch 2 will zoom in or out dependkng on switch position.

The second mode will be exposure correction, switch two will raise or lower the target ev.

The third mode will be a recording mode, switch two will set the framerate. In this mode the trigger should also cause it to begin recording.
I got a chance to do a bit of work on this.  Before I go any further, I'd like confirmation that you can actually configure your Tx unit to produce these pulse sequences.  They are pretty specific so I'd rather only code this once.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: Devinb86 on 12 / May / 2018, 17:24:53
I can verify the tx will output these pulses. It was actually the first thing I did prior to playing with the script, as I wanted to be sure I could actually make the tx produce them and THEN get the script to read them.

On a more somber note, my camera took a digger on a bad crash and I haven't had the money to replace it yet, so it'll be a couple of weeks until I can replace it and test a new script. One of the hazards of diy-ING I guess.

Once we get this figured out and working, I'll add a post detailing what I've done on my end to get this working with details on the tx settings and pixhawk parameters so others can do the same. I can't imagine I'm the only one who would benefit from this.

Anyway, thanks again for working on this, I can't wait to see what you come up with!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: KonradW on 15 / July / 2018, 06:58:03
I can not download the Script for some reason.
the download site (ge.tt/...) just shows the following:
(https://image.ibb.co/eO6a7T/2018_07_15_12_56_01_Mozilla_Firefox.png)
There is no clickable option or anything.
Is it possible that someone provides me a functioning link or the file itself if possible?

Edit:
Found the solution. I was using FF and had declined the advertisement cookies.
With IE and with ad cookies the page loaded correctly and I was able to download.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 07 / November / 2018, 13:38:12
Hey again, I'm having this issue wioth my 125hs. running with pixhawk on continuous mode. Some pictures are out of focus while others are OK, distance between cam and ground are the same.
How is that possible? Since continoues mode keeps the initial focus.
Am I missing something?
Oh and a big thank you for this great script. I use it almost daily with (almost) no issues :)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 07 / November / 2018, 20:38:13
Hey again, I'm having this issue wioth my 125hs. running with pixhawk on continuous mode. Some pictures are out of focus while others are OK, distance between cam and ground are the same.
How is that possible? Since continoues mode keeps the initial focus.
Sigh.  Focus issues again.

Please post your log file (kap.log) as an attachment here. It should be located in the top level folder of your SD card.  It would be helpful to know some of affected image filenames too as I look through the log.

Also, if you look at the EXIF information for good and bad images, can you see a pattern in the reported "SD" or "Subject Distance".

This might be a camera setup issue, a script configuration issue, it might be limitation of the script, or could be a vibration issue with the mounting on your UAV.

For example, people suggest turning Canon's image stabilization off for UAV usage - it's designed for removing jitter during shaky hand help shots where the subject matter tends to stay in one position.  A UAV shoots the opposite way - little camera movement (assuming good vibration reduction mounting) and lots of subject movement (obviously).

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 13 / November / 2018, 13:43:01
Thanks for the fast reply and sorry for my late one.
I have slightly modified your script with some changes for auto shutdown, but otherwise everything is the same.
I have IS turned off, and settings are as suggested in your site.
 According to an online EXIF reader SD seems the same for all images (65.53m). Which makes sense since it's in continuous mode.
Please take a look at my attached script. Particularly out of focus images are : IMG_0001 IMG_0004 IMG_0009 IMG_0011 IMG_0012...







Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / November / 2018, 11:36:42
According to an online EXIF reader SD seems the same for all images (65.53m). Which makes sense since it's in continuous mode.
Please take a look at my attached script. Particularly out of focus images are : IMG_0001 IMG_0004 IMG_0009 IMG_0011 IMG_0012...
Thanks for posting the log file.  I don't have any great answers here but I'll share some thoughts.

One thing that jumps out right away is that you have disabled the script from trying to set the focus at infinity (at least for the images you reference here).  So it theory, the focus for first image in continuous mode is whatever Canon picks when it shoots that image and the subsequent images use the same setting.  That's okay but I noticed you later let the script set the focus - did that change anything?

The EXIF info all set the same is also interesting - it appears neither the camera or script tried to change the focus while shooting.

So is it posible that we are seeing some sort of motion blurr? Or camera vibration? The focus is actually at infinity but the camera is not stable?  If you put the camera on a tripod, point it at landscape scene and let the script take a few hundred photos with the settings you normally use,  do you get any out of focus photos?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 20 / November / 2018, 06:21:23
I did those tests, and seems images from a tripod mount are good. I turned off focus at infinity because it made all the pics blurry,
might have to tweak the distance in the script.
I'm leaning towards a vibration issue myself, weird thing is cameras are mounted on anti vibration bobbins and all props are balanced well.
I'm now gonna test with softer bobbins and see if that makes a difference.
Pictures however look like theyre out of focus and not fuzzy or blurred out like you would expect from vibration,
on the other hand vibes might move the optics around changing the focus.


Will run some more tests and update.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 21 / November / 2018, 08:59:24
I did those tests, and seems images from a tripod mount are good.
So the script is basically working correctly.

Quote
I turned off focus at infinity because it made all the pics blurry, might have to tweak the distance in the script.
There is another huge thread on this forum where we looked at the whole "focus at infinity" issue. We made a lot of improvements but never got it 100% solid for every camera.  Sigh ...

link> Manual Focus @ Infinity not working (https://chdk.setepontos.com/index.php?topic=12062.0)

Quote
I'm leaning towards a vibration issue myself, weird thing is cameras are mounted on anti vibration bobbins and all props are balanced well.
There have been quite few discussions on this forum thread on the vibration topic.  The easiest way to review them is to click the "PRINT" button, which gives you the complete thread on one page in text mode.  You can then use your browser search function ( ctrl-F ) to search on the word vibration and scroll through all the posts

link> KAP & UAV Exposure Control Intervalometer Script in Print Format (https://chdk.setepontos.com/index.php?action=printpage;topic=10822.0)

Quote
I'm now gonna test with softer bobbins and see if that makes a difference.
Pictures however look like theyre out of focus and not fuzzy or blurred out like you would expect from vibration,
on the other hand vibes might move the optics around changing the focus.
This article is very interesting :
link>  DYI Drones : Let's Talk Canon Cameras (https://diydrones.com/forum/topics/lets-talk-canon-cameras)

edit :  forgot about this link : Setting focus from scripts or menus (https://chdk.setepontos.com/index.php?topic=11078.0)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 04 / December / 2018, 06:48:58
After dozens of tests to figure out why my pics started to get blurry I found the culprit...
I had changed some frame parts to my quadcopter (the arms) and left the rest the same.
However it turns out, the different material properties resulted in vibrations of different frequency...


Vibrations in all cases were minimal, but seems the camera is more susceptible to lower frequencies.
I fixed it by swapping out propellers that produce less thrust thus have to be operated at higher RPM
and blurry pics disappeared.
 
Even when on purpose unbalancing the new props blurry pics are far less... 


On another note I have made some additions to the script, one of them being an audible battery level indicator, since I cant really see the screen when mounted. 


Now I'm trying to automate the camera shutdown based on the
get_focus (http://chdk.wikia.com/wiki/CHDK_scripting#set_focus_.2F_get_focus) command.
However after 3353mm I get -1 as return value, any clue why that could be ?
Works fine for 0-3353mm


Again thanks for the help and effort you put in your replies!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 04 / December / 2018, 13:52:32
After dozens of tests to figure out why my pics started to get blurry I found the culprit...
Thanks for reporting back on that.  Too frequently people come here for help and then get busy or something and don't report back on their findings / results.

Quote
However after 3353mm I get -1 as return value, any clue why that could be ? Works fine for 0-3353mm
How did you test this?  I thought you had focus locked in the script?

Can I assume you started with the camera lens almost touching something and then moved away from that object. And the reported focus distance started at 0mm and kept going until you were about 3.3 meters away. If you moved any farther away you got -1 reported?

Edit : I spent 10 minutes chasing through the get_focus() code hoping to see if -1 means "infinity" - which is my suspicion.  Might be - ran out of time to chase it further. Sorry.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 04 / December / 2018, 17:20:42
Edit : I spent 10 minutes chasing through the get_focus() code hoping to see if -1 means "infinity" - which is my suspicion.  Might be - ran out of time to chase it further. Sorry.
Yes. When you set_focus (or AF on a distant object, or use Canon MF, on cameras that have it) beyond a certain (camera / zoom dependent) distance, you start getting -1 back from get_focus.

This does not necessarily mean that it's the focus setting that gives the best focus for distant objects, and at lest in the Canon MF case, there can be many focus positions beyond where get_focus starts returning -1.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 04 / December / 2018, 19:52:02
Waterwigz I tested that with a small script I made that just looped and read get_focus().


It works in a weird way since I seem to max out the focus at roughly 1m, even though
reported value is 3353. 


reyalp .. is it normal that it maxes out so quick ? Or could get_focus() be inconsistent ?
If it is true that puts an end to the auto lens retract idea  :-[


Waterwingz, would you want to see the battery gimmick I added ? In case you'd like to use it.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 04 / December / 2018, 21:01:11
Waterwigz I tested that with a small script I made that just looped and read get_focus().
Did your script do "half press" requests to make the camera refocus between each call to get_focus() ?

Quote
It works in a weird way since I seem to max out the focus at roughly 1m, even though reported value is 3353.  reyalp .. is it normal that it maxes out so quick ? Or could get_focus() be inconsistent ?
I spent a lot of time working and reworking the MF stuff in CHDK. One of my conclusions over time was that while most cameras could be tricked into setting a fixed focus point, the calibration on the models that do not offer true MF under Canon control is pretty much non-existent.  The functions to set focus are in the code but somehow not calibrated - or at least the lens mechanism goes to some fixed position but Canon made no attempt to make that position represent the focus distance requested. 

I would expect the same lack of calibration exists with get_focus( ) too.

I gave some thought to adding a manual calibration function to CHDK so that a user could adjust where CHDK tells the Canon firmware to position the lens for each requested real distance.  It's on my "someday" list as actually performing the calibration would be slow, finickity, and tedious.

Quote
Waterwingz, would you want to see the battery gimmick I added ? In case you'd like to use it.
Sure.  Although I'm not sure every CHDK camera can actually produce sounds - I'm pretty certain some of mine don't.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 04 / December / 2018, 23:33:36
reyalp .. is it normal that it maxes out so quick ? Or could get_focus() be inconsistent ?
My SX710 goes to -1 around ~4000 at full wide. The point where it changes seems to vary, while I was playing around with manual control sometimes it would go to 4400 and sometimes 3900. At longer zooms, the values go much higher.

This .txt https://app.box.com/s/83xz0ltib3v5ebq6m8edlpn8ju2c4wcb is a log from testing elph180 with chdkptp. Between the 2nd and 3rd runs, I zoomed the lens in and back out to fully wide. (linked because attachments seem to be broken at the moment)
Did your script do "half press" requests to make the camera refocus between each call to get_focus() ?
FWIW, this should not be needed if MF or AF lock is on (including set by set_mf or set_aflock if those work in the port)

According the ixus125_elph110hs platform_camera.h, SD override is only supported with set_mf or set_aflock.

edit: I assumed the script was doing set and get, if it's like waterwingz described, then disregard this.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 05 / December / 2018, 00:12:12
FWIW, this should not be needed if MF or AF lock is on (including set by set_mf or set_aflock if those work in the port)
if i understood the description of his script correctly, it just looped calling get_focus( ).  No calls to set_focus( ). So with AFL or MF enabled, the focus distance should not change without a half-press.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: OhSnap on 06 / December / 2018, 06:08:26
if i understood the description of his script correctly, it just looped calling get_focus( ).  No calls to set_focus( ). So with AFL or MF enabled, the focus distance should not change without a half-press.

Yes, I only looped having half-press and having set the camera focus mode to continuous AF.
This way the camera would refocus on every distance change. No need for set_focus().


At longer zooms, the values go much higher.


Hmmm, maybe if I'd get the camera to zoom in I could get more distance before -1 appears.
Thus being able to use it for the before landing lens retract. Though zooming in and out does sound a bit of
a hassle I will probably give it a go.


Sure.  Although I'm not sure every CHDK camera can actually produce sounds - I'm pretty certain some of mine don't.


I use the play_sound function. And use the built in canon sounds. I suppose most have them ?
For anybody who wants to try it I have attached. There are other small changes too.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 06 / December / 2018, 13:18:43
Yes, I only looped having half-press and having set the camera focus mode to continuous AF.
This way the camera would refocus on every distance change. No need for set_focus().
That makes sense. A lot of values only update on half press even if the underlying state updates continuously, but this doesn't apply to get_focus. Beware that continuous AF will prevent CHDK focus overrides from working.

Quote
Sure.  Although I'm not sure every CHDK camera can actually produce sounds - I'm pretty certain some of mine don't.
I use the play_sound function. And use the built in canon sounds. I suppose most have them ?
AFAIK all powershots have sounds. The one tricky bit is if you mute sounds in the menu, it also mutes play_sound.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / December / 2018, 13:50:21
A lot of values only update on half press even if the underlying state updates continuously, but this doesn't apply to get_focus.
For clarity then,  the value returned by get_focus( ) only updates after a half_press ?

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 06 / December / 2018, 16:28:27
For clarity then,  the value returned by get_focus( ) only updates after a half_press ?
No. I verified that the get_focus value updates continuously on SX710 in continuous AF mode, and I would expect it to be true of most/all other cameras.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 06 / December / 2018, 16:40:02
For clarity then,  the value returned by get_focus( ) only updates after a half_press ?
No. I verified that the get_focus value updates continuously on SX710 in continuous AF mode, and I would expect it to be true of most/all other cameras.
So the value returned by get_focus( ) only updates after a half_press unless you are using continuous AF mode, and in that case it updates continuously ?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 06 / December / 2018, 17:32:20
So the value returned by get_focus( ) only updates after a half_press unless you are using continuous AF mode, and in that case it updates continuously ?
AFAIK:
1) get_focus returns the current focus distance
2) Whether the Canon firmware changes the focus distance outside of half press depends on Canon settings. In typical standard AF, it only refocuses on half press.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cagiva on 28 / December / 2018, 20:12:10
I have a PowerShot A3000IS camera and installed the latest CHDK builds1.4.1 using the STICK utility; which automatically configures the SD card with two partitions (a small FAT16 and a larger FAT32) since my camera was released before 2011.

I downloaded and copied the kap_uav.lua script into the \CHDK\SCRIPTS folder as described here (http://www.tuffwing.com/support/pixhawk_camera_trigger_cable.html).  After that, I went to the CHDK Miscellaneous menu and enable Lua Native Calls.  However, I still get an error loading module '/gen/cnf_core' when I try to run/activate the kap_uav.lua script (see attached picture).

Has anyone resolved this issue?  Is the kap_uav.lua script compatible with cameras released before 2011; which usually are configured with two partitions?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 28 / December / 2018, 20:28:10
I have a PowerShot A3000IS camera and installed the latest CHDK builds 1.4.1 using the STICK utility; which automatically configures the SD card with two partitions (a small FAT16 and a larger FAT32) since my camera was released before 2011.
So far .. so good.

Quote
I downloaded and copied the kap_uav.lua script into the \CHDK\SCRIPTS folder as described here (http://www.tuffwing.com/support/pixhawk_camera_trigger_cable.html). 
The script needs to be stored in the /CHDK/SCRIPTS of the larger FAT32 partition - did you do that?  I'm assuming so as if you somehow managed to boot and run from the smaller partition the script would not be there. 

Quote
After that, I went to the CHDK Miscellaneous menu and enable Lua Native Calls.  However, I still get an error loading module '/gen/cnf_core' when I try to run/activate the kap_uav.lua script (see attached picture).
But if you did somehow manage to boot and run from the smaller partition without a switch to the larger partition then the /gen/cnf_core file would make sense.

Quote
Has anyone resolved this issue?  Is the kap_uav.lua script compatible with cameras released before 2011; which usually are configured with two partitions?
FWIW, this is not an issue with the script itself.  The script has been downloaded over 4500 times and used on a lot of Powershots - including several of mine released prior to 2011 with dual partition cards.

It looks like you've somehow ended up with an SD card missing critical files on the large partition.  Either that or an SD card that boots from the small partition and fails to switch to the larger partition. 

Before I speculate further, I'll wait for @reyalp to point out the obvious thing we are missing here  8)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 28 / December / 2018, 20:40:57
Before I speculate further, I'll wait for @reyalp to point out the obvious thing we are missing here  8)
Nothing obvious to me.
I'd suggest checking in the CHDK file browser:
1) Does CHDK/LUALIB/GEN/cnf_core.lua exist?
2) What is the displayed free space at the bottom of the file browser, is it a few MB (meaning you are seeing the "small" partition", or roughly size of the card (the large partition)?

If the file is present and the large partition is in use, I'd suggest checking "Miscellaneous->Show Memory Info" in the CHDK menu and posting the value here. Low free RAM could prevent the cnf_core module from being loaded.

If the file browser is showing the small partition, then something went wrong in the card setup, or multi-partition support is broken in the A3000 port (less likely, IMO)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cagiva on 28 / December / 2018, 20:47:01
Yes, the CHDK/LUALIB/GEN/cnf_core.lua exist in the large partition (see attached pics).
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cagiva on 28 / December / 2018, 20:53:19
Here the 3rd screenshot since I was not allowed to add more than 2 in the previous post.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 28 / December / 2018, 21:00:06
Thanks for those screenshots.  Helps to know you SD card file structure seems to be setup correctly.

So the next step is to make sure the SD card is booting correctly. @reyalp's suggestion is a good one :

Quote
What is the displayed free space at the bottom of the file browser, is it a few MB (meaning you are seeing the "small" partition", or roughly size of the card (the large partition)?

He means to open the CHDK File Browser on your camera that CHDK provides when CHDK is running.  Please report the free space it shows at the bottom.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cagiva on 28 / December / 2018, 21:08:16
File Browser reports 7.49G (screenshot attached).  BTW, thank you both for such quick response.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 28 / December / 2018, 21:11:46
File Browser reports 7.49G (screenshot attached).  BTW, thank you both for such quick response.
Nice.   Can you also find the /gen/cnf_core file using the CHDK file browser and screenshot it?

@reyalp Mac file naming error? Doesn't look like it but I'm out of ideas.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 28 / December / 2018, 21:18:53
@reyalp Mac file naming error? Doesn't look like it but I'm out of ideas.
Don't think so, since CNF_CORE would have been installed by stick along with all the others.

I'd lean toward free RAM. I was thinking 300 KB should be OK, but that's *without* the lua module loaded, which means very little left when it is (lua.flt alone is 128K, and each open file gets a pretty big buffer.

This port doesn't have exmem or ARAM enabled. I'll post an ARAM enabled test build in a bit.

@cagiva which canon firmware does your camera have?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cagiva on 28 / December / 2018, 21:36:22
@waterwingz -- yes, I can find the /gen/cnf_core file using the CHDK file browser (see pic below)

@reyalp -- the canon firmware was 1.00d

Firmware Ver GM1.00D (1.0.0.0)
Adj Ver.005.004
Version 1.00D
Build Mar 29 2010 09:09:55
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 28 / December / 2018, 22:09:25
Firmware Ver GM1.00D (1.0.0.0)
Thanks. Test build in the A3000 porting thread: https://chdk.setepontos.com/index.php?topic=5593.msg138862#msg138862
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 30 / December / 2018, 19:39:33
Thanks. Test build in the A3000 porting thread: https://chdk.setepontos.com/index.php?topic=5593.msg138862#msg138862
To close the loop in this thread, the issue reported about the script halting while trying to load the /gen/cnf_core file was fixed here (https://chdk.setepontos.com/index.php?topic=5593.msg138885;topicseen#msg138885) by freeing up more memory in the specific camera's port.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cagiva on 08 / January / 2019, 02:20:30
Hi @waterwingz, would you mind taking a look at the attached log?  When the Shot Interval is set to [Fast], the Shot Sync LED stays ON a little longer than a second.  In [Burst] mode, the LED drops under a second; but it turns ON twice between shots. TIA!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / January / 2019, 21:28:05
Hi @waterwingz, would you mind taking a look at the attached log?  When the Shot Interval is set to [Fast], the Shot Sync LED stays ON a little longer than a second.  In [Burst] mode, the LED drops under a second; but it turns ON twice between shots. TIA!
It's been a while since I've looked at the script's Fast & Burst modes. 

The behavior shown in your log is strange - when shooting in Burst mode it fails to reach the hook_shoot.is_ready point within 2 seconds of pressing shoot_full on every second shot.   It's also taking up to five seconds between shots when it should be shooting in under a second. 

This might cause what seems like the extra LED "on" pulses you are seeing between shots.

Why it does that I don't know.  I have not seen this behavior before on any other cameras so it does make me wonder if the shoot hooks are correctly located in your port?   

I take a look at it again later today or tomorrow.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cagiva on 08 / January / 2019, 22:37:28
@waterwingz, did you have a chance to look into this behavior?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 10 / January / 2019, 13:06:29
@cagiva
Please run the hooktest.lua script (part of the CHDK full package) and upload the log it creates.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cagiva on 10 / January / 2019, 13:26:32
@srsa_4c, attached the log file generated by hooktest.lua script. Thanks!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 10 / January / 2019, 13:31:46
@srsa_4c, attached the log file generated by hooktest.lua script. Thanks!
That's not it, look for hooktest.log .
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cagiva on 10 / January / 2019, 13:36:54
@srsa_4c

Sorry, my bad.  Here is the correct one.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 10 / January / 2019, 13:54:17
@srsa_4c

Sorry, my bad.  Here is the correct one.
Well, as you can see, this script also reports failures. I'll try to compare the port's capt_seq.c to another cam's from the same era.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: srsa_4c on 10 / January / 2019, 18:35:55
@cagiva
I posted (https://chdk.setepontos.com/index.php?topic=5593.msg139083#msg139083) a test build in the porting thread. Please try and see whether it fixes the hooktest failures. Post your reply in that thread.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cagiva on 19 / January / 2019, 15:37:42
Hi @waterwingz,

I'm not able to trigger the camera when "USB Shot Control" is set to Pixhawk and "Shot Interval" is set to Fast.  It works when it's set to OneShot, but the time per shots seems to be slow (attached log -- sunny day outside).  Does the Pixhawk setting only work exclusively with the Tuffwing trigger cable (http://www.tuffwing.com/support/pixhawk_camera_trigger_cable.html)?  I'm using the one from mobilexcopter (https://www.mobilexcopter.com/shop.htm#!/Simple-Canon-compatible-shutter-Pixhawk-version/p/53286831) instead, do you think that is a factor?

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 19 / January / 2019, 18:45:01
I'm not able to trigger the camera when "USB Shot Control" set to Pixhawk and "Shot Interval" set to Fast.  It works when it's set to OneShot, but the time per shots seems to be slow (attached log -- sunny day outside).  Does the Pixhawk setting only works exclusively with the Tuffwing trigger cable (http://www.tuffwing.com/support/pixhawk_camera_trigger_cable.html)?  I'm using the one from mobilexcopter (https://www.mobilexcopter.com/shop.htm#!/Simple-Canon-compatible-shutter-Pixhawk-version/p/53286831) instead, do you think that is a factor?
Setting "USB Shot Control" to OneShot will trigger a shot each time the USB +5V level toggles.  The "Shot Interval" setting is ignored.  Your mobilexcopter (https://www.mobilexcopter.com/shop.htm#!/Simple-Canon-compatible-shutter-Pixhawk-version/p/53286831) interface triggers shots in that mode so I think it's working just like the Tuffwing trigger cable (http://www.tuffwing.com/support/pixhawk_camera_trigger_cable.html) interface. Your hardwarde choice is not an issue.

Are you actually using a Pixhawk controller?  In Pixhawk mode, the script is waiting for a pulse of a certain length to take a shot - if you are not using a Pixhawk you'll need to setup something to get the same pulse width.

It's been a while since I've delved into this, but from what I recall, the only "Shot Interval" setting that matters in Pixhawk mode is Burst - which starts continuous shooting as fast as the camera will cycle when the Pixhawk requests a shot.

Edit 1: You need to jumper your Pixhawk correctly so that your interface cable can get +5V from the middle pin of its connector. Typically this requires getting the +5V from your BEC and connecting it to the middle row of pins of the pixhawk.

Edit 2:  took another look at your log - thanks for providing that, it helps a lot.  From what I can see, you have tried the following combinations :
ModeSettingResults
PixHawkFastfail
PixHawkBurstfail
PixHawkFastfail
PixHawkFastfail
OneShotFastslow random shots
OneShotBurstrandom shots
On/OffFastfail
One ShotFastfail
NoneFast3 sec per shot
PixHawkFastfail
OneShotFastslow random shots

Note that shooting never starts in Pixhawk mode regardless of the shot rate setting.  This suggests that the script never sees the required 3 mSec start pulse from the Pixhawk. However, it does seem to see some USB activity as shown by the random shooting in OneShot mode (it shoots each time it detect the USB signal changing).

So my guess here is that you are not matching the setup of you PixHawk to what the script is expecting to see on the USB +5V line?


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cagiva on 20 / January / 2019, 14:38:06
Setting "USB Shot Control" to OneShot will trigger a shot each time the USB +5V level toggles.  The "Shot Interval" setting is ignored.

Hum!  That is a good info to know.

Are you actually using a Pixhawk controller?  In Pixhawk mode, the script is waiting for a pulse of a certain length to take a shot - if you are not using a Pixhawk you'll need to setup something to get the same pulse width.

Yes, I'm using a Pixhawk controller. However, the keywords "pulse width" in your answer above are important.  Out of the four Pixhawk firmware modes, two are relevant here.  The GPIO mode and the PWM mode.  The former triggers a voltage relay output; which requires the current adapter (https://www.mobilexcopter.com/shop.htm#!/Simple-Canon-compatible-shutter-Pixhawk-version/p/53286831/category=15393052&forcescroll=true) I'm currently using. In that mode, your script "USB Shot Control" value should be set to OneShot.  With the latter (PWM triggering source), I should use this other adapter (https://www.mobilexcopter.com/shop.htm#!/Simple-Canon-compatible-shutter-RC-PWM-version/p/70382347/category=0); which I don't have it.  In this mode, your script "USB Shot Control" value should be set to Pixhawk.  Unfortunately, the description for Tuffwing cable (http://tuffwing.com/store/store.html#PixHawk_Camera_Trigger_Cable) is quite confusing.

the only "Shot Interval" setting that matters in Pixhawk mode is Burst - which starts continuous shooting as fast as the camera will cycle when the Pixhawk requests a shot.

Correct. Of course, as long as you use a PWM (https://www.mobilexcopter.com/shop.htm#!/Simple-Canon-compatible-shutter-RC-PWM-version/p/70382347/category=0) adapter instead of the Relay (https://www.mobilexcopter.com/shop.htm#!/Simple-Canon-compatible-shutter-Pixhawk-version/p/53286831/category=15393052&forcescroll=true) one.

Edit 1: You need to jumper your Pixhawk correctly so that your interface cable can get +5V from the middle pin of its connector. Typically this requires getting the +5V from your BEC and connecting it to the middle row of pins of the pixhawk.

Yep, that is how I have it setup (i.e. a 5V BEC powering the servo headers).

Edit 2:  took another look at your log - thanks for providing that, it helps a lot.  From what I can see, you have tried the following combinations :
ModeSettingResults
PixHawkFastfail
PixHawkBurstfail
PixHawkFastfail
PixHawkFastfail
OneShotFastslow random shots
OneShotBurstrandom shots
On/OffFastfail
One ShotFastfail
NoneFast3 sec per shot
PixHawkFastfail
OneShotFastslow random shots

Note that shooting never starts in Pixhawk mode regardless of the shot rate setting.  This suggests that the script never sees the required 3 mSec start pulse from the Pixhawk. However, it does seem to see some USB activity as shown by the random shooting in OneShot mode (it shoots each time it detect the USB signal changing).

The log info above might not be valid anymore since I was not using the correct adapter for PWM mode.

So my guess here is that you are not matching the setup of you PixHawk to what the script is expecting to see on the USB +5V line?

Based on the two different type of adapters required for one mode or the other, your guess is correct.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: PaulOski on 26 / January / 2019, 20:49:51
Looking for some help with my aerial shoots being extremely over exposed. I have a Powershot SX610 in a fixed wing drone and being triggered by a pixhawk. The attached picture was taken today at 400 ft on a sunny day. Any suggestions would be greatly appreciated. I have not changed any settings in the script or camera.

Thanks

Paul
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 26 / January / 2019, 21:07:57
Looking for some help with my aerial shoots being extremely over exposed. I have a Powershot SX610 in a fixed wing drone and being triggered by a pixhawk. The attached picture was taken today at 400 ft on a sunny day.
Please post the log file created by the script (kap.log) as an attachment here. It should be located in the top level folder of your SD card. 

Were all shots over exposed or just some of them?  If only some were, it would be helpful to know some of affected image filenames too as I look through the log.

Did you try shooting on the ground with the script?  Disable the USB / Pixhawk stuff and just run the script as an intervalometer while the camera is pointed at a normal daylight exposure scene.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: PaulOski on 27 / January / 2019, 07:53:47
Looking for some help with my aerial shoots being extremely over exposed. I have a Powershot SX610 in a fixed wing drone and being triggered by a pixhawk. The attached picture was taken today at 400 ft on a sunny day.
Please post the log file created by the script (kap.log) as an attachment here. It should be located in the top level folder of your SD card. 

Were all shots over exposed or just some of them?  If only some were, it would be helpful to know some of affected image filenames too as I look through the log.

Did you try shooting on the ground with the script?  Disable the USB / Pixhawk stuff and just run the script as an intervalometer while the camera is pointed at a normal daylight exposure scene.

kap.log attached. All of the pictures (1/26/2019) on that flight were overexposed, 27 in total. I will try the intervalometer later today. Thanks for the guidance and any additional thoughts.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / January / 2019, 13:26:47
kap.log attached. All of the pictures (1/26/2019) on that flight were overexposed, 27 in total. I will try the intervalometer later today. Thanks for the guidance and any additional thoughts.
Thanks for the log - I'll take a few minutes to study it later today. 

Meanwhile, I see several long runs dating back to Oct 25 2018 of the script with quite a few photos taken .  How did those images look or were you just testing?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: PaulOski on 27 / January / 2019, 17:32:22
Thanks once again for your assistance.  Those previous logs were all tests in the garage primarily making sure the pixhawk would trigger the camera. I used your suggestion and tested the intervalometer. The intervalometer scripted running looks good. I ran KAP again and made numerous adjustments to TV, ISO, Exposure and I'm getting closer. The link attached has a test flight at 400 feet with pictures, kap log and snapshots of the script settings. The exposure still looks too high to me. I can increase the Exposure from -1 to -2. Is that the best approach. Any other suggestions? Thanks again!! Paul 

https://inet.idealab.com/dbd/512BA359/Croswind_aerial_test.zip
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / January / 2019, 18:49:50
Those previous logs were all tests in the garage primarily making sure the pixhawk would trigger the camera.
I thought that might be the case - the Bv (brightness values) are quite low as might be expected indoors.  Important clue there - read on.

Quote
I used your suggestion and tested the intervalometer. The intervalometer scripted running looks good.
Actually,  I meant for you to run the kap_uav.lua script in "intervalometer mode" (i.e. with the Shot Interval set for shooting every 10 seconds or so - no pixhawk used).

Quote
I ran KAP again and made numerous adjustments to TV, ISO, Exposure and I'm getting closer.
Looking at your log file, the final script run (with the overexposed images) was done in very bright daylight. And that seems to be causing problems between the camera and script over the use of the ND filter.   Strange to stumble on this now with a script that's been downloaded over 5000 times and used mostly outdoors.

Here's what I think I see, using the image you posted (IMG_0889.JPG) for reference.


Something is very wrong here. 


No wonder the image is massively over exposed. I need to spend a little more time studying how the ND filter is interacting here.

Maybe the reason we've not seen this before is that AFAIK most Powershot don't use the ND filter very often - in some cases only in scene modes like "fireworks".

Interestingly, your camera reports that it's running in something called HYBRID_AUTO mode, described in the manual for your camera as taking a 2 - 4 second video before each shot??  Do you really have it set to HYBRID_AUTO?  Or is this a bug in the camera port resulting in the wrong shooting mode being reported?

So, I'd suggest setting the camera into "P" mode if you have not done so, as very  strongly recommended here : KAP_UAV Exposure Control Script : Camera Settings (https://chdk.wikia.com/wiki/KAP_UAV_Exposure_Control_Script#Camera_Settings) . It won't fix whatever is wrong (if anything) in the script's ND filter logic but P mode might stop the camera from trying to use the ND filter in the first place.

More to come ....





Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 27 / January / 2019, 19:02:30
[quote author=waterwingz link=topic=10822.msg139243#msg139243
Looking at your log file, the final script run (with the overexposed images) was done in very bright daylight. And that seems to be causing problems between the camera and script over the use of the ND filter.   Strange to stumble on this now with a script that's been downloaded over 5000 times and used mostly outdoors.
[/quote]
It seems likely that sx610 could suffer the same ND control problem that elph180, since they are both relatively new cameras. Background: https://chdk.setepontos.com/index.php?topic=13228.msg137603#msg137603

Try a build with #define CAM_ND_SET_AV_VALUE 1


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 27 / January / 2019, 19:09:50
It seems likely that sx610 could suffer the same ND control problem that elph180, since they are both relatively new cameras.
Thanks - I did consider that the sx610 camera port is new.  AFAIK, the bug you mention is the ND filter not doing what the script asks. But in the log file, I'm not sure the script is actually making the request in the first place.  It's more like it is failing to realize that the exposure settings (Tv,Sv, NDF position) are being made with the ND filter engaged.

I also scanned this complete thread in print mode and there are way too many issues with the ND filter handling for me to be happy.  Many of them resulted in underexposure but there are also overexposure issues reported. It's been "fixed" several times and still here we are.

Not having looked at the script's ND filter logic from exposure measurement to shot settings in a couple of years now,  I'll take an hour or two and try to remap what it's doing.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: PaulOski on 29 / January / 2019, 11:04:23
I've made some progress on the over exposure. I reset both the camera settings and went back the KAP defaults. It's overcast today so I will not be able to test brighter conditions until the sun comes out. My biggest take away was I needed to lock the ISO down to 100 in the script and adjust the TV Min and Target to 1/640 or 1/800.  I just took two pictures, P mode normal camera operation and KAP script. The Normal P mode picture auto ISO to 80 and 1/500. The KAP picture came out as ISO 100 and 1/800. A side by side comparison shows the Normal operation still looks better. Any addition thoughts? log and sample pictures can be download at the link below. Thanks again for any feedback.

https://inet.idealab.com/dbd/21CE7446/KAP_log_and_sample_pics_1_29_2018.zip
Title: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 29 / January / 2019, 12:40:29
Any addition thoughts?
As I mentioned previously, the script seems to struggle when the Canon firmware tries to use the ND filter. Your tests are not using brightly lit subjects so the script will work fine as is.  I'm looking at whether the script has a bug when the camera uses the ND filler.  If you lock the exposures settings to a small fixed range you are essentially defeating that purpose of the script and basically taking manual mode exposures.

You did not answer my question about what mode you have the camera set to? It should be P mode but your log file says that's not what you are using? (It says hybrid auto)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: PaulOski on 29 / January / 2019, 12:58:54
Some of my early tests in the garage where in a "Hybrid" mode. The latest items uploaded have the phone in Camera only mode and in "P".  2019Jan29 11:42:08    Mode switched to P

I agree I'm defeating the script purpose by restriction the settings. I welcome any recommendations.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 29 / January / 2019, 15:30:46
Some of my early tests in the garage where in a "Hybrid" mode. The latest items uploaded have the phone in Camera only mode and in "P".  2019Jan29 11:42:08    Mode switched to P

I agree I'm defeating the script purpose by restriction the settings. I welcome any recommendations.
Sorry to keep going back to this but unless I missed a post, your over-exposed shots taken from your UAV were all done using etiher HYBRID_AUTO mode in the first log you posted and LOWLIGHT in the second log. 

Your testing since then has been in much less bright conditions.  So you have not really tested in bright conditions with the camera in P mode?

The reason I ask is that while I might be able to figure out and correct the ND filter bug (if there is one),  I'm guessing that running the script on your UAV in brightly lit conditions might work okay in P mode as most of the shooting I have seen done in that mode does not used the ND filter.

So if you can test and let me know if actual shooting (using the script default exposure settings) actually works well in P mode, that would be interesting to know.

Meanwhile, I'll look at the ND issues some more and see if i can understand what is not working there.


Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 29 / January / 2019, 15:38:27
A side by side comparison shows the Normal operation still looks better. Any addition thoughts? log and sample pictures can be download at the link below.
The biggest difference between the two images seems to be the focus. The log shows that the camera is AFL (auto focus lock) mode so it's possible that it is not focusing at infinity well. CHDK based manual focus & focus at infinity on some Powershots just does not work right, But that is the subject of a different very long thread on this forum. 

Try the shot again but disable the Focus @ Infinity infinity setting?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: PaulOski on 30 / January / 2019, 10:40:15
Sun was out today so I put the SX610 on an old quad and took a couple pictures. Every picture seemed to be extremely washed out. Focus seemed to be a problem as well. I had better luck setting the Focus to infinity in the script. New log and sample pictures are in the link.

https://inet.idealab.com/dbd/195F5B27/KAP_Log_and_sample_pics_1_30_2019.zip


KAP is in default settings.
Camera is in P mode
ISO Auto
Continuous AF Off
IS Mode Off
Lens retract 0 sec.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 30 / January / 2019, 10:53:26
Sun was out today so I put the SX610 on an old quad and took a couple pictures. Every picture seemed to be extremely washed out. Focus seemed to be a problem as well.
Thanks Paul.  Those pictures and the log file help a lot.   8)

Meanwhile, I've very carefully mapped out what I think we are seeing here.  I'll post a technical description shortly in a new thread as it's not really script specific and will get buried here.  I'm really hoping to get this solved properly this time.

What does not make sense is why you are the first person to stumble across this after thousands of downloads from my file share and many more from the UAV vendors. (Note : that's a very popular comment when debugging any software). But it could be something to do with your camera's port as that is quite new. TBD.

Testing now is tough as I only have one of my camera's with me at the moment (S100) and it has a real aperture so does not handle the ND filter the same way in P mode. In fact I'm pretty sure it never uses it.

If I PM you a link to a test version of the script with some additional log messages and a quick fix, are you able to test for me?   I've had a version 4.0 of the script ready for some time but not released it due to lack of test time so we could get that out of the way too.  Mostly just logging cleanups and the use of the newer script header style in the new release FWIW.

Quote
I had better luck setting the Focus to infinity in the script. New log and sample pictures are in the link.
You mention using an "old quad".  Could this be a vibration issue? We've been down that road here many times but it will be hard to tell from the photos until we get the exposure fixed.  The usual first test is to shoot when stable on the ground at a brightly lit scene.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: PaulOski on 30 / January / 2019, 11:09:26
Yes, I am more than willing to do testing as I really want this to work. Please PM me.

As for the other shots being out of focus, I wouldn't rule out some vibrations. The sample  IMG_1270 did not have any vibrations as the quad was in my hand before takeoff.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cagiva on 30 / January / 2019, 13:39:25
As for the other shots being out of focus, I wouldn't rule out some vibrations.

Can you check the logs in the Pixhawk from that last flight to see the vibration levels? e.g. AccX and AccY should be between -3 and +3 and AccZ between -15 to -5.

http://ardupilot.org/copter/docs/common-measuring-vibration.html#imu-dataflash-log-message

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: PaulOski on 30 / January / 2019, 14:11:22
The last flight was not with a Pixhawk.

As for the other shots being out of focus, I wouldn't rule out some vibrations.

Can you check the logs in the Pixhawk from that last flight to see the vibration levels? e.g. AccX and AccY should be between -3 and +3 and AccZ between -15 to -5.

http://ardupilot.org/copter/docs/common-measuring-vibration.html#imu-dataflash-log-message
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cagiva on 30 / January / 2019, 14:17:59
The last flight was not with a Pixhawk.

So, what are you using as a flight controller hardware?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 30 / January / 2019, 14:40:09
Can you check the logs in the Pixhawk from that last flight to see the vibration levels? e.g. AccX and AccY should be between -3 and +3 and AccZ between -15 to -5.
I'm kind of curious about where you found those acceleration thresholds?  And if anyone has correlated them to how the affect the Canon lens mounting mechanisms? 

Even if the Pixhawk sees those levels, the level of vibration seen by the camera will be less if there is a halfway decent vibration mount.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: cagiva on 30 / January / 2019, 14:43:23
I'm kind of curious about where you found those acceleration thresholds?

There was a link to that information in the original post, but here is again.

http://ardupilot.org/copter/docs/common-measuring-vibration.html#imu-dataflash-log-message
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: PaulOski on 30 / January / 2019, 17:20:14
I checked the plane log from this weekend. Vibrations look like they are in the normal range. See attached. I balanced the props recently. The camera is mounted the plane shown.


I'm kind of curious about where you found those acceleration thresholds?

There was a link to that information in the original post, but here is again.

http://ardupilot.org/copter/docs/common-measuring-vibration.html#imu-dataflash-log-message
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 03 / February / 2019, 11:30:47
Yes, I am more than willing to do testing as I really want this to work. Please PM me.
See this thread : use of propcase MIN_AV when the camera inserts its ND filter (https://chdk.setepontos.com/index.php?topic=13679)

I attached an updated build for the sx610hs on the porting thread (https://chdk.setepontos.com/index.php?topic=13355.msg139332#msg139332), but I can't test it myself.  You should also delete the test kap_uav.lua script that I sent you and revert to v3.8 for now.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: PaulOski on 03 / February / 2019, 13:15:31
I tested the 4.0b7 today in the plane. It looks pretty good to me. Samples and log and be downloaded here.  https://inet.idealab.com/dbd/1D721D14/kap_uav4.0b7_log_and_samples_2_3_2019.zip

I will download the new port and go back to 3.8 and see how it does next weekend. Thanks again for all the help!


Yes, I am more than willing to do testing as I really want this to work. Please PM me.
See this thread : use of propcase MIN_AV when the camera inserts its ND filter (https://chdk.setepontos.com/index.php?topic=13679)

I attached an updated build for the sx610hs on the porting thread (https://chdk.setepontos.com/index.php?topic=13355.msg139332#msg139332), but I can't test it myself.  You should also delete the test kap_uav.lua script that I sent you and revert to v3.8 for now.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 03 / February / 2019, 14:10:04
I tested the 4.0b7 today in the plane. It looks pretty good to me.
Thanks for doing that. 

Unfortunately, what I did with that version is hack around the incorrect information returned by the sx610 100a port from incorrectly assigned property case variable. So it will only work for the defective port - its not something I'll be making publicly available.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: willievermeulen on 15 / March / 2019, 15:53:52
Hey Guys, looks like great work!

im having problems actually downloading the script,on the ge.tt page when i click any of the download buttons the page loads something and stops.. never letting me download. I tried with Firefox and Edge.. any advice?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 15 / March / 2019, 19:42:26
I'll find a different hosting site later today. I'm on my mobile right now.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 16 / March / 2019, 09:37:27
im having problems actually downloading the script,on the ge.tt page when i click any of the download buttons the page loads something and stops.. never letting me download. I tried with Firefox and Edge.. any advice?
kap_uav.lua version 3.8 temporarily attached here until I can figure something out better.

Update : correct version of the script now attached


Edit : download link on wikia page restored.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: willievermeulen on 16 / March / 2019, 11:51:44
Thats Excellent thank you!!
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: meghav93 on 18 / March / 2019, 22:56:35
The attached script was giving me a syntax error when running through the camera. The USB_Mode_On-Off variable needs to be changed to remove '-' on Lines 141, 915, 916. The script worked for me after the changes. Thank you for posting it here.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 18 / March / 2019, 23:31:42
The attached script was giving me a syntax error when running through the camera.
That means I did not post the correct recent version of the script.  That's the danger with me trying to find stuff with my mobile phone while I am away from my development station and backups.  :-X

I tried to pull it from ge.ttv using an old browser on an out of date PC with no luck, suggesting it's not an antivirus blocking problem but something with their server.

I'll see what else I can find - the syntax errors you found may not be the only problems.

Update : there were a couple of other changes related to the operation of the sync LED.  I've updated the attachment in my previous post.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: willievermeulen on 19 / March / 2019, 02:18:16
Great i didnt want to message and say its not working after all the effort you put to get it up! :P
Will try this version.....
Im currently doing this for the first time on a matek F405 running audrupilot and not sure if ive made the cable correctly and/or setup the Matek correct........ will post back once i manage or get too frustrated :lol
Thanks again for the efforts!
Title: Re: KAP & UAV Exposure Control Intervalometer Script - now v4.0
Post by: waterwingz on 17 / April / 2019, 08:59:51
I believe the download link on the wiki page (https://chdk.fandom.com/wiki/KAP_UAV_Exposure_Control_Script) now works.   I've updated the script to the v4 release that has been in testing for the last couple of years.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: willievermeulen on 17 / April / 2019, 09:44:03
Awesome thanks
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 06 / July / 2019, 16:52:51
Ixus185 discussion moved to https://chdk.setepontos.com/index.php?topic=13837.0
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / July / 2019, 08:47:37
Ixus185 discussion moved to https://chdk.setepontos.com/index.php?topic=13837.0
This question was evidentally sweep up with the move, resulting in my missing it and not providing any response ...

@waterwingz could you please also help me my display keeps switching on and off on the SX240HS that i finally got the CHDK working with your script i set display to off but it keeps switching on....
@willievermeulen  :   What setting are you using for Display off mode (day) and Display off mode (night) ?  (The choices are None LCD BKLite DispKey PlayKey ShrtCut).


What setting are you using for Display Off?

Also, does your display switch on each time it shoots?  And then does it turn off again immediately after?

Please post the KAP.log file from the root folder of your SD card here as an attachment?


EDIT : modified my question - was looking at parameters from a different script - oopps.

Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: willievermeulen on 08 / July / 2019, 09:53:17
Ixus185 discussion moved to https://chdk.setepontos.com/index.php?topic=13837.0
This question was evidentally sweep up with the move, resulting in my missing it and not providing any response ...

@waterwingz could you please also help me my display keeps switching on and off on the SX240HS that i finally got the CHDK working with your script i set display to off but it keeps switching on....
@willievermeulen  :   What setting are you using for Display off mode (day) and Display off mode (night) ?  (The choices are None LCD BKLite DispKey PlayKey ShrtCut).

Also, does your display switch on each time it shoots?  And then does it turn off again immediately after?

Please post the KAP.log file from the root folder of your SD card here as an attachment?

Hey dont stress about it im sure you are busy busy... im just happy somone wants to help me!
please see the attached file...
It switches the screen off takes a picture and then previews the picture(so switching on the display) i tried to disable review but it didnt make any difference...
Also how do a get the pictures to save on the second partition???

Also i just put disable display on yes on the script settings, i dont understand the other day and night things?(or i havent seen them)
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 08 / July / 2019, 11:34:04
Also i just put disable display on yes on the script settings, i dont understand the other day and night things?(or i havent seen them)
My mistake - I was looking at a different script. You've answered my actual question here. Thanks.

Quote
It switches the screen off takes a picture and then previews the picture(so switching on the display) i tried to disable review but it didnt make any difference...
When you say "disable review", did you mean setting the Shot Review setting in the Canon Menu  (i.e. not a CHDK menu) to Off?  That's the Canon setting that determines how long a copy of your most recent image taken is displayed after the shot completes.  It needs to be set to Off for the script to be able to disable the LCD.

You can test that in normal shooting mode (no CHDK loaded). When you take a photo, the LCD should not show you the most recent image. It should just stay in picture taking mode.

If that works as expected, we can try a little test script to see if it's related to the CHDK port for your SX240hs.

Quote
Also how do a get the pictures to save on the second partition???
The SX240hs was released in 2012 and thus does not need to use - or support the use of - dual partitions on your SD card.



Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: dayzman on 22 / December / 2019, 23:30:01
Hi all,


I'm very new, so please bear with me. I'm trying this wonderful script and I wonder if it can be controlled via chdkptp? I'm actually hoping to use this on a remote control car with a raspberry pi onboard and trigger (remote) shoot via USB. My understanding is that there's no function for (remote) shooting implemented, but there seems to be some sort of USB mode. Anyone know how to do remote shooting with this script?


Thanks
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: waterwingz on 23 / December / 2019, 00:22:12
I'm very new, so please bear with me. I'm trying this wonderful script and I wonder if it can be controlled via chdkptp? I'm actually hoping to use this on a remote control car with a raspberry pi onboard and trigger (remote) shoot via USB. My understanding is that there's no function for (remote) shooting implemented, but there seems to be some sort of USB mode. Anyone know how to do remote shooting with this script?
I'm confused.  Why do you want to do remote shooting with this script?  Why not just use chdkptp on your Pi to shot without a script running on your camera (i.e. just having CHDK loaded on the camera is sufficient) ?
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: dayzman on 23 / December / 2019, 01:47:50
I'm confused.  Why do you want to do remote shooting with this script?  Why not just use chdkptp on your Pi to shot without a script running on your camera (i.e. just having CHDK loaded on the camera is sufficient) ?

I just thought that the shutter speed control logic in your script would be useful. If I have just CHDK loaded and run chkptp rs then the shutter speed would have to be handled manually. I might be missing something though.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 23 / December / 2019, 02:02:48
I just thought that the shutter speed control logic in your script would be useful. If I have just CHDK loaded and run chkptp rs then the shutter speed would have to be handled manually. I might be missing something though.
FWIW, if you want to have the exposure and interval control from a camera side script have the images saved over USB with remote shoot, it should be possible using the remoteshoot -script option and a glue script to set the menu options, like what is described in https://chdk.setepontos.com/index.php?topic=13386.msg136688#msg136688

To make the glue script, you need to go through the script header and set all the menu options as lua variables. See https://chdk.setepontos.com/index.php?topic=12695.msg141845#msg141845 for a description.

I have not tried this with kap_uav.

For completeness, the "USB" options in kap_uav refer to the hardware remote (https://chdk.fandom.com/wiki/USB_Remote). Combining this with remoteshoot probably isn't what you want, but should be technically possible.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: dayzman on 23 / December / 2019, 05:04:01
I just thought that the shutter speed control logic in your script would be useful. If I have just CHDK loaded and run chkptp rs then the shutter speed would have to be handled manually. I might be missing something though.
FWIW, if you want to have the exposure and interval control from a camera side script have the images saved over USB with remote shoot, it should be possible using the remoteshoot -script option and a glue script to set the menu options, like what is described in https://chdk.setepontos.com/index.php?topic=13386.msg136688#msg136688 (https://chdk.setepontos.com/index.php?topic=13386.msg136688#msg136688)


Thanks for the advice. Is exposure control actually better done on the camera side or PC side? Would PC side be slower? For my application, the camera moves slower than a drone but can still cause motion blur because it shoots indoor. That's very much the only reason why I thought the KAPUAV script might come in handy.
Title: Re: KAP & UAV Exposure Control Intervalometer Script
Post by: reyalp on 23 / December / 2019, 14:36:22
Thanks for the advice. Is exposure control actually better done on the camera side or PC side?
"Better" mostly depends on the details of what you want to do, and your personal coding preferences. Speed or where the actual exposure is calculated shouldn't be an issue in most cases, it's more about how you want the overall control logic to work.

Using remoteshoot with -script is fragile and not very flexible: the script is running without knowing anything about remoteshoot, and remoteshoot is running with no control over the script. It's convenient if you already have a camera side script that does what you want, but if you're writing something from scratch it would make more sense to have one main loop on the PC side that controls everything.