Beispiel #1
0
def get_routingdata():
    print('Please wait for loading route response data...')
    log_dir = os.path.normpath(
        os.path.join(os.path.dirname(__file__), '../../../data/log'))
    route_data_path = os.path.join(log_dir, 'passage_region_debug.bin')
    print("File: %s" % route_data_path)
    return proto_utils.get_pb_from_text_file(route_data_path, routing_pb2.RoutingResponse())
def get_routingdata():
    print 'Please wait for loading route response data...'
    log_dir = os.path.normpath(
        os.path.join(os.path.dirname(__file__), '../../../data/log'))
    route_data_path = os.path.join(log_dir, 'passage_region_debug.bin')
    print "file: ", route_data_path
    f_handle = open(route_data_path)
    route = routing_pb2.RoutingResponse()
    text_format.Parse(f_handle.read(), route)
    f_handle.close()
    print "Done"
    return route
Beispiel #3
0
def generate_message(topic, filename):
    """generate message from file"""
    message = None
    if topic == "/apollo/planning":
        message = planning_pb2.ADCTrajectory()
    elif topic == "/apollo/localization/pose":
        message = localization_pb2.LocalizationEstimate()
    elif topic == "/apollo/perception/obstacles":
        message = perception_obstacle_pb2.PerceptionObstacles()
    elif topic == "/apollo/prediction":
        message = prediction_obstacle_pb2.PredictionObstacles()
    elif topic == "/apollo/routing_response":
        message = routing_pb2.RoutingResponse()
    if not message:
        print "Unknown topic:", topic
        sys.exit(0)
    if not os.path.exists(filename):
        return None
    f_handle = file(filename, 'r')
    text_format.Merge(f_handle.read(), message)
    f_handle.close()
    return message
                x = localization.pose.position.x
                y = localization.pose.position.y
            
                #f.write(str(loc_time) + "," + str(x) + "," + str(y) + "\n")
                csv_writer_localization.writerow([loc_time, x, y])

            if msg.topic == "/apollo/canbus/chassis":
                chassis = chassis_pb2.Chassis()
                chassis.ParseFromString(msg.message)
                chassis_time = chassis.header.timestamp_sec
                speed = chassis.speed_mps
                steering_percentage = chassis.steering_percentage
            
                csv_writer_chassis.writerow([chassis_time, speed, steering_percentage])

            if msg.topic == "/apollo/routing_response":
                routingResponse = routing_pb2.RoutingResponse()
                routingResponse.ParseFromString(msg.message)
                routing_time = routingResponse.header.timestamp_sec                
                guidepost_x = routingResponse.routing_request.waypoint[1].pose.x
                guidepost_y = routingResponse.routing_request.waypoint[1].pose.y
                is_use_guidepost = routingResponse.routing_request.is_use_guidepost
                cur_id = routingResponse.routing_request.waypoint[1].id
                end_id = routingResponse.routing_request.end_id            

                csv_writer_routing.writerow([routing_time, guidepost_x, guidepost_y, is_use_guidepost+0, cur_id, end_id])

    f_localization.close()
    f_chassis.close()
    f_routing.close()