Remote shooting issues - page 4 - General Discussion and Assistance - CHDK Forum  

Remote shooting issues

  • 35 Replies
  • 13827 Views
*

Offline reyalp

  • ******
  • 14117
Re: Remote shooting issues
« Reply #30 on: 10 / August / 2021, 14:07:51 »
Advertisements

Note that if you are switching to playback between runs, it should not be needed.
Ok thanks!
To elaborate slightly: If you want to turn the sensor off the keep the temperatures down (or save power), switching to play does that.

While rawopint is running, the sensor will never switch off, because it has either half press or full press held for the whole duration of the run (depending on the "cont" setting).

If you want to turn the screen off in playback mode, you should just use set_lcd_display. The Canon "turn display off after N seconds" functionality doesn't apply in playback.

Quote
I have the webcam of the laptop pointing to the Canon, so I can see if the lens is retracted or if the screen is off or what the green led is doing. :P
That'll do  :)

Quote
I did notice the static scene once or twice. Now I know better what that was. Also
Code: [Select]
=return get_imager_active()
is a good hit. Thanks again!


Is there a way to get a return direct in chdkptp script when using codes like =return get_imager_active() ?
What I do is first type chdkptp -c -i and then =return get_imager_active() but is there a way to execute it like chdkptp -c -i"=return get_imager_active() quit" and get in the powershell cmd a return of the function called?
In that case, I'd use chdkptp side Lua with exec (aka !). For example, you could do something like
Code: [Select]
exec imager_active=con:execwait[[return get_imager_active()]] if imager_active then sys.set_exit_value(1) else sys.set_exit_value(0) end
The main thing here is con:execwait is the same as luar, except the return values from camera side Lua are returned to chdkptp side Lua instead of being printed. Multiple returns and tables work just like they normally do in Lua, except that tables can't contain cyclic references or functions.

Note I used sys.set_exit_status rather than Lua native os.exit(exit value) because I'm not 100% certain chdkptp cleans everything up of you use os.exit(). sys.set_exit_status just sets the return value of main() in the C code.

If your code gets more complex, you might want to put it in a lua file, and then run the file with something like
Code: [Select]
exec dofile('myfile.lua')
or make a Lua module for your functions and load it with require

Quote
Where can I find a code example ore more information how to print live telemetry data to powershell cmd? like "100 photos of 1000 done"
If you want live telemetry while rawopint is running, that would be quite complicated, because it would need to be integrated with the code for the remoteshoot command. You could modify cli.lua to print some things or write to a file.

If you use
Code: [Select]
set cli_verbose=2
remoteshoot will print information about each shot, but it's quite verbose.
Don't forget what the H stands for.

Re: Remote shooting issues
« Reply #31 on: 13 / August / 2021, 09:46:27 »
Quote
how to print live telemetry data to powershell cmd?
:) You can write lines like ...   
Code: [Select]
os.execute('echo %PATH% &&cd&& dir/b')or
Code: [Select]
function echo(...)
local str=string.format(...)
os.execute('echo '..str)
end

echo("%i Photos of %i", count or 0, maxcount or 1000)
Thanks! Yeah I was searching for code like this!

I tried it out, but without any success. I think it is related to the issue that remoteshoot is not able to return messages form the lua script running on the camera, as described by rayalp below.

To elaborate slightly: If you want to turn the sensor off the keep the temperatures down (or save power), switching to play does that.

While rawopint is running, the sensor will never switch off, because it has either half press or full press held for the whole duration of the run (depending on the "cont" setting).

If you want to turn the screen off in playback mode, you should just use set_lcd_display. The Canon "turn display off after N seconds" functionality doesn't apply in playback.

Thanks again!
I think it works now quite good: with the camera waiting in play mode most of the time and without any freezing's.
What I noticed: the temperature of the sensor is about 10°C lower when the camera is shooting the long exposures (13s each 15s) than when the exposure is shorter than 1/4sec.


