supplierdeeply

MultiCamera Rig via multicam.lua how to mass ZOOM In/out on all cameras?

  • 15 Replies
  • 3431 Views
Advertisements
I have multicamera rig (currently 11 cameras connected through 3 USB hubs to PC) connected via USB, i use CHDK PTP multicam.lua script.

Im using this:

exec mc=require('multicam') mc:connect()
exec mc:start() mc:cmdwait('rec') mc:init_sync()

and for synchronized shooting something like this:

!return mc:testshots{tv=384,sv=411,nshots=1}

I would like to ask, while running the script on the cameras (after entering the line !mc:start()   )
Could someone please write me the correct command for zoom (zoom by step or by specific ammount i dont really care)?

And i would also be glad for these commands:

1) Command for mass (all connected cameras) zoom IN
2) Command for zoom IN for only one selected camera
3) Command for mass (all connected cameras) zoom OUT
4) Command for zoom OUT for only one selected camera
?

THANKS a lot :-)!
« Last Edit: 11 / February / 2016, 11:47:54 by goriskil »

*

Offline reyalp

  • ******
  • 11583
Re: MultiCamera Rig via multicam.lua how to mass ZOOM In/out on all cameras?
« Reply #1 on: 11 / February / 2016, 13:11:20 »
!return mc:testshots{tv=384,sv=411,nshots=1}
FWIW, I suggest using mc:shoot instead of testshots. They are similar, but shoot allows you to control more options and shoot bursts, while testshots prints a bunch of extra timing stuff you probably don't need. The idea of testshots is that you can point the cameras at the screen and get a rough idea when they shot based on which timestamps are visible.

Quote
I would like to ask, while running the script on the cameras (after entering the line !mc:start()   )
Could someone please write me the correct command for zoom (zoom by step or by specific ammount i dont really care)?
You can run lua code on all the cameras using the call command. That means you can use almost any function listed on http://chdk.wikia.com/wiki/CHDK_Scripting_Cross_Reference_Page

To zoom all the cameras in to the 3rd zoom step, you could do something like
!mc:cmdwait('set_zoom(3)')

You can also use simulated key presses like
!mc:cmdwait('click("zoom_in")')

Some cameras don't perform jpeg distortion correction correctly if you use set_zoom. However, on cameras with a lot of zoom steps, using clicks can be slow and imprecise.
Don't forget what the H stands for.

Re: MultiCamera Rig via multicam.lua how to mass ZOOM In/out on all cameras?
« Reply #2 on: 11 / February / 2016, 16:24:17 »
!return mc:testshots{tv=384,sv=411,nshots=1}
FWIW, I suggest using mc:shoot instead of testshots. They are similar, but shoot allows you to control more options and shoot bursts, while testshots prints a bunch of extra timing stuff you probably don't need. The idea of testshots is that you can point the cameras at the screen and get a rough idea when they shot based on which timestamps are visible.

Quote
I would like to ask, while running the script on the cameras (after entering the line !mc:start()   )
Could someone please write me the correct command for zoom (zoom by step or by specific ammount i dont really care)?
You can run lua code on all the cameras using the call command. That means you can use almost any function listed on http://chdk.wikia.com/wiki/CHDK_Scripting_Cross_Reference_Page

To zoom all the cameras in to the 3rd zoom step, you could do something like
!mc:cmdwait('set_zoom(3)')

You can also use simulated key presses like
!mc:cmdwait('click("zoom_in")')

Some cameras don't perform jpeg distortion correction correctly if you use set_zoom. However, on cameras with a lot of zoom steps, using clicks can be slow and imprecise.

Thanks for quick post and help :-).

Those commands you posted:

!mc:cmdwait('set_zoom(3)')
!mc:cmdwait('click("zoom_in")')

These are for mass cameras, for one camera it would what?

Thank you

*

Offline reyalp

  • ******
  • 11583
Re: MultiCamera Rig via multicam.lua how to mass ZOOM In/out on all cameras?
« Reply #3 on: 11 / February / 2016, 17:23:34 »
The mc:sel() function lets you select a subset of cameras, so you could use the same commands with just one selected.
e.g.
!mc:sel(5)
!mc:cmdwait('set_zoom(1)')
!mc:sel('all')

See the comments in the source for how to specify which cameras are selected.

Some other functions that might be useful
mc:list_sel() 
mc:list_all()
mc:save_list()
mc:load_list()

To identify specific physical cameras, you can toggle an on-screen ID number using  mc:cmdwait('id')
Don't forget what the H stands for.


Re: MultiCamera Rig via multicam.lua how to mass ZOOM In/out on all cameras?
« Reply #4 on: 11 / February / 2016, 18:34:18 »
The mc:sel() function lets you select a subset of cameras, so you could use the same commands with just one selected.
e.g.
!mc:sel(5)
!mc:cmdwait('set_zoom(1)')
!mc:sel('all')

See the comments in the source for how to specify which cameras are selected.

Some other functions that might be useful
mc:list_sel() 
mc:list_all()
mc:save_list()
mc:load_list()

To identify specific physical cameras, you can toggle an on-screen ID number using  mc:cmdwait('id')

Interesting, thank you, will look into it

