Skip to content

Commit afd7cbe

Browse files
committed
Fix args handling
1 parent 40bfac6 commit afd7cbe

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

drone_estimators/ros_nodes/estimators.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jit_compile = false # TODO add jit compilation for faster estimators
1212

1313
[estimator1]
1414
estimator_type = "ukf"
15-
drone_name = "cf52"
15+
drone_name = "cf1"
1616
drone_config = "cf21B_500"
1717
dynamics_model = "so_rpy_rotor_drag"
1818
estimate_rotor_vel = true

drone_estimators/ros_nodes/ros2_node.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -545,18 +545,18 @@ def launch_node(settings: Munch, stop_event: Event):
545545
logging.basicConfig(level=logging.INFO)
546546

547547
parser = argparse.ArgumentParser()
548-
parser.add_argument(
549-
"--settings", default="ros_nodes/estimators.toml", help="Path to Settings file"
550-
)
551-
parser.add_argument(
552-
"--drone_name", default="cf52", help="Specify which drone is flying"
553-
)
548+
parser.add_argument("--settings", default=None, help="Path to settings file in CWD")
549+
parser.add_argument("--drone_name", default=None, help="Overwrite drone_name in estimator1")
554550
args = parser.parse_args()
555551

556-
path = Path(__file__).parents[1] / args.settings
552+
if args.settings is None:
553+
path = Path(__file__).parents[1] / "ros_nodes/estimators.toml"
554+
else:
555+
path = args.settings
557556
with open(path, "r") as f:
558557
estimators = munchify(toml.load(f))
559-
estimators.estimator1.drone_name = args.drone_name # overwrite drone_name
558+
if args.drone_name is not None:
559+
estimators.estimator1.drone_name = args.drone_name # overwrite drone_name
560560

561561
# Add debug to each estimator (if not already in place)
562562
for key, val in estimators.items():
@@ -569,4 +569,3 @@ def launch_node(settings: Munch, stop_event: Event):
569569
estimators = munchify({k: v for k, v in estimators.items() if k.startswith("estimator")})
570570

571571
launch_estimators(estimators)
572-

0 commit comments

Comments
 (0)