src/TrafficSimulator.py
def add_reservation_patches(self, traffic_coordinator, ax):
        ''' Add axis patches for each reservation square in the reservation matrix'''
        reservation_matrix = traffic_coordinator.get_reservation_matrix()
        m = traffic_coordinator.m
        n = traffic_coordinator.n
        dx = traffic_coordinator.dx
        if m > 0:
            for i in range(m):
                for j in range(n):
                    for (start, end, agent_id) in reservation_matrix[i][j]:
                        time_until_start_reservation = start - self.time
                        k_window_plotting_reservations = 5.0
                        if 0 < time_until_start_reservation < k_window_plotting_reservations:
                            lower_x = -1 - 0.5*dx + dx*j
                            lower_y = 1 - 0.5*dx - dx*i
                            width = dx
                            height = dx
                            reservation_patch = patches.Rectangle((lower_x,lower_y),width,height,facecolor=self.robotColorFromID(agent_id),alpha=1-(time_until_start_reservation/k_window_plotting_reservations))
                            ax.add_patch(reservation_patch)
 Add axis patches for each reservation square in the reservation matrix
Add axis patches for each reservation square in the reservation matrix
Add axis patches for each reservation square in the reservation matrix
def add_reservation_patches(self, traffic_coordinator, ax):
        reservation_matrix = traffic_coordinator.get_reservation_matrix()
        m = traffic_coordinator.m
        n = traffic_coordinator.n
        dx = traffic_coordinator.dx
        if m > 0:
            for i in range(m):
                for j in range(n):
                    for (start, end, agent_id) in reservation_matrix[i][j]:
                        time_until_start_reservation = start - self.time
                        k_window_plotting_reservations = 5.0
                        if 0 < time_until_start_reservation < k_window_plotting_reservations:
                            lower_x = -1 - 0.5*dx + dx*j
                            lower_y = 1 - 0.5*dx - dx*i
                            width = dx
                            height = dx
                            reservation_patch = patches.Rectangle((lower_x,lower_y),width,height,facecolor=self.robotColorFromID(agent_id),alpha=1-(time_until_start_reservation/k_window_plotting_reservations))
                            ax.add_patch(reservation_patch)
def add_reservation_patches ( self , traffic_coordinator , ax ) : reservation_matrix = traffic_coordinator . get_reservation_matrix ( ) m = traffic_coordinator . m n = traffic_coordinator . n dx = traffic_coordinator . dx if m > 0 : for i in range ( m ) : for j in range ( n ) : for ( start , end , agent_id ) in reservation_matrix [ i ] [ j ] : time_until_start_reservation = start - self . time k_window_plotting_reservations = 5.0 if 0 < time_until_start_reservation < k_window_plotting_reservations : lower_x = - 1 - 0.5 * dx + dx * j lower_y = 1 - 0.5 * dx - dx * i width = dx height = dx reservation_patch = patches . Rectangle ( ( lower_x , lower_y ) , width , height , facecolor = self . robotColorFromID ( agent_id ) , alpha = 1 - ( time_until_start_reservation / k_window_plotting_reservations ) ) ax . add_patch ( reservation_patch )
Add axis patches for each reservation square in the reservation matrix
Add axis patches for each reservation square in the reservation matrix
''' Add axis patches for each reservation square in the reservation matrix'''
self
traffic_coordinator
ax