CHDKPTP - PC Remote Control Performance Analysis - page 9 - RAW Shooting and Processing - CHDK Forum supplierdeeply

CHDKPTP - PC Remote Control Performance Analysis

  • 465 Replies
  • 130610 Views
*

Offline SticK

  • *****
  • 779
Re: CHDKPTP - PC Remote Control Performance Analysis
« Reply #80 on: 07 / September / 2012, 00:17:12 »
Advertisements
The S90 hardware has passed acceptance as instrumentation donor.  Next level acceptance hinges on the ability of CHDKPTP being able to mimic RemoteCapture's automatic file transfer capability.

Thus in order to simulate RemoteCapture {shoot and download} auto file transfer at present using the SD card as the storage buffer in this example pseudocode could involve lua functions such as these:

set target directory on PC  just once for a session (a global variable for example)

shoot -tv=2 -sv=200; download last DNG & JPG to PC; delete last DNG & JPG in camera
shoot -tv=4 -sv=200; download last DNG & JPG to PC; delete last DNG & JPG in camera
shoot -tv=8 -sv=400; download last DNG & JPG to PC; delete last DNG & JPG in camera
etc.

... where each command line is the equivalent of pressing the shoot button on RemoteCapture.

QUESTION:  What resources do you currently have available that would allow me to do this?  Or something equivalent?  Could you please give me an example using your currently available resources?  I am open to other better suggestions than my pseudocode.

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP - PC Remote Control Performance Analysis
« Reply #81 on: 07 / September / 2012, 01:49:50 »
shoot error.  When I terminate shoot with a semicolon to allow more commands on one line, it fails.

Console output attached.

*

Offline reyalp

  • ******
  • 14114
Re: CHDKPTP - PC Remote Control Performance Analysis
« Reply #82 on: 07 / September / 2012, 16:25:06 »
shoot error.  When I terminate shoot with a semicolon to allow more commands on one line, it fails.
Shoot is a CLI command. You can only enter one CLI command per line, ';' has no special meaning to the CLI. The CLI commands that accept Lua code (exec, lua, luar) just pass ; to the Lua interpreter, where it follows the normal rules of Lua syntax http://www.lua.org/manual/5.1/manual.html#2.4.1

QUESTION:  What resources do you currently have available that would allow me to do this?  Or something equivalent?  Could you please give me an example using your currently available resources?  I am open to other better suggestions than my pseudocode.
As I mentioned earlier, there's currently no really easy way to get the name of the last shot image. This is something I intend to add when I get a chance. When that is done, I will probably add an option to shoot to download it.

Assuming you never want to keep *any* images around on the camera, a simple approach would be to do something like
Code: [Select]
shoot -tv=2 -sv=200
mdl -fmatch=%.[JD][PN]G$ DCIM <path to download to>
rm -fmatch=%.[JD][PN]G$ -nodirs DCIM
This will shoot and then download and delete all available JPG and DNG files in any subdirectories of the DCIM directory. It would also get anything else matching the pattern, but offhand I can't think of anything it would hit.

You may find the -pretend option to mdl and rm useful for to verify that it behaves as expected, I haven't tested it extensively.

As mentioned above, you cannot do this all on one line from the CLI. You can put CLI command in a file and execute it with the 'source' command, but this will not let you adjust the shooting parameters.

You can execute CLI commands using lua, e.g.
Code: [Select]
!cli:execute('shoot -tv=2 -sv=200');cli:execute('mdl -fmatch=%.[JD][PN]G$ DCIM <path to download to>');...
Note this does not do any error checking

With a little Lua code, you could define your own CLI command (or simple function to call with !) that combines all of the above. If you want to find the last shot image, rather than just assuming it's the only image that exists on the camera, you'll need to write some more code. I think we discussed ways to use a lua file to define your own functions in an earlier thread.
« Last Edit: 07 / September / 2012, 17:02:37 by reyalp »
Don't forget what the H stands for.

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP - PC Remote Control Performance Analysis
« Reply #83 on: 08 / September / 2012, 00:00:30 »
Quote "You can put CLI command in a file and execute it with the 'source' command, but this will not let you adjust the shooting parameters."   ... "Note this does not do any error checking"

I figured there could be some kind limitations like these if I had gone off on my own.  Hence I asked the question of you.  Thanks for the examples and pointing out what to expect.  I'll see what I can do with what you gave me for now.

Quote "This is something I intend to add when I get a chance. When that is done, I will probably add an option to shoot to download it."

Yes this would be fabulous, in fact, very very useful.  At least I would be able to operate the CCD on the instrument seamlessly with its other components (and it would give your community users of RemoteCapture similar performance). 

=================

So to complete a version of CHDKPTP that mimics RemoteCapture to a reasonable degree in the file transfer capability, here is an example specification:

NEW shoot functionality PART A

  > shoot -tv=1/8 -av=2.8  -transferlastfile="c:\PC destination folder" -delete

