python-onvif-zeep icon indicating copy to clipboard operation
python-onvif-zeep copied to clipboard

Issue with create_type() from ONVIFCamera().create_ptz_service()

Open Guilmort opened this issue 8 years ago • 1 comments

Hello

My Python version is 3.5.3. I followed the guide for installation.

The issue is :

mycam=ONVIFCamera("192.168.5.6",888,"admin","*******","/home/guilmort/ONVIF/python-onvif-zeep/wsdl/")
ptz=mycam.create_ptz_service()
media = mycam.create_media_service()
media_profile = media.GetProfiles()[0]
token=media_profile.token
request=ptz.create_type('ContinuousMove')
request.ProfileToken=token
request.Velocity.Zoom.x=-1.0   ---------------> AttributeError: 'NoneType' object has no attribute 'Zoom'

However when I do

request.Velocity={'Zoom':{'x':-1.0}}

Then it works.

Guilmort avatar Nov 11 '17 23:11 Guilmort

Another solution I found was this, you need to add the parameters from the status that you get from the ptz profile.

status = self.ptz.GetStatus({'ProfileToken': self.media_profile.token}) status.Position.PanTilt.x = 0.0 status.Position.PanTilt.y = velocity self.requestc.Velocity = status.Position self.perform_move(timeout)

So basically, you need to get the ptz status from the camera, and change the parameters of the position, then add the status.position parameters to the velocity one that is inside the request. As it has created the objects, you can modify them and then add then to the request, or add the status.Position to the request and then modify them. This is working for me in a continuous movement, but also works for absolute movement if the camera is compatible with it.

jmiguel99 avatar Nov 08 '18 17:11 jmiguel99