Skip to content

Commit

Permalink
fixing path in granite (#149)
Browse files Browse the repository at this point in the history
* fixing path in granite

* suggestion

* changing env var name
  • Loading branch information
marinagmoreira committed Feb 28, 2024
1 parent a68f12e commit eb235f8
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,17 @@ def get_ops_plan_path():
return "/opt/astrobee/ops/gds/plans/"

# Check if the environment variable $ASTROBEE_OPS exists
astrobee_ops_path = os.getenv("ASTROBEE_OPS")
astrobee_ops_path = os.getenv("OPS_REPO")
if astrobee_ops_path:
return os.path.join(astrobee_ops_path, "gds/plans")
return os.path.join(astrobee_ops_path, "dock_scripts/hsc/gds/plans")

# Check if the symlink ~/gds/latest/ControlStationConfig/IssWorld exists
symlink_path = os.path.expanduser("~/gds/latest/ControlStationConfig/IssWorld")
if os.path.islink(symlink_path):
# Get the target of the symlink
target_path = os.path.realpath(symlink_path)
# Construct the relative path ../../plans
relative_path = os.path.join(target_path, "../../plans")
relative_path = os.path.join(target_path, "../../../dock_scripts/hsc/gds/plans")
return relative_path

# Return None if none of the conditions are met
Expand Down Expand Up @@ -392,7 +392,7 @@ def send_command_recursive(self, command):

while exit_code != 0 and not rospy.is_shutdown():
self.write_output_once(
"Exit code non-zero: Do you want to repeat the survey? (yes/no/skip): \n"
"Exit code non-zero: Do you want to repeat the send command? (yes/no/skip): \n"
)
repeat = self.read_input_once().lower()
loginfo(f"user input: {repeat}")
Expand Down Expand Up @@ -581,6 +581,7 @@ def get_quick_stereo_survey(fplan_path: pathlib.Path) -> pathlib.Path:
@dataclass
class SurveyManagerExecutor:
process_executor: ProcessExecutor
command_executor: CommandExecutor
config_static: YamlMapping
fsw_ns_args: List[str]
cmd_exec_ns: str
Expand All @@ -604,14 +605,16 @@ def move(self, from_name: str, to_name: str) -> int:
to_name,
)
if exposure_value != 0:
cexec = CommandExecutor(self.cmd_exec_ns)
exit_code = first_non_zero(exit_code, cexec.change_exposure(exposure_value))
exit_code = first_non_zero(
exit_code, self.command_executor.change_exposure(exposure_value)
)

# Change map if needed
map_name = map_change(self.config_static, from_name, to_name)
if map_name != "":
cexec = CommandExecutor(self.cmd_exec_ns)
exit_code = first_non_zero(exit_code, cexec.change_map(map_name))
exit_code = first_non_zero(
exit_code, self.command_executor.change_map(map_name)
)

return exit_code

Expand Down Expand Up @@ -645,7 +648,9 @@ def survey_manager_executor(args, run, config_static, process_executor, quick: b
cmd_exec_ns = "/" + args["robot"]
command_executor = CommandExecutor(cmd_exec_ns)

sm_exec = SurveyManagerExecutor(process_executor, config_static, ns, cmd_exec_ns)
sm_exec = SurveyManagerExecutor(
process_executor, command_executor, config_static, ns, cmd_exec_ns
)

# Initialize exit code
exit_code = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
TypeVar,
)

import rospkg
import yaml

GOAL_TYPE_OPTIONS = ("panorama", "stereo", "robot_at", "let_other_robot_reach")
Expand All @@ -70,13 +71,13 @@
"let-other-robot-reach",
)

THIS_DIR = pathlib.Path(__file__).resolve().parent
CWD = pathlib.Path.cwd()
rospack = rospkg.RosPack()
DATA_DIR = pathlib.Path(
os.path.relpath(str((THIS_DIR / ".." / ".." / "data").resolve()), CWD)
os.path.relpath(pathlib.Path(rospack.get_path("survey_planner")) / "data", CWD)
)
PDDL_DIR = pathlib.Path(
os.path.relpath(str((THIS_DIR / ".." / ".." / "pddl").resolve()), CWD)
os.path.relpath(pathlib.Path(rospack.get_path("survey_planner")) / "pddl", CWD)
)
DEFAULT_CONFIGS = [
DATA_DIR / "jem_survey_static.yaml",
Expand Down

0 comments on commit eb235f8

Please sign in to comment.