Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update pre-commit hooks to latest versions #1103

Merged
merged 28 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d5d08d9
Update pre-commit hooks to latest versions
pre-commit-ci[bot] Mar 6, 2023
7997847
Run apt-get update before upgrade (#1001)
kawaiiPlat Mar 9, 2023
0ddebfc
Remove clang-format upgrade because of lack of aarch64 wheels for Linux
cbrxyz Mar 9, 2023
b48e3e2
Merge branch 'pre-commit-ci-update-config' of https://github.com/uf-m…
cbrxyz Mar 9, 2023
e317879
Update pre-commit hooks to latest versions
pre-commit-ci[bot] Apr 3, 2023
7135e79
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 3, 2023
1997acc
Merge master
cbrxyz Apr 3, 2023
7791f49
Fix spelling mistakes for codespell
cbrxyz Apr 8, 2023
141e457
Update pre-commit hooks to latest versions
pre-commit-ci[bot] May 1, 2023
547fecc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 1, 2023
078ee8a
Update pre-commit dependencies to latest versions
cbrxyz May 12, 2023
3728f5c
Update files to match new pre-commit updates
cbrxyz Jun 1, 2023
bb6d831
Update pre-commit hooks to latest versions
pre-commit-ci[bot] Aug 7, 2023
1304cda
Merge master
cbrxyz Aug 8, 2023
00a075e
Update with pre-commit changes
cbrxyz Aug 8, 2023
65d92ee
Update pre-commit hooks to latest versions
pre-commit-ci[bot] Oct 2, 2023
0d1918c
Merging
cbrxyz Oct 10, 2023
dc47cc6
Merge remote-tracking branch 'origin' into pre-commit-ci-update-config
cbrxyz Oct 10, 2023
5fb3ef1
Update pre-commit hooks to latest versions
pre-commit-ci[bot] Nov 6, 2023
219d34a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 6, 2023
e9c6ec5
Update pre-commit dependencies to latest versions
cbrxyz Nov 6, 2023
efb9710
Fix spelling mistakes for codespell
cbrxyz Nov 6, 2023
740f752
Fix too short underline
cbrxyz Nov 6, 2023
97e7f7f
Update pre-commit hooks to latest versions
pre-commit-ci[bot] Jan 1, 2024
c2ec9a1
Merge conflict
cbrxyz Jan 21, 2024
962fc9c
Update wait-on-check-action action for dependency updates
cbrxyz Jan 27, 2024
64cd4cb
Update pre-commit hooks to latest versions
pre-commit-ci[bot] Feb 5, 2024
df856b0
Re-format files
cbrxyz Feb 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gh_pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

# Wait for the CI to finish so we can download the docs artifact
- name: Wait for CI
uses: lewagon/wait-on-check-action@v1.0.0
uses: lewagon/wait-on-check-action@v1.3.3
if: github.event.action != 'closed'
with:
ref: ${{ github.event.pull_request.head.ref }}
Expand Down
15 changes: 8 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ ci:

repos:
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.32.0
rev: v1.33.0
hooks:
- id: yamllint
- repo: https://github.com/psf/black
rev: 23.9.1
rev: 24.1.1
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
rev: v17.0.6
hooks:
- id: clang-format
- repo: https://github.com/PyCQA/autoflake
Expand All @@ -34,18 +34,18 @@ repos:
exclude: ^docker|deprecated|NaviGator/simulation/VRX
args: [--severity=warning, --exclude=SC1090]
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.7.0-1
rev: v3.7.0-4
hooks:
- id: shfmt
exclude: ^docker|deprecated|NaviGator/simulation/VRX
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.292'
rev: 'v0.2.0'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
rev: v2.2.6
hooks:
- id: codespell
args:
Expand Down Expand Up @@ -73,11 +73,12 @@ repos:
- id: prettier-package-xml
- id: sort-package-xml
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
exclude_types: [markdown, rst]
- id: check-executables-have-shebangs
- id: check-symlinks
- id: check-json
Expand Down
2 changes: 1 addition & 1 deletion NaviGator/gnc/navigator_path_planner/nodes/path_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ def reevaluate_plan(self) -> None:
def action_check(self, _: rospy.timer.TimerEvent) -> None:
"""
Manages action preempting. Serves as the callback to a Timer operating
opereating every self.revisit_period seconds.
operating every self.revisit_period seconds.
"""
if self.preempted or not self.move_server.is_active():
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
The computer can also command a kill (for example, if ROS notices a criticaly low battery)
by sending the COMPUTER.KILL.REQUEST and undone with COMPUTER.CLEAR.REQUEST
"""

constants = {
"TIMEOUT_SECONDS": 8.0, # How often board must be pinged to not set HEARTBERAT_REMOTE True
# Note: not official documented, this is just a guess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ def _check_voltage(self, msg):
if not self._raised or self._severity != severity:
self.broadcaster.raise_alarm(
severity=severity,
problem_description="battery critcaly low"
if severity == 2
else "battery low",
problem_description=(
"battery critcaly low" if severity == 2 else "battery low"
),
parameters={"voltage": voltage},
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ def check_continuity(self, odom):
self._raised = True # Avoid raising multiple times
rospy.logwarn("ODOM DISCONTINUITY DETECTED")
self.ab.raise_alarm(
problem_description="ODOM DISCONTINUITY DETECTED. JUMPED {} METERS".format(
jump,
),
problem_description=f"ODOM DISCONTINUITY DETECTED. JUMPED {jump} METERS",
severity=5,
)
self.last_position = position
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,14 @@ dock_shape_1:
param: /mission/identify_dock/shape_1
options: [CIRCLE, TRIANGLE, CROSS, ANY]
description: >
The shape of the first bay to dock in during the dentify
The shape of the first bay to dock in during the identify
Symbols and Dock mission. If set to ANY, mission should dock based on the
color parameter and set this parameter during the mission
dock_color_1:
param: /mission/identify_dock/color_1
options: [RED, GREEN, BLUE, ANY]
description: >
The color of the first bay to dock in during the dentify Symbols and Dock
The color of the first bay to dock in during the identify Symbols and Dock
mission. If set to ANY, mission should dock based on the shape parameter
and set this parameter during the mission

Expand All @@ -174,7 +174,7 @@ dock_shape_2:
description: >
# yamllint disable-line rule:line-length
The shape of the second bay to dock in during the
dentify Symbols and Dock mission. If set to ANY,
identify Symbols and Dock mission. If set to ANY,
mission should dock based on the color parameter and set this
parameter during the mission
dock_color_2:
Expand All @@ -183,6 +183,6 @@ dock_color_2:
description: >
# yamllint disable-line rule:line-length
The color of the second bay to dock in during the
dentify Symbols and Dock mission.
identify Symbols and Dock mission.
If set to ANY, mission should dock based on the shape
parameter and set this parameter during the mission
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def decode_parameters(cls, parameters):
return parsed

async def run(self, args):
# Publish a velocity of zero for a while to stabalize navigator
# Publish a velocity of zero for a while to stabilize navigator
self.send_feedback("Switching trajectory to constant")
await self.change_trajectory("constant")
await self.nh.sleep(0.1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ async def run(self, parameters):
_, closest_reds = await self.get_sorted_objects("red_cylinder", 1)
_, closest_greens = await self.get_sorted_objects("green_cylinder", 1)

# Rename the totems for their symantic name
# Rename the totems for their semantic name
green_close = closest_greens[0]
red_close = closest_reds[0]

Expand All @@ -83,7 +83,7 @@ async def run(self, parameters):
_, closest_reds = await self.get_sorted_objects("red_cylinder", 2)
_, closest_greens = await self.get_sorted_objects("green_cylinder", 2)

# Rename the totems for their symantic name
# Rename the totems for their semantic name
green_far = closest_greens[1]
red_far = closest_reds[1]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ async def do_circle():
await self.nh.sleep(0.25)
continue
fprint(
"Shape ({}found, using normal to look at other 3 shapes if needed".format(
res[0],
),
f"Shape ({res[0]}found, using normal to look at other 3 shapes if needed",
title="DETECT DELIVER",
msg_color="green",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async def run(self, args):
"yl": "yaw_left",
"yr": "yaw_right",
}
command = command if command not in shorthand else shorthand[command]
command = shorthand.get(command, command)
movement = getattr(self.move, command)

trans_move = command[:3] != "yaw"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,7 @@ def as_MoveGoal(self, move_type=MoveGoal.DRIVE, **kwargs):
for key in kwargs:
if not hasattr(MoveGoal, key):
fprint(
"MoveGoal msg doesn't have a field called '{}' you tried to set via kwargs.".format(
key,
),
f"MoveGoal msg doesn't have a field called '{key}' you tried to set via kwargs.",
title="POSE_EDITOR",
msg_color="red",
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ async def prepare_for_docking(self):
# This function looks at the two squares in front of the boat
# and it gets the middle pixel between the two squares.
# If the middle pixel is for some reason not in the middle of our camera...
# adjust the boat postiion before docking
# adjust the boat position before docking
print("prepare for landing!")

img = await self.front_left_camera_sub.get_next_message()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ void AerialMapDisplay::assembleScene()
// determine location of this tile, flipping y in the process
const double x = (tile.x() - loader_->centerTileX()) * tile_w + origin_x;
const double y = -(tile.y() - loader_->centerTileY()) * tile_h + origin_y;
// don't re-use any ids
// don't reuse any ids
const std::string name_suffix = std::to_string(tile.x()) + "_" + std::to_string(tile.y()) + "_" +
std::to_string(map_id_) + "_" + std::to_string(scene_id_);

Expand Down
2 changes: 1 addition & 1 deletion NaviGator/scripts/bash_aliases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ nthrust() {
topic="/$1_motor/cmd"
publishers=$(rostopic info "$topic" | grep Publishers)
if [ "$publishers" != "Publishers: None" ]; then
echo "Somone is already publishing to $topic. Perhaps you need to kill thrust mapper?"
echo "Someone is already publishing to $topic. Perhaps you need to kill thrust mapper?"
return 1
fi
rostopic pub "$topic" "roboteq_msgs/Command" "setpoint: $2" -r100
Expand Down
2 changes: 1 addition & 1 deletion NaviGator/utils/navigator_msgs/srv/GetDockBays.srv
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
geometry_msgs/Point[3] bays #The positions in ENU frame of the center of the three bays 0=left, 1=center, 2=right
geometry_msgs/Vector3 normal #Vector or normal pointing away from plane of dock back
bool success #False if an error occurred getting dock bays
string error #Descripion of error if success=false
string error #Description of error if success=false
6 changes: 2 additions & 4 deletions NaviGator/utils/navigator_tools/nodes/navigator_status_tui
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class nav_tui:
self.panel.hide()
panel.update_panels()
self.rate = rospy.Rate(2) # Fixed rate for while loop to update at: 2 hz
# The following are default field initalizations for various values that that will be overwritten
# The following are default field initializations for various values that that will be overwritten
self.voltage = 0
self.wrench = None
self.LAT = None
Expand Down Expand Up @@ -214,15 +214,13 @@ class nav_tui:
if len(self.decode_fault_status(self.FL_fault)) == 0:
self.window.addstr(5, self.x / 2 - 7, "No faults", curses.color_pair(3))
else:
n = 0
for fault in self.decode_fault_status(self.FL_fault):
for n, fault in enumerate(self.decode_fault_status(self.FL_fault)):
self.window.addstr(
5 + n,
self.x / 2 - 7,
"%s" % fault,
curses.color_pair(1),
)
n += 1

self.window.addstr(14, self.x / 2 - 7, "Back Left", color)
if len(self.decode_fault_status(self.BL_fault)) == 0:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def check_for_timeout(self, joy: Joy):

def joy_recieved(self, joy: Joy) -> None:
"""
Button elements are being assigned and simplied to readable names. The
Button elements are being assigned and simplified to readable names. The
number of deployments or retractions for thrusters are being updated based
on several conditions. Moreover, additional settings are changed based on the
state of the controller and the activation of potential alarms or switches.
Expand Down
2 changes: 1 addition & 1 deletion NaviGator/utils/voltage_gui/src/voltage_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def resizeFont(self) -> None: # done
threshFont = QtGui.QFont("Times", (self.fontSize) / 3, QtGui.QFont.Bold)
self.labelThresh.setFont(threshFont)

# Sets the text of the thrshold info box
# Sets the text of the threshold info box
def initThresh(self) -> None:
"""
Sets the text of the threshold info box
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
dist_h: 2.286e-02
# speed of sound in water
v_sound: 1482
# target Frquency in Hz
# target Frequency in Hz
triggering/target_frequency: 30000
# tolerance around target frequerncy in Hz
triggering/frequency_tolerance: 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
<param name="frame_id" type="string" value="/imu"/>
<rosparam>
scale:
- [0.993770963897068, 0.00105871125374563, 7.659410525291767e-05]
- [0.00105871125374563, 0.9996814868251349, -0.0011040738267441828]
- [7.659410525291767e-05, -0.001104073826744163, 1.0065910531028952]
shift: [1.2551999807772446e-06, -1.1666595150804588e-06, 6.895773090438596e-08]
- [0.9991765357958566, 0.006242798579443988, -0.008472478269327878]
- [0.006242798579443957, 1.0016179705091928, 0.0059841151097914345]
- [-0.008472478269327836, 0.0059841151097913, 0.999354597532967]
shift: [7.889247409445414e-06, 4.879179471165382e-06, 7.46017199298374e-06]
</rosparam>
</node>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,11 @@ if __name__ == "__main__":
with rosbag.Bag(sys.argv[1]) as bag:
points = numpy.array(
[
mil_ros_tools.rosmsg_to_numpy(msg.magnetic_field)
if hasattr(msg, "magnetic_field")
else mil_ros_tools.rosmsg_to_numpy(msg.vector)
(
mil_ros_tools.rosmsg_to_numpy(msg.magnetic_field)
if hasattr(msg, "magnetic_field")
else mil_ros_tools.rosmsg_to_numpy(msg.vector)
)
for topic, msg, t in bag.read_messages(topics=["/imu/mag_raw"])
],
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def detect(self, dice_img):
params.minConvexity = 0.8 # 1 = perfect convex hull
# Filter by Inertia
params.filterByInertia = True
params.minInertiaRatio = 0.4 # Defines the ellipsoid 1= detects only cirlces
params.minInertiaRatio = 0.4 # Defines the ellipsoid 1= detects only circles
# 0 = Detects even lines

# Create a detector with the parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@ def parse_string(threshes):
def reconfigure(self, config, level):
try:
self.lower = np.array(self.parse_string(config["dyn_lower"]))
rospy.logwarn("HSV lower bound below minimum value") if (
self.lower < 0
).any() else None
(
rospy.logwarn("HSV lower bound below minimum value")
if (self.lower < 0).any()
else None
)
self.upper = np.array(self.parse_string(config["dyn_upper"]))
rospy.logwarn("HSV upper bound above maximum values") if (
self.upper[0] > 179
).any() or (self.upper[1:] > 255).any() else None
(
rospy.logwarn("HSV upper bound above maximum values")
if (self.upper[0] > 179).any() or (self.upper[1:] > 255).any()
else None
)

except ValueError as e:
rospy.logwarn(f"Invalid dynamic reconfigure: {e}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class OrangeRectangleFinder:
* Transform this frames pose into /map frame
* Plug this frames pose in /map into a kalman filter to reduce noise

TODO: Allow for two objects to be identifed at once, both filtered through its own KF
TODO: Allow for two objects to be identified at once, both filtered through its own KF
"""

# Coordinate axes for debugging image
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
class_list = np.array(0)

# loop through the training images
count = 0
for i in os.listdir(os.path.abspath(folder)):
for count, i in enumerate(os.listdir(os.path.abspath(folder))):
# get the roi from the file
path = folder + "/" + i
roi_str = f.readline()
Expand Down Expand Up @@ -72,7 +71,6 @@
class_temp = np.empty(len_myinvhog / 9)
class_temp.fill(-1)
class_list = np.append(class_list, class_temp)
count += 1

# hack
class_list = np.delete(class_list, [0])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,11 @@ def train_on_data(observation_list, label_list, split_factor=4):
s_time = time.time()
process_round = 0
# Split this into multiple passes in an attempt to free RAM (no idea if this works).
for x, y in zip(all_observations_split, all_labels_split):
for process_round, (x, y) in enumerate(
zip(all_observations_split, all_labels_split),
):
print(f"Training subset {process_round + 1}/{split_factor}.")
boost.train(x, cv2.CV_ROW_SAMPLE, y, params=parameters)
process_round += 1

print(f"Time to complete: {time.time() - s_time}")
print("Done! Saving...")
Expand Down
Loading
Loading