multicam, first steps, syntax wrong? - General Help and Assistance on using CHDK stable releases - CHDK Forum

multicam, first steps, syntax wrong?

  • 34 Replies
  • 2814 Views
*

Offline Mlapse

  • *****
  • 568
  • S95 S110
multicam, first steps, syntax wrong?
« on: 09 / April / 2022, 07:41:11 »
Advertisements
i was testing multicam for the first time and all went well until i tried

Code: [Select]
___> !mc:shoot({shots=10, interval=30000, release_half=true})
i somehow expected it to take 10 shots, but it didn't work out like that.
should i remove the set values in the multicam script for this to work?

and about the sync delay, should i correct that in camera?

result from mc:shoot
Code: [Select]
call
1: {}
2: {}
preshoot
1: true
2: true
shoot_burst [sync +56] {
 interval=30000,
 shots=10,
 release_half=true
}
1: false msg hook_raw ready timeout
2: false msg hook_raw ready timeout
___>

i guess mc:shoot is only meant for bursts or single shots...
now a more pertinent question, how do i activate saving images on my system instead of on the camera?
 
« Last Edit: 09 / April / 2022, 09:06:35 by Mlapse »
frustration is a key ingredient in progress

*

Offline reyalp

  • ******
  • 14000
Re: multicam, first steps, syntax wrong?
« Reply #1 on: 09 / April / 2022, 21:40:32 »
i was testing multicam for the first time and all went well until i tried

Code: [Select]
___> !mc:shoot({shots=10, interval=30000, release_half=true})
i somehow expected it to take 10 shots, but it didn't work out like that.
It should have
Quote
should i remove the set values in the multicam script for this to work?
Trying with different options might give clues what failed.

Quote
and about the sync delay, should i correct that in camera?
I'm not clear what you mean. The init_sync command calculates a reasonable minimum delay. You could use a larger value to reduce the chance of out of sync shots.

Quote
result from mc:shoot
Code: [Select]
...
1: false msg hook_raw ready timeout
2: false msg hook_raw ready timeout
___>

i guess mc:shoot is only meant for bursts or single shots...
It means something broke.

The "hook_raw ready timeout" message means raw image data didn't become available in the expected time. Possible causes could be if the exposure (+dark frame and noise reduction if applicable) was very long, or a bug in the port, or a bug in the multicam logic.

If you look at the multicam.lua source below below local function init() you can see the default value of raw_hook_ready_timeout is 10000, and you can look below to see where it is used.

I initially thought it might have something to do with the 30s interval, but looking at the code (current SVN at least, older versions might have other bugs) it shouldn't, and the shoot command you posted works for me on elph130. So you need to figure out what the cameras actually did.

Quote
now a more pertinent question, how do i activate saving images on my system instead of on the camera?
If you mean remoteshoot, multicam doesn't support it. You can download images after shooting using mc:download_images.

The reasons I didn't implement remoteshoot support:
1) In chdkptp, only one connection can be in use at a time, so download time (whether remoteshoot or file transfer) scales with the number of cameras. In contrast, saving to each SD card happens in parallel. This means that with more than a few cameras, there would be very little advantage to using remoteshoot.
2) It would be quite complicated to implement.
Don't forget what the H stands for.

*

Offline Mlapse

  • *****
  • 568
  • S95 S110
Re: multicam, first steps, syntax wrong?
« Reply #2 on: 10 / April / 2022, 03:20:38 »
I have downloaded the latest multicam.lua from
https://app.assembla.com/spaces/chdkptp/subversion/source/1165/trunk/lua/multicam.lua

this also performed similar, when taken shots up until 10 seconds it works, i hear 2 shots in short succession at start and then screen turns blank and it does it's job.
at 11 seconds or longer you hear 2 shots in short succession and then the screen comes back on without chdk overlay and after a fair wait it fails and the cams get there info back on the display: false msg hook_raw ready timeout on pc.
i tried with hook_raw ready timeout set at 60000, but that did not help.

what i do see after the timeout is that the script on the cam is active (not started)
that was to be part of my next question, how to start a camera side script from multicam?
and the second one would be how to cleanly close multicam/chdkptp? disconnect?

i was wondering how quick remoteshoot would saturate the usb so i was prepared for it not to work :)



« Last Edit: 10 / April / 2022, 03:50:46 by Mlapse »
frustration is a key ingredient in progress

*

Offline reyalp

  • ******
  • 14000
Re: multicam, first steps, syntax wrong?
« Reply #3 on: 10 / April / 2022, 16:44:43 »
this also performed similar, when taken shots up until 10 seconds it works, i hear 2 shots in short succession at start and then screen turns blank and it does it's job.
OK, I can reproduce this now. It appears to happen with long intervals when the camera(s) are not in continuous mode.

It looks like there are several bugs with long intervals. In continuous mode, it doesn't hit the timeout error, but I don't think it maintains the correct interval either.

A fix for the timeout should be to add, in the camera side function cmds.shoot_burst() just below the opts=extend_table expression
Code: [Select]
if opts.interval + 2000 > opts.shoot_hook_timeout then
opts.shoot_hook_timeout = opts.interval + 2000
end
Note this is not the hook referred to in the message. The shoot hook timing out after ten seconds caused the shooting process to continue before it should have, which later made the raw hook wait happen at the wrong time.

I'll check in a more complete fix later, but but beware that I can't promise the current svn multicam.lua will work with older snapshot builds of chdkptp. At the moment, I think only some stuff related to camera ID list files is incompatible with r964, but I certainly haven't tested.

Quote
what i do see after the timeout is that the script on the cam is active (not started)
that was to be part of my next question, how to start a camera side script from multicam?
and the second one would be how to cleanly close multicam/chdkptp? disconnect?
If you're talking about the alt status line, it's normal to see that when a PTP script is running. If the camera side script were not running, then multicam could not do anything.

To start the script on all connected cameras, use mc:start(). If a script is already running, it will be killed.
You can end the script with mc:cmdwait('exit')
You can disconnect from from all cameras using mc:disconnect(). Note this does not stop the script.
If there is a script error (an actual Lua error, not a returned error status like the timeout message) then of course the script will exit and need to be restarted.
Don't forget what the H stands for.


*

Offline Mlapse

  • *****
  • 568
  • S95 S110
Re: multicam, first steps, syntax wrong?
« Reply #4 on: 11 / April / 2022, 11:21:36 »
I'll check in a more complete fix later, but but beware that I can't promise the current svn multicam.lua will work with older snapshot builds of chdkptp. At the moment, I think only some stuff related to camera ID list files is incompatible with r964, but I certainly haven't tested.

no problem, i have enough to discover before it becomes something of interest.

Quote
If you're talking about the alt status line, it's normal to see that when a PTP script is running. If the camera side script were not running, then multicam could not do anything.
To start the script on all connected cameras, use mc:start(). If a script is already running, it will be killed.
You can end the script with mc:cmdwait('exit')
You can disconnect from from all cameras using mc:disconnect(). Note this does not stop the script.
If there is a script error (an actual Lua error, not a returned error status like the timeout message) then of course the script will exit and need to be restarted.

yes, i was talking about the alt status.
ah, here i asked wrong, i was wondering if i could start a cam side script other than multicam (eg suix or rawopint) to start running and how to stop that from the pc.

and something that i want to solve is, i was planning to use utc+1 for mc:setclock() and i have seen that you already implemented utc, so that's a great start.
my (untested) guess: mc:setclock(utc=true)
but how do i make it UTC+1?
« Last Edit: 11 / April / 2022, 11:23:48 by Mlapse »
frustration is a key ingredient in progress

*

Offline reyalp

  • ******
  • 14000
Re: multicam, first steps, syntax wrong?
« Reply #5 on: 11 / April / 2022, 12:48:14 »
ah, here i asked wrong, i was wondering if i could start a cam side script other than multicam (eg suix or rawopint) to start running and how to stop that from the pc.
For starting, you can use the loadfile method described on https://chdk.fandom.com/wiki/Lua/PTP_Scripting
To run scripts with menu parameters, you need to set all the values that would be set by the menu. The current SVN version of chdkptp includes a command "camscript" to do this automatically in various ways.

To end, you have three options:
1) Script logic exits based on some predetermined conditions, like take 10 shots and end
2) Use a read_usb_msg to check for a message from the PC
3) Use killscript from the PC. This immediately terminates the script in the middle of whatever it's doing, so is almost certainly not what you'd want


Quote
and something that i want to solve is, i was planning to use utc+1 for mc:setclock() and i have seen that you already implemented utc, so that's a great start.
my (untested) guess: mc:setclock(utc=true)
but how do i make it UTC+1?
You'd have to modify the code to support that. Assuming you really mean UTC+1 (without DST changes) I think you could just at 1 hour (3600) to the time in the os.date line, like
Code: [Select]
local lt=os.date('!*t',os.time()+3600)
Don't forget what the H stands for.

*

Offline Mlapse

  • *****
  • 568
  • S95 S110
Re: multicam, first steps, syntax wrong?
« Reply #6 on: 12 / April / 2022, 03:42:31 »
i tried loadfile as mc:loadfile('A/CHDK/SCRIPTS/rawopint.lua')() first, because i want to start script on both cams. but came up empty with an unknown command.
then i tried via connect with one cam, that also failed, but different.
the cam side script is already set properly, so normally pressing [play] (alt key) and then [shoot] will start the script on camera.

Code: [Select]
___> connect
connected: Canon PowerShot S110, max packet size 512
con> !loadfile('A/CHDK/SCRIPTS/rawopint.lua')()
ERROR: call failed:[string "loadfile('A/CHDK/SCRIPTS/rawopint.lua')()"]:1: attempt to call a nil value
stack traceback:
[C]: in function 'xpcall'
/home/xxxx/chdkptp/lua/cli.lua:748: in function </home/xxxx/chdkptp/lua/cli.lua:739>
(...tail calls...)
[C]: in function 'xpcall'
/home/xxxx/chdkptp/lua/cli.lua:285: in function 'execute'
/home/xxxx/chdkptp/lua/cli.lua:400: in function </home/xxxx/chdkptp/lua/cli.lua:391>
(...tail calls...)
/home/xxxx/chdkptp/lua/main.lua:307: in main chunk
[C]: in function 'require'
[string "require('main')"]:1: in main chunk

con>

setting up a read message has not been tried by me yet, first have to solve this.

i also looked at the svn, https://subversion.assembla.com/svn/chdkptp/trunk/
but don't understand what files i need and i should do to make it into a workable chdkptp set...is there a step by step guide for this?
in the end i only copied the chdkptp.sh file and placed that in my r964 folder, but that changed nothing i could see.

the os.date adaption you suggested does what it says on the tin :)  UTC+1

after mc:disconnect() I can activate the cam by pressing play, pulling usb and pressing (half) shoot... could not removing usb be solved by usb_force_active(1)?

with multicam running:
killscript ends with:
ERROR: camera does not support clean kill, use -force if you are sure
killscript-force:
WARNING: camera does not support clean kill, crashes likely.
both followed by an error on the killscript line, last one with a disconnect error too

so those commands are out for the s110, good to know.

« Last Edit: 12 / April / 2022, 13:59:08 by Mlapse »
frustration is a key ingredient in progress

*

Offline reyalp

  • ******
  • 14000
Re: multicam, first steps, syntax wrong?
« Reply #7 on: 12 / April / 2022, 16:41:29 »
i tried loadfile as mc:loadfile('A/CHDK/SCRIPTS/rawopint.lua')() first, because i want to start script on both cams. but came up empty with an unknown command.
There is no mc:loadfile function. The mc functions are defined in multicam.lua
You could theoretically do something like mc:cmd("call loadfile('A/CHDK/SCRIPTS/rawopint.lua')()") but to actually use rawopint, you need to do something to set all the menu options at least.

That said, I'm don't really understand why you want to run rawopint from within multicam.lua. The purpose of multicam is primarily synchronized shooting with multiple cameras. Using to to run a different script to do the shooting doesn't really make sense to me. If you just want to start a script on several cameras, multicam seems like needless complication, you do do a very simple script to iterate over chdk.list_usb_devices. See extras/simplemulticam.lua for a possible starting point, though beware it may be out of date. Or just use a chdkptp command script to connect to each camera in turn by name or serial number.

Quote
Code: [Select]
___> connect
connected: Canon PowerShot S110, max packet size 512
con> !loadfile('A/CHDK/SCRIPTS/rawopint.lua')()
ERROR: call failed:[string "loadfile('A/CHDK/SCRIPTS/rawopint.lua')()"]:1: attempt to call
! runs chdkptp side Lua. To run camera side Lua you should use . (no wait) or = (wait, which you probably don't want if running rawopint)

Quote
i also looked at the svn, https://subversion.assembla.com/svn/chdkptp/trunk/
but don't understand what files i need and i should do to make it into a workable chdkptp set...is there a step by step guide for this?
in the end i only copied the chdkptp.sh file and placed that in my r964 folder, but that changed nothing i could see.
You would need to check the complete source out (or download as a zip) and build it was described in README.TXT. The .sh file just sets some environment variables.

Building on Linux is fairly straightforward, especially if you don't need the GUI. Install the prerequisite packages. README.TXT lists the package names for Debian and Fedora based distros, but names might vary for other distros. For a non-GUI build, you should only need readline and libusb 0.1 development packages.

from the source directory, run
misc/setup-ext-libs.bash
If you don't need the gui, you can pass -nogui

After setup-ext-libs completes successfully, use make to build a GUI only build, or make GUI=1 to build with GUI support.

Quote
with multicam running:
killscript ends with:
ERROR: camera does not support clean kill, use -force if you are sure
What version of CHDK are you running? killscript should be supported on every camera, for many years now.
« Last Edit: 12 / April / 2022, 16:43:14 by reyalp »
Don't forget what the H stands for.


*

Offline Mlapse

  • *****
  • 568
  • S95 S110
Re: multicam, first steps, syntax wrong?
« Reply #8 on: 12 / April / 2022, 17:43:24 »
What version of CHDK are you running? killscript should be supported on every camera, for many years now.
the cam that produced that error was running 1.5.1.5708.

i'll try building it, but where do i find the complete zip or how do i check out the complete source, because i coudn't find that.
« Last Edit: 12 / April / 2022, 17:48:07 by Mlapse »
frustration is a key ingredient in progress

*

Offline reyalp

  • ******
  • 14000
Re: multicam, first steps, syntax wrong?
« Reply #9 on: 12 / April / 2022, 18:08:43 »
What version of CHDK are you running? killscript should be supported on every camera, for many years now.
the cam that produced that error was running 1.5.1.5708.
OK, in that case the error chdkptp connections getting confused because you're mixing multicam and CLI. That's a chdkptp bug. Doing mc:disconnect before attempting to use killscript will probably avoid it.

Quote
i'll try building it, but where do i find the complete zip or how do i check out the complete source, because i coudn't find that.
If it's not already installed, install subversion with your package manager, and then

svn co https://subversion.assembla.com/svn/chdkptp/trunk chdkptp

the chdkptp at the end is the directory name where you want it installed. Alternatively, if you go to https://app.assembla.com/spaces/chdkptp/subversion/source/HEAD/trunk there's a download button next to the "checkout" which gives you a zip, but I'd suggest using svn because it makes getting updates easier.
Don't forget what the H stands for.

 

Related Topics