Without -transferlastfile shoot would behave as now.  The flag -delete would only be recognized if I invoke -transferlastfile, giving the option to delete file from SD.  By default, the command would transfer and delete one camera-numbered image file with all its extension flavors the camera created for the shot (ie Canon_CR2 & JPG, CHDK_DNG & JPG, JPG only, etc).  The destination directory must be capable of *very long* strings, such as an over-the-network destination.

Here is a nice thing.    If I don't give a destination folder, instead I say this special case .........

  > shoot -tv=1/8 -av=2.8  -transferlastfile="" -delete

... then the shoot command would use a destination folder I chose in a new Destination Folder: box in the CHDKPTP GUI.  This principle would be very close to setting the destination directory in RemoteCapture options menu.  Recall that RemoteCapture numbers the file, whereas using this indirect transfer in CHDKPTP, the camera would number the file.

NEW shoot functionality PART B

This parameter would add the ISO conversion so that -sv values can be translated that we discussed earlier.

  > shoot -tv=1/8 -av=2.8 -sv=200 -camera="S90"  -transferlastfile="" -delete

In this case shoot would call a user-definable function map_iso that would result in a DNG file exposed at Canon ISO 200.  The C pseudocode function could look something like this:

   float map_iso(float sv, char* camera)
      {
       switch (camera)       
          {
          case "S90":
              return sv /1.6461;
          break;
          case "SX110":
               return a table lookup, interpolant, non-linear equation etc.
          break;
          default:
              return sv;
          }
      }

And at the beginning of shoot somewhere .....
     sv = map_iso(sv, camera);     

I'd be very willing to test out a simplified  "interim" version of this which is defined by your previous post where  '-transferlastfile=' instead does 'transfertheonlyfileonSD='   That would be good enough to proceed with further testing and help me decide to move into to hardware mods to go instrument installation.

Can you please give me your thoughts? 
« Last Edit: 08 / September / 2012, 00:05:13 by SticK »


*

Offline reyalp

  • ******
  • 14114
Re: CHDKPTP - PC Remote Control Performance Analysis
« Reply #84 on: 08 / September / 2012, 02:58:34 »
"Note this does not do any error checking"
What I meant was that my quick and dirty example composed on my lunch break did not do error checking. cli:execute does return status, handling errors is left as an exercise to the reader.
Quote
This parameter would add the ISO conversion so that -sv values can be translated that we discussed earlier.
...
And at the beginning of shoot somewhere .....
     sv = map_iso(sv, camera);     
You could very easily add this to the shoot command yourself, you'd hardly have to do more than convert your pseudocode to Lua syntax. Adding a new option to the shoot command should be self explanatory.

To make this less likely to conflict with future chdkptp updates, you make your own copy of the shoot command, and customize that. You  can add new cli commands in your own lua file using cli:add_commands.
Quote
Can you please give me your thoughts? 
1) Mimicking Canon's RemoteCapture software is not something I care about at all. I care about whether something seems useful, how hard it is to implement, and what impact it has on the rest of the code.
2) I'm happy to provide advice and take suggestions for future features, but I'm not interested in writing special code just for your project. Downloading the last image has been on my list for a long time, so I will probably implement that at some point. When ? I don't know, doing it cleanly requires some support on the camera side that isn't complete. Will I use the exact syntax you outlined above ? Probably not.
3) If you need code written specifically for your project, the source is available.
Don't forget what the H stands for.

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP - PC Remote Control Performance Analysis
« Reply #85 on: 08 / September / 2012, 09:32:47 »
Quote "You could very easily add this to the shoot command yourself"

Of course.  I suggested this format to you from a community perspective where folks with different cameras can go through the rather quick iteration procedure (that I can gladly write) to determine the conversion and contribute to the function.  In that sense, the function could be available to all in a central repository on your site.  That's not something I can do.  If I were just thinking about myself I would simply add the line sv = sv / 1.6461 for my S90 in shoot and not say a peep. 

Quote "Mimicking Canon's RemoteCapture software is not something I care about at all."

That's very unfortunate.  I have been using RemoteCapture for years and I know all its advantages and shortcomings.  What I mean by "mimic" is to add those aspects of RemoteCapture where CHDKPTP can be significantly improved on.  I never lose sight of the value CHDKPTP brings over RemoteCapture: a) the ability to live view with perfect clarity a camera that does not even support RemoteCapture is nothing short of phenomenal, and b) to script out a single text command with complete shoot capability is fantastic.  But direct download what RemoteCapture has, CHDKPTP sadly lacks.

This function is essential to be able to enact the whole shoot&download sequence in one command, and in that sense would replicate the basic functionality of RemoteCapture (which is necessary, not better or worse) as a standard feature of your firmware/software system.  To me it's a question of best-of-both-worlds rather than a competitive posture.

Quote "I'm happy to provide advice and take suggestions for future features"

Thanks, and I note and appreciate the unsolicited added extras that always make a big difference in my understanding.

Quote  "I'm not interested in writing special code just for your project."

