I'd like a recommandation on how to approach the problem I'm facing as a software developer.
Context:
I have an IP Camera that can be moved with a PTZ (Pan, Tilt, Zoom) command that can be called like so:
PTZ(float pan, float tilt, float zoom)
I have a joystick that update its input values every ~0.0001 sec and the available input values are:
joystickX
: from -1(left) to 1(right) 0 being the centerjoystickY
: from -1(down) to 1(up) 0 being the centerjoystickMagnitude
: from 0(untouched) to 1(completely pushed)zoomButton+
: pressed(zoomValue
= 1) or notzoomButton-
: pressed(zoomValue
= -1) or not
Right now, every time the joystick values are updated, a message to the camera is sent, so it's kinda spamming the camera every ~0.0001 sec with PTZ
messages.
Ex:
- Joystick input value update
PTZ(joystickX*joystickMagnitude, joystickY*joystickMagnitude, zoomValue)
message sent- Repeat in ~0.0001 sec
Question:
What would be the best approach to be able to control the camera with the joystick without spamming PTZ
messages?