Integrating PTZ with ioctl controlled camera

Support and queries relating to all previous versions of ZoneMinder
Locked
bzo
Posts: 14
Joined: Wed Jul 07, 2004 7:23 pm

Integrating PTZ with ioctl controlled camera

Post by bzo »

I have this Logitech Orbit I've been looking into integrating with the the PTZ functionality in 1.21.

The control of the pan/tilt is through ioctl calls specific to the pwc driver. The problem is that only one device can have control of the device at the same time. There is a command line utility called setpwc that allows you to set all the params of the device, including pan/tilt. However, if you run it while zmc is using the camera, it will error out with a device busy.

I guess at a first pass, a script could be created that first stopped zmc on the device, ran the setpwc utility to set the pan/tilt, then restarted zmc. But to do it right, how hard would it be to modify zmc to make the ioctl calls itself?
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

This is tricky as the PTZ control is entirely separate from video capture (nothing is allowed to interfere with that). If there no way to open the device in a shared mode?

Phil
bzo
Posts: 14
Joined: Wed Jul 07, 2004 7:23 pm

Post by bzo »

Looking at the code for setpwc, I see that to open the device, it does:

Code: Select all

*fd = open(device, O_RDWR);
then to issue a pan/tilt, calls:

Code: Select all

ioctl(fd, VIDIOCPWCMPTGANGLE, &pma)
I see that zm opens the device the same way in zm_local_camera.cpp, so I'm guessing that v4l doesn't allow shared opens of the device.

Perhaps the most feasible way to implement this is the same way that ZM communicates brightness/contrast requests from the UI to the camera via shared memory? I'm just not sure if it could be done in a generic enough of a way so that you would want to incorporate those changes into zm_local_camera though.
bzo
Posts: 14
Joined: Wed Jul 07, 2004 7:23 pm

Post by bzo »

ok, I think I've found a clean solution to this, but it will have to wait until I upgrade to a 2.6 kernel. It looks like the new version of pwc has a sysfs interface to the pan/tilt calls which will make scripting a piece of cake!
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Excellent. Good luck!

Phil
KaZeR
Posts: 10
Joined: Fri Oct 21, 2005 9:20 am

Post by KaZeR »

Any progress here?

I have the same device, and i'd love to use its PTZ features..
toozie
Posts: 2
Joined: Mon Dec 05, 2005 8:33 pm

pqm tilt orbit

Post by toozie »

here about sphere / orbit ptz pan tilt on linux

http://www.lavrsen.dk/twiki/bin/view/PW ... gInterface

howto install whith zoneminder i dont now..

can some help with this ????

:roll:
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

There is a pwc driver which let's you use Philips camera with the normal v4l interface. It presumably doesn't let you control the other enhanced features listed in the page you are referring to, at least not in applications like ZM that just use a common v4l feature set. If you want to use the PTZ features it's just a case of writing a control application that takes the standard set of control parameters that ZM uses and which uses those ioctls. As far as I know one doesn't exist yet though.

Phil
toozie
Posts: 2
Joined: Mon Dec 05, 2005 8:33 pm

url from active webcam software

Post by toozie »

http://{USER_ID}:{PASSWORD}@{CAMERA_IP}/command/ptzf.cgi?Move=left,10

http://{USER_ID}:{PASSWORD}@{CAMERA_IP}/command/ptzf.cgi?Move=right,10

this is the call be used in active webcam software to move this camera left and right.

can this call be used in zoneminder
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Yes. You will have to create a custom script, look at zmcontrol-axis-v2.pl for an example. You will also have to create a control capability entry in the database, or copy and edit one of the existing ones.
Phil
zylantha
Posts: 8
Joined: Mon Feb 27, 2006 10:36 pm

Post by zylantha »

There is another way to control the Orbit using sysfs calls, now implemented and basically working.

http://www.zoneminder.com/forums/viewtopic.php?t=9788
Locked