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

Remove RC Throttle trim calibration value getting hard-set to Minimum value #10497

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

junwoo091400
Copy link
Contributor

@junwoo091400 junwoo091400 commented Nov 19, 2022

Descrption

A hotfix commit from 7 years ago was forcing RC transmitters to always have a trim value set to 'Min', effectively only allowing the [0, 1000] range.

While for legacy reasons & to bypass cases of spring-loaded transmitters, this may be ok, it is certainly not true regarding reversible thrust vehicles (e.g. Boat / Rovers), and it is confusing why only the throttle would be in the range [0, 1], and not [-1 ,1], as defined in the MANUAL_CONTROL MAVLink message definition.

Changes

Removed this hotfix, and allows setting the trim values automatically in the state machine (need to check logic once again)

Context

The discussion that discovered this flaw is here: PX4/PX4-Autopilot#15949 (comment)

We need to also clearly define the point about the definition of MANUAL_CONTROL's throttle (z) definition. As it doesn't really make sense to have throttle vector's orientation interfere with the RC transmitter's setpoint values (it should be agnostic to vehicle's behavior to be basic).

Also, PX4 will be able to handle this change using this logic (although some legacy parameter translations / user awarenesses would be needed): PX4/PX4-Autopilot#15949

And we need to make sure for ArduPilot this will work out as well. Judging from the way Steer / Throttle Manual override isn't differentiated in Rover code, I guess ArduPilot already uses full range (-1000 ~ +1000) definition for the internal RC throttle data, @peterbarker. Did you not have problem with QGC, regarding this point?

TODOs

  • I am still unclear how the rcTrim value would then get set for throttle, need to check the state machine logic to be sure.

hotfix

- A hotfix commit from 7 years ago was forcing RC transmitters to
  always have a trim value set to 'Min', effectively only allowing the
  [0, 1] range of the `manual_control_setpoint.throttle`.

  This was the commit:
  mavlink@0577af2
- This removes this hotfix, and allows setting the trim values
  automatically in the state machine (need to check logic once again)
- Discussion was here:
  PX4/PX4-Autopilot#15949 (comment)
@DonLakeFlyer
Copy link
Contributor

I don't quite understand what the original code that was removed was actually doing. That said as long as spring loaded throttle still works fine.

But this comment is concering: "although some legacy parameter translations / user awarenesses would be needed"

In general there is pretty much no user awareness on anything.

@MaEtUgR
Copy link
Collaborator

MaEtUgR commented Nov 21, 2022

In short:

We have to be careful with:

  • backward compatibility, if the trim is set to the center value and it's used with an older PX4 version then the lower half of the stick input will get used for negative thrust which is almost nowhere in the code. So for most cases, the lower half would just get capped and be unusable without resetting the trim value.
  • what the trim value gets even set to if it's not hardcoded to the minimum. Is it the center of the stick? When is that measured? Or is it just the position of the stick when the calibration starts (what I assume).

An alternative would be to replace the calibration with an autopilot-based one compared to the ground station doing all the logic based on the telemetry of the autopilot. That way compatibility on the exact ranges and values becomes less of an issue and e.g. also MAVSDK could easier trigger a calibration and just follow the steps. Just a suggestion.

That said as long as spring loaded throttle still works fine.

@DonLakeFlyer With compatible PX4 that's not an issue. From PX4 perspective it currently doesn't matter if the throttle is spring-loaded or not. It has its full range and in certain modes a spring-loaded throttle just makes more sense than in others. We could add this information in the future to possibly enhance UX in some cases but the pure control input is independent.

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/driving-backwards-with-a-boat-rover-in-manual-mode/25714/6

@mrpollo
Copy link
Member

mrpollo commented Jun 6, 2023

Should we get this in?

@DronecodeBot
Copy link

This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-maintainers-call-june-06-2023/32473/1

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.

None yet

5 participants