Using USB remote to control chdkptp with Raspberry Pi - page 2 - Hello, I'm a NEWBIE - HELP!! (Newbies assistance, User Guides and thank you notes) - CHDK Forum supplierdeeply

Using USB remote to control chdkptp with Raspberry Pi

  • 68 Replies
  • 31436 Views
*

Offline reyalp

  • ******
  • 14082
Re: Remotely start/stop recording and Zoom control question!
« Reply #10 on: 09 / March / 2017, 16:44:33 »
Advertisements
Is the raspberry pi still a better option in this scenario? I have more programming knowledge with Arduinos, so that would be my preferred option, but if a Raspberry Pi will make everything simpler, I can make that work!
For PTP control (as opposed to the USB +5V hardware remote), you need a full USB + PTP stack + CHDK extension client on the USB host. A raspberry pi with stock raspbian OS and pre-built chdkptp binaries provides this with very little effort required.

IIRC people have had the CHDK PTP protocol working with Arduino host shields at (see links here https://chdk.setepontos.com/index.php?topic=10458.0 for example), but it's definitely not as straightforward.

edit:
Quote
Ultimately, I am trying to make a tracking device that follows a teacher in a classroom
FWIW, on some cameras it's not too hard to get information out of the native firmware face tracking: https://chdk.setepontos.com/index.php?topic=8243.msg86889#msg86889
« Last Edit: 09 / March / 2017, 16:48:08 by reyalp »
Don't forget what the H stands for.

Re: Remotely start/stop recording and Zoom control question!
« Reply #11 on: 10 / March / 2017, 15:55:00 »
Using a Pi will be a lot simplier to program and the Pi has a lot more computing power.  It also will function as a USB master. The only real drawback is power consumption.

I'm not too worried about power consumption, I can just keep it plugged into a wall. But if a Pi is the best way to go, I can do that.

Another question. I have been looking around on the wiki website and am seeing a lot of useful commands to be able to use via Lua to do things with CHDK, but is there a good place to look at how to start programming in Lua specifically for CHDK for a beginner? I'm struggling on how exactly to start with the script I want. Especially if using a Pi is the best way to go.

FWIW, on some cameras it's not too hard to get information out of the native firmware face tracking: https://chdk.setepontos.com/index.php?topic=8243.msg86889#msg86889

I'm not looking to use the camera as a tracker, that is a completely separate piece of the project. I am using a Pixy cmucam5 to track infrared light to then move a servo with an Arduino, so I just need the camera's main task to be remotely controlled.

*

Offline reyalp

  • ******
  • 14082
Re: Remotely start/stop recording and Zoom control question!
« Reply #12 on: 10 / March / 2017, 22:49:04 »
Another question. I have been looking around on the wiki website and am seeing a lot of useful commands to be able to use via Lua to do things with CHDK, but is there a good place to look at how to start programming in Lua specifically for CHDK for a beginner? I'm struggling on how exactly to start with the script I want. Especially if using a Pi is the best way to go.
If you are using PTP, starting out by sending command interactively, and turning it into a script once you've got the pieces working can be a good approach.

http://chdk.wikia.com/wiki/CHDK_Scripting_Cross_Reference_Page lists Lua functions available in CHDK.

In chdkptp, you can use the = command to call any of these functions. So for example, to zoom in one step, you could send

=click'zoom_in'

Some functions like switching to record mode and shooting also have dedicated commands in the chkdptp CLI. You can use the help command to get a list.

https://app.assembla.com/spaces/chdkptp/wiki/CLI_Quickstart has information about using the chdkptp CLI.

https://app.assembla.com/spaces/chdkptp/wiki/Scripting_Guide has information about scripting from chdkptp

From your description, it seems like you will have some process which takes commands from the remote, and responds by sending commands to the camera. This could be done by executing chdkptp with the -e option to execute code each time, or you could start chdkptp once and pipe commands to it's standard input.
Don't forget what the H stands for.

Re: Remotely start/stop recording and Zoom control question!
« Reply #13 on: 29 / March / 2017, 15:32:51 »

In chdkptp, you can use the = command to call any of these functions. So for example, to zoom in one step, you could send

=click'zoom_in'

Some functions like switching to record mode and shooting also have dedicated commands in the chkdptp CLI. You can use the help command to get a list.

https://app.assembla.com/spaces/chdkptp/wiki/CLI_Quickstart has information about using the chdkptp CLI.

https://app.assembla.com/spaces/chdkptp/wiki/Scripting_Guide has information about scripting from chdkptp

From your description, it seems like you will have some process which takes commands from the remote, and responds by sending commands to the camera. This could be done by executing chdkptp with the -e option to execute code each time, or you could start chdkptp once and pipe commands to it's standard input.

I apologize for the delay in my response... this information is extremely helpful. I had to wait some time in order to receive my Raspberry Pi, and I have installed everything and have CHDK PTP running on the Pi. The only issue I am facing (and and still searching the wiki and in internet while waiting for a response) is how exactly to get my camera to turn on while connected to the Pi via USB. I have it connected, but my camera is just sitting here and not wanting to turn on while connected. I do have the remote functionality deselected on the camera.



*

Offline reyalp

  • ******
  • 14082
Re: Remotely start/stop recording and Zoom control question!
« Reply #14 on: 29 / March / 2017, 15:43:09 »
The only issue I am facing (and and still searching the wiki and in internet while waiting for a response) is how exactly to get my camera to turn on while connected to the Pi via USB. I have it connected, but my camera is just sitting here and not wanting to turn on while connected. I do have the remote functionality deselected on the camera.
From your screenshot, I guess you mean the camera is on and connected, but the screen is black and you cannot switch to record (shooting) mode?

If so, this is probably due to gphoto accessing the camera when you connect it, via some udev rules. See "interactions with default software" in https://app.assembla.com/spaces/chdkptp/wiki/Install
Don't forget what the H stands for.

Re: Remotely start/stop recording and Zoom control question!
« Reply #15 on: 29 / March / 2017, 15:51:16 »
From your screenshot, I guess you mean the camera is on and connected, but the screen is black and you cannot switch to record (shooting) mode?

If so, this is probably due to gphoto accessing the camera when you connect it, via some udev rules. See "interactions with default software" in https://app.assembla.com/spaces/chdkptp/wiki/Install

Yes, that's exactly what I mean. I plug in my camera and then there is no way for me to access its functionality. These udev rules don't seem to help me a bit. Does this mean I have to change something in my camera to allow it to work? I'm searching some more.

EDIT: Basically what I want to know is: can I change this? Is there a way for me to connect my camera to the Pi and have it be able to take pictures/zoom via PTP?
« Last Edit: 29 / March / 2017, 16:01:04 by smartzer »

*

Offline reyalp

  • ******
  • 14082
Re: Remotely start/stop recording and Zoom control question!
« Reply #16 on: 29 / March / 2017, 16:05:47 »
Yes, that's exactly what I mean. I plug in my camera and then there is no way for me to access its functionality. These udev rules don't seem to help me a bit. Does this mean I have to change something in my camera to allow it to work? I'm searching some more.
Does the camera screen go black when you plug the camera in? If so, the udev rules are almost certainly the problem. Unfortunately, this udev stuff isn't well documented and not every distro does everything the same way, so it's hard to give specific instructions.

Be sure to pay attention to the parts about copying the files to override them, and the hwdb file in this post: https://chdk.setepontos.com/index.php?topic=10664.msg115782#msg115782 (that information was for ubuntu, but I'd guess raspbian is pretty similar)

Note that if you set up your pi without a desktop, these rules probably will not be a set up (I didn't have a problem with them on the pi I use for building). The chdkptp GUI may be nice to for initial development, but for automation you probably want to use the cli anyway.

Edit:
Quote
EDIT: Basically what I want to know is: can I change this? Is there a way for me to connect my camera to the Pi and have it be able to take pictures/zoom via PTP?
Absolutely. You just need to ensure that no software other than chdkptp accesses the camera when you plug it in. The "right" way to this is using the udev rules and hwdb, but killing some gphoto / gvfs processes before connecting the camera might work too.
« Last Edit: 29 / March / 2017, 16:09:18 by reyalp »
Don't forget what the H stands for.

Re: Remotely start/stop recording and Zoom control question!
« Reply #17 on: 29 / March / 2017, 16:11:20 »
Does the camera screen go black when you plug the camera in? If so, the udev rules are almost certainly the problem. Unfortunately, this udev stuff isn't well documented and not every distro does everything the same way, so it's hard to give specific instructions.

Yes, my camera screen does go black when I plug the camera in... so it does seem that the udev rules are the issue. I have looked up the documentation and it's not helping me one bit...

Quote
Note that if you set up your pi without a desktop, these rules probably will not be a set up (I didn't have a problem with them on the pi I use for building). The chdkptp GUI may be nice to for initial development, but for automation you probably want to use the cli anyway.

As of right now I have my pi setup with a desktop, but since I plan to simply send my Pi a command and have the Pi in turn send the camera a command, I don't necessarily need a desktop. Since I am new with both CHDK and the Pi, where should I start for using the PTP with a headless Pi?

EDIT:
Sorry, missed your edit there-
Quote
The "right" way to this is using the udev rules and hwdb, but killing some gphoto / gvfs processes before connecting the camera might work too.

I appreciate your help and patience, first of all. Second of all, how do I go about doing this? Is this something I need to change in the udev documentation on my Pi? I searched and found a "rules" text document with about 20 lines of code... Is this the right area?
« Last Edit: 29 / March / 2017, 16:16:48 by smartzer »


*

Offline reyalp

  • ******
  • 14082
Re: Remotely start/stop recording and Zoom control question!
« Reply #18 on: 29 / March / 2017, 16:27:40 »
I have looked up the documentation and it's not helping me one bit...
If you read the forum post I linked to, it should give you enough to find the relevant files. The exact names may vary by distro, but they should be similar.

Quote
As of right now I have my pi setup with a desktop, but since I plan to simply send my Pi a command and have the Pi in turn send the camera a command, I don't necessarily need a desktop. Since I am new with both CHDK and the Pi, where should I start for using the PTP with a headless Pi?
If you mean how to use chdkptp in a headless environment, just use ssh and the cli executable (chdkptp.sh instead of of chdkptp_gui.sh)

https://app.assembla.com/spaces/chdkptp/wiki/CLI_Quickstart has some information on the cli interface. USAGE.TXT included in the zip has some more, as a well as a full list of commands.

If you mean setting up the pi as headless, I just installed the "Raspbian Jessie Lite" image.
Don't forget what the H stands for.

Re: Remotely start/stop recording and Zoom control question!
« Reply #19 on: 29 / March / 2017, 16:50:26 »
If you read the forum post I linked to, it should give you enough to find the relevant files. The exact names may vary by distro, but they should be similar.

Sorry, just read through that post. I am trying these things before working with the Pi with no GUI, but before I move on to that, I was hoping you could clear something up for me-

ahull found a solution by editing the chdkptp.sh bash script, but he said this:
Quote
CHDKPTP_DIR=".... blah.... /chdk-ptp

Change the ...blah... to match your own installation.

What exactly does he mean by my own installation?

 

Related Topics