Closed dsryzhov closed 3 years ago
Hi @dsryzhov
You presented two issues:
(1) The code in .../p6/.../hadabot_odom.cpp may be incorrect, specifically
// Compute distance traveled for each wheel
float d_left_m = (wheel_radps_left_ * dt_s * wheel_radius_m_) / PI;
Should be:
// Compute distance traveled for each wheel
float d_left_m = wheel_radps_left_ * dt_s * wheel_radius_m_;
Yes - you are right!
(2) Equation in Implement ROS2 odometry using VSCode running in a web browser blog article is incorrect.
I will fix that too!
Thanks Jack
Great!
I assume that formulas used in code to compute distance traveled for each wheel is incorrect No need to divide by PI // Compute distance traveled for each wheel float d_left_m = (wheel_radpsleft dt_s wheel_radiusm) / PI; float d_right_m = (wheel_radpsright dt_s wheel_radiusm) / PI;
Formulas in blog post is also incorrect https://blog.hadabot.com/implement-ros2-odometry-using-vscode-in-web-browser.html No need to multiply by 2 float d_left_m = 2 (wheel_radpsleft dt_s wheel_radiusm); float d_right_m = 2 (wheel_radpsright dt_s wheel_radiusm);
The correct formulas should be float d_left_m = (wheel_radpsleft dt_s wheel_radiusm); float d_right_m = (wheel_radpsright dt_s wheel_radiusm);
Let's check it if wheel_radpsleft = 2 pi (one rotation per second) distance should be equal 2pi*wheel_radius_m Using last formulas we obtainb correct values