BreeeZe / rpos

Raspberry Pi Onvif Server
http://breeeze.github.io/rpos
MIT License
643 stars 146 forks source link

Focus Near does not work #80

Closed bagrintech closed 4 years ago

bagrintech commented 4 years ago

I checked the operation of rpos with the milesight VMS lite. The command Focus Far is worked normally. But Focus Near does not work. It issues comes because in the PTZDriver.js has :

else if (command === 'focus') { if (_this.pelcod) { if (data.value < 0) _this.pelcod.focusNear(true); else if (data.value > 0) _this.pelcod.focusFar(true); else { _this.pelcod.focusNear(false); _this.pelcod.focusFar(false); } _this.pelcod.send(); } } If I send focusNear command then data.value === 0 . I changed if (data.value < 0) to if (data.value <= 0).

I have other question about config in the rposConfig.json "PTZOutputURL": "127.0.0.1:9999", What does this line mean? Can I use Raspbery pi to relay onvif commands to another onvif camera? For example: raspberry has the address 192.168.1.2. There is a camera on the local network with the address 192.168.1.3. My videoserver sends the zoom command to the address 192.168.1.2. Raspberry recieve this command, sends it to the serial port and sends the onvif command to the camera via TCP. The camera also responds to this command.

RogerHardiman commented 4 years ago

I have other question about config in the rposConfig.json "PTZOutputURL": "127.0.0.1:9999", What does this line mean?

RPOS will receive PTZ commands in ONVIF Format. It can convert the PTZ Command into older 'serial data' PTZ format (sometimes called RS485 data). The serial data formats supported are Pelco-D, Pelco-P and Sony VISCA. RPOS then has to send the Serial Data (eg Peldo-D serial data) somewhere. It can send it to a USB COM Port or it can send it to a Socket. In this case 127.0.0.1:9999 is sending the Pelco-D serial data to a Socket. There would be some other server listening on Port 9999 that knows what to do with Pelco-D serial data.

It does not send an ONVIF PTZ command on to the URL. That could be added. But right now it is just RS485 Serial Data for Analogue CCTV cameras.

RogerHardiman commented 4 years ago

Hi

The ONVIF Standard says that Positive speeds are one direction for Focus and Negative Speeds are the other direction for focus. There is nothing in there for zero values but the value is a 'speed' and a speed of Zero would mean there is no speed to send.

A few questions 1) There is an official FocusStop command. Can you check Milesight emits FocusStop? 2) There is maybe another reason Milesight is outputting Speed 0. Perhaps there is a bug in RPOS. Perhaps RPOS needs to send the valid speed ranges and it is doing it incorrectly as I'm not sure a VMS should output a speed of 0 when it wants something to happen 3) Are you able to point Milesight at another IP camera and use Wireshark to look at the Focus commands. Does it use Zero's with other cameras. If it does not then it may be an RPOS bug sending out device capabilities

Roger

RogerHardiman commented 4 years ago

Hi Thanks for the bug report about the focus.

I found the cause of the problem. There was a bug in RPOS with the GetMoveOptions command. It returns a range of valid speeds and the range was set from 0.0 to 1.0. Milesight was doing the right thing and capping the output to this range.

GetMoveOptions should have returned a range of -1.0 to +1.0. With this fix, Milesight works properly.

RogerHardiman commented 4 years ago

Fix is now in the code. See this commit...

https://github.com/BreeeZe/rpos/commit/9b7920419f021f9d4c0a85709fbce42ecc8017d3