I know.  Again, if I ask you for something, it's not in a vacuum ... I will only ask if I can project my thoughts outside my own requirements for others' benefit and to provide standard functionality to CHDK and CHDKPTP that is useful not just for me.   In that sense, there are many useful features related to my project I'd like to ask of you but cannot.  Are these not the guiding philosophical principles behind the development of CHDK?  Perhaps I am wrong.  As for my project yes, shoot+autodownload is essential to be accepted, even if the image data has to be be buffered through the SD card.
« Last Edit: 08 / September / 2012, 09:41:37 by SticK »

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP - PC Remote Control Performance Analysis
« Reply #86 on: 08 / September / 2012, 14:43:10 »
Help ....... here is my crude attempt .....  the reason why it's crude right now is that I have to concentrate on getting the basic functionality working so I can do the next phase which is integration testing in the camera-instrumentation control platform.  I just need something (a single call) to work for now.

Code: [Select]
function myshoot(tv, av, sv, destdir)
  !cli:execute('shoot -tv=tv -av=av -sv=sv')
  !cli:execute('mdl -fmatch=%.[JDC][PNR][G2]$ DCIM destdir')
  !cli:execute('rm -fmatch=%.[JDC][PNR][G2]$ -nodirs DCIM')
end

When I say variations of !myshoot(1/8,5.6,200,"C:\") I get these kind of messages:

> !myshoot(1/8,5.6,400,'C:\')
error: compile failed:[string "myshoot(1/8,5.6,400,'C:\')"]:1: unfinished string near '<eof>'
> !myshoot(1/8,5.6,400,C:\)
error: compile failed:[string "myshoot(1/8,5.6,400,C:\)"]:1: '<name>' expected near '\'

What am I doing wrong?
« Last Edit: 08 / September / 2012, 14:59:00 by SticK »

*

Offline srsa_4c

  • ******
  • 4451
Re: CHDKPTP - PC Remote Control Performance Analysis
« Reply #87 on: 08 / September / 2012, 15:38:43 »
> !myshoot(1/8,5.6,400,'C:\')
error: compile failed:[string "myshoot(1/8,5.6,400,'C:\')"]:1: unfinished string near '<eof>'
> !myshoot(1/8,5.6,400,C:\)
error: compile failed:[string "myshoot(1/8,5.6,400,C:\)"]:1: '<name>' expected near '\'

What am I doing wrong?
Try to use either double backslashes or forward slashes in the path. Backslash is an escape character. http://www.lua.org/pil/2.4.html


*

Offline SticK

  • *****
  • 779
Re: CHDKPTP - PC Remote Control Performance Analysis
« Reply #88 on: 08 / September / 2012, 15:47:43 »
Of course, thank you.  Now it runs w/o error but the shoot command doesn't react // it's though myshoot skips over shoot.  I cleared the DCIM directories and expected the 1st shot.  The console instead returns:

  WARNING: no matching files

which in a way makes sense because no shot was taken.  Any ideas?

*

Offline reyalp

  • ******
  • 14114
Re: CHDKPTP - PC Remote Control Performance Analysis
« Reply #89 on: 08 / September / 2012, 16:06:18 »
Help ....... here is my crude attempt .....  the reason why it's crude right now is that I have to concentrate on getting the basic functionality working so I can do the next phase which is integration testing in the camera-instrumentation control platform.  I just need something (a single call) to work for now.

Code: [Select]
function myshoot(tv, av, sv, destdir)
  !cli:execute('shoot -tv=tv -av=av -sv=sv')
  !cli:execute('mdl -fmatch=%.[JDC][PNR][G2]$ DCIM destdir')
  !cli:execute('rm -fmatch=%.[JDC][PNR][G2]$ -nodirs DCIM')
end

When I say variations of !myshoot(1/8,5.6,200,"C:\") I get these kind of messages:

> !myshoot(1/8,5.6,400,'C:\')
error: compile failed:[string "myshoot(1/8,5.6,400,'C:\')"]:1: unfinished string near '<eof>'
> !myshoot(1/8,5.6,400,C:\)
error: compile failed:[string "myshoot(1/8,5.6,400,C:\)"]:1: '<name>' expected near '\'

What am I doing wrong?
There are several errors here:
1) ! is a cli command (meaning "execute lua locally in chdkptp") You are writing lua function. ! doesn't mean anything in lua.
2) You need to insert your values in into the cli commands somehow, how do you expect the lua compiler to know that to do with 'shoot -tv=tv' ? You could do this with string concatenation, e.g.
Code: [Select]
cli:execute('shoot -tv='..tv..' -av='..av..' -sv='..sv) or using string.format, e.g. 
Code: [Select]
cli:execute(string.format('shoot -tv=%s -av=%s -sv=%s',tv,av,sv))In the latter case, you'll need to be careful with the % characters in the fmatch patterns for mdl and rm.
3) You also aren't doing any error checking. If you were, then you would have got better diagnostics about the previous errors. At a minimum, you probably want to call each cli:execute with cli:print_status, e.g.
Code: [Select]
cli:print_status(cli:execute(....
Don't forget what the H stands for.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal