Beispiel #1
0
def generate_test_description(ready_fn):
    # The node under test and the checker node that will pass/fail our tests:
    test_topic = "veloyne_cloud_node_test_topic"
    velodyne_cloud_node = launch_ros.actions.LifecycleNode(
        package="velodyne_node",
        node_executable="velodyne_cloud_node_exe",
        node_name="vlp16_driver_node",
        node_namespace="lidar_front",
        parameters=[
            "{}/param/vlp16_test.param.yaml".format(
                ament_index_python.get_package_share_directory("velodyne_node")
            ),
            {
                "cloud_size": 500,
                "topic": test_topic
            }
        ],
        arguments=["--model", "vlp16"]
    )

    context = {'vel_node': velodyne_cloud_node}

    return launch.LaunchDescription([
        ROSSpecificLaunchStartup(),
        velodyne_cloud_node,
        # Need to keep the launch alive by having an alive process
        launch_testing.util.KeepAliveProc(),
        # Start tests right away - no need to wait for anything
        launch.actions.OpaqueFunction(function=lambda context: ready_fn())]
    ), context
def generate_test_description(ready_fn):
    # The node under test and the checker node that will pass/fail our tests:
    state_estimation_node = launch_ros.actions.Node(
        package="state_estimation_node",
        node_executable="state_estimation_node_exe",
        node_name="state_estimation_node",
        node_namespace="state_estimation_namespace",
        parameters=[
            "{}/param/state_estimation_node_test.param.yaml".format(
                ament_index_python.get_package_share_directory(
                    "state_estimation_node")
            ),
            {"output_frequency": 30.0}
        ]
    )

    context = {'state_node': state_estimation_node}

    return launch.LaunchDescription([
        ROSSpecificLaunchStartup(),
        state_estimation_node,
        # Need to keep the launch alive by having an alive process
        launch_testing.util.KeepAliveProc(),
        # Start tests right away - no need to wait for anything
        launch.actions.OpaqueFunction(function=lambda context: ready_fn())]
    ), context
def get_point_cloud_mutation_launch_description(*,
                                                test_nodes,
                                                checkers,
                                                topic="points_nonground",
                                                other_actions=[],
                                                spoofer=None):

    # Other nodes/procesess in the test fixture:
    if spoofer is None:
        spoofer = launch_ros.actions.Node(
            package="lidar_integration",
            node_executable="point_cloud_mutation_spoofer_exe",
            arguments=[
                "--topic", topic,
                "--freq", "10",
                "--runtime", "60",
                "--mean", "300000",
                "--std", "50000",
            ],
        )

    ld = launch.LaunchDescription([
        ROSSpecificLaunchStartup(),

        # Make sure the spoofer is up and running before launching the checker processes
        launch.actions.RegisterEventHandler(
            launch_testing.event_handlers.StdoutReadyListener(
                target_action=spoofer,
                ready_txt='Spoofer(s) number is:',
                actions=checkers + other_actions
            )
        ),

        # Add action to execute spoofer
        spoofer,

        # Add actions for test nodes
        *test_nodes
    ])

    return ld, {
        "_checkers": checkers,
        "_spoofer": spoofer,
        "_test_nodes": test_nodes,
    }
def generate_test_description(ready_fn):
    test_nodes = launch_ros.actions.Node(
        package="recordreplay_planner_node",
        node_executable="recordreplay_planner_node_exe",
        node_name="recordreplay_planner",
        parameters=[
            "{}/defaults.param.yaml".format(
                ament_index_python.get_package_share_directory(
                    "recordreplay_planner_node"))
        ],
    )

    # integration test
    ld = launch.LaunchDescription([
        ROSSpecificLaunchStartup(),
        test_nodes,
        launch.actions.OpaqueFunction(function=lambda context: ready_fn()),
    ])

    # An array of all the checkers to be enumerated by the tests
    return ld
Beispiel #5
0
def generate_test_description(ready_fn):
    test_nodes = launch_ros.actions.Node(
        package="pure_pursuit_nodes",
        node_executable="pure_pursuit_node_exe",
        node_name="pure_pursuit_node",
        parameters=[
            "{}/param/pure_pursuit_test.param.yaml".format(
                ament_index_python.get_package_share_directory(
                    "pure_pursuit_nodes"))
        ])

    # integration test
    checker = launch_ros.actions.Node(
        package="pure_pursuit_nodes",
        node_executable="pure_pursuit_integration_test_exe")

    ld = launch.LaunchDescription([
        ROSSpecificLaunchStartup(), test_nodes, checker,
        launch.actions.OpaqueFunction(function=lambda context: ready_fn())
    ])

    # An array of all the checkers to be enumerated by the tests
    return ld, {"_checkers": [checker]}
Beispiel #6
0
def get_lidar_launch_description(*,
                                 test_nodes,
                                 checkers,
                                 other_actions=[],
                                 port="21345",
                                 spoofer=None):
    """
    Set up a launch description that can be used to run lidar integration tests.

    :param test_nodes: An array of launch.actions that execute the nodes being tested

    :param checkers: An array of launch.actions representing the checker processes that will test
    the ROS ouput of the test_nodes

    Checkers can be created using the lidar_integration.make_pcl_checker factory function.  One
    checker is expected for each topic to be checked

    :param other_actions: An optional list of other actions to be launched along with the checker
    actions

    :param port: The port number to use for the UDP spoofer.  Tests should use
    lidar_ingetration.get_open_port() so as not to conflict with other tests that may run at the
    same time

    :param spoofer: To override the default vlp16_integration_spoofer (for the velodyne driver).
    Compliant spoofers must write "Spoofer(s) number is:' to the console when they start to
    output data

    :returns: A tuple of (launch.LaunchDescription, test_context dictionary).  The test_context
    dictionary must be part of the test_context returned by the parent generate_test_description
    function.  Its members are considered private and are not expected to be used by the parent
    test description function
    """
    # Other nodes/procesess in the test fixture:
    if spoofer is None:
        spoofer = launch_ros.actions.Node(
            package="lidar_integration",
            node_executable="vlp16_integration_spoofer_exe",
            arguments=[
                "--rpm",
                "600",
                "--ip1",
                "127.0.0.1",
                "--ip2",
                "127.0.0.1",
                "--port1",
                "{}".format(port),
            ])

    ld = launch.LaunchDescription([
        ROSSpecificLaunchStartup(),

        # Make sure the spoofer is up and running before launching the checker processes
        launch.actions.RegisterEventHandler(
            launch_testing.event_handlers.StdoutReadyListener(
                target_action=spoofer,
                ready_txt='Spoofer(s) number is:',
                actions=checkers + other_actions)),

        # Add action to execute spoofer
        spoofer,

        # Add actions for test nodes
        *test_nodes,
    ])

    return ld, {
        "_checkers":
        checkers,  # An array of all the checkers to be enumerated by the tests
        "_spoofer": spoofer,
        "_test_nodes": test_nodes,
    }