SDM non-motion detection

edited March 2010 in General
In a previous post about SDM there was some discussion about the potential use of non-motion detection ubasic commands for KAP. I was wondering if there is anybody out there that has already used these commands in a script during a KAP flight. It would be great to know some results. I am planning to start some tests, and I am interested specially in the range of the sensitivity parameter for KAP use. In some very preliminary tests with the camera in hand, I got the impression that the non-motion detection is quite sensitive. So I was wondering what would be the best way to use these commands to get a reasonable percentage of successful shots.


  • Vicente,

    glad you are interested in experimenting with this.
    I am interested to know what range is suitable for the sensitivity parameter.
    Another Group member intended to test this many months ago but unfortunately never replied.

    The function returns a value that indicates success or failure (within the ten seconds time-out interval).
    I guess you could devise a script (or maybe Dave Mitchell could), that altered the sensitivity parameter until two out of three attempts (for example) were successful.

    Remember, the printed information can be saved to a text file for later analysis.

  • edited March 2010
    I think I stated this somewhere before. I did get a chance to try it out on the ground. I'm not sure I gave it a fair shake and didn't mess too much with the sensitivity settings. CHDK and SDM have seemed a little buggy on my A570 which tends to discourage me from a ton of experimentation. I'll be following to see what you discover. In the end I went in other directions for KAP.

    What I was mostly worried about was time scale.

    1) If you have a ~2 second oscillation on your rig (most of you do due to a pendulum type motion perpendicular to the kite line with a picavet), you need to sense "no motion" and click the shutter within 20-60 milliseconds or so to avoid pendulum blur (depending on shutter speed and size of oscillation). I think that's right, I have some data on my other computer.

    2) If you are trying to take a picture when this type of rapid oscillation dies down and the rig is actually "still" perhaps you can be more leisurely detecting a lack of motion. The comparison time can be as long as a second or ten. It seems to me that the SDM script will tend to fire a bit more when the scenery is really boring though. For an ultra-stable rig this would be useful for triggering long exposures. The feature might not work too well in the dark though when you actually need to do longer exposures.

    The advent of continuous mode and/or rapid intervalometer settings and giant SD cards pretty much wipes out the benefit of a no motion sensor for # 1. If you take enough pictures many of them will occur when the camera is still. Less pictures to sort is a benefit in itself though. #2 pretty much requires an incredibly stable rig, the likes of which I have not seen (or smooth wind like we sometimes actually do get off the bay).

    My two cents.
  • Thank you for your useful comments. I've wrote a script to test non motion detection sensivity in flight. I'll try it in different wind and light conditions during the next days, and let you know.

    Tgran, could you please explain why do you think that these scripts would fire more with boring sceneries?
  • edited March 2010

    The "no motion detection" is based on comparing two images sent toward the LCD display at a set time interval . If there is little difference it triggers the camera. There could be little difference because the camera is not moving or little difference because the scene is monotonous (grass, sand, water, etc.). The sensitivity setting controls how little the difference needs to be. I think David did the algorithm in a couple of different ways to see what people would find useful. For KAP I would pay particular attention to the time interval for the no-motion-detection. I might also try it for horizon shots that are more likely to have quite a bit of light/detail heterogeneity.

    Mostly ignore my negativity. I just wanted to explain to David why I didn't give the setting a full shake. Give it a try, your rig and wind might be different than mine. I also might be simply wrong. I do have some ground applications I'd like to try out next time I visit my brother's great dane.
  • edited April 2010
    During the last days, a lot of rain first and now a cold have kept me at home. So I've been working in my non-motion detection testing script. I've found some problems, so I'd appreciate your help.

    I'm using SDM 1.83, in a A570 firmware 101a. The script I wrote contains a loop that tries to shot the camera with the shoot_when_camera_steady command (CS) first and with the shoot_when_no_movement_for command (NM) then. By default, the sensitivity is set to 80, the time-out to 10 seconds and the no movement duration to 1 second. After five repetitions, if there hasn't been any successful shot, the sensitivity is increased a 20% (52 units). If there has been at least one successful shot, the script continues until a 10th repetition, and the evaluates the results, increasing or decreasing the sensitivity in varying amounts depending on the success rate (see below). This cycle is the repeated until the script is stopped. The evaluation of the success rate and the sensitivity adjustements are done independently for each of the commands. The result of each trial is written to a file for later analysis.

    In case you are interested, I copy the code below.

    @title Testing SDM NMD & CS
    @param a use CS (1=yes)
    @default a 1
    @param b use NM (1=yes)
    @default b 1
    @param c NM timeout (x5 secs)
    @default c 2
    @param d init sens (x10)
    @default d 8
    @param g initial delay (min)
    @default g 5
    @param h LCD off (1=yes)
    @default h 1

    if h=1 then turn_backlight_off
    sleep_for_minutes g

    if a+b=0 then a=1
    print_screen N
    print_screen 1
    print "Id","MD_type","Sens","Result"

    if a=1 then gosub "shot_CS"
    if b=1 then gosub "shot_NM"
    goto "shot"

    if e<1 then e=1
    if e>255 then e=255
    shoot_when_camera_steady e, l
    print q,"CS",e,l
    sleep_for_seconds 5
    if m=5 & p=0 then
    if m=10 then gosub "sensmod_CS"

    if f<1 then f=1
    if f>255 then f=255
    shoot_when_no_movement_for 1, l, f, c
    print q,"NM",f,l
    sleep_for_seconds 5
    if n=5 & r=0 then
    if n=10 then gosub "sensmod_NM"

    if p>8 then e=e-13
    if p<5 then e=e+26
    if p<2 then e=e+26

    if r>8 then f=f-13
    if r<5 then f=f+26
    if r<2 then f=f+26


    Please take into account that my programming skills are very limited, so probably the script can be improved a lot. But I have tried it with the camera in hand and it works. Well, almost works. There is no problem with the CS command. It shoots the camera if it is still enough, and if not, it times out after 10 seconds, and then the adjustment is done correctly. But I'm having problems with the NM command. It looks like as if it fails to time out. When the camera is still, the NM command shoot it, but if not it keeps waiting indefinitely, and doesn't times out. It doesn't seems to be a problem of my script, it happens the same with the "Non-motion test" SDM script I found in the scripts folder. Am I doing something wrong? Have I misunderstood the functionality of this command?

    Another problem I've found is when testing my script with the SDM IDE developped by Dave. I find it really useful, and it had helped me a lot with this script. But it gives me an error message when running the script in it, comes to a line that contains one of the non-motion detection commands. Agian, am I doing something wrong?
  • The version of my SDM IDE (ubasic debugger) for Windows and/or OSX may not match the latest SDM ubasic commands - I'll check asap.
  • Great to see some work on this feature with great potential, Vicente. I look forward to seeing the results from a KAP session when the script is working to your satisfaction.
  • Vicente - I've updated the zip file here so both the Mac OSX and Windows versions are up to date with SDM 1.83.
  • edited April 2010
    One way to make the testing experience more pleasant is to intersperse the NMD script with simple intervalometer shots. Say a nice round number like a minute so the timestamp will differentiate them from NMD photos? Can SDM write a special line in the EXIF data based on trigger mode? That way you'd get some shots from your experience regardless of the success of the NMD.

    While I'm still have reservations for this concerning KAP work . . . Now that I have a pole I do see applications there. It's much easier to make the pole still. Add in the ability to integrate NDM into a camera / servo program with Pan/Click SDM and the ability to bring the the camera down and change settings quickly with a pole. I see Pokytom is thinking along these lines already in the another thread.
  • Vicente,

    I will look at the NM command as soon as possible.

    I also have a pole but no pan-and-tilt mechanism yet.

    Apparently, I live very near the carp-pole suppliers that Dave Mitchell uses .. so that may be useful.

  • Well, the NM command does not seem to be behaving in the way it should.

    I will look at this and do some tests, I am interested in using it for monopd photography.

  • Vincente,

    I have not forgotten about this.

    I just have to finish a number of other things first.

  • Well, I have played around with this indoors and it works fine.
    I used a still interval of one second and sensitivity of 64.

    There is a mistake in your script, if there has been no successful shots you should REDUCE sensitivity, not increase it.

    When I have a pole setup I will also test your script.

  • Thank you, David. I am very busy until the end of this month, but I will revise my script and make some new trials as soon as I can.
  • I have now done another experiment.

    I suspended the camera on a piece of cord and set it swinging.

    Photos were taken when the movement was quite small.

    However, because the exposure was 1/4 second the results were blurred.

    I will do more tests tomorrow.
Sign In or Register to comment.