robot rotation odometry jumps while gmapping
im trying to run gmaapping on my robot, and for the mapping purpose im controlling my robot using tele-op, and im using RPLIDAR A1, but i'm having a problem with gmapping.
when ai try to rotate my robot (in place or when moving) rviz becomes doesn't update the robot position well, for example when i rotate the robot for example by 180°, i can see in rviz for an instant it rotated 180° but then i see like the robot jumps back a couple of degrees back
(for example if i rotate the robot like 200° i can see in rviz ir rotated 200° but after a second or less it jumps back to 160° or so).
I'm also expreincing some odometry delay while runing gmapping, the odometry doesn't update instantly, it has a delay of approximately a second, it feels like lagg in updating odometry while mapping or something.
the map i recieve when i try to rotate my robot is like:
but when i try to run the robot in stratight line with as minimum rotation as possible the map looks very fine:
for the odometry update im using arduino mega to read the encoder ticks and calculate the speed of the robot, then i publish the speed in a ROS topic, then i use a python code to calculate the odometry and publish it to the odom topic.
it is important to mention that im not using robot_locaization or something else.
any ideas about what might be causing this problem?
Please try the Odometry rotation test from Troubleshooting