-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
end2end test can now wait for headless sim to be ready before running…
… tests
- Loading branch information
Showing
17 changed files
with
237 additions
and
68 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
22 changes: 22 additions & 0 deletions
22
ros_ws/src/end2end_tests/launch/isaac_test_env_bringup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<launch> | ||
<!-- Test node --> | ||
<node name="end2end_test_node" pkg="end2end_tests" exec="end2end_tester_node.py" output="screen" /> | ||
|
||
<!-- Simulator --> | ||
<set_env name="OMNI_KIT_ALLOW_ROOT" value="1" /> | ||
<node name="isaacsim" pkg="isaacsim" exec="run_isaacsim.py" output="screen"> | ||
<param name="install_path" value="/isaac-sim" /> | ||
<param name="env_path" value="/extras/spirit_uav_fire_academy.usd" /> | ||
<param name="play_sim_on_start" value="true" /> | ||
<!-- <param name="headless" value="" /> --> | ||
<param name="headless" value="native" /> | ||
<param name="isaac_args" value="--/app/scripting/ignoreWarningDialog=true" /> | ||
</node> | ||
|
||
<!-- <group> | ||
<set_env name="ROS_DOMAIN_ID" value="1" /> | ||
<push_ros_namespace namespace="robot1" /> | ||
<include file="$(find-pkg-share central)/launch/ascent_drone_headless.xml" /> | ||
</group> --> | ||
|
||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
<?xml version="1.0"?> | ||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
<package format="3"> | ||
<name>robot_system_tests</name> | ||
<name>end2end_tests</name> | ||
<version>0.0.0</version> | ||
<description>Tests for the full robot system</description> | ||
<description>Tests in simulation for full systems</description> | ||
<maintainer email="[email protected]">uav</maintainer> | ||
<license>TODO: License declaration</license> | ||
|
||
<!-- <buildtool_depend>rclpy</buildtool_depend> --> | ||
<buildtool_depend>ament_python</buildtool_depend> | ||
<exec_depend>rclpy</exec_depend> | ||
|
||
|
||
<test_depend>ament_copyright</test_depend> | ||
<test_depend>ament_flake8</test_depend> | ||
<test_depend>ament_pep257</test_depend> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,28 @@ | ||
from setuptools import setup, find_packages | ||
|
||
package_name = 'end2end_tests' | ||
package_name = "end2end_tests" | ||
|
||
setup( | ||
name=package_name, | ||
version='0.0.0', | ||
packages=find_packages(), | ||
data_files=[ | ||
('share/' + package_name, ['package.xml']), | ||
('share/ament_index/resource_index/packages', | ||
['resource/' + package_name]), | ||
], | ||
install_requires=['setuptools', 'launch', 'launch_ros', 'launch_testing', 'launch_testing_ros', 'pytest'], | ||
zip_safe=True, | ||
maintainer='TODO', | ||
maintainer_email='TODO', | ||
description='TODO: Package description', | ||
license='TODO: License declaration', | ||
tests_require=['pytest'], | ||
# entry_points={ | ||
# 'console_scripts': [ | ||
# 'my_node = my_py_pkg.my_node:main' | ||
# ], | ||
# }, | ||
) | ||
name=package_name, | ||
version="0.0.0", | ||
packages=find_packages(), | ||
data_files=[ | ||
("share/" + package_name, ["package.xml"]), | ||
("share/ament_index/resource_index/packages", ["resource/" + package_name]), | ||
("share/" + package_name + "/launch", ["launch/isaac_test_env_bringup.xml"]), | ||
], | ||
install_requires=[ | ||
"setuptools", | ||
"launch", | ||
"launch_ros", | ||
"launch_testing", | ||
"launch_testing_ros", | ||
"pytest", | ||
], | ||
zip_safe=True, | ||
maintainer="TODO", | ||
maintainer_email="TODO", | ||
description="Tests in simulation for full systems", | ||
license="TODO: License declaration", | ||
tests_require=["pytest"], | ||
) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import os | ||
import sys | ||
import time | ||
import unittest | ||
import uuid | ||
|
||
import launch | ||
from launch.launch_service import LaunchService | ||
import launch_ros | ||
import launch_ros.actions | ||
import launch_testing.actions | ||
from launch_testing.io_handler import ActiveIoHandler | ||
import launch_testing_ros | ||
|
||
import pytest | ||
|
||
import rclpy | ||
from rclpy.node import Node | ||
|
||
from std_msgs.msg import String | ||
|
||
import time | ||
|
||
class End2EndTestNode(Node): | ||
def __init__(self): | ||
super().__init__('end2end_test_node') | ||
self.subscription = self.create_subscription(String, '/sim_status', self.sim_status_callback, 10) | ||
self.sim_status = None | ||
|
||
def sim_status_callback(self, msg): | ||
self.sim_status = msg.data | ||
self.get_logger().info(f'variable is now: {self.sim_status}') | ||
|
||
@pytest.mark.rostest | ||
# this is the test descriptioon used to launch the full robot system with launch_robot_headless.yaml | ||
def generate_test_description(): | ||
robot_launch_path = '/root/AirStack/ros_ws/src/end2end_tests/launch/isaac_test_env_bringup.xml' | ||
|
||
robot_launch = launch.actions.IncludeLaunchDescription( launch.launch_description_sources.AnyLaunchDescriptionSource(robot_launch_path)) | ||
|
||
return ( | ||
launch.LaunchDescription([ | ||
robot_launch, | ||
launch_testing.actions.ReadyToTest(), | ||
]), | ||
{} | ||
) | ||
|
||
|
||
class TestEnd2End(unittest.TestCase): | ||
|
||
@classmethod | ||
def setUpClass(cls): | ||
# Initialize the ROS context for the test node | ||
rclpy.init() | ||
|
||
@classmethod | ||
def tearDownClass(cls): | ||
# Shutdown the ROS context | ||
rclpy.shutdown() | ||
|
||
def setUp(self): | ||
# Create a ROS node for tests | ||
self.node = End2EndTestNode() | ||
|
||
def tearDown(self): | ||
self.node.destroy_node() | ||
|
||
def test_wait_for_sim(self, timeout=30): | ||
# Wait for the isaac sim to be available | ||
start_time = time.time() | ||
while time.time() - start_time < timeout: | ||
rclpy.spin_once(self.node) | ||
if self.node.sim_status == "ready": | ||
self.assertTrue(True, "Simulation was initialized successfully") | ||
return | ||
self.assertTrue(False, "Timeout waiting for isaac sim to be ready") | ||
|
||
|
||
# def test_arming(self): | ||
# # Create a service call to existing "mavros/cmd/arming" service | ||
# client = self.node.create_client(mavros_msgs.srv.CommandBool, '/mavros/cmd/arming') | ||
# client.wait_for_service() | ||
# request = mavros_msgs.srv.CommandBool.Request() | ||
# request.value = True | ||
# future = client.call_async(request) | ||
# rclpy.spin_until_future_complete(self.node, future) | ||
# response = future.result() | ||
# self.assertTrue(response.success) | ||
|
||
# def test_disarming(self): | ||
# # Create a service call to existing "mavros/cmd/arming" service | ||
# client = self.node.create_client(mavros_msgs.srv.CommandBool, '/mavros/cmd/arming') | ||
# client.wait_for_service() | ||
# request = mavros_msgs.srv.CommandBool.Request() | ||
# request.value = False | ||
# future = client.call_async(request) | ||
# rclpy.spin_until_future_complete(self.node, future) | ||
# response = future.result() | ||
# self.assertTrue(response.success) | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
<package format="3"> | ||
<name>robot_system_tests</name> | ||
<version>0.0.0</version> | ||
<description>Tests for the full robot system</description> | ||
<description>Robot system tests for one singular robot</description> | ||
<maintainer email="[email protected]">uav</maintainer> | ||
<license>TODO: License declaration</license> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
from setuptools import setup, find_packages | ||
|
||
package_name = 'robot_system_tests' | ||
package_name = "robot_system_tests" | ||
|
||
setup( | ||
name=package_name, | ||
version='0.0.0', | ||
packages=find_packages(), | ||
data_files=[ | ||
('share/' + package_name, ['package.xml']), | ||
('share/ament_index/resource_index/packages', | ||
['resource/' + package_name]), | ||
], | ||
install_requires=['setuptools', 'launch', 'launch_ros', 'launch_testing', 'launch_testing_ros', 'pytest'], | ||
zip_safe=True, | ||
maintainer='TODO', | ||
maintainer_email='TODO', | ||
description='TODO: Package description', | ||
license='TODO: License declaration', | ||
tests_require=['pytest'], | ||
# entry_points={ | ||
# 'console_scripts': [ | ||
# 'my_node = my_py_pkg.my_node:main' | ||
# ], | ||
# }, | ||
) | ||
name=package_name, | ||
version="0.0.0", | ||
packages=find_packages(), | ||
data_files=[ | ||
("share/" + package_name, ["package.xml"]), | ||
("share/ament_index/resource_index/packages", ["resource/" + package_name]), | ||
], | ||
install_requires=[ | ||
"setuptools", | ||
"launch", | ||
"launch_ros", | ||
"launch_testing", | ||
"launch_testing_ros", | ||
"pytest", | ||
], | ||
zip_safe=True, | ||
maintainer="TODO", | ||
maintainer_email="TODO", | ||
description="Robot system tests for one singular robot", | ||
license="TODO: License declaration", | ||
tests_require=["pytest"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.