I have tried adding the complete path pipe to /etc/rc.local file and nothing is working!
"nothing is working" isn't very descriptive. Do you see the programs running with ps? Have you tried logging anything to files?A guess: To get input, your python script needs to be running in the console terminal. Normally, rc scripts run without a terminal.
[Desktop Entry]Encoding=UTF-8Name=Terminal autostartComment=Start a terminal and boot remote_function.py piped into chdkptp.shExec=/usr/bin/lxterm -e 'cd chdkptp-r735 && ./remote_function.py|./chdkptp.sh'
When I look at the desktop to the Pi, I see the terminal gives me this error:
But even though it prints these errors, the camera will still connect. And you can also see me playing with the zoom too. Which was strange because my camera was zooming in and out with the press of a button even though the terminal is saying the camera is not connected...
The error means that something already has the camera open, either chdkptp or another photo app.
This suggests to me that more than one copy of your startup entry are being started. That seems consistent with the LEDs blinking more than you expect as well.FWIW, Since you are using X, you could written everything in chdkptp Lua code. You would just need to add some IUP code to catch the key presses. I'm not suggesting you do this now since you already have it working in python, just putting out here for anyone considering a similar project.
The reason I think Lua might come in handy is because of the get_movie_status command in Lua... I would love to be able to run a loop waiting for the return of that function to become 4 (recording in process), and as soon as it sees that recording is in process, then the audio will start recording. This is simply because I can get the audio recording to start almost automatically, and the video takes about a second to actually start recording.I guess my question is this: Is there an easy way to do this using my Python program? Or would the simplest way be to use Lua?
click('video') repeat sleep(10) until get_video_status() == 4
!con:execwait([[click('video') repeat sleep(10) until get_video_status() == 4]]) os.execute('start_audio_recording')
!con:execwait([[click('video') repeat sleep(10) until get_video_status() == 4]]) fh=io.open('video_recording','wb') fh:close()
A follow up question is this: Is there an easy way for me to find the delay between when I send the "=click('video')/n" command and when the camera actually starts recording to simply find that delay and figure out if it is constant?
=t0=get_tick_count() click('video') repeat sleep(10) until get_video_status() == 4 return get_tick_count()-t0
press'shoot_half' sleep(500) click'shoot_full'
To return the number of milliseconds it took for get_video_status() to become 4, use something likeCode: [Select]=t0=get_tick_count() click('video') repeat sleep(10) until get_video_status() == 4 return get_tick_count()-t0I wouldn't expect to be exactly constant since the camera tries to autofocus before starting and that takes a variable amount of time. If your camera has dedicated video mode that can start recording with the shutter button, you could probably get a more consistent delay by having the script hold half press for a fixed amount of time and then press play, e.g.Code: [Select]press'shoot_half' sleep(500) click'shoot_full'This gives the camera a fixed half second to focus before starting. I'm not aware of a way to do this on cameras that only let you start with the video button.
Started by Barnacules
Started by Peterschnecke
Started by ernway
Completed and Working Scripts
Started by mrboop2
Started by phantom2041
General Discussion and Assistance