Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into add-vectornav-imu
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrxyz committed Apr 11, 2024
2 parents 616b80d + f6ea764 commit b5e73e5
Show file tree
Hide file tree
Showing 94 changed files with 2,527 additions and 741 deletions.
29 changes: 14 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:

deploy-docs:
name: Deploy docs from master
runs-on: ubuntu-20.04
runs-on: self-hosted
needs:
- super-ci
if: github.ref == 'refs/heads/master'
Expand All @@ -118,18 +118,17 @@ jobs:
name: docs-ci-html-${{ github.sha }}
path: ${{ github.workspace }}/build/docs

# We need to install rsync for GitHub Pages deploy action
- name: Install rsync
run: |
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y rsync
# Publish the artifact to the GitHub Pages branch
- name: Push docs to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
with:
token: ${{ secrets.INVESTIGATOR_BOT_TOKEN }}
branch: main
repository-name: uf-mil/uf-mil.github.io
folder: ${{ github.workspace }}/build/docs
target-folder: docs
commit-message: Updating docs to ${{ github.sha }}
- name: Push docs to mil.ufl.edu
run: |
# Install sshpass
sudo apt-get install sshpass
# Upload contents of local folder to remote folder
sshpass -p ${{ secrets.MIL_UFL_SFTP_PASS }} \
sftp -o StrictHostKeyChecking=no \
-P ${{ secrets.MIL_UFL_SFTP_PORT }} [email protected] << EOF
cd htdocs/docs
lcd ${{ github.workspace }}/build/docs
put -r .
exit
EOF
64 changes: 31 additions & 33 deletions .github/workflows/gh_pages.yaml → .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:

jobs:
deploy:
runs-on: ubuntu-20.04
runs-on: self-hosted
steps:
- name: Wait to let checks appear
run: sleep 1m
Expand Down Expand Up @@ -47,31 +47,32 @@ jobs:
commit: ${{ github.event.pull_request.head.sha }}
path: ${{ github.workspace }}/pr-docs

