SRA-VJTI / sra-board-component

ESP-IDF component for SRA Board
https://sravjti.in/sra-board-component/
MIT License
36 stars 20 forks source link

Corrected the calculate pulsewidth formula in servo.c #40

Closed ombhilare999 closed 3 years ago

ombhilare999 commented 3 years ago

Current Pulsewidth formula: https://github.com/SRA-VJTI/sra-board-component/blob/529cd97d415df88d2f0b54c820ee9f486f5e824d/src/servo.c#L52

Pulsewidth formula in ROS2.1: cal_pulsewidth_micro = (MICRO_SERVO_MIN_PULSEWIDTH + 2 (((MICRO_SERVO_MAX_PULSEWIDTH - MICRO_SERVO_MIN_PULSEWIDTH) (degree_of_rotation)) / (SERVO_MAX_DEGREE)));

{https://github.com/SRA-VJTI/ROS-Workshop-2.1/blob/421385332b833aa6e2deba377620c4152f8a4ee7/esp32_codes/components/ros_sra20/servo.c#L52}

I have made changes accordingly and tested the formula used in ROS2.1 in hardware. It's working.