ROBOTIS-GIT / OpenCR

Software for ROS Embedded board (a.k.a. OpenCR). OpenCR means Open-source Control Module for ROS.
Apache License 2.0
384 stars 238 forks source link

LIMIT_X_MAX_VELOCITY is scaled for XM430 W210-T (Waffle) and not W250-T (Burger) #323

Open Raphtor opened 1 year ago

Raphtor commented 1 year ago

(See https://github.com/ROBOTIS-GIT/turtlebot3/issues/765#issuecomment-893949135)

The ignorance of the linear velocity of 0.22 seems to be caused by the out of range data error from XL430 DYNAMIXEL. The max linear velocity of XL430 is set to 265.

The constraining logic in the turtlebot3.cpp file, cannot filter the data that exceeds the maximum value in the turtlebot3_motro_driver.cpp file.

The LIMIT_X_MAX_VELOCITY is set to 337 for some reason (looks like it is an old max velocity value of the XM430 in TurtleBot3 Waffle Pi), and this does not help filtering the goal_velocity passed from turtlebot3.cpp.

This can be identified as below.

When publishing the linear velocity 0.22, goal_velocity_from_cmd[VelocityType::LINEAR] is constrained by the max_linear_velocity = 0.033 2 pi 61 / 60 = 0.2108... wheel_velocity[LEFT] does not exceed the LIMIT_X_MAX_VELOCITY(which is 337) and therefore, 0.2108... VELOCITY_CONSTANT_VALUE(1263.632935) = 266.3749... casting 266.3749... to int32_t will return 266 which is out of range for XL430 Max Velocity (265) Meanwhile, publishing 0.21, goal_velocity_from_cmd[VelocityType::LINEAR] = 0.21 wheel_velocity[LEFT] does not exceed the LIMIT_X_MAX_VELOCITY(which is 337) and therefore, 0.21 * VELOCITY_CONSTANT_VALUE(1263.632935) = 265.3629... casting 265.3629... to int32_t will return 265 which is acceptable for XL430 Max Velocity (265). Recently we have also found some issues in TurtleBot3 ROS2 OpenCR firmware, and this will be fixed along with it.

PR here: #322

BartoszZiembickiSpyrosoft commented 1 year ago

Hi, how did you update OpenCR with your own code? I have to do similar change, but for waffle_pi. My turtlebot motor speed limit is 330, not 337 as set in the code. I'm looking into the repository for clues how to build it, but I'm a bit lost. I also found this https://emanual.robotis.com/docs/en/platform/turtlebot3/opencr_setup/#opencr-setup, but I'm lost too. It seems this instruction doesn't use turtlebot3_ros2, but turtlebot3 instead. I would like to be sure I'm building and uploading the right stuff :D