# We need to install rsync for GitHub Pages deploy action
- name: Install rsync
run: |
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install -y rsync
- name: Move folders
if: github.event.action != 'closed'
run: |
cd ${{ github.workspace }}/pr-docs
mv docs-ci-html-${{ github.event.pull_request.head.sha }} ${{ github.event.number }}
echo "datetime=$(TZ=America/New_York date '+%Y-%m-%d %H:%M %Z')" >> $GITHUB_ENV
############################
# If commit was an update/refresh (not close)
############################
# Publish the artifact to the GitHub Pages branch
- name: Push preview to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
- name: Upload docs to mil.ufl.edu
if: github.event.action != 'closed'
with:
token: ${{ secrets.INVESTIGATOR_BOT_TOKEN }}
branch: main
git-config-name: uf-mil-bot
git-config-email: [email protected]
repository-name: uf-mil/uf-mil.github.io
folder: ${{ github.workspace }}/pr-docs/${{ github.event.number }}
target-folder: pr-docs/${{ github.event.number }}
commit-message: "Adding PR preview for PR ${{ github.event.number }}"
run: |
# Install sshpass
sudo apt-get install sshpass
# Upload contents of local folder to remote folder
sshpass -p ${{ secrets.MIL_UFL_SFTP_PASS }} \
sftp -o StrictHostKeyChecking=no \
-P ${{ secrets.MIL_UFL_SFTP_PORT }} [email protected] << EOF
mkdir htdocs/pr-docs/${{ github.event.number }}
cd htdocs/pr-docs/${{ github.event.number }}
lcd ${{ github.workspace }}/pr-docs/${{ github.event.number }}
put -r .
exit
EOF
# Create/update stickied comment
- name: Update stickied comment
Expand All @@ -86,7 +87,7 @@ jobs:
The **docs preview** for this PR is available at
https://uf-mil.github.io/pr-docs/${{ github.event.number }}.
https://mil.ufl.edu/pr-docs/${{ github.event.number }}.
```css
Expand All @@ -102,24 +103,21 @@ jobs:
Have a great day! Go gators! 🐊
############################
# If commit was closed
############################
# If the PR is closed, remove the files
- name: Prepare empty folder
- name: Delete pr-docs folder on mil.ufl.edu
if: github.event.action == 'closed'
run: |
echo "emptydir=$(mktemp -d)" >> $GITHUB_ENV
- name: Prepare deletion folders
uses: JamesIves/github-pages-deploy-action@v4
if: github.event.action == 'closed'
with:
token: ${{ secrets.INVESTIGATOR_BOT_TOKEN }}
branch: main
git-config-name: uf-mil-bot
git-config-email: [email protected]
repository-name: uf-mil/uf-mil.github.io
folder: ${{ env.emptydir }}
target-folder: pr-docs/${{ github.event.number }}
commit-message: Removing PR preview for PR ${{ github.event.number }}
# Install lftp
sudo apt-get install lftp
# Upload docs
lftp -u mil,${{ secrets.MIL_UFL_SFTP_PASS }} \
-p ${{ secrets.MIL_UFL_SFTP_PORT }} sftp://mil.ufl.edu << EOF
rm -r htdocs/pr-docs/${{ github.event.number }}
exit
EOF
# Create/update stickied comment
- name: Update stickied comment
Expand Down
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,36 @@ ci:

repos:
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.33.0
rev: v1.35.1
hooks:
- id: yamllint
- repo: https://github.com/psf/black
rev: 24.1.1
rev: 24.3.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v17.0.6
rev: v18.1.2
hooks:
- id: clang-format
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
rev: v2.3.1
hooks:
- id: autoflake
args: [--remove-all-unused-imports, --ignore-init-module-imports]
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.6
rev: v0.10.0.1
hooks:
- id: shellcheck
exclude: ^docker|deprecated|NaviGator/simulation/VRX
args: [--severity=warning, --exclude=SC1090]
- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.7.0-4
rev: v3.8.0-1
hooks:
- id: shfmt
exclude: ^docker|deprecated|NaviGator/simulation/VRX
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: 'v0.2.0'
rev: 'v0.3.4'
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
12 changes: 3 additions & 9 deletions NaviGator/gnc/navigator_path_planner/nodes/path_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,7 @@ def move_cb(self, msg: MoveAction) -> Optional[bool]:
print(f"\nMove {self.move_count}\n----")
print(f"Behavior: {self.enroute_behavior.__name__[10:]}")
print(
"Reached goal region: {}".format(
self.enroute_behavior.planner.plan_reached_goal,
),
f"Reached goal region: {self.enroute_behavior.planner.plan_reached_goal}",
)
print(f"Goal bias: {np.round(self.goal_bias, 2)}")
print(f"Tree size: {self.tree.size}")
Expand Down Expand Up @@ -1027,9 +1025,7 @@ def reevaluate_plan(self) -> None:
self.failure_reason = "collided"
else:
print(
"\nFound collision on current path!\nTime till collision: {}".format(
time_till_collision,
),
f"\nFound collision on current path!\nTime till collision: {time_till_collision}",
)
self.time_till_issue = time_till_collision
for behavior in self.behaviors_list:
Expand Down Expand Up @@ -1495,9 +1491,7 @@ def ogrid_cb(self, msg: OccupancyGrid) -> None:
elapsed = abs(self.rostime() - start)
if elapsed > 1:
print(
"\n(WARNING: ogrid callback is taking {} seconds)\n".format(
np.round(elapsed, 2),
),
f"\n(WARNING: ogrid callback is taking {np.round(elapsed, 2)} seconds)\n",
)

def odom_cb(self, msg: Odometry) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,7 @@ def from_urdf(

if t_ratio < 0:
raise Exception(
"Thruster mapper does not allow mechanical reduction of {} for {}.".format(
t_ratio,
transmission.name,
),
f"Thruster mapper does not allow mechanical reduction of {t_ratio} for {transmission.name}.",
)

ratio[i] = t_ratio
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ def __init__(self):
def _client_cb(self, terminal_state, result):
if terminal_state != 3:
rospy.logwarn(
"Station hold goal failed (Status={}, Result={})".format(
TerminalState.to_string(terminal_state),
result.result,
),
f"Station hold goal failed (Status={TerminalState.to_string(terminal_state)}, Result={result.result})",
)
return
rospy.loginfo("Station holding!")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,7 @@ async def get_target_bays(self):
self.bay_1 = (bay_1_shape, bay_1_color)
self.bay_2 = (bay_2_shape, bay_2_color)
print_good(
"Docking in Bay (Shape={}, Color={}) then (Shape={}, Color={})".format(
bay_1_shape,
bay_1_color,
bay_2_shape,
bay_2_color,
),
f"Docking in Bay (Shape={bay_1_shape}, Color={bay_1_color}) then (Shape={bay_2_shape}, Color={bay_2_color})",
)

async def get_waypoint(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,7 @@ def is_done(objects, positions):
filter_and_sort,
)
self.send_feedback(
"Going through gate of objects {} and {}".format(
left_obj.labeled_classification,
right_obj.labeled_classification,
),
f"Going through gate of objects {left_obj.labeled_classification} and {right_obj.labeled_classification}",
)
gate = self.get_gate(left, right, p)
await self.go_thru_gate(gate)
Expand Down Expand Up @@ -393,10 +390,7 @@ def is_done(objects, positions):
self.objects_passed.add(red.id)
gate = self.get_gate(white_position, red_position, robot_position)
self.send_feedback(
"Going through start gate formed by {} and {}".format(
white.labeled_classification,
red.labeled_classification,
),
f"Going through start gate formed by {white.labeled_classification} and {red.labeled_classification}",
)
await self.go_thru_gate(gate, AFTER=-2)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,12 +800,7 @@ async def get(self, raise_exception: bool = True):
value = await self.nh.get_param(self.param)
if not self._valid(value):
raise Exception(
"Value {} is invalid for param {}\nValid values: {}\nDescription: {}".format(
value,
self.param,
self.options,
self.description,
),
f"Value {value} is invalid for param {self.param}\nValid values: {self.options}\nDescription: {self.description}",
)
else:
return value
Expand All @@ -816,12 +811,7 @@ async def exists(self) -> bool:
async def set(self, value):
if not self._valid(value):
raise Exception(
"Value {} is invalid for param {}\nValid values: {}\nDescription: {}".format(
value,
self.param,
self.options,
self.description,
),
f"Value {value} is invalid for param {self.param}\nValid values: {self.options}\nDescription: {self.description}",
)
await self.nh.set_param(self.param, value)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ def is_done(objects, positions):
filter_and_sort,
)
self.send_feedback(
"Going through gate of objects {} and {}".format(
left_obj.labeled_classification,
right_obj.labeled_classification,
),
f"Going through gate of objects {left_obj.labeled_classification} and {right_obj.labeled_classification}",
)
gate = self.get_gate(left, right, p)
await self.go_thru_gate(gate)
Expand Down Expand Up @@ -336,10 +333,7 @@ def is_done(objects, positions):
self.objects_passed.add(red.id)
gate = self.get_gate(white_position, red_position, robot_position)
self.send_feedback(
"Going through start gate formed by {} and {}".format(
white.labeled_classification,
red.labeled_classification,
),
f"Going through start gate formed by {white.labeled_classification} and {red.labeled_classification}",
)
await self.go_thru_gate(gate, AFTER=-2)

Expand Down
5 changes: 1 addition & 4 deletions NaviGator/perception/navigator_vision/nodes/classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,7 @@ def process_boxes(self, msg):
# self.CLASSES[a.results[0].id],
# )
# )
cmd = "{}={}".format(
self.last_objects.objects[closest_to_box].id,
self.CLASSES[a.results[0].id],
)
cmd = f"{self.last_objects.objects[closest_to_box].id}={self.CLASSES[a.results[0].id]}"
self.database_client(ObjectDBQueryRequest(cmd=cmd))

if not self.is_perception_task:
Expand Down
11 changes: 2 additions & 9 deletions NaviGator/perception/navigator_vision/nodes/database_color.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,10 +377,7 @@ def _get_closest_color(self, hue_angle):
likely_color = color

fprint(
"Likely color: {} with an hue error of {} rads.".format(
likely_color,
np.round(error, 3),
),
f"Likely color: {likely_color} with an hue error of {np.round(error, 3)} rads.",
)
return [likely_color, error]

Expand Down Expand Up @@ -468,11 +465,7 @@ def do_observe(self, *args):
return

fprint(
"No valid image found for t={} ({}) dt: {}".format(
time_of_marker.to_sec(),
t.to_sec(),
(rospy.Time.now() - t).to_sec(),
),
f"No valid image found for t={time_of_marker.to_sec()} ({t.to_sec()}) dt: {(rospy.Time.now() - t).to_sec()}",
msg_color="red",
)
return
Expand Down
10 changes: 2 additions & 8 deletions NaviGator/perception/navigator_vision/nodes/vrx_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,9 @@ def process_boxes(self, msg):

classified.add(self.last_objects.objects[closest_to_box].id)
print(
"Object {} classified as {}".format(
self.last_objects.objects[closest_to_box].id,
self.CLASSES[a.results[0].id],
),
)
cmd = "{}={}".format(
self.last_objects.objects[closest_to_box].id,
self.CLASSES[a.results[0].id],
f"Object {self.last_objects.objects[closest_to_box].id} classified as {self.CLASSES[a.results[0].id]}",
)
cmd = f"{self.last_objects.objects[closest_to_box].id}={self.CLASSES[a.results[0].id]}"
self.database_client(ObjectDBQueryRequest(cmd=cmd))

if not self.is_perception_task:
Expand Down
Loading

0 comments on commit b5e73e5

Please sign in to comment.