Beispiel #1
0
def main() -> bool:
    parser = argparse.ArgumentParser(
        prog="ros.py",
        description="PathBench 2D ROS extension runner",
        formatter_class=argparse.RawTextHelpFormatter)

    configurers: List[Callable[[Configuration, argparse.Namespace], bool]] = []
    configurers.append(
        add_configuration_flags(parser,
                                visualiser_flags=True,
                                algorithms_flags=True,
                                multiple_algorithms_specifiable=False))

    parser.add_argument("-g",
                        "--goal",
                        nargs=2,
                        type=int,
                        help="goal position \"x y\"")

    args = parser.parse_args()
    print("args:{}".format(args))

    config = Configuration()

    for c in configurers:
        if not c(config, args):
            return False

    if args.algorithm:
        config.algorithm_name = list(config.algorithms.keys())[0]
        config.simulator_algorithm_type, config.simulator_testing_type, config.simulator_algorithm_parameters = config.algorithms[
            config.algorithm_name]

    goal = Point(*args.goal) if args.goal else None

    ros = Ros()
    ros.start(config, goal)

    return True
Beispiel #2
0
def main() -> bool:
    parser = argparse.ArgumentParser(
        prog="ros.py",
        description="ROS 2D Occupancy Grid Publish-Subscriber Demo",
        formatter_class=argparse.RawTextHelpFormatter)

    configurers: List[Callable[[Configuration, argparse.Namespace], bool]] = []
    configurers.append(
        add_configuration_flags(parser,
                                visualiser_flags=True,
                                algorithms_flags=True,
                                multiple_algorithms_specifiable=False))

    parser.add_argument("-f",
                        "--fake",
                        action="store_true",
                        help="fake the ROS publisher")

    args = parser.parse_args()
    print("args:{}".format(args))

    config = Configuration()

    for c in configurers:
        if not c(config, args):
            return False

    if args.algorithm:
        config.algorithm_name = list(config.algorithms.keys())[0]
        config.simulator_algorithm_type, config.simulator_testing_type, config.simulator_algorithm_parameters = config.algorithms[
            config.algorithm_name]

    ros = Ros(fake=args.fake)
    ros.start(config)

    return True