Skip to content

Commit

Permalink
Update pre-commit hooks to latest versions (#1103)
Browse files Browse the repository at this point in the history
* Update pre-commit hooks to latest versions

updates:
- [github.com/pre-commit/mirrors-clang-format: v14.0.6 → v15.0.7](pre-commit/mirrors-clang-format@v14.0.6...v15.0.7)
- [github.com/charliermarsh/ruff-pre-commit: v0.0.247 → v0.0.254](astral-sh/ruff-pre-commit@v0.0.247...v0.0.254)

* Run apt-get update before upgrade (#1001)

The package index from the runner image will go out of date and dependencies may be unresolveable. If upgrade is run before update the index can be stale for the upgrade step.

* Remove clang-format upgrade because of lack of aarch64 wheels for Linux

* Update pre-commit hooks to latest versions

updates:
- [github.com/adrienverge/yamllint.git: v1.29.0 → v1.30.0](https://github.com/adrienverge/yamllint.git/compare/v1.29.0...v1.30.0)
- [github.com/psf/black: 23.1.0 → 23.3.0](psf/black@23.1.0...23.3.0)
- [github.com/pre-commit/mirrors-clang-format: v14.0.6 → v16.0.0](pre-commit/mirrors-clang-format@v14.0.6...v16.0.0)
- [github.com/PyCQA/autoflake: v2.0.1 → v2.0.2](PyCQA/autoflake@v2.0.1...v2.0.2)
- [github.com/scop/pre-commit-shfmt: v3.6.0-1 → v3.6.0-2](scop/pre-commit-shfmt@v3.6.0-1...v3.6.0-2)
- [github.com/charliermarsh/ruff-pre-commit: v0.0.254 → v0.0.260](astral-sh/ruff-pre-commit@v0.0.254...v0.0.260)
- [github.com/codespell-project/codespell: v2.2.2 → v2.2.4](codespell-project/codespell@v2.2.2...v2.2.4)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix spelling mistakes for codespell

* Update pre-commit hooks to latest versions

updates:
- [github.com/adrienverge/yamllint.git: v1.30.0 → v1.31.0](https://github.com/adrienverge/yamllint.git/compare/v1.30.0...v1.31.0)
- [github.com/pre-commit/mirrors-clang-format: v16.0.0 → v16.0.2](pre-commit/mirrors-clang-format@v16.0.0...v16.0.2)
- [github.com/PyCQA/autoflake: v2.0.2 → v2.1.1](PyCQA/autoflake@v2.0.2...v2.1.1)
- [github.com/charliermarsh/ruff-pre-commit: v0.0.260 → v0.0.263](astral-sh/ruff-pre-commit@v0.0.260...v0.0.263)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update files to match new pre-commit updates

* Update pre-commit hooks to latest versions

updates:
- [github.com/psf/black: 23.3.0 → 23.7.0](psf/black@23.3.0...23.7.0)
- [github.com/pre-commit/mirrors-clang-format: v16.0.4 → v16.0.6](pre-commit/mirrors-clang-format@v16.0.4...v16.0.6)
- [github.com/PyCQA/autoflake: v2.1.1 → v2.2.0](PyCQA/autoflake@v2.1.1...v2.2.0)
- [github.com/scop/pre-commit-shfmt: v3.6.0-2 → v3.7.0-1](scop/pre-commit-shfmt@v3.6.0-2...v3.7.0-1)
- https://github.com/charliermarsh/ruff-pre-commithttps://github.com/astral-sh/ruff-pre-commit
- [github.com/astral-sh/ruff-pre-commit: v0.0.270 → v0.0.282](astral-sh/ruff-pre-commit@v0.0.270...v0.0.282)
- [github.com/codespell-project/codespell: v2.2.4 → v2.2.5](codespell-project/codespell@v2.2.4...v2.2.5)

* Update with pre-commit changes

* Update pre-commit hooks to latest versions

updates:
- [github.com/psf/black: 23.7.0 → 23.9.1](psf/black@23.7.0...23.9.1)
- [github.com/shellcheck-py/shellcheck-py: v0.9.0.5 → v0.9.0.6](shellcheck-py/shellcheck-py@v0.9.0.5...v0.9.0.6)
- [github.com/astral-sh/ruff-pre-commit: v0.0.287 → v0.0.292](astral-sh/ruff-pre-commit@v0.0.287...v0.0.292)

* Update pre-commit hooks to latest versions

updates:
- [github.com/psf/black: 23.9.1 → 23.10.1](psf/black@23.9.1...23.10.1)
- [github.com/pre-commit/mirrors-clang-format: v16.0.6 → v17.0.4](pre-commit/mirrors-clang-format@v16.0.6...v17.0.4)
- [github.com/astral-sh/ruff-pre-commit: v0.0.292 → v0.1.4](astral-sh/ruff-pre-commit@v0.0.292...v0.1.4)
- [github.com/codespell-project/codespell: v2.2.5 → v2.2.6](codespell-project/codespell@v2.2.5...v2.2.6)
- [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](pre-commit/pre-commit-hooks@v4.4.0...v4.5.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix spelling mistakes for codespell

* Fix too short underline

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jarrod Sanders <[email protected]>
Co-authored-by: Cameron Brown <[email protected]>
  • Loading branch information
3 people authored Feb 16, 2024
1 parent 2773454 commit 1b57fc4
Show file tree
Hide file tree
Showing 71 changed files with 128 additions and 136 deletions.
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

0 comments on commit 1b57fc4

Please sign in to comment.