Quote
In that case, I'd use chdkptp side Lua with exec (aka !). For example, you could do something like
Code: [Select]
exec imager_active=con:execwait[[return get_imager_active()]] if imager_active then sys.set_exit_value(1) else sys.set_exit_value(0) end
The main thing here is con:execwait is the same as luar, except the return values from camera side Lua are returned to chdkptp side Lua instead of being printed. Multiple returns and tables work just like they normally do in Lua, except that tables can't contain cyclic references or functions.

Note I used sys.set_exit_status rather than Lua native os.exit(exit value) because I'm not 100% certain chdkptp cleans everything up of you use os.exit(). sys.set_exit_status just sets the return value of main() in the C code.
I searched for such an example for a long time! This is great stuff! and it works!
(actually i don't know what  os.exit(exit value) or sys.set_exit_status is used for but
Code: [Select]
chdkptp -c -e"exec imager_active=con:execwait[[return get_imager_active()]] if imager_active then print'sensor is acive' else print'sensor is not active' end" also worked! :lol :lol)

The idea for a better code:
Code: [Select]
! zoom_position=con:execwait[[return get_zoom()]] if zoom_position~=28 then print'zoom wrong: set to 28%' set_zoom(28) else print'zoom ok' end

Quote
If you want live telemetry while rawopint is running, that would be quite complicated, because it would need to be integrated with the code for the remoteshoot command. You could modify cli.lua to print some things or write to a file.

If you use
Code: [Select]
set cli_verbose=2
remoteshoot will print information about each shot, but it's quite verbose.

Okay, so if remoteshoot doesn't have support printing to the cmd using the lua script running on the camera as with the code @Caefix posted above, I'll put that off until later as it's just a nice to have and not necessary for running the time lapse and I can check the status of the camera with the code snippet you share above just like that.  ;)

attached a plot of the logging of a sunset where you can see that the temperatures are lower when the exposure starts to take longer than 1/4s.
« Last Edit: 13 / August / 2021, 10:01:47 by dolomiti_timelapse »
If you want to see a sunset or sunrise of Dolomiti Val Gardena shot with CHDK visit
Instagram: dolomiti_timelapse
YouTube: https://www.youtube.com/channel/UCEJHg--ujxLkjMrevJXh-Gw

*

Offline c_joerg

  • *****
  • 1251
Re: Remote shooting issues
« Reply #32 on: 13 / August / 2021, 10:40:28 »
What I noticed: the temperature of the sensor is about 10°C lower when the camera is shooting the long exposures (13s each 15s) than when the exposure is shorter than 1/4sec.

Yes. Reading out the sensor generates the heating. Here is an example of the M3
M100 100a, M3 121a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

*

Offline Caefix

  • *****
  • 947
  • Sorry, busy deleting test shots...
Re: Remote shooting issues
« Reply #33 on: 13 / August / 2021, 11:45:37 »
:) You can write lines like ...   
Code: [Select]
os.execute('echo %PATH% &&cd&& dir/b')or
Code: [Select]
function echo(...)
local str=string.format(...)
os.execute('echo '..str)
end

echo("%i Photos of %i", count or 0, maxcount or 1000)
... in the HostLua environment, sorry,  :-X ... seems a step off topic.
https://forum.chdk-treff.de/viewtopic.php?f=7&t=3540
All lifetime is a loan from eternity.


*

Offline reyalp

  • ******
  • 14117
Re: Remote shooting issues
« Reply #34 on: 13 / August / 2021, 13:31:06 »
I searched for such an example for a long time! This is great stuff! and it works!
(actually i don't know what  os.exit(exit value) or sys.set_exit_status is used for but
Code: [Select]
chdkptp -c -e"exec imager_active=con:execwait[[return get_imager_active()]] if imager_active then print'sensor is acive' else print'sensor is not active' end" also worked! :lol :lol)
Yes, that's fine if you want to print it. You would use sys.set_exit_status / os.exit would be if you wanted it as an exit value for whatever script or batch file is running the chdkptp commands.

