ROBOTIS-GIT / turtlebot3

ROS packages for Turtlebot3
http://turtlebot3.robotis.com
Apache License 2.0
1.47k stars 1.01k forks source link

Motors don't react properly on specific cmd_vel messages from Nav2 stack. #967

Closed BartoszZiembickiSpyrosoft closed 1 year ago

BartoszZiembickiSpyrosoft commented 1 year ago

ISSUE TEMPLATE ver. 0.4.0

  1. Which TurtleBot3 platform do you use?

    • [ ] Burger
    • [ ] Waffle
    • [x] Waffle Pi
  2. Which ROS is working with TurtleBot3?

    • [ ] ROS 1 Kinetic Kame
    • [ ] ROS 1 Melodic Morenia
    • [ ] ROS 1 Noetic Ninjemys
    • [ ] ROS 2 Dashing Diademata
    • [ ] ROS 2 Eloquent Elusor
    • [ ] ROS 2 Foxy Fitzroy
    • [x] ROS 2 Galactic
  3. Which SBC(Single Board Computer) is working on TurtleBot3?

    • [ ] Intel Joule 570x
    • [ ] Raspberry Pi 3B+
    • [x] Raspberry Pi 4
    • [ ] etc (Please specify your SBC here)
  4. Which OS you installed on SBC?

    • [ ] Raspbian distributed by ROBOTIS
    • [ ] Ubuntu MATE (16.04/18.04/20.04)
    • [x] Ubuntu preinstalled server (18.04/20.04)
    • [ ] etc (Please specify your OS here)
  5. Which OS you installed on Remote PC?

    • [ ] Ubuntu 16.04 LTS (Xenial Xerus)
    • [ ] Ubuntu 18.04 LTS (Bionic Beaver)
    • [x] Ubuntu 20.04 LTS (Focal Fossa)
    • [ ] Windows 10
    • [ ] MAC OS X (Specify version)
    • [ ] etc (Please specify your OS here)
  6. Specify the software and firmware version(Can be found from Bringup messages)

    • Software version: [x.x.x]
    • Firmware version: [x.x.x]
    • OpenCR: there is released_0.2.1.txt file in my last update package.
  7. Specify the commands or instructions to reproduce the issue.

    Option 1) Run either ros2 topic pub --once /cmd_vel geometry_msgs/Twist '{linear: {x: 0.15, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 1.0}}' or ros2 topic pub --once /cmd_vel geometry_msgs/Twist '{linear: {x: 0.12, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 1.0}}' Option 2) Navigate with nav2 stack using rviz

  8. Copy and Paste the error messages on terminal.

    • No error messages visible in terminal
  9. Please describe the issue in detail.

Robot drives mostly fine. But in some specific cases motors don't react correctly on /cmd_vel messages from DWBController. Robot stucks in place just doing micro-moves. It can be seen of attached gif. On the left side there is live plot of /cmd_vel messages (linear.x and angular.z). I updated OpenCR today using https://github.com/ROBOTIS-GIT/OpenCR-Binaries/raw/master/turtlebot3/ROS2/latest/opencr_update.tar.bz2 and it didn't solve the issue. I was able to reproduce this issue also by publishing /cmd_vel with both of below commands: 1) ros2 topic pub --once /cmd_vel geometry_msgs/Twist '{linear: {x: 0.15, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 1.0}}' 2) ros2 topic pub --once /cmd_vel geometry_msgs/Twist '{linear: {x: 0.12, y: 0.0, z: 0.0}, angular: {x: 0.0,y: 0.0,z: 1.0}}'

TurtleBotCmdVelIssue_short

BartoszZiembickiSpyrosoft commented 1 year ago

It's worth to note that also RotationShimController is not working on turtlebot. Behaviour is very similar - doing micro-moves in place, but I didn't record anything for that case.

BartoszZiembickiSpyrosoft commented 1 year ago

According to my analysis robot drives fine when motors get the velocity in range [-330,330]. When abs(v) > 330 the corresponding motor just stays in place. Add very small, alternating speed of other wheel and we have micro moves. In the example from gif we have linear speed oscillating between 0.15 and 0.12. Adding angular speed of 1 for each cases gives (according to my analysis) left wheel speed of: 8 and -29. Since right wheel is frozen robot just oscillates in place. Here is a table with my test results. Red rows contain values leading to "stuck robot", green ones work fine: image

Below we have clearly visible border value. OpenCR turtlebot code casts to integer, so we observe clear border value at 330: image

BartoszZiembickiSpyrosoft commented 1 year ago

It turned out to be an issue of too big motor speed limit in OpenCR turtlebot3_motor_driver.cpp for my Waffle. I'm not sure how to check the dynamixel model I have, but lowering the limit to 75 RPM (327 in servo units) did the job and now robot accepts all velocities properly clamping the values. Doesn't get stuck out of nowhere now. Closing the issue.