diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index d779f6d1..029441b7 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -24,7 +24,7 @@ jobs: - name: Run black run: | - black . --diff --extend-exclude cmake --check + black . --diff --extend-exclude=cmake --extend-exclude=submodules --extend-exclude=astrobee/survey_manager/survey_dependencies --check - name: Run isort run: | - isort . --diff --extend-skip cmake --profile black --check-only + isort . --diff --extend-skip=cmake --extend-skip=submodules --extend-skip=astrobee/survey_manager/survey_dependencies --profile=black --check-only diff --git a/.isort.cfg b/.isort.cfg index 88864386..0f2c426d 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -15,4 +15,4 @@ # folder, you can auto-update it by running # scripts/git/configure_isort_paths.sh. -src_paths = analyst/workspace/scripts,anomaly/gmm-change-detection,anomaly/gmm-change-detection/scripts/gmm,anomaly/image/scripts,astrobee/behaviors/inspection/scripts,astrobee/simulation/acoustics_cam/src,astrobee/survey_manager/survey_planner/tools,dense_map/geometry_mapper/tools,dense_map/volumetric_mapper/scripts,pano/pano_stitch/scripts,pano/pano_view/scripts,scripts/git +src_paths = analyst/workspace/scripts,anomaly/gmm-change-detection,anomaly/gmm-change-detection/scripts/gmm,anomaly/image/scripts,astrobee/behaviors/inspection/scripts,astrobee/simulation/acoustics_cam/src,astrobee/survey_manager/survey_planner,astrobee/survey_manager/survey_planner/scripts,astrobee/survey_manager/survey_planner/src/survey_planner,astrobee/survey_manager/survey_planner/tools/bak,communications/isaac_msgs/isaac_msgs/test,dense_map/geometry_mapper/tools,dense_map/volumetric_mapper/scripts,pano/pano_stitch/scripts,pano/pano_view/scripts,scripts/git diff --git a/astrobee/survey_manager/survey_planner/data/jem_survey_dynamic.yaml b/astrobee/survey_manager/survey_planner/data/jem_survey_dynamic.yaml index f7d8f9ae..69e8d29a 100644 --- a/astrobee/survey_manager/survey_planner/data/jem_survey_dynamic.yaml +++ b/astrobee/survey_manager/survey_planner/data/jem_survey_dynamic.yaml @@ -44,7 +44,7 @@ goals: - {type: panorama, robot: honey, order: 2, location: jem_bay6} - {type: panorama, robot: honey, order: 3, location: jem_bay5} # This is the other objective we previously had to comment out for POPF to return a decent plan. -- {type: stereo, robot: honey, order: 4, trajectory: jem_bay4_to_bay7} +- {type: stereo, robot: honey, order: 4, trajectory: jem_bay7_to_bay4} - {type: robot_at, robot: honey, location: berth2} init: diff --git a/astrobee/survey_manager/survey_planner/data/sample_output_plan.yaml b/astrobee/survey_manager/survey_planner/data/sample_output_plan.yaml index 45b0da90..6a517af3 100644 --- a/astrobee/survey_manager/survey_planner/data/sample_output_plan.yaml +++ b/astrobee/survey_manager/survey_planner/data/sample_output_plan.yaml @@ -192,7 +192,7 @@ action: type: stereo robot: honey - fplan: jem_stereo_mapping_bay4_to_bay7.fplan + fplan: ISAAC/jem_stereo_mapping_bay7_to_bay4 base_name: jem_bay7 bound_name: jem_bay4 duration_seconds: '600.000' @@ -206,7 +206,7 @@ action: type: stereo robot: bumble - fplan: jem_stereo_mapping_bay1_to_bay3.fplan + fplan: ISAAC/jem_stereo_mapping_bay1_to_bay3 base_name: jem_bay1 bound_name: jem_bay4 duration_seconds: '600.000' diff --git a/astrobee/survey_manager/survey_planner/pddl/problem_jem_survey.pddl b/astrobee/survey_manager/survey_planner/pddl/problem_jem_survey.pddl index 48d20caf..cd8061c2 100644 --- a/astrobee/survey_manager/survey_planner/pddl/problem_jem_survey.pddl +++ b/astrobee/survey_manager/survey_planner/pddl/problem_jem_survey.pddl @@ -1,6 +1,6 @@ ;; Auto-generated by problem_generator.py. Do not edit! -;; Command was: ./tools/problem_generator.py -;; Working directory was: /home/vagrant/isaac/astrobee/survey_manager/survey_planner +;; Command was: ./tools/problem_generator +;; Working directory was: /home/vagrant/isaac/src/astrobee/survey_manager/survey_planner ;; Problem template: pddl/jem_survey_template.pddl ;; Config 1: data/survey_static.yaml ;; Config 2: data/jem_survey_dynamic.yaml diff --git a/astrobee/survey_manager/survey_planner/pddl/problem_jem_survey.ps2.pddl b/astrobee/survey_manager/survey_planner/pddl/problem_jem_survey.ps2.pddl index f39e5694..02092c24 100644 --- a/astrobee/survey_manager/survey_planner/pddl/problem_jem_survey.ps2.pddl +++ b/astrobee/survey_manager/survey_planner/pddl/problem_jem_survey.ps2.pddl @@ -16,7 +16,7 @@ set instance o1 order set instance o2 order set instance o3 order set instance o4 order -set goal (and (completed-panorama bumble o0 jem_bay4) (completed-panorama bumble o1 jem_bay3) (completed-panorama bumble o2 jem_bay2) (completed-panorama bumble o3 jem_bay1) (completed-stereo bumble o4 jem_bay1 jem_bay4) (completed-panorama honey o0 jem_bay7) (completed-panorama honey o1 jem_bay6) (completed-panorama honey o2 jem_bay5) (robot-at honey berth2)) +set goal (and (completed-panorama bumble o0 jem_bay4) (completed-panorama bumble o1 jem_bay3) (completed-panorama bumble o2 jem_bay2) (completed-panorama bumble o3 jem_bay1) (completed-stereo bumble o4 jem_bay1 jem_bay4) (robot-at bumble berth1) (completed-panorama honey o1 jem_bay7) (completed-panorama honey o2 jem_bay6) (completed-panorama honey o3 jem_bay5) (completed-stereo honey o4 jem_bay7 jem_bay4) (robot-at honey berth2)) set predicate (move-connected jem_bay0 jem_bay1) set predicate (move-connected jem_bay1 jem_bay0) set predicate (move-connected jem_bay1 jem_bay2) @@ -130,6 +130,7 @@ set predicate (location-available jem_bay6) set predicate (location-available jem_bay7) set predicate (location-available jem_bay8) set predicate (need-stereo bumble o4 jem_bay1 jem_bay4) +set predicate (need-stereo honey o4 jem_bay7 jem_bay4) set function (= (order-identity o0) 0) set function (= (order-identity o1) 1) set function (= (order-identity o2) 2) diff --git a/astrobee/survey_manager/survey_planner/src/survey_planner/plan_interpreter.py b/astrobee/survey_manager/survey_planner/src/survey_planner/plan_interpreter.py index 13404b03..82e13f58 100755 --- a/astrobee/survey_manager/survey_planner/src/survey_planner/plan_interpreter.py +++ b/astrobee/survey_manager/survey_planner/src/survey_planner/plan_interpreter.py @@ -42,7 +42,8 @@ from matplotlib import collections as mc from matplotlib import patches as mp from matplotlib import pyplot as plt -from problem_generator import ( + +from survey_planner.problem_generator import ( DATA_DIR, get_stereo_traj, load_yaml, diff --git a/astrobee/survey_manager/survey_planner/src/survey_planner/plan_survey.py b/astrobee/survey_manager/survey_planner/src/survey_planner/plan_survey.py index c43be3d0..9c2879ee 100755 --- a/astrobee/survey_manager/survey_planner/src/survey_planner/plan_survey.py +++ b/astrobee/survey_manager/survey_planner/src/survey_planner/plan_survey.py @@ -29,6 +29,7 @@ import pyparsing as pp import yaml + from survey_planner.problem_generator import PDDL_DIR LocationName = str # Names PDDL object of type location diff --git a/scripts/git/configure_isort_paths.sh b/scripts/git/configure_isort_paths.sh index 318fae8a..1323b50c 100755 --- a/scripts/git/configure_isort_paths.sh +++ b/scripts/git/configure_isort_paths.sh @@ -27,7 +27,15 @@ srcdir=$(cd $thisdir/../.. && pwd) cd $srcdir # Generate a comma-separated list of folders containing *.py files -pydirs=$(find . -name "*.py" -print0 | xargs -0 dirname | cut -c3- | sort | uniq | paste -sd "," -) +pydirs=$( \ + find . -name "*.py" -print0 \ + | xargs -0 dirname \ + | cut -c3- \ + | grep -Pv "^cmake|^submodules|^astrobee/survey_manager/survey_dependencies|^scripts/setup/dependencies" \ + | sort \ + | uniq \ + | paste -sd "," - \ +) # Overwrite the src_paths line in the config file to use the list perl -i -ple "if (/^src_paths = /) { \$_ = 'src_paths = $pydirs'; }" .isort.cfg diff --git a/scripts/git/pre-commit.linter_python b/scripts/git/pre-commit.linter_python index 6f33ccb9..6ed60178 100755 --- a/scripts/git/pre-commit.linter_python +++ b/scripts/git/pre-commit.linter_python @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # Copyright (c) 2021, United States Government, as represented by the # Administrator of the National Aeronautics and Space Administration. @@ -72,12 +72,18 @@ echo " Analysing python code style with 'isort'." # could happen for example if the .isort.cfg src_paths list gets out # of date. -if $(isort ${py_changed} --profile black --diff --check-only --quiet >/dev/null); then +isort_args=( + "--extend-skip=cmake" + "--extend-skip=submodules" + "--extend-skip=astrobee/survey_manager/survey_dependencies" + "--profile=black" +) +if $(isort . "${isort_args[@]}" --diff --check-only --quiet >/dev/null); then echo "Linter checks using 'isort' passed." else echo "Errors detected with 'isort'. Fixing them. Try to add and commit your files again." - isort ${py_changed} --profile black >/dev/null - failed_lint=true + isort . "${isort_args[@]}" >/dev/null + failed_lint=true fi # Cancel commit if linter failed