Created
September 24, 2022 16:21
-
-
Save JasonRBowling/16664659910432eea5924e83b5e5785b to your computer and use it in GitHub Desktop.
Wheel Speed Calculations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Calculate wheel speeds in m/s | |
#reference https://snapcraft.io/blog/your-first-robot-the-driver-4-5 | |
left_wheel_vel = data.linear.x - ((data.angular.z * wheel_base) / 2.0) | |
right_wheel_vel = data.linear.x + ((data.angular.z * wheel_base) / 2.0) | |
# convert the required wheel speeds in m/s into rpms | |
c = math.pi * wheel_diameter # wheel circumference in meters | |
right_rpm = int((right_wheel_vel / c) * 60.0 * gear_ratio) | |
left_rpm = int((left_wheel_vel / c) * 60.0 * gear_ratio) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment