stanfordroboticsclub / StanfordQuadruped

MIT License
1.46k stars 561 forks source link

Abnormal process about pwm_to_duty_cycle #23

Open mangdangDOTnet opened 3 years ago

mangdangDOTnet commented 3 years ago

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 commented 3 years ago

sorry about the delay, yes seems fine