open-rmf / rmf_simulation

Support plugins for simulating RMF scenarios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Robot spinning unnecessarily

xiyuoh opened this issue · comments

commented

Description of the bug

Recent changes introduced a bug in simulation, where cleaning robots tend to spin on the spot in the middle of a cleaning task. In earlier commits, the robot only pauses at the spot instead of turning around. This can be reproduced in hotel world by running the clean_lobby task. The latest working commit without spinning is 80b22b9.

Edit: Observed when using demo fleet adapter, not full_control

No spinning:

lobby.pause.1.mp4

Spinning:

lobby.spin.1.mp4
commented

The behavior is not unique to cleaning and is observed for both reversible and non-reversible slotcars while following a path.

Recent changes introduced a bug in simulation, where cleaning robots tend to spin on the spot in the middle of a cleaning task. In earlier commits, the robot only pauses at the spot instead of turning around. This can be reproduced in hotel world by running the clean_lobby task. The latest working commit without spinning is 80b22b9.

When you say that's the latest commit it means you tried all the different commits and the first one where the behavior is exhibited is the one that was merged immediately after the one you mentioned - #38?
If that's the case it sounds a bit strange, int #38 the only functional change is adding a check for reversibility here so the behavior for reversible robots shouldn't have changed

commented

Hmm I tried every commit from 0455e7a to 80b22b9 and found that the one after (#38) starts to exhibit the spinning behaviour.

I tried to run the latest main in rmf_demos with the incriminated commit and this is what I see:

extra_turn.mp4

So there is one extra turn but I can't reproduce the long oscillating behavior, can you try a fresh vcs pull, clean build and post the output of vcs status?

commented

I believe the extra turn is normal before docking. Anyway my bad, i should have mentioned that this occurs when using the new demo fleet adapter for me, not sure what is causing the difference between the rmf_simulation commits. When i try it with the current rmf_demos/main and it works fine just like yours.

I can reproduce, although only on Gazebo on my machine (i.e. doing rmf_demos_ign instead of rmf_demos_gz gets rid of the issue). Can you confirm that's the case for you as well?

commented

Yup same, the spinning doesn't occur in ignition for me too. I found that during the spinning, cleanerBotA is hovering between rotate_towards_next_target and !rotate_towards_next_target. Increasing the close_enough threshold to 0.04 gets rid of the spinning in the docking cases, but i'm not sure that's a good fix

Yup same, the spinning doesn't occur in ignition for me too. I found that during the spinning, cleanerBotA is hovering between rotate_towards_next_target and !rotate_towards_next_target. Increasing the close_enough threshold to 0.04 gets rid of the spinning in the docking cases, but i'm not sure that's a good fix

That would explain why there is a difference between the two simulators, in Gazebo we simulate the vehicle dynamics more accurately (i.e. we apply torques to the wheels and as a consequence robots move). In Ignition instead we do a much simpler kinematic simulation where we treat the vehicle as a box and set its target speed so I would expect minor differences in the behavior.
Imho 0.04 (4cm) is a very reasonable threshold, I'm happy to increase it to that value if it helps with this issue.

commented

I see! I ran all the demo cleaning tasks + a few other loops with the increased threshold, looks fine so far. If you are ok let's increase it, thanks!

commented

Closing this issue as the pause and spinning can be fixed altogether from the fleet adapter