Multi cam script help for deferred start - Script Writing - CHDK Forum  

Multi cam script help for deferred start

  • 11 Replies
  • 6423 Views
*

Offline i20

  • *
  • 12
Multi cam script help for deferred start
« on: 02 / August / 2017, 12:30:55 »
Advertisements
Hi all,
I am trying to write a script but I have some issues.
I have a multi camera system control with the multicam script. I have some battery issues, it is shutting down when action requieres too much power at the same time, so my idea is to do some actions camera per camera. I would like to start one by one each camera, to shutdown it one by one and to change the zoom one by one for example.
I started with the starting script, but it is not working, can I get some help please?
So far, I tried something like this.
Code: [Select]

mc=require('multicam')
      local count = 0
      local max = 2
      local count_timeout = 500
      mc:connect()
      while count < max do           
            count = count + 1
            mc:sel(0,count)           
            mc:cmdwait('rec')
         mc:sel(0,count)
            mc:cmdwait('rec')
            sleep(100)
          end

      end
Do you have any idea? Thanks in advance!

*

Offline reyalp

  • ******
  • 14080
Re: Multi cam script help for deferred start
« Reply #1 on: 02 / August / 2017, 23:40:42 »
If at all possible, I'd suggest addressing the underlying power supply issues instead of trying to work around it this way.

In your code, the problem is the logic in the loop. To use this approach, you need to loop over the total number of cameras, and use sel to select consecutive ranges, but that's not simple to do with the multicam code.

You could try something like

Code: [Select]
for i,lcon in ipairs(mc.cams) do
  mc:sel(lcon.mc_id)
  mc:cmdwait('rec')
  sys.sleep(100)
end
mc:sel('all')
This only does one camera at a time, if you wanted to do batches of several you'd need more complicated logic.

Note that sel takes either a numeric id, the string 'all' or a table specifying what to select like {min=1,max=5}. The second argument (range) is mistakenly left over from an earlier version and doesn't do anything. I will fix it in svn shortly.
Don't forget what the H stands for.

*

Offline i20

  • *
  • 12
Re: Multi cam script help for deferred start
« Reply #2 on: 03 / August / 2017, 10:30:16 »
Nice, it is exactly what I was looking for :)
Another question, when I am using shoot_hook_sync function, it turn on the LCD even if it was turned off before, is it possible to shoot with the LCD off?
Thank a lot

*

Offline reyalp

  • ******
  • 14080
Re: Multi cam script help for deferred start
« Reply #3 on: 03 / August / 2017, 22:36:25 »
Nice, it is exactly what I was looking for :)
Another question, when I am using shoot_hook_sync function, it turn on the LCD even if it was turned off before, is it possible to shoot with the LCD off?
Thank a lot
How are you turning the LCD off?

On most cameras, it will stay off after shooting if you used set_lcd_display(false), unless review is enabled in the canon firmware.

From multicam, you can use something like
mc:cmdwait('call set_lcd_display(false)')
Don't forget what the H stands for.


*

Offline i20

  • *
  • 12
Re: Multi cam script help for deferred start
« Reply #4 on: 04 / August / 2017, 08:55:12 »
I am using the function set_lcd_display(0) and set_lcd_display(1), I can turn it on and off, it is working fine, but everytime I take a pictuure, the lcd is turn on again

*

Offline reyalp

  • ******
  • 14080
Re: Multi cam script help for deferred start
« Reply #5 on: 04 / August / 2017, 12:53:28 »
I am using the function set_lcd_display(0) and set_lcd_display(1), I can turn it on and off, it is working fine, but everytime I take a pictuure, the lcd is turn on again
Check the "review" setting in the canon firmware menu. It should be off.

What camera are you using?
Don't forget what the H stands for.

*

Offline i20

  • *
  • 12
Re: Multi cam script help for deferred start
« Reply #6 on: 04 / August / 2017, 13:02:50 »
I am using some powershots a2500. I will have a look to the review setting, thanks.
I found a trick, I divided my camera in 2 groups, so I can control it and take pictures without any DC power issues. Basically I have 2 groups of 5 cameras, I can zoom, focus and shot, one group after the other, I don't have issues with the tension anymore.
But, I still have a small problem, when I take the picture, it needs a lot a time to take, store and then continue the function, so between my shots from group 1 and group 2, there is around 3-4 seconds (that is too much in my case), is there a way to reduce that? for example taking the shots from both groups and then process it after (compress, store etc)?


*

Offline reyalp

  • ******
  • 14080
Re: Multi cam script help for deferred start
« Reply #7 on: 04 / August / 2017, 15:58:45 »
I am using some powershots a2500. I will have a look to the review setting, thanks.
I found a trick, I divided my camera in 2 groups, so I can control it and take pictures without any DC power issues.
I really suggest addressing the underlying power supply issues if at all possible. This kind of thing is notorious for causing unpredictable, difficult to diagnose problems.
Quote
is there a way to reduce that? for example taking the shots from both groups and then process it after (compress, store etc)?
You can pause the shooting process before the jpeg is created using the raw hook, see http://chdk.wikia.com/wiki/Script_Shooting_Hooks. Using it will require modifying the camera side shoot code (e.g. cmds.shoot_hook_sync).

I have no idea whether this would accomplish what you want, and integrating it into multicam requires some understanding of the code.
Don't forget what the H stands for.


Re: Multi cam script help for deferred start
« Reply #8 on: 01 / December / 2017, 14:17:51 »
Could it be, possible / relatively straightforward, having identified a (crashed) disconnected camera / cameras [using lcon:is_connected()], to:

programmatically disconnect all currently connected cameras
exit multicam

turn power off/on to, only, any crashed camera(s)

then reconnect, to all cameras, normally via:

!mc=require('multicam')
!mc:connect()
etc etc

*

Offline reyalp

  • ******
  • 14080
Re: Multi cam script help for deferred start
« Reply #9 on: 02 / December / 2017, 01:21:35 »
Could it be, possible / relatively straightforward, having identified a (crashed) disconnected camera / cameras [using lcon:is_connected()], to:

programmatically disconnect all currently connected cameras
exit multicam

turn power off/on to, only, any crashed camera(s)

I tested this briefly with two cameras and it seems to work as expected, though I don't have the capability to actually reboot them from software.

then reconnect, to all cameras, normally via:
More graceful handling of crashed / disconnected cameras has been on my wish list for a long time.

Regarding your suggestion: I added a function mc:check_connections in rev 788
https://app.assembla.com/spaces/chdkptp/subversion/source/HEAD/trunk/lua/multicam.lua#ln275

I'm not sure if this is exactly what you had in mind. It's supposed to work like this
If you have the capability to powercycle cameras from software, set  mc.cam_powercycle_cmd to contain the command. It will be passed the id number of the cam.

If you notice cameras are crashed, run mc:check_connections(). You can pass it options for connect, e.g. a camera list like {list='mylist.txt'}

It checks for disconnected cameras in the current selection. If none are found, it returns without making any changes.
Otherwise, it exits the camera side script on the remaining cameras. If mc.cam_powercycle_cmd is defined, it runs it with the IDs of the disconnected cameras and waits 5 seconds. If not, it lists the cameras to be restarted and waits for keyboard input.
After the cameras are restarted, it runs mc:connect with the options passed in, followed by mc:start()
Don't forget what the H stands for.

 

Related Topics