EnricoReg / robot-sf

Environment for the Simulation of a Robot moving in a a pedestrians-filled space
GNU General Public License v3.0
2 stars 2 forks source link

Kinematics Steering Bug #2

Open Bonifatius94 opened 1 year ago

Bonifatius94 commented 1 year ago

Hey guys, I'm very suspicious whether your robot can even steer to the right because the wheel speed isn't properly updated, see https://github.com/EnricoReg/robot-sf/blob/main/robot_sf/robot.py#L120. Can you confirm or disprove my theory?

EnricoReg commented 1 year ago

Hi Marco, sorry for the late reply. It's a very busy period for us (and for Matteo in particular, who is the responsible for the implementation of the robot model and therefore the component you're mentioning). Unfortunately I don't think I can help you with the issue you raised, but maybe Matteo will be able to reach out to you after he has submitted his PhD thesis.

We will complete the re-submission of the paper after the first round of reviews by the end of this month, so we are hopeful to be able to publish it soon. In the meantime I share with you the link to the preprint: https://www.researchgate.net/profile/Matteo-Caruso-2/publication/366215925_Robot_Navigation_in_Crowded_Environments_a_Reinforcement_Learning_Approach/links/63983aabe42faa7e75bc59f3/Robot-Navigation-in-Crowded-Environments-a-Reinforcement-Learning-Approach.pdf

KR Enrico

Il giorno mar 3 gen 2023 alle ore 18:22 Marco Tröster < @.***> ha scritto:

Hey guys, I'm very suspicious whether your robot can even steer to the right because the wheel speed isn't properly updated, see https://github.com/EnricoReg/robot-sf/blob/main/robot_sf/robot.py#L120. Can you confirm or disprove my theory?

— Reply to this email directly, view it on GitHub https://github.com/EnricoReg/robot-sf/issues/2, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO3JKNDE4VHP5QXZXHVIVZ3WQRN5ZANCNFSM6AAAAAATP5FN6Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Bonifatius94 commented 1 year ago

No problem. I think I fixed the issue. Your "bug" is really just a little typo, no worries :wink: You probably need to replace

self.wheels_speed['left'] = (dot_x - self.interaxis_lenght*dot_orient/2)/self.wheel_radius
self.last_wheels_speed['right'] = (dot_x + self.interaxis_lenght*dot_orient/2)/self.wheel_radius

with

self.wheels_speed['left'] = (dot_x - self.interaxis_lenght*dot_orient/2)/self.wheel_radius
self.wheels_speed['right'] = (dot_x + self.interaxis_lenght*dot_orient/2)/self.wheel_radius

such that the right wheel speed is assigned a value other than zero (see line 120).

In your current version, self.wheels_speed['right'] is always zero. But in one of the other formulas, you're computing the mean of the last and current wheel speeds for both wheels, like this (last_speed + current_speed) / 2 (see line 134).

new_x_local = self.wheel_radius/2*((self.last_wheels_speed['left'] + self.wheels_speed['left'])/2 \
    + (self.last_wheels_speed['right'] + self.wheels_speed['right'])/2)*Ts

It doesn't make a lot of sense to have the current wheel speed of the right wheel to always be zero while the current wheel speed for the left wheel is assigned a value other than zero. This obviously makes it a lot harder if not impossible to steer properly, considering the wheels on one side are spinning much faster than the wheels on the other side. It really has to be a bug :thinking:

But if you want to be safe, then consider merging my changes back to your repo. I've already fixed the issue on my fork and verified that the steering is ok :wink: