inav icon indicating copy to clipboard operation
inav copied to clipboard

Change gimbal sensitivity from programming framework

Open error414 opened this issue 1 year ago • 7 comments

Would be nice to change gimbal sensitivity during flight, the easiest way how to achieve it by programming framework.

In settings.yaml is mentioned min max values as -16 to 15, but variable in configuration is not marked as int16, default value is uint8. https://github.com/iNavFlight/inav/blob/master/src/main/fc/settings.yaml#L4284

This PR assume that source of true is min max -16 to 15, so I changed type for all related variables in code from uint8 to int16.

error414 avatar Oct 07 '24 18:10 error414

Why not int8_t? That range doesn't need int16_t.

MrD-RC avatar Oct 07 '24 18:10 MrD-RC

I think that this would be better as an adjustment. Rather than in the programming framework. It's more like a tuning change that you'll adjust once. Not all the time.

MrD-RC avatar Oct 07 '24 18:10 MrD-RC

uint8_t is an unsigned 8-bit integer, which can have the range 0-255.

int16_t is an signed 16-bit, with a range of -32,768 to 32,767

You probably want int8_t , which has the range -128 to 127

sensei-hacker avatar Oct 07 '24 18:10 sensei-hacker

yea, I decided to use int16 because in struct what is sending to gimbal is int16 https://github.com/iNavFlight/inav/blob/master/src/main/io/gimbal_serial.h#L41

I don't know why programmers of gimbal decided to use two bytes for sensitivity. I like uniformity so I used int16, it's not problem to change to int8, it's not big deal.

Story behind, why I would like to change gimbal sensitivity durrung flight. I use gimbal on plane, inav provides nice autonomous flying so I would like to set small sensitivity (for nice stabilised image) durring autonomous flight and hight sensitivity (lock image) If I fly FPV. Firs flight I flew with gimbal which was set to small sensitivity (stabilized image) and it was not nice experience to fly with it, it feels like flying with huuuuge input lag.

error414 avatar Oct 07 '24 19:10 error414

I rewrite it to int8, I will move it from draft to pull request I will test it on field.

error414 avatar Oct 08 '24 20:10 error414

@error414 One comment for this change. Do we want the change made in the programming framework to be permanent or temporary? Currently it would result in a permanent change. But if we want it to revert when there is a power cycle. Maybe it should be made temporary. Other than that, it looks good.

MrD-RC avatar Oct 14 '24 16:10 MrD-RC

I don't know :). I'm OK with both cases.

I decided to make it permanent, because when I tested VTX settings via programming framework it was permanent as well. So I wanted to keep logic in INAV same as it's possible.

Be honest, I'm not big fun to set config values (configMuttable()->xxx = yyyy) in programming framework. If you save settings for example by stick command then new value from programming framework will be saved to eeprom.

So if you would like to make "sensitivity setting" temporary, maybe would be good idea to revisit programming framework's values and fix all function which set anything in config via "configMuttable()->.....", to make it consistent for all.

error414 avatar Oct 15 '24 08:10 error414

Hi , any progress on this great to have feature, as i just heard that a feature freeze is coming up and would be too bad to miss out on this. Thanks for your work and looking forwad to this.

glenn-venghaus avatar Oct 25 '24 07:10 glenn-venghaus

before pull allowing I need test it on air, on plane, last week I tested it, unfortunately the code in programing framework was not correct, I'm going to field tomorow to test it again. If it will work, I will move pull request from draft to ready.

error414 avatar Oct 25 '24 14:10 error414

tested on air, it works without any problem

error414 avatar Oct 27 '24 21:10 error414

Great stuff. Tnx. Used your code today to drive the gimbal sens via a free RC channel on a knob of my Boxer via the programming framework. Played a bit with the transmitter to limit my channel output to 1484-1515 range , then substract 1500 with the 1st logic line from it and feed the new gimal sens with that result in the second line.
Also added a switch on the same channel which overrides the value to 15 for easier landing. So adjustable stabilisation during flight and locked for landing . PERFECT !!

glenn-venghaus avatar Nov 10 '24 15:11 glenn-venghaus

Hi there. Any reason why this (and its partner PR for the configurator) is still not beeing merged ? It has been a while so was wondering. Been using it for months now but its a drag to keep doing custom builds ;-) Thanks

glenn-venghaus avatar Mar 04 '25 20:03 glenn-venghaus

Merging based on Glenn's testing over several months.

sensei-hacker avatar Mar 04 '25 20:03 sensei-hacker