Wanscam Foscam clone PTZ control file.

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
theforce
Posts: 129
Joined: Tue May 11, 2010 5:22 am

Wanscam Foscam clone PTZ control file.

Post by theforce »

I had to modify the Foscam PTZ control file to make the Wanscam PTZ camera work somewhat correctly. I've also modified it so I can easily command it to go to any position with a simple shell script. I apologize for the sloppy code edits. In time I hope to clean it up and get some other things working better. I'm not a programmer but I can read and understand some of it. I know just enough to screw things up. :) Feel free to make changes and post them here.

The Wanscam PTZ camera is limited in the commands it will receive but I have Pan/Tilt/Zoom working. Right now you have to keep clicking the PTZ buttons to make it PTZ in small amounts. I have some ideas to get P/T to move for longer periods of time but I dont think I can get zoom to do the same. Its only a 3x zoom so after a few clicks your at the extremes with the zoom anyway. You have all 16 presets that can be called and set from ZM.

Camera now can move relative and diagonally. I've corrected the movements so they move the right way. I'm unable to get auto stop to work at the moment so you will have to stop manually if doing a continuous pan or tilt.

Here is how to setup ZM for the camera.

Control Capability
Main
Name - Wanscam
Type - Remote
Protocol - Wanscam
Can wake - no
Can sleep - no
Can reset - yes

Move
Can move - yes
Can Move Diagonally - yes
Can Move Relative - yes
Can move continous - yes

Pan
Can pan - yes
Min Pan Step - 1
Max Pan Step - 50

Tilt
Can tilt - yes
Min Tilt Step - 1
Max Tilt Step - 50

Zoom
Can zoom - yes
Can zoom continous - yes (Not currently but you must check this for it to zoom)

Presets
Has presets - yes
Num presets - 16
Has home preset - yes
Can set presets - yes


Leave everything else default and you should be OK.

Here is the file
http://stuff.jaygroh.com/zoneminder/Wanscam.pm

Camera setup
Username = admin
Password =

You can change this in the Wanscam.pm file to fit your camera setup.

An example on how to get the camera to move to a preset location from the command line or script.

Code: Select all

zmcontrol.pl --id 23 --command=presetGoto1
The id # is the id number of your PTZ camera. Replace presetGoto1 with presetGoto2 through presetGoto16 for your preset locations.

Here is a list of commands for the camera from the cameras webpage. Some commands are oppssite in what they do like the TZ_LEFT_UP. You use the numbers in the URL to control the camera. Example = http://YOURcameraIP/decoder_control.cgi?command=0 to tilt the camera down. Some commands dont work since the camera does not have that feature. All stop commands are the same as far as I can tell. You can use 1 to stop movement of any control. I think the file comments explain how the set presets work.

var PTZ_STOP=1;
var TILT_DOWN=0;
var TILT_DOWN_STOP=1;
var TILT_UP=2;
var TILT_UP_STOP=3;
var PAN_RIGHT=4;
var PAN_RIGHT_STOP=5;
var PAN_LEFT=6;
var PAN_LEFT_STOP = 7;
var PTZ_ZOOM_WIDE = 16;
var PTZ_ZOOM_WIDE_STOP = 17;
var PTZ_ZOOM_TELE = 18;
var PTZ_ZOOM_TELE_STOP = 19;
var PTZ_PELCO_D_HPATROL = 20;
var PTZ_PELCO_D_HPATROL_STOP = 21;
var PTZ_CENTER=25;
var PTZ_VPATROL=26;
var PTZ_VPATROL_STOP=27;
var PTZ_HPATROL=28;
var PTZ_HPATROL_STOP=29;
var PTZ_PRESET_START = 30;
var PTZ_LEFT_UP = 90;
var PTZ_RIGHT_UP = 91;
var PTZ_LEFT_DOWN = 92;
var PTZ_RIGHT_DOWN = 93;
var IO_ON = 94;
var IO_OFF=95;

There are some issues with the file. An example is that you can click on the image to diagonally move but the controls are reversed and continous. I've gotten the camera to work well with what I use it for so I'm not really motivated at the moment to get all capibilities working correctly. So dont expect any updates anytime soon.
Last edited by theforce on Sun Dec 09, 2012 5:09 pm, edited 2 times in total.
theforce
Posts: 129
Joined: Tue May 11, 2010 5:22 am

Re: Wanscam Foscam clone PTZ control file.

Post by theforce »

After looking into the commands for this post I have found that this camera accepts degree command instead of the onstep command. Maybe this can be use for motion tracking? I'll look into it but dont expect anything soon.

Sample command.

To move camera up 50 positions
decoder_control.cgi?command=2&degree=50


I have tested the camera and it looks like the full range for the degree command is...
Vertical = ~300
Horizontal = ~1000
theforce
Posts: 129
Joined: Tue May 11, 2010 5:22 am

Re: Wanscam Foscam clone PTZ control file.

Post by theforce »

I've been playing with the camera some more and got a few more things working. Camera now can move relative and diagonally. I've corrected the movements so they move the right way. I'm unable to get auto stop to work at the moment so you will have to stop manually if doing a continuous pan or tilt.

If you know how to get auto stop working please let me know.

Also if you know how to get motion tracking working let me know. Its not a big deal but its something I would like to play with.
Post Reply