You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently created a PID for lateral control. I want to check whether it can correct the agent yaw to the desired yaw. The result is not what I hoped for because the agent starts to drift away or worse rotate even though the difference between its yaw and desired yaw is only 0.001 something.
Here is the scenario,
-Agent: Tesla Model 3
-Spawn yaw: -90
-Desired yaw: -90
-Desired speed: 3 km/h
-Simulation time: 15 sec
-Step time: 0.05 sec
-Reverse gear = True
An agent is spawned on Town04 with a determined location and rotation. It has two controllers, both PID, for lateral and longitudinal. The PID takes the agent's current yaw and speed every time step and compares it with desired values. The output is PID then converted to control action throttle and steering.
Is there something wrong with my code or is there something I missed??
Can simple PID be used in CARLA??
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey everyone,
I recently created a PID for lateral control. I want to check whether it can correct the agent yaw to the desired yaw. The result is not what I hoped for because the agent starts to drift away or worse rotate even though the difference between its yaw and desired yaw is only 0.001 something.
Here is the scenario,
-Agent: Tesla Model 3
-Spawn yaw: -90
-Desired yaw: -90
-Desired speed: 3 km/h
-Simulation time: 15 sec
-Step time: 0.05 sec
-Reverse gear = True
An agent is spawned on Town04 with a determined location and rotation. It has two controllers, both PID, for lateral and longitudinal. The PID takes the agent's current yaw and speed every time step and compares it with desired values. The output is PID then converted to control action throttle and steering.
Is there something wrong with my code or is there something I missed??
Can simple PID be used in CARLA??
Here is my code
class PIDController:
def init(self, K_P, K_I, K_D, dt):
self.K_P = K_P
self.K_I = K_I
self.K_D = K_D
self.dt = dt
self.integral = 0
self.prev_error = 0
class VehiclePIDController:
def init(self, vehicle, args_lateral, args_longitudinal, max_throttle=0.75, max_brake=0.3, max_steering=0.8):
self.max_throttle = max_throttle
self.max_brake = max_brake
self.max_steering = max_steering
self.vehicle = vehicle
self.world = self.vehicle.get_world()
self.past_steering = self.vehicle.get_control().steer
def main():
client = carla.Client('localhost', 2000)
client.set_timeout(20.0)
world = client.load_world('Town04')
if name == 'main':
main()
Beta Was this translation helpful? Give feedback.
All reactions