FalkTannhaeuser / python-onvif-zeep

ONVIF Client Implementation in Python 2+3 (using https://github.com/mvantellingen/python-zeep instead of suds as SOAP client)
MIT License
445 stars 145 forks source link

Unknown error: A space is referenced in an argument which is not supported by the PTZ Node. #47

Open hua1024 opened 5 years ago

hua1024 commented 5 years ago

I try to run continuous_move.py,has some problem ,please help me. runtime enviorment : python3.6

Use Ctrl-C to quit Your command: l move left... ERROR:asyncio:Exception in callback readin() at examples/continuous_move.py:114 handle: <Handle readin() at examples/continuous_move.py:114> Traceback (most recent call last): File "/home/vision/Documents/python-onvif-zeep/onvif/client.py", line 25, in wrapped return func(*args, kwargs) File "/home/vision/Documents/python-onvif-zeep/onvif/client.py", line 150, in wrapped return call(params, callback) File "/home/vision/Documents/python-onvif-zeep/onvif/client.py", line 138, in call ret = func(params) File "/usr/local/lib/python3.6/dist-packages/zeep/proxy.py", line 45, in call kwargs, File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/bindings/soap.py", line 130, in send return self.process_reply(client, operation_obj, response) File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/bindings/soap.py", line 195, in process_reply return self.process_error(doc, operation) File "/usr/local/lib/python3.6/dist-packages/zeep/wsdl/bindings/soap.py", line 362, in process_error subcodes=subcodes, zeep.exceptions.Fault: A space is referenced in an argument which is not supported by the PTZ Node.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run self._callback(*self._args) File "examples/continuous_move.py", line 127, in readin move_left(ptz,moverequest) File "examples/continuous_move.py", line 54, in move_left do_move(ptz, request) File "examples/continuous_move.py", line 30, in do_move ptz.ContinuousMove(request) File "/home/vision/Documents/python-onvif-zeep/onvif/client.py", line 27, in wrapped raise ONVIFError(err) onvif.exceptions.ONVIFError: Unknown error: A space is referenced in an argument which is not supported by the PTZ Node.

chenmaolin88 commented 5 years ago

i got the same error , please let me know when you fix it

hua1024 commented 5 years ago

I can't find a solution,just using python2.7 is ok@chenmaolin88

chenmaolin88 commented 5 years ago

@Jeffer-hua i found a solution , the problem is : the "space" value of the response is not correct, add the following code below line 96 of the examples/continuous_move.py

        moverequest.Velocity = ptz.GetStatus({'ProfileToken': media_profile.token}).Position
        moverequest.Velocity.PanTilt.space = ptz_configuration_options.Spaces.ContinuousPanTiltVelocitySpace[0].URI
        moverequest.Velocity.Zoom.space = ptz_configuration_options.Spaces.ContinuousZoomVelocitySpace[0].URI

this can fix the problem , at least work with my camera , my camera is hikvision DS-2DC7223IW-A

hua1024 commented 5 years ago

thanks,it worked,How can I control the camera to rotate to a fixed position @chenmaolin88

chenmaolin88 commented 5 years ago

as far as i know, you need to change the operation from continuousMove to AbsoluteMove, follow the ptz.wsdl file , modify the example code above. i am working with the relativeMove operation, once I finish that , I will give you the code ,you can refer to that.

hua1024 commented 5 years ago

yes,i am change to AbsouteMove , but the range of x or y is -1 to 1 which in onvif protocol,i can't change to hikvision pcoordinate system.@chenmaolin88

chenmaolin88 commented 5 years ago

@Jeffer-hua you can rotate you camera to the specific coordingates with the official software, then you can get the current coordintes in onvif protocol by the following code: ptz.GetStatus({'ProfileToken': media_profile.token}).Position that means hikvision can translate it for you , you don't need hikvision's private coordinate system

hua1024 commented 5 years ago

@chenmaolin88 thank you very much for your good suggestions