Open SHITIANYU-hue opened 3 years ago
Hi SHITIANYU,
The agent in PID controller script does not avoid obstacles, actually. It just tries to follow the lane (a.k.a. Lane Following).
In Line#71:
obs, reward, done, info = env.step(action)
we send the action that the agent should take in the environment. What's that action
? It is a list of size 2 (2 numbers) which refers to the left wheel velocity and the right wheel velocity.
In Line#69:
action = wrapper.convert([speed, steering])
we get the action
, which is converted from the list [speed, steering]
to [leftWheelVelocity, rightWheelVelocity]
. Why is that? Because the Simulator
accepts only the wheel velocities as action.
In Line#67:
steering = k_p*distance_to_road_center + k_d*angle_from_straight_in_rads + k_i * sum(prev_angles)
we see how steering
is calculated with respect to PID parameters. These parameters are tuned manually, in other words they're chosen manually after trying bunch of different combinations.
All in all, the script is just trying to stay in the lane and to follow it, without avoiding obstacles.
Thanks for your reply! Yes, this is as same as my understanding, is it in the simulator, they implement the obstacle avoidance function? (I saw in the simulation it could avoid static obstacles) And the above script is trying to stay in the lane and to follow it, why the robot can move forward rather than just stand still in the middle of the lane?
I guess they don't do obstacle avoidance, they just check if the agent collided with an object or not (see the function proximity penalty
at Line#1206). In case the agent collides with an object they apply a penalty to the reward, see function compute_reward
at Line#1419
Maybe they have another script for doing obstacle avoidance, not that I know of. In that regard, you can contact the creators of the simulator on their Slack channel or by their GitHub repo
Hello,
I have a little confusion about the gym-duckietown simulator. My confusion is how does the robot moves forward and avoids obstacles?
For example, in the PID controller script, I didn't see the implementation of controlling the robot to move forward and avoid obstacles. But it can do this in the simulation after I run this script. According to my understanding, it is mainly for path tracking. Does the simulator has already provided the motion planning part?