Skip to content

XSD: add scaling value 2E-3#1224

Open
hamishwillee wants to merge 1 commit into
ArduPilot:masterfrom
hamishwillee:patch-8
Open

XSD: add scaling value 2E-3#1224
hamishwillee wants to merge 1 commit into
ArduPilot:masterfrom
hamishwillee:patch-8

Conversation

@hamishwillee

Copy link
Copy Markdown
Contributor

Allow efficient scaling of a % value in UINT16 value. With this, 0 to 100 is represented by 50000.

This is needed for https://github.com/mavlink/mavlink/pull/2526/changes#r3465455513 - but would do no harm anyway.

@peterbarker

Copy link
Copy Markdown
Contributor

This works, but why not the full range? Leaving room for flag "not supplied values, of course.

I also suggest making the soc 0-1 rather than as a percentage to make things simpler. Usually that will be scaled to a percentage, but it may not need to go via that before the GCS renders a little "gauge" icon, for example.

We're trying to move away from percentages generally in ArduPilot, preferring a scaler of 0-1 (or -1 to 1 in places...)

@hamishwillee

hamishwillee commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@peterbarker There's literally no difference in the data conveyed by a scaled percentage or a normalized value from 0 to 1, so if you want to call SoC a normalized scaled value then go for it :-).

I'm opposed to scaling across the full range though because it makes the maths a little bit harder, and a lot less intuitive. You could argue that doesn't matter, but I think it increases the chance for error.

If the argument is that the extra range gained from scaling from 50K up to 64K ish will make a difference, then you're arguing that it makes sense to move back to a float :-)

EDIT PS This is just my opinion. You're welcome to take this to the dev call since we're not getting this resolved right now unless you agree with me. I would like to come out of the call on Wednesday with agreement that this is the message. 3 years is a long wait.

@peterbarker

peterbarker commented Jun 26, 2026 via email

Copy link
Copy Markdown
Contributor

@hamishwillee

Copy link
Copy Markdown
Contributor Author

Yeah, I don't think that logics ;-)

I'm sure you get my point

  • if we don't need the extra resolution, choosing to provide it should be balanced against the calculation cost, ease of scaling, and so on.
  • if we really do need more resolution it is unlikely that increasing the range by 15% oir whatever it is will be sufficient long time.

I know I'd prefer to work with numbers that are easy to convert to decimal unless there is real value in it.

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.

2 participants