--[[This is to start and run Multicam]]mc=require('multicam')mc:connect()mc:start()mc:cmdwait('rec')mc:cmdwait('preshoot')mc:cmdwait('shoot')mc:cmd('exit')--[[This is to turn on the table ]]http.request (<URL>/cm?cmnd=Power%20TOGGLE)--[[This is to pause for the turning of the table 3 seconds for the table to advance]]sys.sleep(3000)--[[This is to turn off the table ]]http.request (http://<URL>/cm?cmnd=Power%20TOGGLE)--[[This is to start and run Multicam]]mc=require('multicam')mc:connect()mc:start()mc:cmdwait('rec')mc:cmdwait('preshoot')mc:cmdwait('shoot')mc:cmd('exit')
I am new to the world of LUA and Python scripting. I have installed LUA and Python for Windows but getting all the dependencies correctly installed and working together has been difficult for me. Therefore I have been unable to get the CLI operation working.
I have been using chdkptp GUI to connect the cameras. I am able to run multicam from Notepad++ and execute it through the 'LUA local Macro' and this has been successful for running the cameras.
What I am endeavoring to accomplish is to get a running program that will send commands to take pictures as well as stop and start the turntable via a HTTP request.
Also, if you could provide me with some pointers on the best way to install LUA, Python, and the dependencies for a noob, I would really appreciate that too.
I'm not sure if I completely understand, but FWIW, the chdkptp binaries from https://app.assembla.com/spaces/chdkptp/documents include a complete Lua interpreter and support both the CLI and GUI mode.To use the CLI, start chdkptp (from command prompt, powershell etc) with chdkptp -iYou can run your own load code or modules from there using the "!" command, but 3rd party modules built in DLL are unlikely to work.
I'm unclear how you are running multicam from notepad++. Do you somehow have chdkptp built as a modules running within the notepad++ Lua environment, or are you just executing it as an external .exe?
If you want to run your own Lua scripts inside chkdptp, you don't need notepad++, you can just run them with !dofile(...) or use require and call functions with !.
FWIW, if you want to run everything from the chdkptp Lua interpreter, you could just use standard Lua os.execute or io.popen (or the chdkptp wrapper fsutil.popen) to execute curl or something like that to make the http requests.
Without knowing what you want to accomplish with them, this isn't straightforward question.If you just want python and easy access to python packages on windows, anaconda is a straightforward standalone install https://www.anaconda.com/products/individualMSYS2 https://www.msys2.org/ also provides python, along with a complete gcc development environment and large selection of *nix-ish tools. This is the environment I use to develop chdkptp on windows, and I also use it for various python things. However, python in msys2 can have confusing compatibility issues. There are separate python packages for the "msys" and the "mingw" environments, which are incompatible with each other and have different behavior. "msys" is a unix-ish (more or less) "posix" environment, while the mingw environments are more windows-ish.MSYS2 provides various Lua packages as well, but the chdkptp executables I distribute use a statically linked standalone build from the the official Lua source, so MSYS2 Lua is not directly relevant to chdkptp.You can also get Python and Lua on windows using WSL (https://docs.microsoft.com/en-us/windows/wsl/) but I have never tried to run chdkptp through WSL and don't know if it's possible to make the USB connection work.
I suppose necessity is the mother of invention. Honestly, I don't know how I got it working either. But I was working on editing the LUA on Notepad++ I ran this chdkptp macro and the program worked! (I added an Screenshot here)
This statement will be the most difficult for me to make sense of. Ideally, I would like to write a program in a .lua file and then execute it via the command line.
chdkptp -e"exec dofile('somefile.lua')"
If the chdkptp LUA interpreter gets me the ability to make the HTTP request then I will proceed that way. Is there a way to embed the request in the same lua program as multicam that I can execute it from the command line?
os.execute('curl <URL>/cm?cmnd=Power%20TOGGLE')
OK, I guess you used the environment from https://chdk.setepontos.com/index.php?topic=12961.0 ?I don't personally use that, but I assume in that case it's just running the code in chdkptp normally, equivalent to saving the file and then executing it in chdkptp from the command line.
USAGE.TXT in chdkptp directory has more details.
chdkptp Lua does not directly have the ability to make HTTP requests. But as I mentioned, you can use os.execute to call a program like curl (https://curl.se/windows/)something likeCode: [Select]os.execute('curl <URL>/cm?cmnd=Power%20TOGGLE')Note os.execute will just print any output from the command, which in the case of curl with default options, will be the server response plus some status output on stderr. If you need to read the server response, you should use popen instead (see http://www.lua.org/manual/5.2/manual.html#6.9)
chdkptp -e"exec dofile(basicTest.lua)"
connect --[[Not sure about this one]]--[[This is to start and run Multicam]]mc=require('multicam')mc:connect()mc:start()mc:cmdwait('rec')mc:cmdwait('preshoot')mc:cmdwait('shoot')mc:cmd('exit')os.execute('curl <url>/cm?cmnd=Power%20TOGGLE')--[[This is to pause for the turning of the table 3 seconds ]]sys.sleep(3000)os.execute('curl <url>/cm?cmnd=Power%20TOGGLE')mc=require('multicam')mc:connect()mc:start()mc:cmdwait('rec')mc:cmdwait('preshoot')mc:cmdwait('shoot')mc:cmd('exit')
chdkptp -e"exec dofile( 'basicTest.lua' )"
I get all kinds of errors (Screenshot here).
In the future, V2, I would like to perform callbacks to assist with the timings but I have to start with something that works first.
Does this script look like it should work?
connect --[[Not sure about this one]]
-- multicam initializationmc=require('multicam')mc:connect()mc:start()mc:cmdwait('rec')-- first shotmc:cmdwait('preshoot')mc:cmdwait('shoot')-- turn tableos.execute('curl <url>/cm?cmnd=Power%20TOGGLE')--[[This is to pause for the turning of the table 3 seconds]]sys.sleep(3000)os.execute('curl <url>/cm?cmnd=Power%20TOGGLE')-- second shotmc:cmdwait('preshoot')mc:cmdwait('shoot')-- cleanupmc:cmdwait('play')mc:cmd('exit')
I'm not sure what you mean by callbacks here. I assume you want to get some information back from the the table, but how to do that would depend on the interface, which I know nothing about.
chdkptp -e"exe dofile('test2.lua')"
The idea would be to trigger the cameras with a signal from the table once it has stopped rather than timing out the process. Make the functioning more event based rather than timing based. This would be via the HTTP request. Tasmota (the software running on the Sonoff) would take the request and then output a JSON, which I was thinking, could be used to trigger the cameras. Currently, I will give power to the motor for enough time to rotate the table 1/8th of a full rotation, stop, give a few milliseconds of the taking of the pictures, and then start the table again for enough time to rotate another 1/8, everything being time based. I was thinking it would be better if it were event based. Cameras take their first pictures, that is a queue to start the turntable for its 1/8th turn, when it's finished it says "off", which is a cue for the cameras to take their pictures and so on. Do you think this is a reasonable plan? If so, what might be some challenges? Do you have any recommendations on approaches?
I got parts of the system to work. In my testing, I was able to control the Sonoff to turn on and off when the camera wasn't on. I kept getting an "1: failed I/O error" when the camera was on even though it did recognize and give the correct USB information. (screenshot here) Could this be due to low batteries? (Got them on the charger, now)
chdkptp -e"set err_trace=always" -e"exec dofile('test2.lua')"
Started by Alarik « 1 2 3 4 5 » General Discussion and Assistance
Started by plua_mea General Discussion and Assistance
Started by mrred Script Writing
Started by ikercito « 1 2 ... 15 16 » General Help and Assistance on using CHDK stable releases
Started by emerrryjones General Help and Assistance on using CHDK stable releases