Quote
The idea for a better code:
Code: [Select]
! zoom_position=con:execwait[[return get_zoom()]] if zoom_position~=28 then print'zoom wrong: set to 28%' set_zoom(28) else print'zoom ok' end
set_zoom is camera side, so you'd need a con:execwait for that too, but you can put all the logic in one script if you want, like
Code: [Select]
print(con:execwait[[
if get_zoom() == 28 then
  return 'zoom ok'
else
  set_zoom(28)
  return 'zoom wrong: set to 28%'
end]])
Above formatted as normal Lua for readability, if it's part of an exec command it would all be on one line.
Personally, I'd put anything more than trivial one-liners in a separate lua file. You can then either put all your logic in the lua file, using cli:execute to execute cli commands like remoteshoot, imrm etc, or load your lua file as a module with exec mymod=require'mymode' and call functions individually like exec mymod.check_zoom()

The escursionisticivatesi.it script uses the first approach https://github.com/alesanmanoweb/multilapse-CHDK/blob/master/multilapse.lua

Quote
Okay, so if remoteshoot doesn't have support printing to the cmd using the lua script running on the camera as with the code Caefix posted above, I'll put that off until later as it's just a nice to have and not necessary for running the time lapse and I can check the status of the camera with the code snippet you share above just like that.  ;)
I'm not really clear what Caefix was suggesting, but os.execute allows you to execute programs on the PC side, from chdkptp lua, it doesn't exist on the camera. You can also use fsutil.popen if you want to pipe input or output, but I don't see how this would help.

If you want remoteshoot to print a line for every shot, you can just add something to the main loop of the remoteshoot command in cli.lua like
Code: [Select]
local shot = 1
repeat
rcopts.shotseq=prefs.cli_shotseq
cli.dbgmsg('get data %d\n',shot)
printf('shot %d\n',shot) -- added
status,err = con:capture_get_data_pcall(rcopts)
...
If you wanted specific information from the camera side script, you'd have to modify rawopint to send messages and then handle them in the chdkptp code.
Don't forget what the H stands for.

Re: Remote shooting issues
« Reply #35 on: 18 / August / 2021, 14:32:17 »
Thank you guys @Caefix, @c_joerg, @reyalp for your fast replay!  8) You are really a priceless and precious support! It takes me more time to find an answer and present the new developments and testing of your recommendations.

You would use sys.set_exit_status / os.exit would be if you wanted it as an exit value for whatever script or batch file is running the chdkptp commands.
oh, that's also a great idea! Thank you for the explanation.

Quote
set_zoom is camera side, so you'd need a con:execwait for that too, but you can put all the logic in one script if you want, like
Code: [Select]
print(con:execwait[[
if get_zoom() == 28 then
  return 'zoom ok'
else
  set_zoom(28)
  return 'zoom wrong: set to 28%'
end]])
Above formatted as normal Lua for readability, if it's part of an exec command it would all be on one line.
Personally, I'd put anything more than trivial one-liners in a separate lua file. You can then either put all your logic in the lua file, using cli:execute to execute cli commands like remoteshoot, imrm etc, or load your lua file as a module with exec mymod=require'mymode' and call functions individually like exec mymod.check_zoom()

The escursionisticivatesi.it script uses the first approach https://github.com/alesanmanoweb/multilapse-CHDK/blob/master/multilapse.lua

Ok, thanks! I started to write a lua file but for now I have some one-liners with some lua logic in int. Once I will be happy with the code I will post it to my dolomiti timelapse chat.
Quote
If you want remoteshoot to print a line for every shot, you can just add something to the main loop of the remoteshoot command in cli.lua like
Code: [Select]
local shot = 1
repeat
rcopts.shotseq=prefs.cli_shotseq
cli.dbgmsg('get data %d\n',shot)
printf('shot %d\n',shot) -- added
status,err = con:capture_get_data_pcall(rcopts)
...
If you wanted specific information from the camera side script, you'd have to modify rawopint to send messages and then handle them in the chdkptp code.

Once someone has shown you how to do it, it always ends up being really easy. Thank you!
If you want to see a sunset or sunrise of Dolomiti Val Gardena shot with CHDK visit
Instagram: dolomiti_timelapse
YouTube: https://www.youtube.com/channel/UCEJHg--ujxLkjMrevJXh-Gw

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal