bartbutenaers / node-red-contrib-onvif-nodes

Node Red nodes for communicating with OnVif compliant IP devices
Apache License 2.0
65 stars 25 forks source link

Continous Move on PAN and TILT #5

Open nishant2019 opened 4 years ago

nishant2019 commented 4 years ago

Thanks for integrating ONVIF with NODE RED, excellent work. But I have a issue with PAN and TILT code you have shared. Whenever I move camera to LEFT/RIGHT/UP/DOWN it keeps on moving till it completes the full cycle. How can code to move camera in limited steps ?

bartbutenaers commented 4 years ago

Hi @nishant2019 , Thanks for the feedback! That is behaviour I didn't expected. When I click the buttons my Panasonic camera's only move limited steps. Perhaps the step size can be adjusted somehow in Onvif? If you would have time to figure out how Onvif does this, please be my guest. I'm currently busy with other Node-RED stuff, but I will continue with these Onvif nodes in a couple of months ... Bart

nygma2004 commented 3 years ago

Hi Bart,

Can you summarise what to pass PTZ node to move the camera? The ContinousMove works for me, but what is I only want to move it with a set amount? I don't understand how to pass the time parameter. Does it also go with ContinousMove action? What should be passed to the AbsoluteMove and RelativeMove actions? It is not mentioned in the documentation.

Thanks, Csongor

bartbutenaers commented 3 years ago

Morning Csongor (@nygma2004), I have setup a camera with ptz to test this, and seems there are a lot of copy-paste errors in that node. Have fixed them on my pc, but need to test it this weekend...

The problem with my Onvif nodes is that I need to find some free time to work on them. Have announced a couple of beta's on the forum (in periods where I have more time), but then almost nobody responds to help me with testing...

Anyway I'm working on it in the evenings...

bartbutenaers commented 3 years ago

I have update the version on Github (not on NPM!), which can be installed like this directly from this Github repo:

npm install bartbutenaers/node-red-contrib-onvif-nodes

With this example flow, the RELATIVE movement seem to work on my Panasonc VT164 camera:

image

[{"id":"1a73736a.1dba8d","type":"inject","z":"97e84354.4bf71","name":"Right","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":530,"y":2040,"wires":[["75b4b30f.fa083c"]]},{"id":"e8706725.a44048","type":"inject","z":"97e84354.4bf71","name":"Left","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":530,"y":2080,"wires":[["6e663fe7.d6e42"]]},{"id":"75b4b30f.fa083c","type":"change","z":"97e84354.4bf71","name":"","rules":[{"t":"set","p":"pan_speed","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"pan_translation","pt":"msg","to":"0.01","tot":"num"},{"t":"set","p":"action","pt":"msg","to":"relativeMove","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":2040,"wires":[["b479ba5.b7cd948"]]},{"id":"6e663fe7.d6e42","type":"change","z":"97e84354.4bf71","name":"","rules":[{"t":"set","p":"pan_speed","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"pan_translation","pt":"msg","to":"-0.01","tot":"num"},{"t":"set","p":"action","pt":"msg","to":"relativeMove","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":2080,"wires":[["b479ba5.b7cd948"]]},{"id":"93da7b10.7e1998","type":"inject","z":"97e84354.4bf71","name":"Up","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":530,"y":1960,"wires":[["96dc0ec9.cdef8"]]},{"id":"61b46938.aef1f8","type":"inject","z":"97e84354.4bf71","name":"Down","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":530,"y":2000,"wires":[["4ffa7371.d4e3ac"]]},{"id":"96dc0ec9.cdef8","type":"change","z":"97e84354.4bf71","name":"","rules":[{"t":"set","p":"tilt_speed","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"tilt_translation","pt":"msg","to":"0.1","tot":"num"},{"t":"set","p":"action","pt":"msg","to":"relativeMove","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":1960,"wires":[["b479ba5.b7cd948"]]},{"id":"4ffa7371.d4e3ac","type":"change","z":"97e84354.4bf71","name":"","rules":[{"t":"set","p":"tilt_speed","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"tilt_translation","pt":"msg","to":"-0.1","tot":"num"},{"t":"set","p":"action","pt":"msg","to":"relativeMove","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":2000,"wires":[["b479ba5.b7cd948"]]},{"id":"b479ba5.b7cd948","type":"onvif-ptz","z":"97e84354.4bf71","name":"","deviceConfig":"4396f8cf.47a9c8","profileName":"","action":"","panSpeed":0,"tiltSpeed":0,"zoomSpeed":0,"panPosition":0,"tiltPosition":0,"zoomPosition":0,"panTranslation":0,"tiltTranslation":0,"zoomTranslation":0,"time":1,"preset":"","presetName":"","stopPanTilt":true,"stopZoom":true,"configurationToken":"","x":998,"y":1960,"wires":[[]]},{"id":"46bb3e04.c72dd","type":"comment","z":"97e84354.4bf71","name":"PTZ - relative movements demo","info":"","x":590,"y":1920,"wires":[]},{"id":"4396f8cf.47a9c8","type":"onvif-config","z":"","xaddress":"192.168.1.200","name":"MyCamKitchen"}]

P.S. If you use translation values of -1 or 1, then the camera will translate over the maximum distance. A value in between will make smaller steps.

However it works only when I use a translation value of 0.1 in the Y direction, and a value of 0.01 value in the X direction. Is that an abnormality of my cam, or is that explained somewhere in the Onvif specs. No idea at the moment. Would be nice if - anybody who is following this discussion - could give me some background info about that ...

The ABSOLUTE movement doesn't work on my camera. When I send a position between -1 and 1:

image

Then I get an error:

ONVIF SOAP Fault: Destination out of boundsThe requested position is out of bounds.

Which makes no sense to me at the moment ....

bartbutenaers commented 3 years ago

Perhaps someone else can test the absolute movement, whether it works on another cam...

image

[{"id":"1a73736a.1dba8d","type":"inject","z":"97e84354.4bf71","name":"Right","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":530,"y":2040,"wires":[["75b4b30f.fa083c"]]},{"id":"e8706725.a44048","type":"inject","z":"97e84354.4bf71","name":"Left","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":530,"y":2080,"wires":[["6e663fe7.d6e42"]]},{"id":"75b4b30f.fa083c","type":"change","z":"97e84354.4bf71","name":"","rules":[{"t":"set","p":"pan_speed","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"pan_position","pt":"msg","to":"0.5","tot":"num"},{"t":"set","p":"action","pt":"msg","to":"absoluteMove","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":2040,"wires":[["b479ba5.b7cd948"]]},{"id":"6e663fe7.d6e42","type":"change","z":"97e84354.4bf71","name":"","rules":[{"t":"set","p":"pan_speed","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"pan_position","pt":"msg","to":"-0.5","tot":"num"},{"t":"set","p":"action","pt":"msg","to":"absoluteMove","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":2080,"wires":[["b479ba5.b7cd948"]]},{"id":"93da7b10.7e1998","type":"inject","z":"97e84354.4bf71","name":"Up","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":530,"y":1960,"wires":[["96dc0ec9.cdef8"]]},{"id":"61b46938.aef1f8","type":"inject","z":"97e84354.4bf71","name":"Down","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":530,"y":2000,"wires":[["4ffa7371.d4e3ac"]]},{"id":"96dc0ec9.cdef8","type":"change","z":"97e84354.4bf71","name":"","rules":[{"t":"set","p":"tilt_speed","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"tilt_position","pt":"msg","to":"0.5","tot":"num"},{"t":"set","p":"action","pt":"msg","to":"absoluteMove","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":1960,"wires":[["b479ba5.b7cd948"]]},{"id":"4ffa7371.d4e3ac","type":"change","z":"97e84354.4bf71","name":"","rules":[{"t":"set","p":"tilt_speed","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"tilt_position","pt":"msg","to":"-0.5","tot":"num"},{"t":"set","p":"action","pt":"msg","to":"absoluteMove","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":2000,"wires":[["b479ba5.b7cd948"]]},{"id":"b479ba5.b7cd948","type":"onvif-ptz","z":"97e84354.4bf71","name":"","deviceConfig":"4396f8cf.47a9c8","profileName":"","action":"","panSpeed":0,"tiltSpeed":0,"zoomSpeed":0,"panPosition":0,"tiltPosition":0,"zoomPosition":0,"panTranslation":0,"tiltTranslation":0,"zoomTranslation":0,"time":1,"preset":"","presetName":"","stopPanTilt":true,"stopZoom":true,"configurationToken":"","x":998,"y":1960,"wires":[[]]},{"id":"46bb3e04.c72dd","type":"comment","z":"97e84354.4bf71","name":"PTZ - absolute movements demo","info":"","x":590,"y":1920,"wires":[]},{"id":"4396f8cf.47a9c8","type":"onvif-config","z":"","xaddress":"192.168.1.200","name":"MyCamKitchen"}]

This flow sets the absolute position to -0.5 or 0.5 (maximum range should between -1 and 1)?

Thanks !!

nygma2004 commented 3 years ago

Hi Bart,

I have a few Reolink cameras so I can help with testing, but I am assuming their Onvif support is spotty at best. I mean they all have image motion detection, and the RLC522 model sends events when motion is detected, but the E1 Zoom model does not. And I tested the new RelativeMove and AbsoluteMove examples with the E1 Zoom, but it does not do anything. The I am getting a "failed" status on the PTZ node when trying these messages. So I am guessing it is not supported. I see a ONVIF SOAP Fault: {"value":"SOAP-ENV:Sender"} message in the console.

So I am happy to help you testing, but I think some of these "advanced" features are just not implemented in these cameras. For example, I was able to create Presets but when I try to recall them nothing happens. The camera even responds and I get a bit fat empty string in msg.payload[0].gotoPresetResponse.

But also I am not sure what is the best place to keep interacting with you, the big long discussion is not closed.

bartbutenaers commented 3 years ago

The I am getting a "failed" status on the PTZ node when trying these messages.

Ai that is a pity... It is very difficult to get all the different branches up and running. And your config node (in the ptz config screen) contains correct information to access your camera?

So I am happy to help you testing

That is very kind of you!

But also I am not sure what is the best place to keep interacting with you, the big long discussion is not closed.

You can always send me a private message on discourse.nodered.org

nygma2004 commented 3 years ago

Yes, I am pretty sure it is the correct setup, because the camera responds to some of the other onvif commands. Other interesting thing was that when I tested your absolute move flow, the Down and Up button was panning the camera left and right to full extent. So these actions are definitely not fully implemented.

SuperNinja73 commented 3 years ago

Hi Bart, I test the PTZ part of your node:

on my PTZ camera: xiongmai (with ICsee app, XMeye) it works EXCEPT tilt : if I click on DOWN it goes left, and UP goes right image this is UP configuration

[EDIT] : I have the impression that you have inverted the : Continuous Move command: which must make the camera rotate until a Stop current Motion HERE: I only do small jumps that work correctly (UP, DOWN, LEFT, RIGHT) and the : Absolute Move: which should make small jumps with each click HERE: it runs nonstop and I have to do Stop current Motion to stop it PLUS the UP and DOWN bug that turns left and right.