From 2a65a2473c09cd91c3b735cb11de1d9c8c78afd9 Mon Sep 17 00:00:00 2001 From: Longtao Lin Date: Tue, 14 Jan 2020 13:40:00 -0800 Subject: [PATCH] common: python 2 to 3 for modules/tools (#10627) * 2to3 batch update * remove unnecessary changes * take care of division --- modules/tools/common/logger.py | 2 +- modules/tools/common/message_manager.py | 4 ++-- modules/tools/common/proto_utils.py | 2 +- modules/tools/configurator/ModuleConf.py | 6 ++--- modules/tools/configurator/configurator.py | 6 ++--- modules/tools/control_info/control_info.py | 6 ++--- .../tools/create_map/convert_map_txt2bin.py | 2 +- modules/tools/create_map/create_map.py | 2 +- modules/tools/create_map/lane_recorder.py | 2 +- modules/tools/dump_gpsbin/dump_gpsbin.py | 2 +- .../extrinsics_broadcaster.py | 2 +- .../control_calibration_sanity_check.py | 2 +- .../gen_vehicle_protocol/extract_dbc_meta.py | 2 +- modules/tools/gen_vehicle_protocol/gen.py | 2 +- .../gen_vehicle_protocol/gen_proto_file.py | 2 +- .../gen_vehicle_protocol/gen_protocols.py | 6 ++--- .../gen_vehicle_controller_and_manager.py | 2 +- modules/tools/map_gen/add_signal.py | 2 +- modules/tools/map_gen/extract_path.py | 2 +- modules/tools/map_gen/map_gen.py | 2 +- modules/tools/map_gen/map_gen_single_lane.py | 2 +- .../map_gen/map_gen_two_lanes_right_ext.py | 2 +- modules/tools/map_gen/plot_path.py | 2 +- modules/tools/mapshow/libs/localization.py | 2 +- modules/tools/mapshow/libs/map.py | 24 +++++++++---------- modules/tools/mapshow/libs/path.py | 2 +- modules/tools/mapshow/libs/planning.py | 6 ++--- modules/tools/mapshow/libs/plot_planning.py | 16 ++++++------- modules/tools/mapshow/libs/plot_smoothness.py | 10 ++++---- modules/tools/mapshow/libs/plot_st.py | 8 +++---- modules/tools/mapshow/libs/subplot_path.py | 4 ++-- modules/tools/mapshow/libs/subplot_sl_main.py | 2 +- modules/tools/mapshow/libs/subplot_speed.py | 2 +- modules/tools/mapshow/libs/subplot_st_main.py | 2 +- .../tools/mapshow/libs/subplot_st_speed.py | 2 +- .../tools/mapshow/libs/subplot_traj_acc.py | 4 ++-- .../tools/mapshow/libs/subplot_traj_path.py | 4 ++-- .../tools/mapshow/libs/subplot_traj_speed.py | 4 ++-- modules/tools/mapshow/mapshow.py | 2 +- modules/tools/mapshow/roadshow.py | 2 +- modules/tools/mapviewers/gmapviewer.py | 2 +- modules/tools/mapviewers/hdmapviewer.py | 2 +- modules/tools/mobileye_viewer/chassis_data.py | 2 +- .../mobileye_viewer/localization_data.py | 2 +- .../tools/mobileye_viewer/location_server.py | 4 ++-- .../tools/mobileye_viewer/mobileye_data.py | 12 +++++----- .../tools/mobileye_viewer/mobileye_viewer.py | 2 +- .../tools/mobileye_viewer/planning_data.py | 2 +- modules/tools/mobileye_viewer/plot_routing.py | 2 +- modules/tools/mobileye_viewer/routing_data.py | 2 +- .../tools/mobileye_viewer/subplot_routing.py | 2 +- .../tools/mobileye_viewer/subplot_s_speed.py | 2 +- .../tools/mobileye_viewer/subplot_s_theta.py | 2 +- .../tools/mobileye_viewer/subplot_s_time.py | 2 +- modules/tools/mobileye_viewer/view_subplot.py | 2 +- .../mock_routing/mock_routing_request.py | 2 +- .../tools/navigation/config/navi_config.py | 6 ++--- .../driving_behavior/path_extract.py | 2 +- .../navigation/driving_behavior/path_plot.py | 2 +- .../driving_behavior/path_process.py | 2 +- .../driving_behavior/plot_gps_path.py | 2 +- .../perception_adapter/perception_adaper.py | 2 +- .../tools/navigation/planning/ad_vehicle.py | 2 +- .../navigation/planning/heading_decider.py | 2 +- .../planning/lanemarker_corrector.py | 2 +- .../tools/navigation/planning/local_path.py | 2 +- .../planning/navigation_mobileye_debug.py | 2 +- .../planning/navigation_planning.py | 2 +- .../planning/navigation_routing_debug.py | 2 +- .../navigation/planning/obstacle_decider.py | 2 +- .../tools/navigation/planning/path_decider.py | 2 +- .../navigation/planning/provider_chassis.py | 2 +- .../planning/provider_localization.py | 2 +- .../navigation/planning/provider_mobileye.py | 2 +- .../navigation/planning/provider_routing.py | 2 +- .../navigation/planning/reference_path.py | 2 +- .../navigation/planning/speed_decider.py | 2 +- .../planning/trajectory_generator.py | 2 +- .../navigation/routing/navigation_routing.py | 6 ++--- .../simulator/navigation_view_backend.py | 4 ++-- modules/tools/navigator/dbmap/generator.py | 2 +- modules/tools/navigator/dbmap/libs/point.py | 2 +- modules/tools/navigator/dbmap/viewer.py | 2 +- modules/tools/navigator/navigator.py | 2 +- modules/tools/navigator/record_extractor.py | 2 +- modules/tools/navigator/viewer_raw.py | 2 +- modules/tools/navigator/viewer_smooth.py | 2 +- .../auto_param_tuning.py | 2 +- .../distance_approach_python_interface.py | 2 +- .../distance_approach_visualizer.py | 2 +- .../hybrid_a_star_python_interface.py | 2 +- .../hybrid_a_star_visualizer.py | 2 +- .../open_space_roi_interface.py | 2 +- .../open_space_roi_visualizer.py | 2 +- modules/tools/ota/create_sec_package.py | 2 +- modules/tools/ota/query_client.py | 4 ++-- modules/tools/ota/update_client.py | 4 ++-- modules/tools/ota/verify_client.py | 4 ++-- modules/tools/perception/empty_prediction.py | 2 +- modules/tools/perception/extend_prediction.py | 2 +- modules/tools/perception/print_perception.py | 2 +- modules/tools/perception/replay_perception.py | 2 +- .../tools/planning/plot_trajectory/main.py | 10 ++++---- .../planning/plot_trajectory/mkz_polygon.py | 2 +- modules/tools/plot_control/plot_control.py | 2 +- modules/tools/plot_control/realtime_test.py | 2 +- modules/tools/plot_planning/chassis_speed.py | 2 +- modules/tools/plot_planning/imu_acc.py | 2 +- .../plot_planning/imu_angular_velocity.py | 2 +- .../tools/plot_planning/imu_av_curvature.py | 2 +- modules/tools/plot_planning/imu_speed.py | 2 +- modules/tools/plot_planning/imu_speed_acc.py | 12 +++++----- modules/tools/plot_planning/imu_speed_jerk.py | 2 +- modules/tools/plot_planning/planning_speed.py | 2 +- modules/tools/plot_planning/plot_acc_jerk.py | 2 +- .../tools/plot_planning/plot_chassis_acc.py | 2 +- .../tools/plot_planning/plot_planning_acc.py | 2 +- .../plot_planning/plot_planning_speed.py | 2 +- .../tools/plot_planning/plot_speed_jerk.py | 2 +- modules/tools/plot_planning/record_reader.py | 2 +- .../plot_planning/speed_dsteering_data.py | 2 +- .../plot_planning/time_curvature_data.py | 4 ++-- .../tools/plot_trace/plot_planning_result.py | 2 +- modules/tools/plot_trace/plot_trace.py | 2 +- modules/tools/prediction/__init__.py | 2 +- .../prediction/data_pipelines/__init__.py | 2 +- .../data_pipelines/common/__init__.py | 2 +- .../common/bounding_rectangle.py | 8 +++---- .../data_pipelines/common/configure.py | 2 +- .../data_pipelines/common/data_preprocess.py | 2 +- .../data_pipelines/common/feature_io.py | 2 +- .../prediction/data_pipelines/common/log.py | 2 +- .../common/online_to_offline.py | 6 ++--- .../data_pipelines/common/rotation2d.py | 4 ++-- .../data_pipelines/common/trajectory.py | 8 +++---- .../prediction/data_pipelines/common/util.py | 2 +- .../data_pipelines/common/vector2d.py | 2 +- .../generate_cruise_labels.py | 2 +- .../data_pipelines/junctionMLP_train.py | 6 ++--- .../prediction/data_pipelines/merge_h5.py | 4 ++-- .../prediction/data_pipelines/mlp_train.py | 18 +++++++------- .../data_pipelines/proto/__init__.py | 2 +- .../multiple_gpu_estimator/counting.py | 2 +- .../multiple_gpu_estimator/preprocessing.py | 2 +- modules/tools/realtime_plot/item.py | 2 +- modules/tools/realtime_plot/realtime_plot.py | 2 +- modules/tools/realtime_plot/stitem.py | 2 +- modules/tools/realtime_plot/xyitem.py | 2 +- .../common/distribution_analyzer.py | 4 ++-- .../common/error_code_analyzer.py | 6 ++--- .../common/error_msg_analyzer.py | 6 ++--- .../common/frechet_distance.py | 2 +- .../common/statistical_analyzer.py | 2 +- .../lidar_endtoend_analyzer.py | 2 +- modules/tools/record_analyzer/main.py | 2 +- .../record_analyzer/metrics/curvature.py | 2 +- .../record_analyzer/metrics/frame_count.py | 2 +- .../metrics/lat_acceleration.py | 2 +- .../tools/record_analyzer/metrics/latency.py | 2 +- .../metrics/lon_acceleration.py | 2 +- .../record_analyzer/metrics/reference_line.py | 2 +- .../module_control_analyzer.py | 2 +- .../module_planning_analyzer.py | 2 +- .../record_analyzer/tools/dump_message.py | 2 +- .../tools/perception_obstacle_sender.py | 2 +- modules/tools/record_play/rtk_player.py | 10 ++++---- modules/tools/record_play/rtk_recorder.py | 2 +- .../relative_map_viewer.py | 2 +- modules/tools/replay/replay_file.py | 6 ++--- modules/tools/replay/replay_sequence.py | 2 +- .../restore_video_record.py | 2 +- .../tools/rosbag/body_sensation_evaluation.py | 2 +- modules/tools/rosbag/channel_size_stats.py | 2 +- modules/tools/rosbag/drive_event.py | 6 ++--- modules/tools/rosbag/dump_gpsbin.py | 2 +- modules/tools/rosbag/dump_planning.py | 2 +- modules/tools/rosbag/dump_record.py | 2 +- modules/tools/rosbag/dump_road_test_log.py | 2 +- modules/tools/rosbag/extract_trajectory.py | 2 +- modules/tools/rosbag/sample_pnc_topics.py | 2 +- modules/tools/rosbag/stat_mileage.py | 2 +- modules/tools/rosbag/stat_static_info.py | 2 +- modules/tools/rosbag/tf_stats.py | 2 +- modules/tools/rosbag/transcribe.py | 2 +- modules/tools/routing/debug_passage_region.py | 2 +- modules/tools/routing/debug_route.py | 2 +- modules/tools/routing/debug_topo.py | 4 ++-- modules/tools/routing/road_show.py | 2 +- modules/tools/routing/util.py | 2 +- .../sensor_calibration/data_file_object.py | 2 +- .../tools/sensor_calibration/extract_data.py | 2 +- .../sensor_calibration/extract_static_data.py | 2 +- .../sensor_msg_extractor.py | 10 ++++---- .../vehicle_calibration/data_collector.py | 6 ++--- .../tools/vehicle_calibration/plot_data.py | 6 ++--- .../tools/vehicle_calibration/plot_grid.py | 2 +- .../tools/vehicle_calibration/plot_results.py | 8 +++---- modules/tools/vehicle_calibration/process.py | 6 ++--- .../tools/vehicle_calibration/process_data.py | 6 ++--- .../tools/vehicle_calibration/result2pb.py | 6 ++--- 200 files changed, 314 insertions(+), 316 deletions(-) diff --git a/modules/tools/common/logger.py b/modules/tools/common/logger.py index b7ec4c16c20..b0f68cf5a0f 100644 --- a/modules/tools/common/logger.py +++ b/modules/tools/common/logger.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/common/message_manager.py b/modules/tools/common/message_manager.py index c0fed9cad7f..8a4a6b42bd2 100644 --- a/modules/tools/common/message_manager.py +++ b/modules/tools/common/message_manager.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -29,7 +29,7 @@ from modules.map.relative_map.proto import navigation_pb2 from modules.guardian.proto import guardian_pb2 -import proto_utils +from . import proto_utils class MessageType: diff --git a/modules/tools/common/proto_utils.py b/modules/tools/common/proto_utils.py index 5ae63d33877..6968fd898d7 100644 --- a/modules/tools/common/proto_utils.py +++ b/modules/tools/common/proto_utils.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/configurator/ModuleConf.py b/modules/tools/configurator/ModuleConf.py index 4ce2dbdca71..9fec92553e3 100644 --- a/modules/tools/configurator/ModuleConf.py +++ b/modules/tools/configurator/ModuleConf.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -110,10 +110,10 @@ def prefetch(self, entity, descriptor, row, col, descript_path): descriptor.type == descriptor.TYPE_MESSAGE: for descript, item in entity.ListFields(): if row >= self.winy - 1: - if col >= (self.winx / 3) * 2: + if col >= (self.winx // 3) * 2: return row, col row = self.basex - col = col + self.winx / 3 + col = col + self.winx // 3 descript_path.append(descript.name) if descript.label == descript.LABEL_REPEATED: diff --git a/modules/tools/configurator/configurator.py b/modules/tools/configurator/configurator.py index 7196308ceb7..aebace57389 100644 --- a/modules/tools/configurator/configurator.py +++ b/modules/tools/configurator/configurator.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -89,7 +89,7 @@ def setup(self): self.stdscr.addstr(1, 50, "Class", curses.A_BOLD) self.stdscr.addstr(1, 65, "Configuration File", curses.A_BOLD) - for idx in xrange(len(self.moduleconf)): + for idx in range(len(self.moduleconf)): lidx = idx + 2 if idx == self.select: self.stdscr.addstr(lidx, 2, self.moduleconf[idx].name, @@ -128,7 +128,7 @@ def show(self): """ Update Main Screen """ - for idx in xrange(len(self.moduleconf)): + for idx in range(len(self.moduleconf)): lidx = idx + 2 if idx == self.select: self.stdscr.addstr(lidx, 2, self.moduleconf[idx].name, diff --git a/modules/tools/control_info/control_info.py b/modules/tools/control_info/control_info.py index 6bee0fb8818..aa87fec0f66 100644 --- a/modules/tools/control_info/control_info.py +++ b/modules/tools/control_info/control_info.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -27,7 +27,7 @@ import matplotlib import matplotlib.pyplot as plt import numpy -import tkFileDialog +import tkinter.filedialog from matplotlib import patches from matplotlib import lines from cyber_py import cyber @@ -379,7 +379,7 @@ def press(self, event): canbussub = node.create_reader('/apollo/canbus/chassis', chassis_pb2.Chassis, controlinfo.callback_canbus) - raw_input("Press Enter To Stop") + input("Press Enter To Stop") mng = plt.get_current_fig_manager() controlinfo.longitudinal() diff --git a/modules/tools/create_map/convert_map_txt2bin.py b/modules/tools/create_map/convert_map_txt2bin.py index 4332a6cf6bc..cd50444cafa 100755 --- a/modules/tools/create_map/convert_map_txt2bin.py +++ b/modules/tools/create_map/convert_map_txt2bin.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/create_map/create_map.py b/modules/tools/create_map/create_map.py index 89f03ed39ec..ef604f01f54 100755 --- a/modules/tools/create_map/create_map.py +++ b/modules/tools/create_map/create_map.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/create_map/lane_recorder.py b/modules/tools/create_map/lane_recorder.py index 9fc838dbba6..cc7c5a358ff 100755 --- a/modules/tools/create_map/lane_recorder.py +++ b/modules/tools/create_map/lane_recorder.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/dump_gpsbin/dump_gpsbin.py b/modules/tools/dump_gpsbin/dump_gpsbin.py index 33db3eed4d3..aa9ae8fa8f5 100644 --- a/modules/tools/dump_gpsbin/dump_gpsbin.py +++ b/modules/tools/dump_gpsbin/dump_gpsbin.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/extrinsics_broadcaster/extrinsics_broadcaster.py b/modules/tools/extrinsics_broadcaster/extrinsics_broadcaster.py index d6359787ab1..452f2aa7007 100755 --- a/modules/tools/extrinsics_broadcaster/extrinsics_broadcaster.py +++ b/modules/tools/extrinsics_broadcaster/extrinsics_broadcaster.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/fuel_proxy/control_calibration_sanity_check.py b/modules/tools/fuel_proxy/control_calibration_sanity_check.py index a205b7715d7..db3c6236b87 100644 --- a/modules/tools/fuel_proxy/control_calibration_sanity_check.py +++ b/modules/tools/fuel_proxy/control_calibration_sanity_check.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/gen_vehicle_protocol/extract_dbc_meta.py b/modules/tools/gen_vehicle_protocol/extract_dbc_meta.py index edee28155aa..d60d7c667c7 100644 --- a/modules/tools/gen_vehicle_protocol/extract_dbc_meta.py +++ b/modules/tools/gen_vehicle_protocol/extract_dbc_meta.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/gen_vehicle_protocol/gen.py b/modules/tools/gen_vehicle_protocol/gen.py index adea91bab8e..c1f96ab9d02 100644 --- a/modules/tools/gen_vehicle_protocol/gen.py +++ b/modules/tools/gen_vehicle_protocol/gen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/gen_vehicle_protocol/gen_proto_file.py b/modules/tools/gen_vehicle_protocol/gen_proto_file.py index 85e7c9de746..80a8b1fc57a 100644 --- a/modules/tools/gen_vehicle_protocol/gen_proto_file.py +++ b/modules/tools/gen_vehicle_protocol/gen_proto_file.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/gen_vehicle_protocol/gen_protocols.py b/modules/tools/gen_vehicle_protocol/gen_protocols.py index 3ca851a929b..489d4dc8e5f 100644 --- a/modules/tools/gen_vehicle_protocol/gen_protocols.py +++ b/modules/tools/gen_vehicle_protocol/gen_protocols.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -215,7 +215,7 @@ def get_byte_info(var): bit = var["bit"] byte_info = [] left_len = var["len"] - byte_idx = bit / 8 + byte_idx = bit // 8 bit_start = bit % 8 if var["order"] == "motorola": while left_len > 0: @@ -399,7 +399,7 @@ def gen_control_cpp(car_type, protocol, output_dir): ) + "::" + var["enum"][0].upper() else: init_val = protocol["name"].capitalize( - ) + "::" + var["enum"].values()[0].upper() + ) + "::" + list(var["enum"].values())[0].upper() set_private_var_init_list.append(" %s_ = %s;" % (var["name"].lower(), init_val)) diff --git a/modules/tools/gen_vehicle_protocol/gen_vehicle_controller_and_manager.py b/modules/tools/gen_vehicle_protocol/gen_vehicle_controller_and_manager.py index 18e3ceb8419..e730d55e5ec 100644 --- a/modules/tools/gen_vehicle_protocol/gen_vehicle_controller_and_manager.py +++ b/modules/tools/gen_vehicle_protocol/gen_vehicle_controller_and_manager.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/map_gen/add_signal.py b/modules/tools/map_gen/add_signal.py index c6f767dca9b..0924ed03512 100644 --- a/modules/tools/map_gen/add_signal.py +++ b/modules/tools/map_gen/add_signal.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/map_gen/extract_path.py b/modules/tools/map_gen/extract_path.py index 6afa67fa843..094ae5fe531 100644 --- a/modules/tools/map_gen/extract_path.py +++ b/modules/tools/map_gen/extract_path.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/map_gen/map_gen.py b/modules/tools/map_gen/map_gen.py index ea2739527f6..89f64c7dad6 100644 --- a/modules/tools/map_gen/map_gen.py +++ b/modules/tools/map_gen/map_gen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/map_gen/map_gen_single_lane.py b/modules/tools/map_gen/map_gen_single_lane.py index cfefdccbc25..ab16efb7958 100644 --- a/modules/tools/map_gen/map_gen_single_lane.py +++ b/modules/tools/map_gen/map_gen_single_lane.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/map_gen/map_gen_two_lanes_right_ext.py b/modules/tools/map_gen/map_gen_two_lanes_right_ext.py index e853b181bfc..7ce829616e5 100644 --- a/modules/tools/map_gen/map_gen_two_lanes_right_ext.py +++ b/modules/tools/map_gen/map_gen_two_lanes_right_ext.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/map_gen/plot_path.py b/modules/tools/map_gen/plot_path.py index 8365f619380..16cb4618f96 100644 --- a/modules/tools/map_gen/plot_path.py +++ b/modules/tools/map_gen/plot_path.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mapshow/libs/localization.py b/modules/tools/mapshow/libs/localization.py index f223e630380..877124729d2 100644 --- a/modules/tools/mapshow/libs/localization.py +++ b/modules/tools/mapshow/libs/localization.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mapshow/libs/map.py b/modules/tools/mapshow/libs/map.py index 2eb470411cf..05b461ee891 100644 --- a/modules/tools/mapshow/libs/map.py +++ b/modules/tools/mapshow/libs/map.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -35,7 +35,7 @@ def __init__(self): def init_colors(self): color_num = 6 self.colors = [] - values = range(color_num) + values = list(range(color_num)) jet = plt.get_cmap('brg') color_norm = mcolors.Normalize(vmin=0, vmax=values[-1]) scalar_map = cmx.ScalarMappable(norm=color_norm, cmap=jet) @@ -180,18 +180,18 @@ def _draw_label(label_id, point, ax, color_val): @staticmethod def _find_lane_central_point(lane): - segment_idx = len(lane.left_boundary.curve.segment) / 2 + segment_idx = len(lane.left_boundary.curve.segment) // 2 median_segment = lane.left_boundary.curve.segment[segment_idx] - left_point_idx = len(median_segment.line_segment.point) / 2 + left_point_idx = len(median_segment.line_segment.point) // 2 left_median_point = median_segment.line_segment.point[left_point_idx] - segment_idx = len(lane.right_boundary.curve.segment) / 2 + segment_idx = len(lane.right_boundary.curve.segment) // 2 median_segment = lane.right_boundary.curve.segment[segment_idx] - right_point_idx = len(median_segment.line_segment.point) / 2 + right_point_idx = len(median_segment.line_segment.point) // 2 right_median_point = median_segment.line_segment.point[right_point_idx] - x = (left_median_point.x + right_median_point.x) / 2 - y = (left_median_point.y + right_median_point.y) / 2 + x = (left_median_point.x + right_median_point.x) // 2 + y = (left_median_point.y + right_median_point.y) // 2 return x, y @@ -199,11 +199,11 @@ def _find_lane_central_point(lane): def _get_median_point(points): """get_median_point""" if len(points) % 2 == 1: - point = points[len(points) / 2] + point = points[len(points) // 2] return point.x, point.y else: - point1 = points[len(points) / 2 - 1] - point2 = points[len(points) / 2] + point1 = points[len(points) // 2 - 1] + point2 = points[len(points) // 2] return (point1.x + point2.x) / 2.0, (point1.y + point2.y) / 2.0 @staticmethod @@ -280,7 +280,7 @@ def _draw_stop_line(line_segment, label, ax, label_color_val): ax.plot(px, py, 'o-') lxy = [random.randint(20, 80) * random.sample([-1, 1], 1)[0], random.randint(20, 80) * random.sample([-1, 1], 1)[0]] - xy = (sum(px) / len(px), sum(py) / len(py)) + xy = (sum(px) // len(px), sum(py) // len(py)) plt.annotate( label, xy=xy, xytext=lxy, diff --git a/modules/tools/mapshow/libs/path.py b/modules/tools/mapshow/libs/path.py index 685894259be..9d0b80745bb 100644 --- a/modules/tools/mapshow/libs/path.py +++ b/modules/tools/mapshow/libs/path.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mapshow/libs/planning.py b/modules/tools/mapshow/libs/planning.py index e66ec4b1403..9d5e41a1074 100644 --- a/modules/tools/mapshow/libs/planning.py +++ b/modules/tools/mapshow/libs/planning.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -109,12 +109,12 @@ def compute_sl_data(self): sl_sampled_s.append(s) for l in sl_frame.map_lower_bound: if (l > 10 or l < -10): - sl_map_lower_boundary.append(100 * l / abs(l)) + sl_map_lower_boundary.append(100 * l // abs(l)) else: sl_map_lower_boundary.append(l) for l in sl_frame.map_upper_bound: if (l > 10 or l < -10): - sl_map_upper_boundary.append(100 * l / abs(l)) + sl_map_upper_boundary.append(100 * l // abs(l)) else: sl_map_upper_boundary.append(l) for l in sl_frame.static_obstacle_lower_bound: diff --git a/modules/tools/mapshow/libs/plot_planning.py b/modules/tools/mapshow/libs/plot_planning.py index 04d2bb461c7..8b20710d956 100644 --- a/modules/tools/mapshow/libs/plot_planning.py +++ b/modules/tools/mapshow/libs/plot_planning.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -21,13 +21,13 @@ import matplotlib.animation as animation from cyber_py import cyber from modules.planning.proto import planning_pb2 -from subplot_st_main import StMainSubplot -from subplot_path import PathSubplot -from subplot_sl_main import SlMainSubplot -from subplot_st_speed import StSpeedSubplot -from subplot_speed import SpeedSubplot -from localization import Localization -from planning import Planning +from .subplot_st_main import StMainSubplot +from .subplot_path import PathSubplot +from .subplot_sl_main import SlMainSubplot +from .subplot_st_speed import StSpeedSubplot +from .subplot_speed import SpeedSubplot +from .localization import Localization +from .planning import Planning planning = Planning() localization = Localization() diff --git a/modules/tools/mapshow/libs/plot_smoothness.py b/modules/tools/mapshow/libs/plot_smoothness.py index 5afd5ae06f5..59549ae5380 100644 --- a/modules/tools/mapshow/libs/plot_smoothness.py +++ b/modules/tools/mapshow/libs/plot_smoothness.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -19,11 +19,11 @@ from cyber_py import cyber from modules.planning.proto import planning_pb2 import matplotlib.pyplot as plt -from planning import Planning +from .planning import Planning import matplotlib.animation as animation -from subplot_traj_speed import TrajSpeedSubplot -from subplot_traj_acc import TrajAccSubplot -from subplot_traj_path import TrajPathSubplot +from .subplot_traj_speed import TrajSpeedSubplot +from .subplot_traj_acc import TrajAccSubplot +from .subplot_traj_path import TrajPathSubplot planning = Planning() diff --git a/modules/tools/mapshow/libs/plot_st.py b/modules/tools/mapshow/libs/plot_st.py index 959efec5722..a24e562870c 100644 --- a/modules/tools/mapshow/libs/plot_st.py +++ b/modules/tools/mapshow/libs/plot_st.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -17,11 +17,11 @@ ############################################################################### from cyber_py import cyber -from planning import Planning +from .planning import Planning import matplotlib.pyplot as plt import matplotlib.animation as animation -from subplot_st_main import StMainSubplot -from subplot_st_speed import StSpeedSubplot +from .subplot_st_main import StMainSubplot +from .subplot_st_speed import StSpeedSubplot from modules.planning.proto import planning_pb2 planning = Planning() diff --git a/modules/tools/mapshow/libs/subplot_path.py b/modules/tools/mapshow/libs/subplot_path.py index 91dd2db2680..ed127230e80 100644 --- a/modules/tools/mapshow/libs/subplot_path.py +++ b/modules/tools/mapshow/libs/subplot_path.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -16,7 +16,7 @@ # limitations under the License. ############################################################################### -from map import Map +from .map import Map class PathSubplot: diff --git a/modules/tools/mapshow/libs/subplot_sl_main.py b/modules/tools/mapshow/libs/subplot_sl_main.py index 91e107bc9da..86b30460cf3 100644 --- a/modules/tools/mapshow/libs/subplot_sl_main.py +++ b/modules/tools/mapshow/libs/subplot_sl_main.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mapshow/libs/subplot_speed.py b/modules/tools/mapshow/libs/subplot_speed.py index becc45f16a7..a6326169051 100644 --- a/modules/tools/mapshow/libs/subplot_speed.py +++ b/modules/tools/mapshow/libs/subplot_speed.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mapshow/libs/subplot_st_main.py b/modules/tools/mapshow/libs/subplot_st_main.py index e5e242dde8d..9c8611aa1b2 100644 --- a/modules/tools/mapshow/libs/subplot_st_main.py +++ b/modules/tools/mapshow/libs/subplot_st_main.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mapshow/libs/subplot_st_speed.py b/modules/tools/mapshow/libs/subplot_st_speed.py index f07ca79cce0..12f923bc3d8 100644 --- a/modules/tools/mapshow/libs/subplot_st_speed.py +++ b/modules/tools/mapshow/libs/subplot_st_speed.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mapshow/libs/subplot_traj_acc.py b/modules/tools/mapshow/libs/subplot_traj_acc.py index 3b731a66150..890df6f3dd2 100644 --- a/modules/tools/mapshow/libs/subplot_traj_acc.py +++ b/modules/tools/mapshow/libs/subplot_traj_acc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -50,7 +50,7 @@ def __init__(self, ax): def init_colors(self): self.colors = [] - values = range(self.acc_lines_size) + values = list(range(self.acc_lines_size)) jet = plt.get_cmap('brg') color_norm = mcolors.Normalize(vmin=0, vmax=values[-1]) scalar_map = cmx.ScalarMappable(norm=color_norm, cmap=jet) diff --git a/modules/tools/mapshow/libs/subplot_traj_path.py b/modules/tools/mapshow/libs/subplot_traj_path.py index b233c3ac2ca..8f040c9ceb9 100644 --- a/modules/tools/mapshow/libs/subplot_traj_path.py +++ b/modules/tools/mapshow/libs/subplot_traj_path.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -50,7 +50,7 @@ def __init__(self, ax): def init_colors(self): self.colors = [] - values = range(self.path_lines_size) + values = list(range(self.path_lines_size)) jet = plt.get_cmap('brg') color_norm = mcolors.Normalize(vmin=0, vmax=values[-1]) scalar_map = cmx.ScalarMappable(norm=color_norm, cmap=jet) diff --git a/modules/tools/mapshow/libs/subplot_traj_speed.py b/modules/tools/mapshow/libs/subplot_traj_speed.py index 1a46508d9eb..18707f7adb1 100644 --- a/modules/tools/mapshow/libs/subplot_traj_speed.py +++ b/modules/tools/mapshow/libs/subplot_traj_speed.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -50,7 +50,7 @@ def __init__(self, ax): def init_colors(self): self.colors = [] - values = range(self.speed_lines_size) + values = list(range(self.speed_lines_size)) jet = plt.get_cmap('brg') color_norm = mcolors.Normalize(vmin=0, vmax=values[-1]) scalar_map = cmx.ScalarMappable(norm=color_norm, cmap=jet) diff --git a/modules/tools/mapshow/mapshow.py b/modules/tools/mapshow/mapshow.py index 885b94a149f..7e7c4322257 100644 --- a/modules/tools/mapshow/mapshow.py +++ b/modules/tools/mapshow/mapshow.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mapshow/roadshow.py b/modules/tools/mapshow/roadshow.py index f76190baecd..813fcbfe7eb 100644 --- a/modules/tools/mapshow/roadshow.py +++ b/modules/tools/mapshow/roadshow.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mapviewers/gmapviewer.py b/modules/tools/mapviewers/gmapviewer.py index 7112baa0824..2f9a8921868 100644 --- a/modules/tools/mapviewers/gmapviewer.py +++ b/modules/tools/mapviewers/gmapviewer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mapviewers/hdmapviewer.py b/modules/tools/mapviewers/hdmapviewer.py index 52d91394d2f..06f9f318161 100644 --- a/modules/tools/mapviewers/hdmapviewer.py +++ b/modules/tools/mapviewers/hdmapviewer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mobileye_viewer/chassis_data.py b/modules/tools/mobileye_viewer/chassis_data.py index 1aade412989..2e612de8f05 100644 --- a/modules/tools/mobileye_viewer/chassis_data.py +++ b/modules/tools/mobileye_viewer/chassis_data.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mobileye_viewer/localization_data.py b/modules/tools/mobileye_viewer/localization_data.py index 2c770885feb..4c5712a1c27 100644 --- a/modules/tools/mobileye_viewer/localization_data.py +++ b/modules/tools/mobileye_viewer/localization_data.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mobileye_viewer/location_server.py b/modules/tools/mobileye_viewer/location_server.py index 12d06980c12..5458d25c388 100644 --- a/modules/tools/mobileye_viewer/location_server.py +++ b/modules/tools/mobileye_viewer/location_server.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -19,7 +19,7 @@ import os import rospy import math -import thread +import _thread import requests import json import pyproj diff --git a/modules/tools/mobileye_viewer/mobileye_data.py b/modules/tools/mobileye_viewer/mobileye_data.py index 61a2ea943b2..5e21133b4fb 100644 --- a/modules/tools/mobileye_viewer/mobileye_data.py +++ b/modules/tools/mobileye_viewer/mobileye_data.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -102,11 +102,11 @@ def compute_lanes(self): self.left_lane_x.append(x) self.lane_data_lock.release() - c0 = (rc0 + lc0) / 2 - c1 = (rc1 + lc1) / 2 - c2 = (rc2 + lc2) / 2 - c3 = (rc3 + lc3) / 2 - rangex = (lrangex + rrangex) / 2 + c0 = (rc0 + lc0) // 2 + c1 = (rc1 + lc1) // 2 + c2 = (rc2 + lc2) // 2 + c3 = (rc3 + lc3) // 2 + rangex = (lrangex + rrangex) // 2 self.lane_data_lock.acquire() for y in range(int(rangex)): self.ref_lane_y.append(y) diff --git a/modules/tools/mobileye_viewer/mobileye_viewer.py b/modules/tools/mobileye_viewer/mobileye_viewer.py index cec014bf3de..842747161e7 100644 --- a/modules/tools/mobileye_viewer/mobileye_viewer.py +++ b/modules/tools/mobileye_viewer/mobileye_viewer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mobileye_viewer/planning_data.py b/modules/tools/mobileye_viewer/planning_data.py index 7eb6b3305f0..27c5fe478d3 100644 --- a/modules/tools/mobileye_viewer/planning_data.py +++ b/modules/tools/mobileye_viewer/planning_data.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mobileye_viewer/plot_routing.py b/modules/tools/mobileye_viewer/plot_routing.py index 2884b625af8..a6986a6b6f9 100644 --- a/modules/tools/mobileye_viewer/plot_routing.py +++ b/modules/tools/mobileye_viewer/plot_routing.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mobileye_viewer/routing_data.py b/modules/tools/mobileye_viewer/routing_data.py index 11a4a79287c..6653936bda8 100644 --- a/modules/tools/mobileye_viewer/routing_data.py +++ b/modules/tools/mobileye_viewer/routing_data.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mobileye_viewer/subplot_routing.py b/modules/tools/mobileye_viewer/subplot_routing.py index efea6e80c3c..78325a370b6 100644 --- a/modules/tools/mobileye_viewer/subplot_routing.py +++ b/modules/tools/mobileye_viewer/subplot_routing.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mobileye_viewer/subplot_s_speed.py b/modules/tools/mobileye_viewer/subplot_s_speed.py index 9e644b68534..f96c7332169 100644 --- a/modules/tools/mobileye_viewer/subplot_s_speed.py +++ b/modules/tools/mobileye_viewer/subplot_s_speed.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mobileye_viewer/subplot_s_theta.py b/modules/tools/mobileye_viewer/subplot_s_theta.py index ff9e3545540..eada1714de0 100644 --- a/modules/tools/mobileye_viewer/subplot_s_theta.py +++ b/modules/tools/mobileye_viewer/subplot_s_theta.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mobileye_viewer/subplot_s_time.py b/modules/tools/mobileye_viewer/subplot_s_time.py index 7eba013cd8a..8fc84562742 100644 --- a/modules/tools/mobileye_viewer/subplot_s_time.py +++ b/modules/tools/mobileye_viewer/subplot_s_time.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mobileye_viewer/view_subplot.py b/modules/tools/mobileye_viewer/view_subplot.py index fa1e8c902d3..eca37c0a7e6 100644 --- a/modules/tools/mobileye_viewer/view_subplot.py +++ b/modules/tools/mobileye_viewer/view_subplot.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/mock_routing/mock_routing_request.py b/modules/tools/mock_routing/mock_routing_request.py index a5d2af9e194..9309516c03a 100644 --- a/modules/tools/mock_routing/mock_routing_request.py +++ b/modules/tools/mock_routing/mock_routing_request.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/config/navi_config.py b/modules/tools/navigation/config/navi_config.py index 9adeae53789..db38f778388 100644 --- a/modules/tools/navigation/config/navi_config.py +++ b/modules/tools/navigation/config/navi_config.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. @@ -19,7 +19,7 @@ config navigation mode """ import sys -import ConfigParser +import configparser from modules.dreamview.proto import hmi_config_pb2 from modules.planning.proto import planning_config_pb2 from common import proto_utils @@ -125,7 +125,7 @@ def set_planning_flag(config): print("\nusage: python navi_config.py config.ini\n\n") sys.exit(0) config_file = sys.argv[1] - config = ConfigParser.ConfigParser() + config = configparser.ConfigParser() config.read(config_file) set_hmi_conf(config) diff --git a/modules/tools/navigation/driving_behavior/path_extract.py b/modules/tools/navigation/driving_behavior/path_extract.py index 7db8054ffb7..13b3a627708 100644 --- a/modules/tools/navigation/driving_behavior/path_extract.py +++ b/modules/tools/navigation/driving_behavior/path_extract.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/driving_behavior/path_plot.py b/modules/tools/navigation/driving_behavior/path_plot.py index e56532a9c37..3f373358e12 100644 --- a/modules/tools/navigation/driving_behavior/path_plot.py +++ b/modules/tools/navigation/driving_behavior/path_plot.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/driving_behavior/path_process.py b/modules/tools/navigation/driving_behavior/path_process.py index 947fdb73273..e76f97cb308 100644 --- a/modules/tools/navigation/driving_behavior/path_process.py +++ b/modules/tools/navigation/driving_behavior/path_process.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/driving_behavior/plot_gps_path.py b/modules/tools/navigation/driving_behavior/plot_gps_path.py index 5578eaf13e2..a0b5201c821 100644 --- a/modules/tools/navigation/driving_behavior/plot_gps_path.py +++ b/modules/tools/navigation/driving_behavior/plot_gps_path.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/perception_adapter/perception_adaper.py b/modules/tools/navigation/perception_adapter/perception_adaper.py index 0308111c21d..561f8dd694c 100644 --- a/modules/tools/navigation/perception_adapter/perception_adaper.py +++ b/modules/tools/navigation/perception_adapter/perception_adaper.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/ad_vehicle.py b/modules/tools/navigation/planning/ad_vehicle.py index 4ae40128594..fd9fab7ebfd 100644 --- a/modules/tools/navigation/planning/ad_vehicle.py +++ b/modules/tools/navigation/planning/ad_vehicle.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/heading_decider.py b/modules/tools/navigation/planning/heading_decider.py index 36fd0e61f03..8121d83666c 100644 --- a/modules/tools/navigation/planning/heading_decider.py +++ b/modules/tools/navigation/planning/heading_decider.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/lanemarker_corrector.py b/modules/tools/navigation/planning/lanemarker_corrector.py index cf1a927f734..8e4f725593e 100644 --- a/modules/tools/navigation/planning/lanemarker_corrector.py +++ b/modules/tools/navigation/planning/lanemarker_corrector.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/local_path.py b/modules/tools/navigation/planning/local_path.py index bddcba77248..9fb0bbc1f74 100644 --- a/modules/tools/navigation/planning/local_path.py +++ b/modules/tools/navigation/planning/local_path.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/navigation_mobileye_debug.py b/modules/tools/navigation/planning/navigation_mobileye_debug.py index af44fce9156..5287b3bc477 100644 --- a/modules/tools/navigation/planning/navigation_mobileye_debug.py +++ b/modules/tools/navigation/planning/navigation_mobileye_debug.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/navigation_planning.py b/modules/tools/navigation/planning/navigation_planning.py index c76f242321e..f29899f604d 100644 --- a/modules/tools/navigation/planning/navigation_planning.py +++ b/modules/tools/navigation/planning/navigation_planning.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/navigation_routing_debug.py b/modules/tools/navigation/planning/navigation_routing_debug.py index 3efa819f694..3497410d1db 100644 --- a/modules/tools/navigation/planning/navigation_routing_debug.py +++ b/modules/tools/navigation/planning/navigation_routing_debug.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/obstacle_decider.py b/modules/tools/navigation/planning/obstacle_decider.py index 4531a158c51..6be7888e427 100644 --- a/modules/tools/navigation/planning/obstacle_decider.py +++ b/modules/tools/navigation/planning/obstacle_decider.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/path_decider.py b/modules/tools/navigation/planning/path_decider.py index 56c9c8b60ff..88cdf40d901 100644 --- a/modules/tools/navigation/planning/path_decider.py +++ b/modules/tools/navigation/planning/path_decider.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/provider_chassis.py b/modules/tools/navigation/planning/provider_chassis.py index 666ddba4d07..5a8a73b2bcd 100644 --- a/modules/tools/navigation/planning/provider_chassis.py +++ b/modules/tools/navigation/planning/provider_chassis.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/provider_localization.py b/modules/tools/navigation/planning/provider_localization.py index 61b6c7ecf0a..e9864e23b2f 100644 --- a/modules/tools/navigation/planning/provider_localization.py +++ b/modules/tools/navigation/planning/provider_localization.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/provider_mobileye.py b/modules/tools/navigation/planning/provider_mobileye.py index c4c95868ae4..c61f6da4a9a 100644 --- a/modules/tools/navigation/planning/provider_mobileye.py +++ b/modules/tools/navigation/planning/provider_mobileye.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/provider_routing.py b/modules/tools/navigation/planning/provider_routing.py index 352f1a2b5cc..57a267e5878 100644 --- a/modules/tools/navigation/planning/provider_routing.py +++ b/modules/tools/navigation/planning/provider_routing.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/reference_path.py b/modules/tools/navigation/planning/reference_path.py index 776aeb6ad5f..128902e8edf 100644 --- a/modules/tools/navigation/planning/reference_path.py +++ b/modules/tools/navigation/planning/reference_path.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/speed_decider.py b/modules/tools/navigation/planning/speed_decider.py index 2466201c87b..1396437bb5c 100644 --- a/modules/tools/navigation/planning/speed_decider.py +++ b/modules/tools/navigation/planning/speed_decider.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/planning/trajectory_generator.py b/modules/tools/navigation/planning/trajectory_generator.py index 9cbb0a8a15a..145ebe5c06b 100644 --- a/modules/tools/navigation/planning/trajectory_generator.py +++ b/modules/tools/navigation/planning/trajectory_generator.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigation/routing/navigation_routing.py b/modules/tools/navigation/routing/navigation_routing.py index 1431082d629..130d685984d 100644 --- a/modules/tools/navigation/routing/navigation_routing.py +++ b/modules/tools/navigation/routing/navigation_routing.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -19,7 +19,7 @@ import os import rospy import math -import thread +import _thread import requests import json import pyproj @@ -293,6 +293,6 @@ def routing(): load_drive_data() add_listener() - thread.start_new_thread(run_flask, ()) + _thread.start_new_thread(run_flask, ()) # app.run(debug=False, port=5001, host='localhost') rospy.spin() diff --git a/modules/tools/navigation/simulator/navigation_view_backend.py b/modules/tools/navigation/simulator/navigation_view_backend.py index 0e6b7c79e80..a325934d3fd 100644 --- a/modules/tools/navigation/simulator/navigation_view_backend.py +++ b/modules/tools/navigation/simulator/navigation_view_backend.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -19,7 +19,7 @@ import os import rospy import math -import thread +import _thread import requests import json import pyproj diff --git a/modules/tools/navigator/dbmap/generator.py b/modules/tools/navigator/dbmap/generator.py index b91ce102c20..4f739fb579d 100644 --- a/modules/tools/navigator/dbmap/generator.py +++ b/modules/tools/navigator/dbmap/generator.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigator/dbmap/libs/point.py b/modules/tools/navigator/dbmap/libs/point.py index 5f716a89a48..0c2b0916275 100644 --- a/modules/tools/navigator/dbmap/libs/point.py +++ b/modules/tools/navigator/dbmap/libs/point.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigator/dbmap/viewer.py b/modules/tools/navigator/dbmap/viewer.py index 7d385d14b16..05e9cb1bb28 100644 --- a/modules/tools/navigator/dbmap/viewer.py +++ b/modules/tools/navigator/dbmap/viewer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigator/navigator.py b/modules/tools/navigator/navigator.py index 5739268098b..4edbd19e912 100644 --- a/modules/tools/navigator/navigator.py +++ b/modules/tools/navigator/navigator.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigator/record_extractor.py b/modules/tools/navigator/record_extractor.py index 0cdd27fd5cf..624cbf163e5 100644 --- a/modules/tools/navigator/record_extractor.py +++ b/modules/tools/navigator/record_extractor.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigator/viewer_raw.py b/modules/tools/navigator/viewer_raw.py index e56532a9c37..3f373358e12 100644 --- a/modules/tools/navigator/viewer_raw.py +++ b/modules/tools/navigator/viewer_raw.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/navigator/viewer_smooth.py b/modules/tools/navigator/viewer_smooth.py index d5e369f22b1..38ddca44bd1 100644 --- a/modules/tools/navigator/viewer_smooth.py +++ b/modules/tools/navigator/viewer_smooth.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/open_space_visualization/auto_param_tuning.py b/modules/tools/open_space_visualization/auto_param_tuning.py index 97fd67068c2..095b14a227d 100755 --- a/modules/tools/open_space_visualization/auto_param_tuning.py +++ b/modules/tools/open_space_visualization/auto_param_tuning.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/open_space_visualization/distance_approach_python_interface.py b/modules/tools/open_space_visualization/distance_approach_python_interface.py index 7b8de150b37..8b937549c9b 100755 --- a/modules/tools/open_space_visualization/distance_approach_python_interface.py +++ b/modules/tools/open_space_visualization/distance_approach_python_interface.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/open_space_visualization/distance_approach_visualizer.py b/modules/tools/open_space_visualization/distance_approach_visualizer.py index 48b950b6285..aef292bb15d 100755 --- a/modules/tools/open_space_visualization/distance_approach_visualizer.py +++ b/modules/tools/open_space_visualization/distance_approach_visualizer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/open_space_visualization/hybrid_a_star_python_interface.py b/modules/tools/open_space_visualization/hybrid_a_star_python_interface.py index a2b5f9bc153..fc919d3d50e 100755 --- a/modules/tools/open_space_visualization/hybrid_a_star_python_interface.py +++ b/modules/tools/open_space_visualization/hybrid_a_star_python_interface.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/open_space_visualization/hybrid_a_star_visualizer.py b/modules/tools/open_space_visualization/hybrid_a_star_visualizer.py index b36c4a23713..41213126ea6 100755 --- a/modules/tools/open_space_visualization/hybrid_a_star_visualizer.py +++ b/modules/tools/open_space_visualization/hybrid_a_star_visualizer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/open_space_visualization/open_space_roi_interface.py b/modules/tools/open_space_visualization/open_space_roi_interface.py index 34897497e85..ad42970d4ea 100755 --- a/modules/tools/open_space_visualization/open_space_roi_interface.py +++ b/modules/tools/open_space_visualization/open_space_roi_interface.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/open_space_visualization/open_space_roi_visualizer.py b/modules/tools/open_space_visualization/open_space_roi_visualizer.py index edbed5788d9..70e99c7d827 100755 --- a/modules/tools/open_space_visualization/open_space_roi_visualizer.py +++ b/modules/tools/open_space_visualization/open_space_roi_visualizer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/ota/create_sec_package.py b/modules/tools/ota/create_sec_package.py index a512c684119..975aee3b407 100755 --- a/modules/tools/ota/create_sec_package.py +++ b/modules/tools/ota/create_sec_package.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/ota/query_client.py b/modules/tools/ota/query_client.py index f1e6ef7bc95..1b10af7f7e8 100644 --- a/modules/tools/ota/query_client.py +++ b/modules/tools/ota/query_client.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -21,7 +21,7 @@ import sys import os import urllib3 -from ConfigParser import ConfigParser +from configparser import ConfigParser from modules.data.proto.static_info_pb2 import VehicleInfo import common.proto_utils as proto_utils diff --git a/modules/tools/ota/update_client.py b/modules/tools/ota/update_client.py index 833b45ff34f..bf7371d0f72 100644 --- a/modules/tools/ota/update_client.py +++ b/modules/tools/ota/update_client.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -20,7 +20,7 @@ import os import sys import urllib3 -from ConfigParser import ConfigParser +from configparser import ConfigParser from modules.data.proto.static_info_pb2 import VehicleInfo import common.proto_utils as proto_utils diff --git a/modules/tools/ota/verify_client.py b/modules/tools/ota/verify_client.py index d4228d4e9b1..3f66b750a80 100644 --- a/modules/tools/ota/verify_client.py +++ b/modules/tools/ota/verify_client.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -22,7 +22,7 @@ import requests import os import sys -from ConfigParser import ConfigParser +from configparser import ConfigParser from modules.data.proto.static_info_pb2 import VehicleInfo import common.proto_utils as proto_utils sys.path.append('/home/caros/secure_upgrade/python') diff --git a/modules/tools/perception/empty_prediction.py b/modules/tools/perception/empty_prediction.py index ceb79824fec..daeef3e73ea 100644 --- a/modules/tools/perception/empty_prediction.py +++ b/modules/tools/perception/empty_prediction.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/perception/extend_prediction.py b/modules/tools/perception/extend_prediction.py index e00d50e894a..b53cc5e835f 100644 --- a/modules/tools/perception/extend_prediction.py +++ b/modules/tools/perception/extend_prediction.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/perception/print_perception.py b/modules/tools/perception/print_perception.py index 41709c2f9df..1c15a3230b0 100644 --- a/modules/tools/perception/print_perception.py +++ b/modules/tools/perception/print_perception.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/perception/replay_perception.py b/modules/tools/perception/replay_perception.py index 76b5ccf3161..0dec3ce60ab 100644 --- a/modules/tools/perception/replay_perception.py +++ b/modules/tools/perception/replay_perception.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/planning/plot_trajectory/main.py b/modules/tools/planning/plot_trajectory/main.py index 946a9165b40..87ff8fef4e7 100644 --- a/modules/tools/planning/plot_trajectory/main.py +++ b/modules/tools/planning/plot_trajectory/main.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -48,10 +48,10 @@ def find_closest_t(points_t, current_t): return points_t[0] else: return points_t[1] - if points_t[len(points_t) / 2] > current_t: - return find_closest_t(points_t[0:len(points_t) / 2], current_t) - elif points_t[len(points_t) / 2] < current_t: - return find_closest_t(points_t[len(points_t) / 2 + 1:], current_t) + if points_t[len(points_t) // 2] > current_t: + return find_closest_t(points_t[0:len(points_t) // 2], current_t) + elif points_t[len(points_t) // 2] < current_t: + return find_closest_t(points_t[len(points_t) // 2 + 1:], current_t) else: return current_t diff --git a/modules/tools/planning/plot_trajectory/mkz_polygon.py b/modules/tools/planning/plot_trajectory/mkz_polygon.py index 764cf5e7a17..41789b0cd54 100644 --- a/modules/tools/planning/plot_trajectory/mkz_polygon.py +++ b/modules/tools/planning/plot_trajectory/mkz_polygon.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_control/plot_control.py b/modules/tools/plot_control/plot_control.py index 93bfa904eb6..b763e764c15 100644 --- a/modules/tools/plot_control/plot_control.py +++ b/modules/tools/plot_control/plot_control.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_control/realtime_test.py b/modules/tools/plot_control/realtime_test.py index b95a12509a1..613f4785f3e 100644 --- a/modules/tools/plot_control/realtime_test.py +++ b/modules/tools/plot_control/realtime_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/chassis_speed.py b/modules/tools/plot_planning/chassis_speed.py index 4f598741a31..c764ef59d2e 100644 --- a/modules/tools/plot_planning/chassis_speed.py +++ b/modules/tools/plot_planning/chassis_speed.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/imu_acc.py b/modules/tools/plot_planning/imu_acc.py index 0e28aa20e14..1c794f875c2 100644 --- a/modules/tools/plot_planning/imu_acc.py +++ b/modules/tools/plot_planning/imu_acc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/imu_angular_velocity.py b/modules/tools/plot_planning/imu_angular_velocity.py index 5aaf9340acf..af940d05b1b 100644 --- a/modules/tools/plot_planning/imu_angular_velocity.py +++ b/modules/tools/plot_planning/imu_angular_velocity.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/imu_av_curvature.py b/modules/tools/plot_planning/imu_av_curvature.py index 52901327237..120ffa51cf2 100644 --- a/modules/tools/plot_planning/imu_av_curvature.py +++ b/modules/tools/plot_planning/imu_av_curvature.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/imu_speed.py b/modules/tools/plot_planning/imu_speed.py index 31520eca638..cd886ac29eb 100644 --- a/modules/tools/plot_planning/imu_speed.py +++ b/modules/tools/plot_planning/imu_speed.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/imu_speed_acc.py b/modules/tools/plot_planning/imu_speed_acc.py index f9b8da3907f..2218a2075cf 100644 --- a/modules/tools/plot_planning/imu_speed_acc.py +++ b/modules/tools/plot_planning/imu_speed_acc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. @@ -79,12 +79,12 @@ def plot_freq(x, y, ax, color): Fs = len(y) / float(x[-1] - x[0]) n = len(y) k = np.arange(n) - T = n/Fs - frq = k/T - frq = frq[range(n/2)] + T = n / Fs + frq = k / T + frq = frq[range(n // 2)] - Y = np.fft.fft(y)/n - Y = Y[range(n/2)] + Y = np.fft.fft(y) / n + Y = Y[range(n // 2)] ax.plot(frq, abs(Y), c=color) folders = sys.argv[1:] diff --git a/modules/tools/plot_planning/imu_speed_jerk.py b/modules/tools/plot_planning/imu_speed_jerk.py index 7419178a975..abdfad3b2eb 100644 --- a/modules/tools/plot_planning/imu_speed_jerk.py +++ b/modules/tools/plot_planning/imu_speed_jerk.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/planning_speed.py b/modules/tools/plot_planning/planning_speed.py index a7012e2772a..aa1c96186c3 100644 --- a/modules/tools/plot_planning/planning_speed.py +++ b/modules/tools/plot_planning/planning_speed.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/plot_acc_jerk.py b/modules/tools/plot_planning/plot_acc_jerk.py index 09e1e41961a..32339a89108 100644 --- a/modules/tools/plot_planning/plot_acc_jerk.py +++ b/modules/tools/plot_planning/plot_acc_jerk.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/plot_chassis_acc.py b/modules/tools/plot_planning/plot_chassis_acc.py index c64f8c95783..891580ff58c 100644 --- a/modules/tools/plot_planning/plot_chassis_acc.py +++ b/modules/tools/plot_planning/plot_chassis_acc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/plot_planning_acc.py b/modules/tools/plot_planning/plot_planning_acc.py index 9c30fcf2653..31cd3298302 100644 --- a/modules/tools/plot_planning/plot_planning_acc.py +++ b/modules/tools/plot_planning/plot_planning_acc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/plot_planning_speed.py b/modules/tools/plot_planning/plot_planning_speed.py index a0302b368ec..bd2151c63f5 100644 --- a/modules/tools/plot_planning/plot_planning_speed.py +++ b/modules/tools/plot_planning/plot_planning_speed.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/plot_speed_jerk.py b/modules/tools/plot_planning/plot_speed_jerk.py index 8c4e786bb05..61f78df8a2d 100644 --- a/modules/tools/plot_planning/plot_speed_jerk.py +++ b/modules/tools/plot_planning/plot_speed_jerk.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/record_reader.py b/modules/tools/plot_planning/record_reader.py index 91d58015906..ba533f2d572 100644 --- a/modules/tools/plot_planning/record_reader.py +++ b/modules/tools/plot_planning/record_reader.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/speed_dsteering_data.py b/modules/tools/plot_planning/speed_dsteering_data.py index 8cf7339ed66..d2e691220fc 100644 --- a/modules/tools/plot_planning/speed_dsteering_data.py +++ b/modules/tools/plot_planning/speed_dsteering_data.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_planning/time_curvature_data.py b/modules/tools/plot_planning/time_curvature_data.py index 533a0d21b5c..1624dfbed5b 100644 --- a/modules/tools/plot_planning/time_curvature_data.py +++ b/modules/tools/plot_planning/time_curvature_data.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. @@ -61,7 +61,7 @@ def get_speed_curvature(self): return self.speed_list, self.curvature_list def get_fixed_ca_speed_curvature(self): - speed_list = range(1, 31) + speed_list = list(range(1, 31)) curvature_list = [] for speed in speed_list: curvature = 2.0 / (speed * speed) diff --git a/modules/tools/plot_trace/plot_planning_result.py b/modules/tools/plot_trace/plot_planning_result.py index 7519db2305c..6799f49693a 100755 --- a/modules/tools/plot_trace/plot_planning_result.py +++ b/modules/tools/plot_trace/plot_planning_result.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/plot_trace/plot_trace.py b/modules/tools/plot_trace/plot_trace.py index 259025d602f..b7dd4048cdd 100755 --- a/modules/tools/plot_trace/plot_trace.py +++ b/modules/tools/plot_trace/plot_trace.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/prediction/__init__.py b/modules/tools/prediction/__init__.py index d38e98714dd..d6e98366d16 100644 --- a/modules/tools/prediction/__init__.py +++ b/modules/tools/prediction/__init__.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/prediction/data_pipelines/__init__.py b/modules/tools/prediction/data_pipelines/__init__.py index d38e98714dd..d6e98366d16 100644 --- a/modules/tools/prediction/data_pipelines/__init__.py +++ b/modules/tools/prediction/data_pipelines/__init__.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/prediction/data_pipelines/common/__init__.py b/modules/tools/prediction/data_pipelines/common/__init__.py index b3265c75e4d..45806692cdc 100644 --- a/modules/tools/prediction/data_pipelines/common/__init__.py +++ b/modules/tools/prediction/data_pipelines/common/__init__.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/prediction/data_pipelines/common/bounding_rectangle.py b/modules/tools/prediction/data_pipelines/common/bounding_rectangle.py index 3bcfd9de102..f97d83f6b1b 100644 --- a/modules/tools/prediction/data_pipelines/common/bounding_rectangle.py +++ b/modules/tools/prediction/data_pipelines/common/bounding_rectangle.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. @@ -17,9 +17,9 @@ ############################################################################### -from vector2d import Vector2 -from rotation2d import * -from util import segment_overlap +from .vector2d import Vector2 +from .rotation2d import * +from .util import segment_overlap class BoundingRectangle: diff --git a/modules/tools/prediction/data_pipelines/common/configure.py b/modules/tools/prediction/data_pipelines/common/configure.py index 7bc9da55094..e985f07f56f 100644 --- a/modules/tools/prediction/data_pipelines/common/configure.py +++ b/modules/tools/prediction/data_pipelines/common/configure.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/prediction/data_pipelines/common/data_preprocess.py b/modules/tools/prediction/data_pipelines/common/data_preprocess.py index 769bff4bb6d..5f381bdb910 100644 --- a/modules/tools/prediction/data_pipelines/common/data_preprocess.py +++ b/modules/tools/prediction/data_pipelines/common/data_preprocess.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/prediction/data_pipelines/common/feature_io.py b/modules/tools/prediction/data_pipelines/common/feature_io.py index 6423d46e97d..34b151794fe 100644 --- a/modules/tools/prediction/data_pipelines/common/feature_io.py +++ b/modules/tools/prediction/data_pipelines/common/feature_io.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/prediction/data_pipelines/common/log.py b/modules/tools/prediction/data_pipelines/common/log.py index 34199d1da79..ce3eeaf2c8a 100644 --- a/modules/tools/prediction/data_pipelines/common/log.py +++ b/modules/tools/prediction/data_pipelines/common/log.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/prediction/data_pipelines/common/online_to_offline.py b/modules/tools/prediction/data_pipelines/common/online_to_offline.py index 740dfe97efe..24d4001b7cb 100644 --- a/modules/tools/prediction/data_pipelines/common/online_to_offline.py +++ b/modules/tools/prediction/data_pipelines/common/online_to_offline.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. @@ -25,8 +25,8 @@ from google.protobuf.internal import encoder from modules.prediction.proto import offline_features_pb2 -from bounding_rectangle import BoundingRectangle -from configure import parameters +from .bounding_rectangle import BoundingRectangle +from .configure import parameters param_fea = parameters['feature'] diff --git a/modules/tools/prediction/data_pipelines/common/rotation2d.py b/modules/tools/prediction/data_pipelines/common/rotation2d.py index f2bd4856c5d..0f9ba756bc5 100644 --- a/modules/tools/prediction/data_pipelines/common/rotation2d.py +++ b/modules/tools/prediction/data_pipelines/common/rotation2d.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. @@ -18,7 +18,7 @@ from math import cos, sin -from vector2d import Vector2 +from .vector2d import Vector2 def rotate(v, theta): diff --git a/modules/tools/prediction/data_pipelines/common/trajectory.py b/modules/tools/prediction/data_pipelines/common/trajectory.py index d5f9800f22e..0e7a8d4fb39 100644 --- a/modules/tools/prediction/data_pipelines/common/trajectory.py +++ b/modules/tools/prediction/data_pipelines/common/trajectory.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. @@ -21,14 +21,12 @@ import math import numpy as np -from configure import parameters +from .configure import parameters from common.bounding_rectangle import BoundingRectangle param_fea = parameters['feature'] -class TrajectoryToSample(object): - - __metaclass__ = abc.ABCMeta +class TrajectoryToSample(object, metaclass=abc.ABCMeta): def __call__(self, trajectory): self.clean(trajectory) diff --git a/modules/tools/prediction/data_pipelines/common/util.py b/modules/tools/prediction/data_pipelines/common/util.py index bdeb64fff51..64a247ca6a9 100644 --- a/modules/tools/prediction/data_pipelines/common/util.py +++ b/modules/tools/prediction/data_pipelines/common/util.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/prediction/data_pipelines/common/vector2d.py b/modules/tools/prediction/data_pipelines/common/vector2d.py index d845758e790..75ab3fb094e 100644 --- a/modules/tools/prediction/data_pipelines/common/vector2d.py +++ b/modules/tools/prediction/data_pipelines/common/vector2d.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/prediction/data_pipelines/data_preprocessing/generate_cruise_labels.py b/modules/tools/prediction/data_pipelines/data_preprocessing/generate_cruise_labels.py index 20d60b7a1b2..de83f30dec0 100644 --- a/modules/tools/prediction/data_pipelines/data_preprocessing/generate_cruise_labels.py +++ b/modules/tools/prediction/data_pipelines/data_preprocessing/generate_cruise_labels.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/prediction/data_pipelines/junctionMLP_train.py b/modules/tools/prediction/data_pipelines/junctionMLP_train.py index 15e968cd779..e6f5043bca7 100644 --- a/modules/tools/prediction/data_pipelines/junctionMLP_train.py +++ b/modules/tools/prediction/data_pipelines/junctionMLP_train.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. @@ -26,8 +26,8 @@ import argparse import numpy as np import tensorflow as tf -import proto.fnn_model_pb2 -from proto.fnn_model_pb2 import FnnModel, Layer +from . import proto.fnn_model_pb2 +from .proto.fnn_model_pb2 import FnnModel, Layer from sklearn.model_selection import train_test_split dim_input = 7 + 72 diff --git a/modules/tools/prediction/data_pipelines/merge_h5.py b/modules/tools/prediction/data_pipelines/merge_h5.py index 752c829c358..35ec18234b9 100644 --- a/modules/tools/prediction/data_pipelines/merge_h5.py +++ b/modules/tools/prediction/data_pipelines/merge_h5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. @@ -50,7 +50,7 @@ def load_hdf5(filename): os._exit(1) h5_file = h5py.File(filename, 'r') - values = h5_file.values()[0] + values = list(h5_file.values())[0] print ("load data size:", values.shape[0]) return values diff --git a/modules/tools/prediction/data_pipelines/mlp_train.py b/modules/tools/prediction/data_pipelines/mlp_train.py index dc485244059..b92b5f13614 100644 --- a/modules/tools/prediction/data_pipelines/mlp_train.py +++ b/modules/tools/prediction/data_pipelines/mlp_train.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. @@ -39,15 +39,15 @@ from keras.regularizers import l2, l1 from sklearn.model_selection import train_test_split -import proto.fnn_model_pb2 -from proto.fnn_model_pb2 import FnnModel, Layer +from . import proto.fnn_model_pb2 +from .proto.fnn_model_pb2 import FnnModel, Layer -import common.log -from common.data_preprocess import load_h5 -from common.data_preprocess import down_sample -from common.data_preprocess import train_test_split -from common.configure import parameters -from common.configure import labels +from . import common.log +from .common.data_preprocess import load_h5 +from .common.data_preprocess import down_sample +from .common.data_preprocess import train_test_split +from .common.configure import parameters +from .common.configure import labels # Constants dim_input = parameters['mlp']['dim_input'] diff --git a/modules/tools/prediction/data_pipelines/proto/__init__.py b/modules/tools/prediction/data_pipelines/proto/__init__.py index b3265c75e4d..45806692cdc 100644 --- a/modules/tools/prediction/data_pipelines/proto/__init__.py +++ b/modules/tools/prediction/data_pipelines/proto/__init__.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/prediction/multiple_gpu_estimator/counting.py b/modules/tools/prediction/multiple_gpu_estimator/counting.py index 59251c36513..e92e0a1f6b4 100644 --- a/modules/tools/prediction/multiple_gpu_estimator/counting.py +++ b/modules/tools/prediction/multiple_gpu_estimator/counting.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/prediction/multiple_gpu_estimator/preprocessing.py b/modules/tools/prediction/multiple_gpu_estimator/preprocessing.py index c8a684bc8af..5f7532459be 100644 --- a/modules/tools/prediction/multiple_gpu_estimator/preprocessing.py +++ b/modules/tools/prediction/multiple_gpu_estimator/preprocessing.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/realtime_plot/item.py b/modules/tools/realtime_plot/item.py index 224a07dfdad..403014de42d 100644 --- a/modules/tools/realtime_plot/item.py +++ b/modules/tools/realtime_plot/item.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/realtime_plot/realtime_plot.py b/modules/tools/realtime_plot/realtime_plot.py index 4f687ac1edf..4999757c0ea 100644 --- a/modules/tools/realtime_plot/realtime_plot.py +++ b/modules/tools/realtime_plot/realtime_plot.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/realtime_plot/stitem.py b/modules/tools/realtime_plot/stitem.py index 7fba7086704..74ab0187268 100644 --- a/modules/tools/realtime_plot/stitem.py +++ b/modules/tools/realtime_plot/stitem.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/realtime_plot/xyitem.py b/modules/tools/realtime_plot/xyitem.py index b450e09001d..60d73c7c294 100644 --- a/modules/tools/realtime_plot/xyitem.py +++ b/modules/tools/realtime_plot/xyitem.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_analyzer/common/distribution_analyzer.py b/modules/tools/record_analyzer/common/distribution_analyzer.py index 482fb0fc0f3..0d83e3de26c 100644 --- a/modules/tools/record_analyzer/common/distribution_analyzer.py +++ b/modules/tools/record_analyzer/common/distribution_analyzer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. @@ -16,7 +16,7 @@ # limitations under the License. ############################################################################### -from statistical_analyzer import PrintColors +from .statistical_analyzer import PrintColors class DistributionAnalyzer: diff --git a/modules/tools/record_analyzer/common/error_code_analyzer.py b/modules/tools/record_analyzer/common/error_code_analyzer.py index 4e05dda16cc..801dfe2ef43 100644 --- a/modules/tools/record_analyzer/common/error_code_analyzer.py +++ b/modules/tools/record_analyzer/common/error_code_analyzer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. @@ -17,8 +17,8 @@ ############################################################################### from modules.common.proto import error_code_pb2 -from statistical_analyzer import PrintColors -from distribution_analyzer import DistributionAnalyzer +from .statistical_analyzer import PrintColors +from .distribution_analyzer import DistributionAnalyzer class ErrorCodeAnalyzer: diff --git a/modules/tools/record_analyzer/common/error_msg_analyzer.py b/modules/tools/record_analyzer/common/error_msg_analyzer.py index 29c264b215e..01146cd5edd 100644 --- a/modules/tools/record_analyzer/common/error_msg_analyzer.py +++ b/modules/tools/record_analyzer/common/error_msg_analyzer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. @@ -17,8 +17,8 @@ ############################################################################### from modules.common.proto import error_code_pb2 -from statistical_analyzer import PrintColors -from distribution_analyzer import DistributionAnalyzer +from .statistical_analyzer import PrintColors +from .distribution_analyzer import DistributionAnalyzer class ErrorMsgAnalyzer: diff --git a/modules/tools/record_analyzer/common/frechet_distance.py b/modules/tools/record_analyzer/common/frechet_distance.py index bed0144c934..446982021e3 100644 --- a/modules/tools/record_analyzer/common/frechet_distance.py +++ b/modules/tools/record_analyzer/common/frechet_distance.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_analyzer/common/statistical_analyzer.py b/modules/tools/record_analyzer/common/statistical_analyzer.py index 556f73b6577..f88402e1be8 100644 --- a/modules/tools/record_analyzer/common/statistical_analyzer.py +++ b/modules/tools/record_analyzer/common/statistical_analyzer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_analyzer/lidar_endtoend_analyzer.py b/modules/tools/record_analyzer/lidar_endtoend_analyzer.py index 4855e295685..94eb08a35f7 100644 --- a/modules/tools/record_analyzer/lidar_endtoend_analyzer.py +++ b/modules/tools/record_analyzer/lidar_endtoend_analyzer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_analyzer/main.py b/modules/tools/record_analyzer/main.py index 05ef8f5f357..04d5a0bff50 100644 --- a/modules/tools/record_analyzer/main.py +++ b/modules/tools/record_analyzer/main.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_analyzer/metrics/curvature.py b/modules/tools/record_analyzer/metrics/curvature.py index 65cce967750..76f87c0165e 100644 --- a/modules/tools/record_analyzer/metrics/curvature.py +++ b/modules/tools/record_analyzer/metrics/curvature.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_analyzer/metrics/frame_count.py b/modules/tools/record_analyzer/metrics/frame_count.py index 178ed811f42..e614a92faeb 100644 --- a/modules/tools/record_analyzer/metrics/frame_count.py +++ b/modules/tools/record_analyzer/metrics/frame_count.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_analyzer/metrics/lat_acceleration.py b/modules/tools/record_analyzer/metrics/lat_acceleration.py index 817f1c36203..7b866937717 100644 --- a/modules/tools/record_analyzer/metrics/lat_acceleration.py +++ b/modules/tools/record_analyzer/metrics/lat_acceleration.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_analyzer/metrics/latency.py b/modules/tools/record_analyzer/metrics/latency.py index 34f4a754a0a..72236066de5 100644 --- a/modules/tools/record_analyzer/metrics/latency.py +++ b/modules/tools/record_analyzer/metrics/latency.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_analyzer/metrics/lon_acceleration.py b/modules/tools/record_analyzer/metrics/lon_acceleration.py index e69fc96cdf2..46a2cf2fae5 100644 --- a/modules/tools/record_analyzer/metrics/lon_acceleration.py +++ b/modules/tools/record_analyzer/metrics/lon_acceleration.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_analyzer/metrics/reference_line.py b/modules/tools/record_analyzer/metrics/reference_line.py index aeed64c74f2..df840b6fbc1 100644 --- a/modules/tools/record_analyzer/metrics/reference_line.py +++ b/modules/tools/record_analyzer/metrics/reference_line.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_analyzer/module_control_analyzer.py b/modules/tools/record_analyzer/module_control_analyzer.py index d5b1d184eca..c31507ad728 100644 --- a/modules/tools/record_analyzer/module_control_analyzer.py +++ b/modules/tools/record_analyzer/module_control_analyzer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_analyzer/module_planning_analyzer.py b/modules/tools/record_analyzer/module_planning_analyzer.py index 1cbab7ed1ae..273595c449b 100644 --- a/modules/tools/record_analyzer/module_planning_analyzer.py +++ b/modules/tools/record_analyzer/module_planning_analyzer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_analyzer/tools/dump_message.py b/modules/tools/record_analyzer/tools/dump_message.py index 335333fd414..f0dfe8b7e13 100644 --- a/modules/tools/record_analyzer/tools/dump_message.py +++ b/modules/tools/record_analyzer/tools/dump_message.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_analyzer/tools/perception_obstacle_sender.py b/modules/tools/record_analyzer/tools/perception_obstacle_sender.py index dcd65700a37..ed1497b5d1a 100644 --- a/modules/tools/record_analyzer/tools/perception_obstacle_sender.py +++ b/modules/tools/record_analyzer/tools/perception_obstacle_sender.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/record_play/rtk_player.py b/modules/tools/record_play/rtk_player.py index 23a443669a4..9d3e90888d2 100644 --- a/modules/tools/record_play/rtk_player.py +++ b/modules/tools/record_play/rtk_player.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -148,8 +148,8 @@ def restart(self): def closest_dist(self): shortest_dist_sqr = float('inf') self.logger.info("before closest self.start=%s" % (self.start)) - search_start = max(self.start - SEARCH_INTERVAL / 2, 0) - search_end = min(self.start + SEARCH_INTERVAL / 2, len(self.data)) + search_start = max(self.start - SEARCH_INTERVAL // 2, 0) + search_end = min(self.start + SEARCH_INTERVAL // 2, len(self.data)) self.logger.debug("search_start: %s" % search_start) self.logger.debug("search_end: %s" % search_end) closest_dist_point = self.start @@ -285,10 +285,10 @@ def publish_planningmsg(self): if CHANGE_TO_COM: # translation vector length(length / 2 - back edge to center) adc_point.path_point.x = adc_point.path_point.x + \ - (self.vehicle_param.length / 2 - self.vehicle_param.back_edge_to_center) * \ + (self.vehicle_param.length // 2 - self.vehicle_param.back_edge_to_center) * \ math.cos(adc_point.path_point.theta) adc_point.path_point.y = adc_point.path_point.y + \ - (self.vehicle_param.length / 2 - self.vehicle_param.back_edge_to_center) * \ + (self.vehicle_param.length // 2 - self.vehicle_param.back_edge_to_center) * \ math.sin(adc_point.path_point.theta) if planningdata.gear == chassis_pb2.Chassis.GEAR_REVERSE: diff --git a/modules/tools/record_play/rtk_recorder.py b/modules/tools/record_play/rtk_recorder.py index 9ad04c9c2c0..630b383815f 100644 --- a/modules/tools/record_play/rtk_recorder.py +++ b/modules/tools/record_play/rtk_recorder.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/relative_map_viewer/relative_map_viewer.py b/modules/tools/relative_map_viewer/relative_map_viewer.py index 5c5b8517a44..d673e7d4abb 100644 --- a/modules/tools/relative_map_viewer/relative_map_viewer.py +++ b/modules/tools/relative_map_viewer/relative_map_viewer.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/replay/replay_file.py b/modules/tools/replay/replay_file.py index f7eb333a55f..17d6cbd6373 100644 --- a/modules/tools/replay/replay_file.py +++ b/modules/tools/replay/replay_file.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -63,7 +63,7 @@ def topic_publisher(topic, filename, period): if period == 0: while not cyber.is_shutdown(): - raw_input("Press any key to publish one message...") + input("Press any key to publish one message...") writer.write(msg) print("Topic[%s] message published" % topic) else: @@ -99,7 +99,7 @@ def topic_publisher(topic, filename, period): for f in files: print("%d %s" % (i, f)) i += 1 - str_input = raw_input("Select message by number: ") + str_input = input("Select message by number: ") try: selected_file = int(str_input) if selected_file < 0 or selected_file > len(files): diff --git a/modules/tools/replay/replay_sequence.py b/modules/tools/replay/replay_sequence.py index 838ad61ee1a..4ff580da59a 100644 --- a/modules/tools/replay/replay_sequence.py +++ b/modules/tools/replay/replay_sequence.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/restore_video_record/restore_video_record.py b/modules/tools/restore_video_record/restore_video_record.py index b202b41a1b7..fd3055dcf8b 100644 --- a/modules/tools/restore_video_record/restore_video_record.py +++ b/modules/tools/restore_video_record/restore_video_record.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/rosbag/body_sensation_evaluation.py b/modules/tools/rosbag/body_sensation_evaluation.py index ecd17fc1686..266f63ce647 100644 --- a/modules/tools/rosbag/body_sensation_evaluation.py +++ b/modules/tools/rosbag/body_sensation_evaluation.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/rosbag/channel_size_stats.py b/modules/tools/rosbag/channel_size_stats.py index 22dacb6f667..d0d328c5b75 100755 --- a/modules/tools/rosbag/channel_size_stats.py +++ b/modules/tools/rosbag/channel_size_stats.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/rosbag/drive_event.py b/modules/tools/rosbag/drive_event.py index 923dcb407f1..c8166fb37cd 100755 --- a/modules/tools/rosbag/drive_event.py +++ b/modules/tools/rosbag/drive_event.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -66,7 +66,7 @@ def main(args): drive_event_meta_msg.msg_type) seq_num = 0 while not cyber.is_shutdown(): - event_type = raw_input( + event_type = input( "Type in Event Type('d') and press Enter (current time: " + str(datetime.datetime.now()) + ")\n>") event_type = event_type.strip() @@ -75,7 +75,7 @@ def main(args): current_time = cyber_time.Time.now().to_sec() event_str = None while not event_str: - event_str = raw_input("Type Event:>") + event_str = input("Type Event:>") event_str = event_str.strip() event_msg = drive_event_meta_msg.msg_type() event_msg.header.timestamp_sec = current_time diff --git a/modules/tools/rosbag/dump_gpsbin.py b/modules/tools/rosbag/dump_gpsbin.py index 527e73a7cb7..18300767058 100755 --- a/modules/tools/rosbag/dump_gpsbin.py +++ b/modules/tools/rosbag/dump_gpsbin.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/rosbag/dump_planning.py b/modules/tools/rosbag/dump_planning.py index 7517662b63e..2e824753959 100755 --- a/modules/tools/rosbag/dump_planning.py +++ b/modules/tools/rosbag/dump_planning.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/rosbag/dump_record.py b/modules/tools/rosbag/dump_record.py index 19842e10d13..5688da54dd3 100755 --- a/modules/tools/rosbag/dump_record.py +++ b/modules/tools/rosbag/dump_record.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/rosbag/dump_road_test_log.py b/modules/tools/rosbag/dump_road_test_log.py index e8d99c1460a..2b991af4bf0 100755 --- a/modules/tools/rosbag/dump_road_test_log.py +++ b/modules/tools/rosbag/dump_road_test_log.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/rosbag/extract_trajectory.py b/modules/tools/rosbag/extract_trajectory.py index b8e5d2b11a8..98897600409 100755 --- a/modules/tools/rosbag/extract_trajectory.py +++ b/modules/tools/rosbag/extract_trajectory.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/rosbag/sample_pnc_topics.py b/modules/tools/rosbag/sample_pnc_topics.py index e73b7da9689..8e7e3868c76 100755 --- a/modules/tools/rosbag/sample_pnc_topics.py +++ b/modules/tools/rosbag/sample_pnc_topics.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2018 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/rosbag/stat_mileage.py b/modules/tools/rosbag/stat_mileage.py index d1e49297f30..d106b780132 100755 --- a/modules/tools/rosbag/stat_mileage.py +++ b/modules/tools/rosbag/stat_mileage.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/rosbag/stat_static_info.py b/modules/tools/rosbag/stat_static_info.py index 28d8ba36eed..6456c1f22ef 100755 --- a/modules/tools/rosbag/stat_static_info.py +++ b/modules/tools/rosbag/stat_static_info.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/rosbag/tf_stats.py b/modules/tools/rosbag/tf_stats.py index 9594c8613cd..74c32d0ca6e 100755 --- a/modules/tools/rosbag/tf_stats.py +++ b/modules/tools/rosbag/tf_stats.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/rosbag/transcribe.py b/modules/tools/rosbag/transcribe.py index 8063f8ffa96..ab779669adc 100755 --- a/modules/tools/rosbag/transcribe.py +++ b/modules/tools/rosbag/transcribe.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/routing/debug_passage_region.py b/modules/tools/routing/debug_passage_region.py index 21a169513e7..cdf8335c0b3 100644 --- a/modules/tools/routing/debug_passage_region.py +++ b/modules/tools/routing/debug_passage_region.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/routing/debug_route.py b/modules/tools/routing/debug_route.py index 917b462f7cc..ef1c6a72c06 100644 --- a/modules/tools/routing/debug_route.py +++ b/modules/tools/routing/debug_route.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/routing/debug_topo.py b/modules/tools/routing/debug_topo.py index 75705a1904b..d8955cf17a4 100644 --- a/modules/tools/routing/debug_topo.py +++ b/modules/tools/routing/debug_topo.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -122,7 +122,7 @@ def plot_central_curve(central_curve, color): node_y = node_y + py #if curve.HasField('arc'): # draw_arc(curve.arc) - return [node_x[len(node_x) / 2], node_y[len(node_y) / 2]] + return [node_x[len(node_x) // 2], node_y[len(node_y) // 2]] def plot_node(node, plot_id, color): diff --git a/modules/tools/routing/road_show.py b/modules/tools/routing/road_show.py index 502af1cb20d..aa9c7f8f972 100644 --- a/modules/tools/routing/road_show.py +++ b/modules/tools/routing/road_show.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/routing/util.py b/modules/tools/routing/util.py index 46f3331de97..a810c629886 100644 --- a/modules/tools/routing/util.py +++ b/modules/tools/routing/util.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/sensor_calibration/data_file_object.py b/modules/tools/sensor_calibration/data_file_object.py index eb1f9907906..887c877720a 100644 --- a/modules/tools/sensor_calibration/data_file_object.py +++ b/modules/tools/sensor_calibration/data_file_object.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/sensor_calibration/extract_data.py b/modules/tools/sensor_calibration/extract_data.py index 1c842f1fab1..17a19582b29 100755 --- a/modules/tools/sensor_calibration/extract_data.py +++ b/modules/tools/sensor_calibration/extract_data.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/sensor_calibration/extract_static_data.py b/modules/tools/sensor_calibration/extract_static_data.py index 4421866576f..8a630e0b025 100644 --- a/modules/tools/sensor_calibration/extract_static_data.py +++ b/modules/tools/sensor_calibration/extract_static_data.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/sensor_calibration/sensor_msg_extractor.py b/modules/tools/sensor_calibration/sensor_msg_extractor.py index 8880128207f..27256b8887e 100644 --- a/modules/tools/sensor_calibration/sensor_msg_extractor.py +++ b/modules/tools/sensor_calibration/sensor_msg_extractor.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2019 The Apollo Authors. All Rights Reserved. @@ -201,7 +201,7 @@ def make_xyzit_point_cloud(self, xyz_i_t): np_type = pypcd.pcd_type_to_numpy_type[(t, s)] typenames.append(np_type) - np_dtype = np.dtype(zip(md['fields'], typenames)) + np_dtype = np.dtype(list(zip(md['fields'], typenames))) pc_data = self.convert_xyzit_pb_to_array(xyz_i_t, data_type=np_dtype) pc = pypcd.PointCloud(md, pc_data) return pc @@ -273,7 +273,7 @@ def parse_sensor_message(self, msg): print('Unsupported image encoding type: %s.' % image.encoding) return False - channel_num = image.step / image.width + channel_num = image.step // image.width self._parsed_data = np.fromstring(image.data, dtype=np.uint8).reshape( (image.height, image.width, channel_num)) @@ -351,7 +351,7 @@ def make_contidata_point_cloud(self, contiobs): np_type = pypcd.pcd_type_to_numpy_type[(t, s)] typenames.append(np_type) - np_dtype = np.dtype(zip(md['fields'], typenames)) + np_dtype = np.dtype(list(zip(md['fields'], typenames))) pc_data = self.convert_contiobs_pb_to_array(contiobs, data_type=np_dtype) pc = pypcd.PointCloud(md, pc_data) return pc @@ -381,4 +381,4 @@ def parse_sensor_message(self, msg): else: raise ValueError("not implement multiple message concatenation for COontiRadar topic") # TODO(gchen-Apollo): add saint check - return True \ No newline at end of file + return True diff --git a/modules/tools/vehicle_calibration/data_collector.py b/modules/tools/vehicle_calibration/data_collector.py index d66d3875f58..eaad743dc7f 100644 --- a/modules/tools/vehicle_calibration/data_collector.py +++ b/modules/tools/vehicle_calibration/data_collector.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -58,7 +58,7 @@ def run(self, cmd): signal.signal(signal.SIGINT, self.signal_handler) self.in_session = True - self.cmd = map(float, cmd) + self.cmd = list(map(float, cmd)) out = '' if self.cmd[0] > 0: out += 't' @@ -207,7 +207,7 @@ def main(): print('Positive number for throttle and negative number for brake.') while True: - cmd = raw_input("Enter commands: ").split() + cmd = input("Enter commands: ").split() if len(cmd) == 0: print('Quiting.') break diff --git a/modules/tools/vehicle_calibration/plot_data.py b/modules/tools/vehicle_calibration/plot_data.py index fc500b27b8b..14b5e8cddeb 100644 --- a/modules/tools/vehicle_calibration/plot_data.py +++ b/modules/tools/vehicle_calibration/plot_data.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -22,7 +22,7 @@ import matplotlib.pyplot as plt import numpy as np -import tkFileDialog +import tkinter.filedialog from process import get_start_index from process import preprocess @@ -127,7 +127,7 @@ def main(): # Get the latest file file_path = sys.argv[1] else: - file_path = tkFileDialog.askopenfilename( + file_path = tkinter.filedialog.askopenfilename( initialdir="/home/caros/.ros", filetypes=(("csv files", ".csv"), ("all files", "*.*"))) print('File path: %s' % file_path) diff --git a/modules/tools/vehicle_calibration/plot_grid.py b/modules/tools/vehicle_calibration/plot_grid.py index 954273ff916..d7cbebd8bf5 100644 --- a/modules/tools/vehicle_calibration/plot_grid.py +++ b/modules/tools/vehicle_calibration/plot_grid.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. diff --git a/modules/tools/vehicle_calibration/plot_results.py b/modules/tools/vehicle_calibration/plot_results.py index 83ec9be7cfc..e883159a26b 100644 --- a/modules/tools/vehicle_calibration/plot_results.py +++ b/modules/tools/vehicle_calibration/plot_results.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -55,13 +55,13 @@ NCURVES = len(cmd_table) np.random.seed(101) curves = [np.random.random(20) for i in range(NCURVES)] -values = range(NCURVES) +values = list(range(NCURVES)) jet = cm = plt.get_cmap('brg') cNorm = mcolors.Normalize(vmin=0, vmax=values[-1]) scalarMap = cmx.ScalarMappable(norm=cNorm, cmap=jet) cnt = 0 -cmds = cmd_table.keys() +cmds = list(cmd_table.keys()) cmds.sort() fig, ax = plt.subplots() @@ -70,7 +70,7 @@ speed_table = cmd_table[cmd] X = [] Y = [] - speeds = speed_table.keys() + speeds = list(speed_table.keys()) speeds.sort() for speed in speeds: X.append(speed) diff --git a/modules/tools/vehicle_calibration/process.py b/modules/tools/vehicle_calibration/process.py index 13d70b163d1..cb57155c7ca 100644 --- a/modules/tools/vehicle_calibration/process.py +++ b/modules/tools/vehicle_calibration/process.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -38,8 +38,8 @@ def preprocess(filename): b, a = signal.butter(6, 0.05, 'low') data['imu'] = signal.filtfilt(b, a, data['imu']) - data['imu'] = np.append(data['imu'][-SPEED_DELAY / 10:], - data['imu'][0:-SPEED_DELAY / 10]) + data['imu'] = np.append(data['imu'][-SPEED_DELAY // 10:], + data['imu'][0:-SPEED_DELAY // 10]) return data def get_start_index(data): diff --git a/modules/tools/vehicle_calibration/process_data.py b/modules/tools/vehicle_calibration/process_data.py index 9bcf7de5af3..cd78ffe7888 100644 --- a/modules/tools/vehicle_calibration/process_data.py +++ b/modules/tools/vehicle_calibration/process_data.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -23,7 +23,7 @@ import sys import numpy as np -import tkFileDialog +import tkinter.filedialog from process import get_start_index from process import preprocess @@ -76,7 +76,7 @@ def main(): # get the latest file file_path = sys.argv[1] else: - file_path = tkFileDialog.askopenfilename( + file_path = tkinter.filedialog.askopenfilename( initialdir="/home/caros/.ros", filetypes=(("csv files", ".csv"), ("all files", "*.*"))) plotter = Plotter(file_path) diff --git a/modules/tools/vehicle_calibration/result2pb.py b/modules/tools/vehicle_calibration/result2pb.py index 8c99b625eca..8b4999f2c94 100644 --- a/modules/tools/vehicle_calibration/result2pb.py +++ b/modules/tools/vehicle_calibration/result2pb.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ############################################################################### # Copyright 2017 The Apollo Authors. All Rights Reserved. @@ -89,11 +89,11 @@ def load_calibration_raw_data_old(fn): def get_calibration_table_pb(speed_table): calibration_table_pb = calibration_table_pb2.ControlCalibrationTable() - speeds = speed_table.keys() + speeds = list(speed_table.keys()) speeds.sort() for speed in speeds: acc_table = speed_table[speed] - accs = acc_table.keys() + accs = list(acc_table.keys()) accs.sort() for acc in accs: cmds = acc_table[acc]