quatanium / python-onvif

ONVIF Client Implementation in Python
MIT License
470 stars 312 forks source link

how to send a RelativeMove command using onvif-cli? #59

Open czyz opened 6 years ago

czyz commented 6 years ago

I'm able to connect to my cheap little Digoo DG-M1X camera via onvif-cli, but can't for the life of me figure out how to use onvif-cli to tell the camera to pan or tilt. I'm trying to use RelativeMove, but am not sure how to format the command or how to include a PTZ vector and pass it along at the command-line. I just want to be able to nudge the camera left, right, up, and down, by small increments.

I'm guessing the answer is obvious to anyone with any knowledge of Python and ONVIF, but I'm rather new to both.

On an unrelated but amusing note, the manufacturer left this camera's telnet port wide open. Hilarious. One can just telnet in as root with no password and get shell access.

towster commented 6 years ago

I am having same issue as you trying to figure out how to construct a PTZ Vector to pass as an argument. Best clue I have gotten so far is to query the current camera vector. Have you figured it out?

>>> status = ptz.GetStatus({'ProfileToken': media_profile._token})
>>> status
(PTZStatus){
   Position = 
      (PTZVector){
         PanTilt = 
            (Vector2D){
               _y = 0.631778
               _x = -0.336056
               _space = "http://www.onvif.org/ver10/tptz/PanTiltSpaces/PositionGenericSpace"
            }
         Zoom = 
            (Vector1D){
               _x = 0.0
               _space = "http://www.onvif.org/ver10/tptz/ZoomSpaces/PositionGenericSpace"
            }
      }
   Error = "NO error"
   UtcTime = 2018-01-20 04:35:57
 }

I have even tried passing back my results of that to absolutemove and the camera just goes to -1,-1..

>>> ptz.AbsoluteMove({'ProfileToken': media_profile._token},{'Position': status.Position})

dcyrils commented 6 years ago

THNX TO ALL ))))

Correct: ptz_service.ContinuousMove({'ProfileToken': mediaProfileToken, 'Velocity': velocity} ) INcorrect: ptz_service.ContinuousMove(mediaProfileToken, velocity)