carla-simulator / carla

Open-source simulator for autonomous driving research.
http://carla.org
MIT License
10.88k stars 3.5k forks source link

/ #3883 Vehicle is not moving in turning waypoints #6829

Closed SExpert12 closed 6 months ago

SExpert12 commented 9 months ago
          / #3883

Originally posted by @SExpert12 in https://github.com/carla-simulator/carla/issues/3883#issuecomment-1761290642

I am working with CARLA 0.9.14 with Ubuntu. I am able to move vehicle in straight movement using the following code:

def drive_through_turn(planned_route,vehicle,PID): speed = 5 i=0 target=planned_route[0]

print("target",target.lane_id)

    #print("road_id",target.road_id)

    while True:
        if target!=None:
            print('in target',target)
            vehicle_loc= vehicle.get_location()
            #distance_v =find_dist_veh(vehicle_loc,target)
            control = PID.run_step(speed,target)

            vehicle.apply_control(control)
            i=i+1
            target = planned_route[i]
            #print("\ntarget",target)
        if i==(len(planned_route)-1):
            print("last waypoint reached")
            break
    control = PID.run_step(0,planned_route[len(planned_route)-1])
    vehicle.apply_control(control)

def turn_PID(vehicle):

    args_lateral_dict = {
            'K_P': 1,
            'K_D': 0.1,
            'K_I': 0.07

            ,'dt': 1.0 / 10.0
            }

    args_long_dict = {
            'K_P': 1,
            'K_D': 0.0,
            'K_I': 0.75
            ,'dt': 1.0 / 10.0
            }

    PID=controller.VehiclePIDController(vehicle,args_lateral=args_lateral_dict,args_longitudinal=args_long_dict)

    return PID

How to change this code for a vehicle having a turning movement? The vehicle is rotating at its place when I use this code for a vehicle having a turning movement.

stale[bot] commented 7 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.