Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Issue regarding changing the destination of onboarded person for dispatched taxis

Changing the destination for a person that is already in a vehicle is currently not supported. 
removeStages will evict the person from it's current vehicle and appendDrivingStage requires the person to be picked up anew.


Am Di., 8. Juli 2025 um 09:37 Uhr schrieb Jay Patel via sumo-user <sumo-user@xxxxxxxxxxx>:
Hello,
I have been trying to change the destination of an onboarded person in the taxi which was using the dispatchTaxi() but unable to do so and got the warning of teleporting the person. I am appending the code below of changing the person's destination written by me. Please review the code and help me to solve the issue. 

Thanks,
Jay

def change_person_destination(person_id, new_lane):
    try:
        stage = traci.person.getStage(person_id)

        if stage.type != traci.constants.STAGE_DRIVING:
            print(f"[Skip] Person {person_id} is not in a driving stage.")
            return

        vehicle_id = traci.person.getVehicle(person_id)

        current_edge = traci.person.getRoadID(person_id)
        if not current_edge:
            print(f"[Error] Could not get current road for {person_id}")
            return

        traci.person.removeStages(person_id)
        traci.person.appendDrivingStage(person_id, new_lane, "taxi")

        print(f"[Updated] Person {person_id}'s destination changed to lane {new_lane}")

    except Exception as e:
        print(f"[Error] Failed to change destination for {person_id}: {e}")
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top