View unanswered posts | View active topics It is currently Wed Jul 23, 2014 7:04 pm



Reply to topic  [ 14 posts ] 
Foscam FI8910w 
Author Message

Joined: Sun Mar 18, 2012 7:05 pm
Posts: 7
Post Foscam FI8910w
Hi I am using ubuntu 12.04 with a Foscam FI8910W
I am able to get a video stream working however I cannot get the pan and tilt working at all.
using firefox i'm able to get the camera to move and I wrote a very simple perl script that I can control this camera with. However when I try to use 'zmcontrol.pl --id 1 --command=moveConLeft' at a command line, I recieve this error '2012-03-18 12:20:18.960420 zmcontrol 6199 FAT Can't connect: Permission denied zmcontrol.pl'.
Also when I tring using the actual controls i get this error 'Control response was status = undefined
message = /usr/bin/zmcontrol.pl --autostop --command=moveConUp --id=1=>' and from the logs '2012-03-18 12:23:13.951470 zmcontrol 6217 FAT Can't connect: No such file or directory zmcontrol.pl'

I have been searching for more information on the use of the zmcontrol.pl and how it works (including parmeters and resulting error messages. I also have installed wireshark to look at the packet being sent to the camera. However no packet with the expected control strings are being sent. I have started wondering if this may be a permission or a path issue. Any ideas would be appreciated, thanks

looking in the forums and searching the internet I have not been able to solve this problem. While I dont know very much about perl, I have used php and some other programming languages.


Sun Mar 18, 2012 7:30 pm
Profile
User avatar

Joined: Thu Oct 18, 2007 2:55 pm
Posts: 481
Location: Shiloh, IL
Post Re: Foscam FI8910w
It could be a number of things, but first check the following line of code in your PTZ control script.
If it says this:
Code:
use ZoneMinder::Debug qw(:all);

then change it to this:
Code:
use ZoneMinder::Logger qw(:all);

The latest version of Zoneminder requires this change to be made for all PTZ control scripts.

Once the change is made, enter this from a command prompt as root to reset the control function:
Code:
killall -9 zmcontrol.pl

_________________
We want... a shrubbery! [dramatic chord]


Tue Mar 20, 2012 7:14 pm
Profile

Joined: Sun Mar 18, 2012 7:05 pm
Posts: 7
Post Re: Foscam FI8910w
thankyou for your reply I have made the change suggested.



Code:
use ZoneMinder::Debug qw(:all);



then change it to this:


Code:
use ZoneMinder::Logger qw(:all);



I then enter this into terminal

Code:
killall -9 zmcontrol.pl
zmcontrol.pl: no process found


the result was just the same as before
Quote:
Control response was status = undefined
message = /usr/bin/zmcontrol.pl --autostop --command=moveConUp --id=1=>


please let me know if you have any other suggestions. In the mean time I will work on this issue some more.


after a restart the message changeged to this:
Quote:
Control response was status = undefined
message = /usr/bin/zmcontrol.pl --panspeed= --tiltspeed= --autostop --command=moveConUpRight --id=1=> // Usage: zmcontrol.pl --id <monitor_id> --command=<command> <various options>


Thu Mar 22, 2012 6:53 pm
Profile

Joined: Tue Mar 20, 2012 10:02 pm
Posts: 1
Post Re: Foscam FI8910w
Hi,

I had a similar problem with some FI8918W and i managed to solve it by doing the following in zoneminder 1.25.0

1. in the control script change the line
Code:
 use ZoneMinder::Debug qw(:all);

to
Code:
use ZoneMinder::Logger qw(:all);


2. create a user in the cam with operator privilegges in your camera. In zoneminder at the control tab leave the control device empty and modify the control address to include the username and the pass of the user you created in the form username:password@camera_ip_address

Hope this helps,

Ianos


Thu Mar 22, 2012 9:08 pm
Profile
User avatar

Joined: Thu Oct 18, 2007 2:55 pm
Posts: 481
Location: Shiloh, IL
Post Re: Foscam FI8910w
benb,
Since you've already made the appropriate changes to your PTZ control file for zoneminder 1.25 and that didn't solve the problem, please post the following information:
  • Linux Distro
  • path to your PTZ control file
  • As lanos mentions, are you sending the right user credentials to the camera?
  • Exact steps you took to add & then program the PTZ control into zoneminder. Screenshots of your zoneminder config would be helpful here. Where you following a guide? if so, which one?
  • post the output of the following:
    Code:
    perl {your_ptz_control_file.pm}

They are a lot of steps that must be done correctly to get your PTZ control file working. It simply won't work if even one step is missed.

_________________
We want... a shrubbery! [dramatic chord]


Fri Mar 23, 2012 9:04 pm
Profile

Joined: Sun Nov 06, 2011 12:03 am
Posts: 20
Post Re: Foscam FI8910w
Since 1.25 is now more common, I updated the FI8915W wiki to include this modification to the control script. Thanks!


Sat Mar 24, 2012 7:37 pm
Profile

Joined: Sun Mar 18, 2012 7:05 pm
Posts: 7
Post Re: Foscam FI8910w
thanks for all the help and information. I really appreciate the help I have recieved. After reading the latest replys I ran the following command:
Code:
perl {your_ptz_control_file.pm}
and realized the changes I had made where to the wrong file. After making these changes, I reran the command and only got a warning. I then went ahead and tried out the control section of the camera again. The button still did not seem to work, however I ran a packet capure with wireshark and found that the correct command was actually being sent. Digging into it a little more I found that a stop command was also being sent fairly quickly afterwards so the camera never moved. I then modified the file to not send the stop command and it worked!!! here is the code changes I made. from this
Code:
my $cmd = "decoder_control.cgi?command=2&user=admin&pwd=";
$self->sendCmd( $cmd );
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );


to
Code:
my $cmd = "decoder_control.cgi?command=2&user=admin&pwd=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );


by adding the sleep command I was able to get this to function.


Mon Apr 02, 2012 3:55 am
Profile

Joined: Sun Mar 18, 2012 7:05 pm
Posts: 7
Post Re: Foscam FI8910w
the key for me to get this to work was definitely Knnniggett post on the changes from
Code:
use ZoneMinder::Debug qw(:all);

to
Code:
use ZoneMinder::Logger qw(:all);


Mon Apr 02, 2012 3:59 am
Profile
User avatar

Joined: Thu Oct 18, 2007 2:55 pm
Posts: 481
Location: Shiloh, IL
Post Re: Foscam FI8910w
Glad you got it working.

I don't use the Foscam script myself, but I've noticed that most of the control scripts make use of the "Auto Stop Timeout" field shown under the Control tab of your camera.

This allows you to tweak the delay time straight from your web browser. Of course, the sleep command inserted straight into the perl script will work too.

benb wrote:
thanks for all the help and information. I really appreciate the help I have recieved. After reading the latest replys I ran the following command:
Code:
perl {your_ptz_control_file.pm}
and realized the changes I had made where to the wrong file. After making these changes, I reran the command and only got a warning. I then went ahead and tried out the control section of the camera again. The button still did not seem to work, however I ran a packet capure with wireshark and found that the correct command was actually being sent. Digging into it a little more I found that a stop command was also being sent fairly quickly afterwards so the camera never moved. I then modified the file to not send the stop command and it worked!!! here is the code changes I made. from this
Code:
my $cmd = "decoder_control.cgi?command=2&user=admin&pwd=";
$self->sendCmd( $cmd );
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );


to
Code:
my $cmd = "decoder_control.cgi?command=2&user=admin&pwd=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );


by adding the sleep command I was able to get this to function.

_________________
We want... a shrubbery! [dramatic chord]


Mon Apr 02, 2012 12:55 pm
Profile

Joined: Sun Mar 18, 2012 7:05 pm
Posts: 7
Post Re: Foscam FI8910w
I will have to look into the "Auto Stop Timeout" field and see if I can get that to work
I really do appreciate the help :lol:


