Skip to content

Commit

Permalink
Run test with both worlds
Browse files Browse the repository at this point in the history
  • Loading branch information
fabid committed Feb 13, 2025
1 parent e3df7c3 commit 544cdd1
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- uses: art-e-fact/action-artefacts-ci@main
with:
artefacts-api-key: ${{ secrets.ARTEFACTS_API_KEY }}
job-name: all
job-name: nav2
23 changes: 20 additions & 3 deletions artefacts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,24 @@ project: artefacts/navigation2-ignition-example

jobs:

all: # Overall job name
basic: # Only checks that things are loading
type: test
package:
docker:
build:
dockerfile: ./Dockerfile
runtime:
simulator: gazebo:fortress
framework: ros2:humble
timeout: 5 #minutes
scenarios:
defaults: # Global to all scenarios, and overriden in specific scenarios.
output_dirs: ["output"]
settings:
- name: bringup
ros_testfile: "src/sam_bot_nav2_gz/test/test_bringup.launch.py"

nav2:
type: test
package:
docker:
Expand All @@ -21,9 +38,9 @@ jobs:
- /odometry_error
- /distance_from_start_gt
- /distance_from_start_est
params:
launch/world: ["bookstore.sdf", "empty.sdf"]
settings:
- name: bringup
ros_testfile: "src/sam_bot_nav2_gz/test/test_bringup.launch.py"
- name: reach_goal
ros_testfile: "src/sam_bot_nav2_gz/test/test_reach_goal.launch.py"
- name: follow_waypoints
Expand Down
6 changes: 6 additions & 0 deletions src/sam_bot_nav2_gz/launch/complete_navigation.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def generate_launch_description():
navigation_ready_message = "Creating bond timer"

run_headless = LaunchConfiguration("run_headless")
world_file = LaunchConfiguration("world_file")

# Including launchfiles with execute process because i didn't find another way to wait for a certain messages befor starting the next launchfile
bringup = ExecuteProcess(
Expand All @@ -57,6 +58,7 @@ def generate_launch_description():
"use_rviz:=false",
["run_headless:=", run_headless],
"use_localization:=false",
["world_file:=", world_file]
],
shell=False,
output="screen",
Expand Down Expand Up @@ -169,6 +171,10 @@ def generate_launch_description():
default_value="False",
description="Start GZ in hedless mode and don't start RViz (overrides use_rviz)",
),
DeclareLaunchArgument(
name="world_file",
default_value="empty.sdf",
),
bringup,
waiting_toolbox,
waiting_navigation,
Expand Down
15 changes: 9 additions & 6 deletions src/sam_bot_nav2_gz/launch/display.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from launch_ros.substitutions import FindPackageShare
import launch_ros
import os
from launch.substitutions import PathJoinSubstitution


def generate_launch_description():
Expand All @@ -29,15 +30,17 @@ def generate_launch_description():
pkg_share, "src/description/sam_bot_description.urdf"
)
default_rviz_config_path = os.path.join(pkg_share, "rviz/urdf_config.rviz")
world_path = os.path.join(pkg_share, "world/empty.sdf")
gz_models_path = os.path.join(pkg_share, "models")

use_sim_time = LaunchConfiguration("use_sim_time")
use_localization = LaunchConfiguration("use_localization")
use_rviz = LaunchConfiguration("use_rviz")
log_level = LaunchConfiguration("log_level")
gz_verbosity = LaunchConfiguration("gz_verbosity")
run_headless = LaunchConfiguration("run_headless")
world_file_name = LaunchConfiguration("world_file")
gz_models_path = ":".join([pkg_share, os.path.join(pkg_share, "models")])
#gz_models_path = os.path.join(pkg_share, "models")
world_path = PathJoinSubstitution([pkg_share, "world", world_file_name])

robot_state_publisher_node = Node(
package="robot_state_publisher",
Expand Down Expand Up @@ -192,10 +195,6 @@ def generate_launch_description():
name="IGN_GAZEBO_RESOURCE_PATH",
value=gz_models_path,
),
SetEnvironmentVariable(
name="IGN_GAZEBO_MODEL_PATH",
value=gz_models_path,
),
DeclareLaunchArgument(
name="model",
default_value=default_model_path,
Expand All @@ -211,6 +210,10 @@ def generate_launch_description():
default_value="False",
description="Start GZ in hedless mode and don't start RViz (overrides use_rviz)",
),
DeclareLaunchArgument(
name="world_file",
default_value="empty.sdf",
),
DeclareLaunchArgument(
name="rvizconfig",
default_value=default_rviz_config_path,
Expand Down
7 changes: 6 additions & 1 deletion src/sam_bot_nav2_gz/test/test_reach_goal.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@
import pytest
from artefacts_toolkit.rosbag import rosbag, image_topics
from artefacts_toolkit.chart import make_chart
from artefacts_toolkit.config import get_artefacts_param


# This function specifies the processes to be run for our test
@pytest.mark.launch_test
@launch_testing.markers.keep_alive
def generate_test_description():
try:
world = get_artefacts_param("launch", "world")
except FileNotFoundError:
world = "empty.world"
launch_navigation_stack = IncludeLaunchDescription(
PythonLaunchDescriptionSource(
[
Expand All @@ -27,7 +32,7 @@ def generate_test_description():
),
]
),
launch_arguments=[("run_headless", "True")],
launch_arguments=[("run_headless", "True"), ("world_file", world)],
)

reach_goal = Node(
Expand Down

0 comments on commit 544cdd1

Please sign in to comment.