Re: MultiCamera Rig via multicam.lua how to mass ZOOM In/out on all cameras?
« Reply #5 on: 12 / February / 2016, 04:57:57 »
I tried testing the zoom step on a single camera (A2500  ) but the camera crashes (Shuts off without lens retract disconnecting from PC).  Below is output..

C:\chdkptp>chdkptp -i
___> !mc=require'multicam'
___> !mc:connect()
+ 1:Canon PowerShot A2500  b=\\.\libusb0-0001--0x04a9-0x3271 d=bus-0 s=84B7D031B1B74B2E9DE870DCEA13DB95
___> !mc:start()
___> !mc:cmdwait('rec')
rec
___> !mc:cmd('sleep(5000)')
sleep(5000)
___> !mc:cmdwait('call set_zoom(60)')
call set_zoom(60)
___> !mc:cmd('sleep(5000)')
ERROR: call failed:I/O error

___>

*

Offline reyalp

  • ******
  • 11583
Re: MultiCamera Rig via multicam.lua how to mass ZOOM In/out on all cameras?
« Reply #6 on: 12 / February / 2016, 13:46:37 »
I tried testing the zoom step on a single camera (A2500  ) but the camera crashes (Shuts off without lens retract disconnecting from PC).  Below is output..
This sounds like a bug in the port.

Can you use set_zoom without using multicam? Just
chdkptp -c -i
=set_zoom(60)

How much free RAM is there on this port? You can use
=return get_meminfo('system')
to find out.

Can you get a ROMLOG http://chdk.wikia.com/wiki/Debugging#Camera_crash_logs_.28romlog.29 from the camera?

Have you checked the forum for other reports of zoom crashes with this camera? The porting thread http://chdk.setepontos.com/index.php?topic=10626.msg104790#msg104790 would be a good place to start.


I don't think following is related to your problem, but FWIW, mc:cmd('sleep(5000)') is not a valid multicam command. 
If you want to call camera side lua like "sleep(5000)", you need to use the 'call' command, as you did for set_zoom.
cmdwait waits for the command to finish, so normally shouldn't need to add extra delay after every command (in some cases like switching to rec mode it might be a good idea), but if you do want to delay, I'd suggest doing it on the chdkptp side with
!sys.sleep(5000)
sending mc:cmd('call sleep(5000)') would not make your chdkptp script wait, because mc:cmd returns as soon as the commands are sent, without waiting for them to finish.

If you just want to make sure the connection is alive, you could use !mc:cmdwait('tick')
Don't forget what the H stands for.

Re: MultiCamera Rig via multicam.lua how to mass ZOOM In/out on all cameras?
« Reply #7 on: 13 / February / 2016, 02:44:45 »
Hi reyalp

[/quote]
This sounds like a bug in the port.

Can you use set_zoom without using multicam? Just
chdkptp -c -i
=set_zoom(60)

How much free RAM is there on this port? You can use
=return get_meminfo('system')
to find out.

Can you get a ROMLOG
[/quote]

I have noticed that when I run "=set_zoom(60)" , it works sometime but in two - three attempts, it crashes again. I believe with multiple camera's it will become worse.

I'm attaching RAMLOG and command output here.

Successful command test Output:

C:\chdkptp>chdkptp -c -i
connected: Canon PowerShot A2500 , max packet size 512
con> list
*1:Canon PowerShot A2500  b=bus-0 d=\\.\libusb0-0001--0x04a9-0x3271 v=0x4a9 p=0x3271 s=84B7D031B1B74B2E9DE870DCEA13DB95
con> =return get_meminfo('system')
1:return:table:{start_address=1557528,chdk_start=1421288,free_size=457968,chdk_size=136232,allocated_size=1053000,free_block_count=13,allocated_count=1527,name="system",end_address=3068496,chdk_malloc=true,free_block_max_size=455952,allocated_peak=1054416,total_size=1510968,}
con 1> !sys.sleep(5000)
con 1> rec
con 2> =set_zoom(60)
con 3> =set_aflock(1)
con 4> =set_focus(10)
con 5> shoot
con 6>


Output when Camera crashed:

C:\chdkptp>chdkptp -c -i
connected: Canon PowerShot A2500 , max packet size 512
con> rec
con 1> =set_zoom(60)
ERROR: I/O error
___>

Also I noticed, it fails on below command as well if set zoom worked.
=set_aflock(1)

I will go through the post you recommended today.




*

Offline reyalp

  • ******
  • 11583
Re: MultiCamera Rig via multicam.lua how to mass ZOOM In/out on all cameras?
« Reply #8 on: 13 / February / 2016, 03:36:41 »
Here's a test build with CAM_NEED_SET_ZOOM_DELAY set to 300, maybe that will help.
Don't forget what the H stands for.

Re: MultiCamera Rig via multicam.lua how to mass ZOOM In/out on all cameras?
« Reply #9 on: 15 / February / 2016, 04:59:45 »
Here's a test build with CAM_NEED_SET_ZOOM_DELAY set to 300, maybe that will help.

Tested the file and it works for single camera. I tried running with multiple camera's and it starts giving problem intermittently. The errors are mostly I/O errors. I think those are due to inferior USB hub quality than the camera or CHDKPTP itself.

Will it help if I send the RAMLOG after I/O error on PC? On camera side , the camera just turns off with lens retracted.

 

Related Topics