PTZ Control Issue with NX Witness API Integration
In ProgressI would like to seek your assistance regarding an issue we encountered while integrating our custom iOS/Android application with NX Witness via its API.
1.The version of NX Witness we are using is 6.0.0.39503.
2.We have developed a custom iOS/Android application to integrate with NX Witness using its API.
3.While attempting to control IP cameras connected to NX Witness using PTZ functionality, we observed the following issues:
•3-1. When performing zoom in/out, the camera initially pans to the left before zooming in or out.
•3-2. When controlling the camera to pan left, it initially pans to the right.
•3-3. When controlling the camera to pan right, it initially pans to the left.
•3-4. These behaviors occur only during the first execution of the app and typically normalize within 5-10 seconds.
4.The API reference documentation we used is as follows:
POST /rest/v3/devices/{deviceId}/ptz/position
Move to absolute PTZ position
Moves the Device to an absolute position. When the Device reports its PTZ capabilities to the Server during initialization, the range of position parameters is sent to the Server. PTZ capabilities cannot be read via the API.
Parameters:
- **Name**: deviceId (required)
Type: string (path)
Description: Device ID (can be obtained from the "id," "physicalId," or "logicalId" field via GET /rest/v3/devices) or MAC address (not supported for certain cameras).
- **_local**: boolean (query)
Description: If false or unspecified, the information in the response will be collected from other Servers in the System as well. If specified as empty or true, then only the Server processing the request will provide information. Available values: true.
- **_strict**: boolean (query)
Description: If false or unspecified, the Server will produce available results, ignoring minor errors. If specified as empty or true, the request will fail on any error.
- **_ticket**: string (query)
Description: One-time authorization ticket previously generated using the Login REST API obtained from the current Server.
Could you kindly provide insights into why these issues occur during the initial app execution and how we might resolve them? Your assistance would be greatly appreciated.
-
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 capabilitiesptzDict = {
'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. -
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}
...
Please sign in to leave a comment.
Comments
3 comments