PX4-Autopilot
PX4-Autopilot copied to clipboard
Trim params for Tilts
Summary
Provides trim parameters for Tilts.
Background
It was strange for me that these parameters hasn't been brought in, since I would believe any Tilt Rotor would want to trim their servos. Inspecting MCTilt, it looks like the offset effectively is determined through your min and max values. However when your min-angle == -max-angle, your trim value results in being zero.
In our use case, we use the entire range of our tilts, and after the mechanical assembly, there would be a small offset, and this gets amplify with the use of gears.
Tested
Tested with Tiltrotor adjusting the trim parameters and making sure only the corresponding parameters are adjusted.
Looks like this might at least affect actuator config. Can you create a PR for docs fixes at the end please.
In our use case, we use the entire range of our tilts, and after the mechanical assembly, there would be a small offset, and this gets amplify with the use of gears.
But that means min-angle != -max-angle, no? And you could use the min/max angles instead?
Full range in our use case is: min angle = -180, and max angle = 180, providing full rotation. Our airship needs to provide thrust downwards. This would be the case for underwater vehicles also, I assume.
Looking more into this, if we use the trim, we will be loosing effectively the trim amount in our full rotation, due to the fact that the outputs gets clip between min and max. Therefore I will need to implement a function to wrap it around.
Thinking more about this, this seems a bit too use case specific to implement to be merge upstream. Let me know, happy to close the PR if this seems irrelevant for the general vehicles. ... :thinking: ?
Hi @henrykotze , thanks for kicking this discussion off, it's an important one to have.
So to double check what you want to achieve: you have a tilt that you want to configure to go from exactly -180° (input =-1) to exactly +180° (input=1), while also being exactly at 0° with 0 input = 0 correct? As you say above in your last message, I don't think we can do that right now by simply adding a trim, as the trim is just a shift without any additional scale (the usable output range gets reduced, eg a trim of 0.25 means the range is [1125, 2000] instead of [1000, 2000]).
What you would need is a way to map your three input points (-1, 0, 1), which we could do if we add the ability to define the NEUTRAL point beside MIN and MAX for an actuator. Then the ranges below/above 0 of the input signal are decoupled from each other, meaning you can set independent MIN and MAX values. For example, a tiltrotor that has tilts that can be tilted 90° forward but only 20° backwards could be correctly setup to have the tilts go to -20° when the controller demands full backwards thrust, to 90° if full forward and 0° without any thrust setpoint.
If we add NETURAL we could remove TRIM, unless I miss something. The current TRIM (eg for control surfaces) doesn't add functionality that couldn't also be achieved with the setting of MIN/MAX, it's just more convenient. Or do I miss something @bkueng ?
So to double check what you want to achieve: you have a tilt that you want to configure to go from exactly -180° (input =-1) to exactly +180° (input=1), while also being exactly at 0° with 0 input = 0 correct
Yes.
What you are suggesting with the NEUTRAL param sounds promising.
The tilt servo has a trim parameter we can set, but this is a bit involved once you integrate the entire system, and ideally you would like to set the trim from the FMU side..
If we add NETURAL we could remove TRIM, unless I miss something. The current TRIM (eg for control surfaces) doesn't add functionality that couldn't also be achieved with the setting of MIN/MAX, it's just more convenient. Or do I miss something @bkueng ?
We can do that. Just consider that the TRIM is currently also added to the actuator testing value. EDIT: Also, NEUTRAL introduces a non-linearity, especially for larger values, whereas TRIM does not.
Whats the status of this PR? What's needed to bring this in?