Not sure what I broke but suddenly I can't control my PTZ :(
Posted: Mon May 04, 2009 9:05 pm
Not sure what I broke but now I can't control the PTZ cam's on our network
Originally I had PTZ working for 3 cams in both WATCH and Montage view. Everything worked fine.
Sometime over the weekend the camera controls in the Montage page stoped working. I dont know what changed. I wasn't here. All I know is it worked friday and monday it wasn't working. No errors - just was defaulting back to the first camera in the list and not able to control them.
In the process of trying to fix this issue, I managed to fubar, bork, decafinate, and general overal kaplowied the controls within the WATCH portion. Now controls don't work period <man>
[/code]
I tried adjusting the settings in the PTZ controls and changed from Continuous to Relative and it changed from moveConup to MoveRelup but no difference. still not working.
the camera is a Panasonic PTZ camera. As I said it was working before.
my control script for the Panasonic PTZ camera is as follows:
Now your probably wondering why I have the home preset set to scan. Well my office really wanted a "Tour" option that steps through each of the presets on its own - this happend to be programed already into the camera and I'm just making use of it.
Also the other thing to note - I only changed the code to reflect the camera's controls. These camera's use cgi-bin/camctrl? for the controls.
Hope I can get help to solve this.
Originally I had PTZ working for 3 cams in both WATCH and Montage view. Everything worked fine.
Sometime over the weekend the camera controls in the Montage page stoped working. I dont know what changed. I wasn't here. All I know is it worked friday and monday it wasn't working. No errors - just was defaulting back to the first camera in the list and not able to control them.
In the process of trying to fix this issue, I managed to fubar, bork, decafinate, and general overal kaplowied the controls within the WATCH portion. Now controls don't work period <man>
[/code]
I tried adjusting the settings in the PTZ controls and changed from Continuous to Relative and it changed from moveConup to MoveRelup but no difference. still not working.
the camera is a Panasonic PTZ camera. As I said it was working before.
my control script for the Panasonic PTZ camera is as follows:
Code: Select all
package ZoneMinder::Control::PanasonicIP;
use 5.006;
use strict;
use warnings;
require ZoneMinder::Base;
require ZoneMinder::Control;
our @ISA = qw(ZoneMinder::Control);
our $VERSION = $ZoneMinder::Base::VERSION;
# ==========================================================================
#
# Panasonic IP Control Protocol
#
# ==========================================================================
use ZoneMinder::Debug 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 );
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" );
}
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 cameraReset
{
my $self = shift;
Debug( "Camera Reset" );
my $cmd = "nphRestart?PAGE=Restart&Restart=OK";
$self->sendCmd( $cmd );
}
sub moveConUp
{
my $self = shift;
Debug( "Move Up" );
my $cmd = "cgi-bin/camctrl?tilt=-1";
$self->sendCmd( $cmd );
}
sub moveConDown
{
my $self = shift;
Debug( "Move Down" );
my $cmd = "cgi-bin/camctrl?tilt=1";
$self->sendCmd( $cmd );
}
sub moveConLeft
{
my $self = shift;
Debug( "Move Left" );
my $cmd = "cgi-bin/camctrl?pan=-1";
$self->sendCmd( $cmd );
}
sub moveConRight
{
my $self = shift;
Debug( "Move Right" );
my $cmd = "cgi-bin/camctrl?pan=1";
$self->sendCmd( $cmd );
}
sub moveMap
{
my $self = shift;
my $params = shift;
my $xcoord = $self->getParam( $params, 'xcoord' );
my $ycoord = $self->getParam( $params, 'ycoord' );
Debug( "Move Map to $xcoord,$ycoord" );
my $cmd = "cgi-bin/camctrl?nphControlCamera?Direction=Direct&NewPosition.x=$xcoord&NewPosition.y=$ycoord&Width=".$self->{Monitor}->{Width}."&Height=".$self->{Monitor}->{Height};
$self->sendCmd( $cmd );
}
sub zoomConTele
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'step' );
Debug( "Zoom Tele" );
my $cmd = "nphControlCamera?Direction=ZoomTele";
$self->sendCmd( $cmd );
}
sub zoomConWide
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'step' );
Debug( "Zoom Wide" );
my $cmd = "nphControlCamera?Direction=ZoomWide";
$self->sendCmd( $cmd );
}
sub focusConNear
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'step' );
Debug( "Focus Near" );
my $cmd = "nphControlCamera?Direction=FocusNear";
$self->sendCmd( $cmd );
}
sub focusConFar
{
my $self = shift;
my $params = shift;
my $step = $self->getParam( $params, 'step' );
Debug( "Focus Far" );
my $cmd = "nphControlCamera?Direction=FocusFar";
$self->sendCmd( $cmd );
}
sub focusAuto
{
my $self = shift;
Debug( "Focus Auto" );
my $cmd = "nphControlCamera?Direction=FocusAuto";
$self->sendCmd( $cmd );
}
sub focusMan
{
my $self = shift;
Debug( "Focus Manual" );
my $cmd = "/axis-cgi/com/ptz.cgi?autofocus=off";
$self->sendCmd( $cmd );
}
sub presetClear
{
my $self = shift;
my $params = shift;
my $preset = $self->getParam( $params, 'preset' );
Debug( "Clear Preset $preset" );
my $cmd = "cgi-bin/camctrl?preset=scan";
$self->sendCmd( $cmd );
}
sub presetSet
{
my $self = shift;
my $params = shift;
my $preset = $self->getParam( $params, 'preset' );
Debug( "Set Preset $preset" );
my $cmd = "nphPresetNameCheck?PresetName=$preset&Data=$preset";
$self->sendCmd( $cmd );
}
sub presetGoto
{
my $self = shift;
my $params = shift;
my $preset = $self->getParam( $params, 'preset' );
Debug( "Goto Preset $preset" );
my $cmd = "cgi-bin/camctrl?preset=$preset";
$self->sendCmd( $cmd );
}
sub presetHome
{
my $self = shift;
Debug( "Home Preset" );
my $cmd = "cgi-bin/camctrl?preset=scan";
$self->sendCmd( $cmd );
}
1;
__END__
Also the other thing to note - I only changed the code to reflect the camera's controls. These camera's use cgi-bin/camctrl? for the controls.
Hope I can get help to solve this.