Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change gimbal sensitivity from programming framework #10405

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

error414
Copy link
Contributor

@error414 error414 commented Oct 7, 2024

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.

iNavFlight/inav-configurator#2204

@MrD-RC
Copy link
Collaborator

MrD-RC commented Oct 7, 2024

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

@MrD-RC
Copy link
Collaborator

MrD-RC commented Oct 7, 2024

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.

@sensei-hacker
Copy link
Collaborator

sensei-hacker commented Oct 7, 2024

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

@error414
Copy link
Contributor Author

error414 commented Oct 7, 2024

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
Copy link
Contributor Author

error414 commented Oct 8, 2024

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

@mmosca mmosca added this to the 8.0 milestone Oct 13, 2024
@MrD-RC
Copy link
Collaborator

MrD-RC commented Oct 14, 2024

@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.

@error414
Copy link
Contributor Author

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.

@glenn-venghaus
Copy link

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.

@error414
Copy link
Contributor Author

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 error414 marked this pull request as ready for review October 27, 2024 21:50
@error414
Copy link
Contributor Author

tested on air, it works without any problem

@glenn-venghaus
Copy link

glenn-venghaus commented Nov 10, 2024

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 !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants