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

AP_Motors6DOF: use its own rc_write, which allows trimming motor outputs #26300

Closed
wants to merge 1 commit into from

Conversation

Williangalvani
Copy link
Contributor

@Williangalvani Williangalvani commented Feb 23, 2024

I was told some people out there sell ESCs with bad crystals or something that fail to detect 1500us properly.
I was also told "they calibrate it in the factory", but that doesn't seem to be quite true. These (bi-directional) ESCs end up centered at 1520 or sometimes more.

This allows the users to cope with these and other ESCs.

Tested and working.

should fix #23002

Copy link
Member

@IamPete1 IamPete1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using output trimmed adds a dependency on the individual servo min and max params too. It just constrains, this would be a problem with default parameter values because MOT_PWM_MIN and MOT_PWM_MAX default to 1000 and 2000 where as SERVOx_MIN and SERVOx_MAN default to 1100 and 1900. So you would be loosing the top 20% of your range.

@Williangalvani
Copy link
Contributor Author

Using output trimmed adds a dependency on the individual servo min and max params too. It just constrains, this would be a problem with default parameter values because MOT_PWM_MIN and MOT_PWM_MAX default to 1000 and 2000 where as SERVOx_MIN and SERVOx_MAN default to 1100 and 1900. So you would be loosing the top 20% of your range.

Using output trimmed adds a dependency on the individual servo min and max params too. It just constrains, this would be a problem with default parameter values because MOT_PWM_MIN and MOT_PWM_MAX default to 1000 and 2000 where as SERVOx_MIN and SERVOx_MAN default to 1100 and 1900. So you would be loosing the top 20% of your range.

we actually do override those.

but it would make MOT_MIN/MAX and MOT_REVERSE redundant...
I think I should probably remove those and migrate them to SERVO params

@IamPete1
Copy link
Member

Yeah, the possibility of having conflicting ranges means the mixer will get confused, it might endup winding up I against the servo limit because it does not know the output is saturated. The other problem with unilaterally switching to set_output_pwm_trimmed is that it will reverse the output if SERVOx_REVERSED is set, so if users have messed with their reversals previously now we start using them some of the motors come out backwards.

Why not have users change to range MOT_PWM_TYPE so set_output_scaled is used?

@Williangalvani
Copy link
Contributor Author

Why not have users change to range MOT_PWM_TYPE so set_output_scaled is used?

I wasn't aware of this! nice. I'll check it out.

thanks

@Williangalvani
Copy link
Contributor Author

It turned out that PWM_TYPE_PWM_RANGE is actually not working for sub.
This change makes it work, although I'm not sure it is 100% correct

@IamPete1
Copy link
Member

IamPete1 commented Mar 5, 2024

Do you know if the other none standard PWM types work for sub? Dshot ect. It looks to me like it really should work, I think the setup is done in on sub the same way as the other vehicles.

@Williangalvani
Copy link
Contributor Author

Do you know if the other none standard PWM types work for sub? Dshot ect. It looks to me like it really should work, I think the setup is done in on sub the same way as the other vehicles.

the only thing I noticed missing was calc_pwm() and while that made it work in a way, it still didn't use SERVOx_TRIM

@IamPete1
Copy link
Member

IamPete1 commented Mar 6, 2024

Ah, we need to set servo type to angle not range I guess subs motors are always reversible?

@IamPete1
Copy link
Member

IamPete1 commented Mar 6, 2024

Sorry for the bad steer on range type, I have done a PR to add a new angle type which will respect trim.

#26415

@Williangalvani
Copy link
Contributor Author

closing in favor of #26415

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.

Sub: Support servo output trim
2 participants