KAP & UAV Exposure Control Intervalometer Script - page 63 - Completed and Working Scripts - CHDK Forum  

KAP & UAV Exposure Control Intervalometer Script

  • 1068 Replies
  • 340004 Views
Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #620 on: 14 / September / 2015, 21:15:24 »
Advertisements
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
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

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
« Last Edit: 14 / September / 2015, 22:19:07 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #621 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
  • . For each camera, I took a series of 5 images of a distant landscape scene, then swung the camera down to take 2 images of an object that was about 12 inches away. After stoping KAP_UAV, i did get a "focus@infinity" confirmation message onscreen.


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
or here:
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.


Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #622 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 leading to this circuit that you can build yourself or source from tuffwing

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 :
  • On/Off -  takes pictures at the specified interval while the control signal from the flight controller is asserted
  • OneShot - takes one picture each time the control signal from the flight controller is asserted
  • Pixhawk - takes the picture when the servo channel asserts for 3 mSec  (works in continuous mode).
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.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #623 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 leading to this circuit that you can build yourself or source from tuffwing
[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.
« Last Edit: 16 / September / 2015, 20:01:03 by Naccio »


Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #624 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

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/

3. 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,


 



*

Offline reyalp

  • ******
  • 13621
Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #625 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 ;)
« Last Edit: 17 / September / 2015, 22:40:56 by reyalp »
Don't forget what the H stands for.

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #626 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
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/
3. 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.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #627 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 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.
Ported :   A1200    SD940   G10    Powershot N    G16


Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #628 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.
« Last Edit: 18 / September / 2015, 01:32:18 by Naccio »

Re: KAP & UAV Exposure Control Intervalometer Script
« Reply #629 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?
« Last Edit: 18 / September / 2015, 10:20:44 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics