def _plot_track_ped(self): if constants.tracked_pedestrian_id != -1: target_force = force_model.group_pedestrian_id_property( constants.tracked_pedestrian_id, "target_force") if target_force != -999.0: wall_force = force_model.group_pedestrian_id_property( constants.tracked_pedestrian_id, "wall_force") ingroup_force = force_model.group_pedestrian_id_property( constants.tracked_pedestrian_id, "ingroup_force") outgroup_force = force_model.group_pedestrian_id_property( constants.tracked_pedestrian_id, "outgroup_force") velocity_x = force_model.group_pedestrian_id_property( constants.tracked_pedestrian_id, "velocity_x") speed = force_model.group_pedestrian_id_property( constants.tracked_pedestrian_id, "velocity") (x, y) = force_model.group_pedestrian_id_property( constants.tracked_pedestrian_id, "position") current_position = int(round(x + self.shift)) # +30 #plot for force and velocity based on time #self.pedestrian_track._addsample(self.time , target_force, ingroup_force, outgroup_force, wall_force,velocity_x,current_position) self.pedestrian_track._addsample(self.time, target_force, ingroup_force, outgroup_force, wall_force, speed, current_position) data = [] group_population_number = int(force_model.get_population_size()) for i in range(group_population_number): ped_id = int(force_model.group_pedestrian_a_property(i, "ped_id")) target_force = force_model.group_pedestrian_a_property( i, "target_force") ingroup_force = force_model.group_pedestrian_a_property( i, "ingroup_force") outgroup_force = force_model.group_pedestrian_a_property( i, "outgroup_force") wall_force = force_model.group_pedestrian_a_property( i, "wall_force") velocity_x = force_model.group_pedestrian_a_property( i, "velocity_x") speed = force_model.group_pedestrian_id_property(i, "velocity") (x, y) = force_model.group_pedestrian_a_property(i, "position") current_position = int(round(x + self.shift)) #+30 #data.append([ped_id,target_force,ingroup_force,outgroup_force,wall_force,velocity_x,current_position]) data.append([ ped_id, target_force, ingroup_force, outgroup_force, wall_force, speed, current_position ]) self.pedestrian_track._addsample2(self.time, data)
def draw_tracked_ped(self): target_vector = force_model.group_pedestrian_id_property(constants.tracked_pedestrian_id, "target_vector") ingroup_vector = force_model.group_pedestrian_id_property(constants.tracked_pedestrian_id, "ingroup_vector") outgroup_vector = force_model.group_pedestrian_id_property(constants.tracked_pedestrian_id, "outgroup_vector") wall_vector = force_model.group_pedestrian_id_property(constants.tracked_pedestrian_id, "wall_vector") (x,y) = force_model.group_pedestrian_id_property(constants.tracked_pedestrian_id, "position") r = force_model.group_pedestrian_id_property(constants.tracked_pedestrian_id, "radius") group_id = force_model.group_pedestrian_id_property(constants.tracked_pedestrian_id, "groupid") if math.isnan(x) ==False and math.isnan(y)==False: self._canvas("draw_pedestrian_tracking", x,y,r,group_id, target_vector, ingroup_vector, outgroup_vector, wall_vector)