Mon Apr 16, 2012 10:21 pm
Profile

Joined: Mon Apr 09, 2012 6:02 am
Posts: 3
Post Re: Foscam FI8910w
Do you mind sharing your script? I used the F8918W script but I can't get it to work. I can run the commands manually and they work fine, but nothing works using Zoneminder. The control log also shows no errors.

I also realized that I get no messages when I try the "perl controlfile.pm" command suggested in this thread. Am I supposed to run it in the perl shell?

Thanks


Tue Apr 17, 2012 1:18 am
Profile

Joined: Wed Apr 25, 2012 11:25 pm
Posts: 2
Post Re: Foscam FI8910w
Hi there.
I've been having the same problem.
I changed the script as indicated in the wiki and nothing!
Until I remembered that I use the port 8090, changed to 80 and it worked immediately!
I think the port to control only works in 80.


Wed Apr 25, 2012 11:29 pm
Profile

Joined: Sun Mar 18, 2012 7:05 pm
Posts: 7
Post Re: Foscam FI8910w
Quote:
I also realized that I get no messages when I try the "perl controlfile.pm" command suggested in this thread. Am I supposed to run it in the perl shell?

yes, run something like this to test your control script
Code:
zmcontrol.pl --id 1 --command=moveConLeft

Code:
# ==========================================================================
#
# ZoneMinder Foscam FI8918W IP Control Protocol Module, $Date: 2009-11-25 09:20:00 +0000 (Wed, 04 Nov 2009) $, $Revision: 0003 $
# Copyright (C) 2001-2008 Philip Coombes
# Modified for use with Foscam FI8908W IP Camera by Dave Harris
# Modified for use with Foscam FI8918W IP 01102011
# Modified for use with Foscam FI8910W IP 01102011 by Ben Boone
# Modified and added MOVE-STOP - To use reset PTZ Settings to default (0) 01112011
# Modified and added Video Presets (PacoLM) - To use edit control-presets-add num presets to 3 - 01112011
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# ==========================================================================
#
# This module contains the implementation of the Foscam FI8918W IP camera control
# protocol
#
package ZoneMinder::Control::FoscamFI8910W;

use 5.006;
use strict;
use warnings;

require ZoneMinder::Base;
require ZoneMinder::Control;

our @ISA = qw(ZoneMinder::Control);

our $VERSION = $ZoneMinder::Base::VERSION;

# ==========================================================================
#
# Foscam FI8910w IP Control Protocol
#
# ==========================================================================

#use ZoneMinder::Debug qw(:all);
use ZoneMinder::Logger qw(:all);
use ZoneMinder::Config qw(:all);

use Time::HiRes qw( usleep );

sub new
{

my $class = shift;
my $id = shift;
my $self = ZoneMinder::Control->new( $id );
my $logindetails = "";
bless( $self, $class );
srand( time() );
return $self;
}

our $AUTOLOAD;

sub AUTOLOAD
{
my $self = shift;
my $class = ref($self) || croak( "$self not object" );
my $name = $AUTOLOAD;
$name =~ s/.*://;
if ( exists($self->{$name}) )
{
return( $self->{$name} );
}
Fatal( "Can't access $name member of object of class $class" );
}
our $stop_command;

sub open
{
my $self = shift;

$self->loadMonitor();

use LWP::UserAgent;
$self->{ua} = LWP::UserAgent->new;
$self->{ua}->agent( "ZoneMinder Control Agent/".ZM_VERSION );

$self->{state} = 'open';
}

sub close
{
my $self = shift;
$self->{state} = 'closed';
}

sub printMsg
{
my $self = shift;
my $msg = shift;
my $msg_len = length($msg);

Debug( $msg."[".$msg_len."]" );
}

sub sendCmd
{
my $self = shift;
my $cmd = shift;
my $result = undef;
printMsg( $cmd, "Tx" );

my $req = HTTP::Request->new( GET=>"http://".$self->{Monitor}->{ControlAddress}."/$cmd" );
my $res = $self->{ua}->request($req);

if ( $res->is_success )
{
$result = !undef;
}
else
{
Error( "Error check failed:'".$res->status_line()."'" );
}

return( $result );
}

sub reset
{
my $self = shift;
Debug( "Camera Reset" );
my $cmd = "reboot.cgi?user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Up Arrow
sub moveConUp
{
my $self = shift;
$stop_command = "1"; 
Debug( "Move Up" );
my $cmd = "decoder_control.cgi?command=0&user=admin&pwd=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );
 
}

#Down Arrow
sub moveConDown
{
my $self = shift;
$stop_command = "1";
Debug( "Move Down" );
my $cmd = "decoder_control.cgi?command=2&user=admin&pwd=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Left Arrow
sub moveConLeft
{
my $self = shift;
$stop_command = "1";
Debug( "Move Left" );
my $cmd = "decoder_control.cgi?command=4&user=admin&pwd=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );
 
}

#Right Arrow
sub moveConRight
{
my $self = shift;
$stop_command = "1";
Debug( "Move Right" );
my $cmd = "decoder_control.cgi?command=6&user=admin&pwd=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Diagonally Up Right Arrow
sub moveConUpRight
{
my $self = shift;
$stop_command = "1";
Debug( "Move Diagonally Up Right" );
my $cmd = "decoder_control.cgi?command=91&user=admin&pwd=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Diagonally Down Right Arrow
sub moveConDownRight
{
my $self = shift;
$stop_command = "1";
Debug( "Move Diagonally Down Right" );
my $cmd = "decoder_control.cgi?command=93&user=admin&pwd=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Diagonally Up Left Arrow
sub moveConUpLeft
{
my $self = shift;
$stop_command = "1";
Debug( "Move Diagonally Up Left" );
my $cmd = "decoder_control.cgi?command=90&user=admin&pwd=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Diagonally Down Left Arrow
sub moveConDownLeft
{
my $self = shift;
$stop_command = "1";
Debug( "Move Diagonally Down Left" );
my $cmd = "decoder_control.cgi?command=92&user=admin&pwd=";
$self->sendCmd( $cmd );
sleep(1);
my $cmd = "decoder_control.cgi?command=1&user=admin&pwd=";
$self->sendCmd( $cmd );
}

#Stop
sub moveStop
{
my $self = shift;
Debug( "Move Stop" );
my $cmd = "decoder_control.cgi?user=admin&pwd=&command=1";
$self->sendCmd( $cmd );
}

#Move Camera to Home Position
sub presetHome
{
my $self = shift;
Debug( "Home Preset" );
my $cmd = "decoder_control.cgi?command=25&user=admin&pwd=";
$self->sendCmd( $cmd );
}

# Choose video preset
# preset 1 -> 50 Hz mode (0)
# preset 2 -> 60 Hz mode (1)
# preset 3 -> outdoors mode (2)
sub presetGoto
{
my $self = shift;
my $params = shift;
my $preset = $self->getParam( $params, 'preset' );
my $preset = ( $preset - 1 );
Debug( "Goto Preset $preset" );
my $cmd = "camera_control.cgi?param=3&value=$preset&user=admin&pwd=";
$self->sendCmd( $cmd );
}

1;


Mon Jun 11, 2012 3:07 am
Profile
User avatar

Joined: Thu Oct 18, 2007 2:55 pm
Posts: 481
Location: Shiloh, IL
Post Re: Foscam FI8910w
eren wrote:
I also realized that I get no messages when I try the "perl controlfile.pm" command suggested in this thread. Am I supposed to run it in the perl shell?


The example you are quoting "perl controlfile.pm" is only used to check for syntax errors in your perl script. If the script returns nothing, then you know there are no errors of that kind. Executing the script this way won't control the camera in anyway.

Another user has already posted the solution for testing zoneminder camera control via the command line.

_________________
We want... a shrubbery! [dramatic chord]


Mon Jun 11, 2012 1:24 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 14 posts ] 

Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group