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

removed saturation from the rosflight_io node #188

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

JMoore5353
Copy link
Contributor

The saturation should happen in either the firmware or before the user sends commands to the firmware. This was also raising an issue as I was implementing controls that send passthrough commands to the mixer that are on a different scale than from [-1,1].

This pull request removes saturation from the rosflight_io node, making it the user's responsibility to saturate their input. Note that the mixer also does some saturation when composing motor and servo commands.

@JMoore5353 JMoore5353 linked an issue Aug 28, 2024 that may be closed by this pull request
@bsutherland333
Copy link
Contributor

I agree that saturation in rosflight_io doesn't make sense, but I think we do want saturation somewhere in the rosflight side of things, where we don't assume that the user is never going to attempt to send infeasible inputs that could damage the hardware. Does the firmware have saturation? Keeping the saturation inside the firmware makes the most sense to me.

@JMoore5353
Copy link
Contributor Author

@bsutherland333 The firmware does saturate the inputs when it goes to write motor commands to the motors/servos. In the case of a motor, it saturates the command between 0 and 1. In the case of a servo, from -1 to 1. So the saturation limits in the firmware (right before writing PWM commands to the motors/servos) match exactly the saturation limits in rosflight_io.

When we remove the saturation from rosflight_io, the difference will be that the saturation happens after computing mixing outputs instead of before. Note that this doesn't solve the problem of avoiding damaging the hardware, but the current saturation limits in rosflight_io also don't solve that problem.

What are the hardware limits you are thinking about? What are your thoughts on how we could implement something to protect those hardware limits?

@iandareid iandareid merged commit 474c767 into main Sep 10, 2024
2 checks passed
@iandareid iandareid deleted the 187-rosflight_io-node-saturates-passthrough-input branch September 10, 2024 18:34
@bsutherland333
Copy link
Contributor

@JMoore5353 I don't think this would be an issue for our current airframes, but if we were ever controlling hardware where it would be possible to command something outside of its safe working range then we would want to saturate the command to avoid commands ever leaving that range. varmint_h7 would also probably saturate this, but I think it would be good to have at least one check somewhere in the standard software stack. At the very least, this would involve limiting PWM or command outputs to 1000-2000 or -1-1 or 0-1. We could also make this a parameter if a particular airframe needed tighter restrictions. But all this should happen after mixing, of course. We want this to be on the raw hardware commands itself, not xyz commands.

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.

ROSflight_io node saturates passthrough input
3 participants