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

Abnormal process about pwm_to_duty_cycle #23

Open
mangdangDOTnet opened this issue Feb 15, 2021 · 1 comment
Open

Abnormal process about pwm_to_duty_cycle #23

mangdangDOTnet opened this issue Feb 15, 2021 · 1 comment

Comments

@mangdangDOTnet
Copy link

Hello,
Sometimes, I can get the abnormal return from functions "pwm_to_duty_cycle" in the file HardwareInterface.py.
It's OK after change from
return int(pulsewidth_micros / 1e6 * pwm_params.freq * pwm_params.range)
to
pulsewidth_micros = int(pulsewidth_micros / 1e6 * pwm_params.freq * pwm_params.range)
if np.isnan(pulsewidth_micros):
return 0
return int(np.clip(pulsewidth_micros, 0, 4096))

Please double confirm whether the change point is OK, thanks!
Best,
Afreez

@Nate711
Copy link
Contributor

Nate711 commented Jun 2, 2021

sorry about the delay, yes seems fine

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

No branches or pull requests

2 participants