rsint with network socket for control using ipc - page 3 - Script Writing - CHDK Forum  

rsint with network socket for control using ipc

  • 27 Replies
  • 779 Views
Re: rsint with network socket for control using ipc
« Reply #20 on: 11 / September / 2021, 22:03:03 »
Advertisements
Quote
  27  t0 to t01: 5.6353001127718e-05 t01 to t1: 0.99675145999936t1 to t4: 0.65600149700185
This seems odd. Defining two local variables should not take a noticeable fraction of a second. It should be microseconds. Can you post a diff or the files with the full logging changes?
Yeah, I think this one was my mistake, forgot to declare ones of the timing variables as local, so I was timing it from a different part of the code.

In any case I found the culprit. It's in the wait loop inside get_capture_data(). Here is the latest diff that shows the logging. Looking like it's camera side.

51 Calling capture_get_data()
  wait time: 1.6381495999522
52 Calling capture_get_data()
  wait time: 1.7816475
53 Calling capture_get_data()
  wait time: 1.8490861000028
54 Calling capture_get_data()
  wait time: 1.7832486000261
55 Calling capture_get_data()
  wait time: 3.2204962000251
56 Calling capture_get_data()
  wait time: 3.170976799971
57 Calling capture_get_data()
  wait time: 2.9203273999738
58 Calling capture_get_data()
  wait time: 3.4219162000227



Code: [Select]
--- C:\Imager\chdkptp-r921-win-x86_64\chdkptp-r921\lua\chdku_stock.lua Sat Sep 11 21:08:40 2021
+++ C:\Imager\chdkptp-r921-win-x86_64\chdkptp-r921\lua\chdku.lua Sat Sep 11 21:23:27 2021
@@ -1525,6 +1525,7 @@
  true or array of store_return[bitnum][value] values on success
  throws on error
 ]]
+log_file = io.open('C:/Imager/chdkptp-r921-win-x86_64/chdkptp-r921/con_wait_log.txt', 'w')
 function con_methods:capture_get_data(opts)
  opts=util.extend_table({
  timeout=20000,
@@ -1560,11 +1561,14 @@
  local rets = {}
 
  local done
+ log_file:write("Calling capture_get_data() \n")
+ local t0 = ticktime.get()
  while not done do
  local status = con:wait_status(wait_opts)
  if status.rsdata == 0x10000000 then
  error('remote shoot error')
  end
+ log_file:write("  wait time: "..ticktime.elapsed(t0)..'\n')
  -- initialize subst state when first data available, ~shot time
  if opts.do_subst and not subst then
  subst=varsubst.new(chdku.rc_subst_funcs)



*

Offline reyalp

  • ******
  • 13353
Re: rsint with network socket for control using ipc
« Reply #21 on: 12 / September / 2021, 20:11:40 »
In any case I found the culprit. It's in the wait loop inside get_capture_data(). Here is the latest diff that shows the logging. Looking like it's camera side.
Yeah, that's essentially measuring the time between the shot being requested and the first data becoming available. Have you tried cont mode?

I tested elph130 and sx710 using the attached script. In both cases, the first shot was slower (2s for elph130, 1.5s for sx710) and the following 39 shots were very steady (~1.8s and 1s respectively)

The first shot in a series being slower is something we've seen widely.

Neither of these cameras are very close to yours in terms of model / specs, so it's not surprising they behave differently from yours, but it suggests the problem isn't a global CHDK problem.

Usage for the script is like
Code: [Select]
!m=dofile('rstest.lua')
!do_test(40)
It just feeds rsint an 's' command each time it requests input, up to the number specified.
Don't forget what the H stands for.

Re: rsint with network socket for control using ipc
« Reply #22 on: 12 / September / 2021, 23:27:57 »
Yes, I tried cont mode but kept seeing the same delay. It turns out this may be a moot point.

I tested my custom multicam script with the 6 camera array but kept getting a timeout error. I'm guessing during the transfer of the chunks one of the instances runs into a timeout while waiting to receive the data.

On the plus side, it's good to know it's not a CHDK issue.

Thanks for the help and all the suggestions by the way

*

Offline reyalp

  • ******
  • 13353
Re: rsint with network socket for control using ipc
« Reply #23 on: 12 / September / 2021, 23:59:50 »
I tested my custom multicam script with the 6 camera array but kept getting a timeout error. I'm guessing during the transfer of the chunks one of the instances runs into a timeout while waiting to receive the data.
Depending on the specific thing that times out, it may be adjustable. If you use
Code: [Select]
set err_trace=always
it should give you a stack trace that will allow identifying the specific timeout.
Don't forget what the H stands for.


*

Offline Caefix

  • *****
  • 559
  • Sorry, busy deleting test shots...
Re: rsint with network socket for control using ipc
« Reply #24 on: 13 / September / 2021, 12:44:28 »
Gives benchmarking RAW vs small JPG any hints  ????
Are the SD-cards all the same?
« Last Edit: 13 / September / 2021, 15:59:41 by Caefix »
All lifetime is a loan from eternity.

Re: rsint with network socket for control using ipc
« Reply #25 on: 13 / September / 2021, 16:28:10 »
Depending on the specific thing that times out, it may be adjustable. If you use
Code: [Select]
set err_trace=always
it should give you a stack trace that will allow identifying the specific timeout.
Thanks for the hint, it came in handy. The camera side runs a loop in wait_shooting() that polls a state from get_shooting() for up to a timeout value; increasing it to 10000 instead of the default 2000 did the trick.

Gives benchmarking RAW vs small JPG any hints  ????
Are the SD-cards all the same?
I haven't tried testing with raw mode, but can say that .JPEG files were coming in as a single chunk (I want to say with some files being as large as 2MB, but take it with a grain of salt) on the single camera test. If that's the case I'm guessing the bus/sd card on the pi are the limiting factors here.

*

Offline reyalp

  • ******
  • 13353
Re: rsint with network socket for control using ipc
« Reply #26 on: 13 / September / 2021, 19:59:02 »
Thanks for the hint, it came in handy. The camera side runs a loop in wait_shooting() that polls a state from get_shooting() for up to a timeout value; increasing it to 10000 instead of the default 2000 did the trick.
Interesting, that's not a place I would have expected. get_shooting should go true when autofocus and auto-exposure are done, so it shouldn't be related to having multiple cameras in the rig, though I guess the chance of one taking longer could be higher.

Quote
I haven't tried testing with raw mode, but can say that .JPEG files were coming in as a single chunk (I want to say with some files being as large as 2MB, but take it with a grain of salt) on the single camera test. If that's the case I'm guessing the bus/sd card on the pi are the limiting factors here.
FWIW, if you wanted to use Canon raw, you'd need chdkptp r964 and chdk 1.5 (or later). But I don't think this is relevant to the drop in shooting speed, since it appears to happen before the data starts.
Don't forget what the H stands for.

Re: rsint with network socket for control using ipc
« Reply #27 on: 13 / September / 2021, 23:33:19 »
Oh really? I thought it did something memory related.

I logged the time it took to complete a single 's' command on the rig over 1200 shots, resulting in an average of 2.7s to complete a single command (effectively 0.45s per camera). Occasionally it would take 4.5s to 5s, maybe every 17 shots or so, which to me looked like buffering behavior. Weird.


 

Related Topics