From d8d230133127ae9e28cb870d614e754f653babf4 Mon Sep 17 00:00:00 2001 From: TiaSinghania Date: Thu, 15 Aug 2024 18:30:56 -0700 Subject: [PATCH] pylint --- rb_ws/src/buggy/paths/rosbag_to_pose_csv.py | 9 +++------ rb_ws/src/buggy/scripts/auton/brake_controller.py | 6 ++---- rb_ws/src/buggy/scripts/auton/pure_pursuit_controller.py | 2 -- rb_ws/src/buggy/scripts/validation/log_battery.py | 3 +-- rb_ws/src/buggy/scripts/validation/log_battery_tester.py | 2 +- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/rb_ws/src/buggy/paths/rosbag_to_pose_csv.py b/rb_ws/src/buggy/paths/rosbag_to_pose_csv.py index f0c9f399..0af3b6e9 100644 --- a/rb_ws/src/buggy/paths/rosbag_to_pose_csv.py +++ b/rb_ws/src/buggy/paths/rosbag_to_pose_csv.py @@ -1,9 +1,7 @@ #! /usr/bin/env python3 -import rosbag import argparse -import uuid -import json import csv +import rosbag from tf.transformations import euler_from_quaternion def main(): @@ -26,7 +24,7 @@ def main(): i = 0 # Loop through bag - for topic, msg, t in bag.read_messages(topics="/nav/odom"): + for _, msg, _ in bag.read_messages(topics="/nav/odom"): # Skip waypoints if i % args.subsample != 0: i += 1 @@ -38,7 +36,7 @@ def main(): orientation_q = msg.pose.pose.orientation orientation_list = [orientation_q.x, orientation_q.y, orientation_q.z, orientation_q.w] - (roll, pitch, yaw) = euler_from_quaternion (orientation_list) + (_, _, yaw) = euler_from_quaternion (orientation_list) waypoints.append([str(lat), str(lon), str(yaw)]) @@ -49,7 +47,6 @@ def main(): quotechar='|', quoting=csv.QUOTE_MINIMAL) for row in waypoints: writer.writerow(row) - if __name__ == "__main__": diff --git a/rb_ws/src/buggy/scripts/auton/brake_controller.py b/rb_ws/src/buggy/scripts/auton/brake_controller.py index 9fd85d76..6c1e407c 100644 --- a/rb_ws/src/buggy/scripts/auton/brake_controller.py +++ b/rb_ws/src/buggy/scripts/auton/brake_controller.py @@ -1,5 +1,4 @@ #!/usr/bin/env python3 -import rospy import numpy as np from controller import Controller @@ -24,7 +23,6 @@ def calculate_lateral_accel(linear_speed: float, steering_angle: float) -> float """ if (steering_angle == 0.0): return 0.0 - radius_front_wheel = Controller.WHEELBASE / np.sin(np.deg2rad(steering_angle)) radius_rear_wheel = Controller.WHEELBASE / np.tan(np.deg2rad(steering_angle)) @@ -49,7 +47,7 @@ def compute_braking(self, speed: float, steering_angle: float) -> float: return self._compute_binary_braking(speed, steering_angle) else: return self._compute_modulated_braking(speed, steering_angle) - + def _compute_binary_braking(self, speed: float, steering_angle: float) -> float: """Binary braking - using lateral acceleration @@ -65,7 +63,7 @@ def _compute_binary_braking(self, speed: float, steering_angle: float) -> float: return 1.0 else: return 0.0 - + def _compute_modulated_braking(self, speed: float, steering_angle: float) -> float: """Using P controller for braking based on lateral acceleration of buggy. Modulated values from 0-1 diff --git a/rb_ws/src/buggy/scripts/auton/pure_pursuit_controller.py b/rb_ws/src/buggy/scripts/auton/pure_pursuit_controller.py index 81f48a2f..29e5922e 100755 --- a/rb_ws/src/buggy/scripts/auton/pure_pursuit_controller.py +++ b/rb_ws/src/buggy/scripts/auton/pure_pursuit_controller.py @@ -1,5 +1,3 @@ -from abc import ABC, abstractmethod - import numpy as np import rospy diff --git a/rb_ws/src/buggy/scripts/validation/log_battery.py b/rb_ws/src/buggy/scripts/validation/log_battery.py index 466669ce..ef6804a5 100755 --- a/rb_ws/src/buggy/scripts/validation/log_battery.py +++ b/rb_ws/src/buggy/scripts/validation/log_battery.py @@ -1,9 +1,8 @@ # A script to log battery data to a .txt file +import csv import rospy from sensor_msgs.msg import BatteryState # Callback function to print the subscribed data on the terminal -import numpy as np -import csv file = open('battery_data.txt', 'w', newline='') writer = csv.writer(file) diff --git a/rb_ws/src/buggy/scripts/validation/log_battery_tester.py b/rb_ws/src/buggy/scripts/validation/log_battery_tester.py index 5019fe13..d315a87f 100755 --- a/rb_ws/src/buggy/scripts/validation/log_battery_tester.py +++ b/rb_ws/src/buggy/scripts/validation/log_battery_tester.py @@ -1,4 +1,4 @@ -# Script +# Script import rospy from sensor_msgs.msg import BatteryState # Callback function to print the subscribed data on the terminal import numpy as np