Hi,

you can use traci.lane.getAllowed("lane id") to check if the given lane allows 
your vehicle type (see 
https://sumo.dlr.de/docs/TraCI/Lane_Value_Retrieval.html). With 
traci.lane.setAllowed("lane id") you can change the vehicle types that are 
allow in the given lane (see 
https://sumo.dlr.de/docs/TraCI/Change_Lane_State.html).

I'm not sure if it Is the best solution, but you could add turnarounds in your 
net to avoid dead ends and allow the vehicles to turn around in the next 
junction. You can do this with netconvert:
netconvert -s yournet.net.xml --no-turnarounds false -o newnet.net.xml (see 
https://sumo.dlr.de/docs/netconvert.html)

Regards,
Giuliana

From: [email protected] [mailto:[email protected]] On 
Behalf Of Paul Fierro
Sent: Freitag, 18. September 2020 19:07
To: Sumo project User discussions
Subject: [sumo-user] Dead End - changeTarget/MoveToXY issues


I want to set up the problem properly and then highlight the issue I am having.

I have a series of people that need to be picked up by a busroute, and I see 
numerous capabilities to handle bus routes that I am not using as of yet.  What 
I am doing now is I am visiting a RoadId or route segment near the person and 
when the vehicle arrives the person will board and then the bus will change its 
Target to a new destination target to the next customer in the route.

at times this fails because the person is on a road segment that does Not allow 
vehicles to travel down, like local road/rural road/private road.  I have 
gotten around this by writing a radius alternative algorithm using your api too 
discover a nearby road that does allow vehicles.  This works fine.

Occasionally when the vehicle arrives to a person's nearby location, the route 
ends on a dead-end route.  In this case changeTarget does not turn the vehicle 
around, instead what may be an available destination is failed, as well as I am 
sure the original problem which some of the edges are not allowing vehicle's 
may also be failing.

Simply, I have tried moveToXY as a way to re orient the vehicle at angle -= 180 
degrees.  This would seem to be needed a prerequisite to calling changeTarget.  
This is my current thinking and strategy.  But somehow, I am calling movetoXY 
in manner that does not work.  It must be in lane_index, edge_id, angle, xv, yv 
values.  I need to turn this vehicle around so a change Target can take it to 
the next customer.

Lastly, is there a way to check if an edge allows vehicle or not, and 
potentially can that be changed.

        tmp = traci.simulation.convertRoad( XcnvTry, YcnvTry )
        destEdgeId = tmp[0]
        lane_index = tmp[2]

        nptabu = np.array(tabu)
        stateNotTabu = StateNotInTabu([destEdgeId], nptabu)
        if stateNotTabu:
            tabu.append([destEdgeId])
            print('Size of Tabu List:', len(tabu))

            try:
                traci.vehicle.changeTarget(prid, destEdgeId )
                #done = True
                headingToX = XcnvTry
                headingToY = YcnvTry
                initialChampionFound = True
                dtry = distEuclid( XcnvTry, YcnvTry, XCustcnv, YCustcnv )
                if dtry < chDfrmOrig:
                    chEdgeId = destEdgeId
                    chDfrmOrig = dtry
                    chXtry = XcnvTry
                    chYtry = YcnvTry
                    print( "NEW CHAMPION - Base Radius stRadius:", stRadius ," 
cnt:", cnt, " ch:", chDfrmOrig, chXtry , chYtry  )
                    if circularMove:
                        break
            except:
                pass

    return chEdgeId, chXtry, chYtry, cnt

Could not make Bold work:

#     route_id = traci.vehicle.getRouteID(prid)
# edge_id = traci.vehicle.getRoadID(prid)
# lane_index = traci.vehicle.getLaneIndex(prid)
# position = traci.vehicle.getPosition(prid)
# xv = tuple(position)[0]
# yv = tuple(position)[1]
# angle = traci.vehicle.getAngle(prid)
# angle -= 180.0
#
# fndMinus = edge_id.find('-')
# if fndMinus >= 0:
#     edge_id = edge_id[1:]
# else:
#     edge_id = '-' + edge_id
#
# traci.vehicle.moveToXY(prid, edge_id, lane_index, xv + 50, yv + 50, angle, 
keepRoute=2)
# try:
#     traci.vehicle.changeTarget(prid, destEdgeId)
#     # done = True
#     headingToX = XcnvTry
#     headingToY = YcnvTry
#     initialChampionFound = True
#     dtry = distEuclid(XcnvTry, YcnvTry, XCustcnv, YCustcnv)
#     if dtry < chDfrmOrig:
#         chEdgeId = destEdgeId












_______________________________________________
sumo-user mailing list
[email protected]
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/sumo-user

Reply via email to