PTZ Control Issue with NX Witness API Integration

In Progress

Comments

3 comments

  • Avatar
    Ichiro

    Hi Gary,

    To use the PTZ API, you may refer to the article here, firstly get the ptzCapabilites, then send the proper command/parameter to the camera.
     
    For example, there is an PTZ camera, then 
     
    1) Use GET /rest/v3/devices/{deviceId}?_with=parameters.ptzCapabilities
    And you may see its PTZ capabilities value is "135229431" in decimal.
     
    2) Then you can transit the decimal value into a binary bit mask, in this case.
    135229431 (decimal) = 0b00001000000011110110111111110111
     
    3) According to the PTZ Capabilities mapping, you can find the supported capabilities

    ptzDict = {
    'NoPtzCapabilities': 0,
    'ContinuousPanCapability': 1,
    'ContinuousTiltCapability': 2,
    'ContinuousZoomCapability': 4,
    'ContinuousFocusCapability': 8,
    'ContinuousRotationCapability': 536870912,
    'AbsolutePanCapability': 16,
    'AbsoluteTiltCapability': 32,
    'AbsoluteZoomCapability': 64,
    'AbsoluteRotationCapability': 1073741824,
    'RelativePanCapability': 1024,
    'RelativeTiltCapability': 2048,
    'RelativeZoomCapability': 16384,
    'RelativeRotationCapability': 32768,
    'RelativeFocusCapability': 8388608,
    'ViewportPtzCapability': 128,
    'FlipPtzCapability': 256,
    'LimitsPtzCapability': 512,
    'DevicePositioningPtzCapability': 4096,
    'LogicalPositioningPtzCapability': 8192,
    'PresetsPtzCapability': 65536,
    'ToursPtzCapability': 131072,
    'ActivityPtzCapability': 262144,
    'HomePtzCapability': 524288,
    'AsynchronousPtzCapability': 1048576,
    'SynchronizedPtzCapability': 2097152,
    'VirtualPtzCapability': 4194304,
    'AuxiliaryPtzCapability': 16777216,
    'NativePresetsPtzCapability': 134217728
    }

     
    4) Then you would be able to find which movement and capabilities set you can use (ex: absolute move, relative move, continous move..etc)
     
    5) Then we can check the PTZ camera, and the PTZ capabilities set is :

    • NativePresetsPtzCapability
    • HomePtzCapability
    • ActivityPtzCapability
    • ToursPtzCapability
    • PresetsPtzCapability
    • RelativeZoomCapability
    • LogicalPositioningPtzCapability
    • RelativeTiltCapability
    • RelativePanCapability
    • LimitsPtzCapability
    • FlipPtzCapability
    • ViewportPtzCapability
    • AbsoluteZoomCapability
    • AbsoluteTiltCapability
    • AbsolutePanCapability
    • ContinuousZoomCapability
    • ContinuousTiltCapability
    • ContinuousPanCapability

     
    So you can see the camera's capabilities, and use the proper and supported functions in your APP. 
    This will significantly reduce lots of issues.

     

    Regarding the movement behaviors, unfortunately, without a video or complete details of the requests made, we are unable to investigate further based solely on assumptions. To assist you more effectively, could you please provide the following:

    1.The PTZ model in use.

    2.The exact full API request you have made (this is mandatory).

    3.Ideally, test the issue using a tool like POSTMAN or a similar API testing platform to isolate the issue at the API level, independent of the APP, including a screen recording of the process would also help us better understand the behavior and the problem you are encountering.

     

    Once these details are available, we will be in a better position to assist you further.
    Thank you for your cooperation.



    Thanks.

    0
    Comment actions Permalink
  • Avatar
    gary lin

    We have encountered an issue with the PTZ API where the API responses indicate “success,” but the actual PTZ behavior seems to deviate from the expected operation. Below, I have detailed the situation and included relevant logs for your review. We would appreciate your guidance on resolving this issue or adjusting the API parameters to ensure accurate PTZ operations.

    1. Problem Description

    Issue: The API call for PTZ operations, specifically with the “absolute” movement type, returns “success.” However, the camera does not always reach the specified position or behave as expected.

    Question: Could this behavior be related to how the API parameters are configured? Are there recommended parameters or adjustments we should apply to ensure precise PTZ operations?

    2. Relevant Logs

    Here are some sample logs from our system:
    2024-12-09 16:41:17.469 +0800: {Network} {nx} {PTZ get position: {pan: 0.05999999865889549, tilt: 0.41999998688697815, zoom: 0.07000000029802322}} {WARNING}
    2024-12-09 16:41:21.928 +0800: {Network} {nx} {PTZ move to: {deviceId: 00eae28a-6d1e-cb5b-a1b8-e4433a0c003a, type: absolute, api: none, pan: -0.2400000013411045, tilt: 0.41999998688697815, speed: 0.5, zoom: 0.07000000029802322}} {WARNING}
    2024-12-09 16:41:25.283 +0800: {Network} {nx} {PTZ move success: {deviceId: {00eae28a-6d1e-cb5b-a1b8-e4433a0c003a}, pan: 0, speed: 0, tilt: -1, type: absolute, zoom: 0}} {WARNING}
    2024-12-09 16:41:27.064 +0800: {Network} {nx} {PTZ move to: {deviceId: 00eae28a-6d1e-cb5b-a1b8-e4433a0c003a, type: absolute, api: none, pan: -0.5400000013411045, tilt: 0.41999998688697815, speed: 0.5, zoom: 0.07000000029802322}} {WARNING}
    ...

    0
    Comment actions Permalink

Please sign in to leave a comment.