4k Camera Zoom/Focus rate of change

Is there a way to increase the rate/speed of change of the zoom & focus on the new 4k camera, on x-box controller? If I use the cockpit widget sliders to go from say 1x to 2x magnification, the change is pretty quick (around 4 seconds), if I use the x-box buttons, the change takes 20 seconds. If I go to the PWM setup in BlueOS, there are the min/trim/max variables - which set the range, but not the speed. In Cockpit Joystick Configuration I can bind the buttons to the function, but no mention of speed/rate.

Agree that this would be a welcome change. I would also like the option to have preset zoom levels and option to bind to a button, so the camera just goes to a preset on button press.

Hi @3dMB -
Yes, it is quite easy to adjust the speed. Simply search the datalake for Camera Zoom / Focus:


Click the pencil icon to edit:

adjust the code to have the speed factor multiplier you’d like:

const speedFactor = 5
const zoom = {{camera-zoom-increase}} -
{{camera-zoom-decrease}}
return zoom < 0.05 && zoom > -0.05 ? 0: speedFactor * zoom

@mattcmgb
You can potentially get that sort of functionality from buttons on-screen in Cockpit (not a game controller button, but maybe that too?) You’re simply wanting to set servo output(s) to a pre-determined value via a custom action for DO_set_servo - Eliot has detailed how that is accomplished in Cockpit before for a vaguely similar case, but we can provide some specific documentation to this case if it would be helpful!

Noting there’s an incoming firmware change to enable more correctly implemented speed changes going forwards, but that doesn’t work yet, so we’re holding off including this functionality in our official guides until the implementation is stabilised.

If you want the behaviour in the meantime then Tony’s Cockpit multiplication approach is the way to go (possibly using an extra data-lake variable for the speed instead of a fixed factor, if you want it to be readily adjustable), but that method involves sending values that are technically outside the MAVLink spec, so will stop working in a future firmware update (when the autopilot parameter approach becomes available).

Adding this to the focus does not seem to have any effect on focus speed. I have changed the number upto 5000 and no change. For clarity, the expression is as follows:

const speedFactor = 5
const focus = {{camera-focus-increase}} -
{{camera-focus-decrease}}
return focus < 0.05 && focus > -0.05 ? 0: Math.max (Math.min(1, focus), -1)

Hi @3dMB -
Your expression does not include the second instance of the speed factor multiplying the output, you only define it. Without multiplying by it, you see no increase!

I appreciate the reply @tony-white but you may as well have written it in Chinese for what it is worth.

So going on your zoom example, the expression started with:

then changed to:

So I can see that you have added the “const speedFactor = 5” in line 1. I now also see that you have added "speedfactor * " between 0: and zoom, at the end.

The focus expression has the addition of “Math.max (Math.min(1, focus), -1)”, that the zoom expression does not have.

I can only assume that when you say “Your expression does not include the second instance of the speed factor multiplying the output,” - does this refer to the "speedfactor * " that was added to the zoom expression? If so, where does it go?

@tony-white due to your recommendations on previous topics, I have used AI, which went around the houses a bit, however it has now come up with a workable solution. Simply adding the second instance did not work. This failed due to the extra clamp of “Math.max(Math.min(1, focus), -1)”. The final working expressions should be:

Zoom:

const speedFactor = 5
const zoom = {{camera-zoom-increase}} -
{{camera-zoom-decrease}}
return zoom < 0.05 && zoom > -0.05 ? 0 : speedFactor * zoom

Focus:

const speedFactor = 5
const focus = {{camera-focus-increase}} -
{{camera-focus-decrease}}
return focus < 0.05 && focus > -0.05 ? 0 : speedFactor * focus