cyberbotics / webots_ros

Webots ROS package
88 stars 39 forks source link

Problem with Odom values and rotation #106

Closed luisebt995 closed 2 years ago

luisebt995 commented 2 years ago

Hello,

I am trying to implement a simulation of a robot using webot_ros, so far so good. But when I try to rotate the robots, I get a delay between the rotation of the robots in webots, and the rotation in rviz.

BenjaminHug8 commented 2 years ago

Hi, could you elaborate a little bit more please?

How do you rotate your robot in Webots? Just to be sure, the rotation appears in Rviz after than it appears in Webots (not the inverse)? Can you define a little bit more delay ? Is that 1 second, 5, 30 ? And according to that question how heavy is your simulation (a lot of robots/objects or not)?

luisebt995 commented 2 years ago

Hello,

ROSDistro: Melodic Webots: R2022a Packages: summit_xl_webots, summit_xl_sim

We're using Summit_xl from Robotnik, I used the tool urdf2webots to convert the urdf file to proto format. We publish in the topic /cmd_vel a Twist message with an angular.z value, what happens is that the controllers is calculating the odometry based on the position sensor of each wheels. What happens is that webots is simulating friction and other physical phenomenons so when we are visualizing in Rviz there is a discrepancy between the tf of the robot and the LaserScan lectures.

We've tried to increase the friction between the wheels and the floor, but this issue is not related with the friction.

I'm sending you a link with a video representation of the problem: https://drive.google.com/file/d/1_cIM1NoGxLIbCOgOFIpleaBN3LoNtzVH/view?usp=sharing

BenjaminHug8 commented 2 years ago

Ok so then the issue is not a delay, but the fact you base your odometry only on your position sensor and that you send this to Rviz? If it is the case you probably should include other information in your odometry. You can either use the laserscan and Kalman filter in case you environment is static or maybe add a Gyroscope on your robot to determine your rotational speed?

From what I can see the Laserscan is correct relatively to the robot in both Webots and RViz, but the information that RViz receive on the pose of the robot in the world is false.

BenjaminHug8 commented 2 years ago

Digging a bit more, I founded that some people had this kind of issues with a non correct joint between the wheels and the body of the robot (https://forum.dexterindustries.com/t/ugh-my-odometry-is-terrible/8440/14).

Can you ensure that this is correct in your URDF, and if so, check in Webots that is correctly in your robot too?

luisebt995 commented 2 years ago

Hi,

In the end we manage to fix this issue using a different type of controller for the movement and pub of odom data using the information from the imu topic. You were right about including more information to our odom topic.

Thank You!

omichel commented 2 years ago

Can we close the issue?

luisebt995 commented 2 years ago

Yes