Skip to content

Commit

Permalink
multi-robot
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-labs committed Jul 25, 2024
1 parent 9c367b5 commit 6b37d9c
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import os
import subprocess # nosec B404
import glob
from shutil import which
import defusedxml.ElementTree
from ament_index_python import get_package_share_directory
from pathlib import Path
Expand Down Expand Up @@ -242,7 +241,7 @@ def find_mesh(self, mesh_name: str, entity_name: str) -> str:
print(f'[{entity_name}] unrecognized model file definition: {mesh_name}')
return None

def get_env():
def get_env(): # pylint: disable=no-method-argument
if "ROS_DISTRO" not in os.environ:
raise ValueError("ROS_DISTRO not set.")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ scenario test_ros_service_call:
keep(it.service_name == '/bla')
keep(it.service_type == 'std_srvs.srv.SetBool')
keep(it.data == '{\"data\": True}')
wait elapsed(2s)
emit_arrival: emit end
emit end
Original file line number Diff line number Diff line change
Expand Up @@ -9,65 +9,34 @@ scenario test_ros_service_call_blocking:
keep(it.service_name == '/bla_service')
keep(it.service_type == 'std_srvs.srv.SetBool')
keep(it.data == '{\"data\": True}')
wait elapsed(10s)
emit end
test2: serial:
topic_publish() with:
keep(it.topic_name == '/bla')
keep(it.topic_type == 'std_msgs.msg.Int32')
keep(it.value == '{\"data\": 0}')
wait elapsed(1s)
wait elapsed(2s)
topic_publish() with:
keep(it.topic_name == '/bla')
keep(it.topic_type == 'std_msgs.msg.Int32')
keep(it.value == '{\"data\": 1}')
wait elapsed(1s)
wait elapsed(2s)
topic_publish() with:
keep(it.topic_name == '/bla')
keep(it.topic_type == 'std_msgs.msg.Int32')
keep(it.value == '{\"data\": 2}')
wait elapsed(1s)
wait elapsed(2s)
topic_publish() with:
keep(it.topic_name == '/bla')
keep(it.topic_type == 'std_msgs.msg.Int32')
keep(it.value == '{\"data\": 3}')
wait elapsed(1s)
wait elapsed(2s)
topic_publish() with:
keep(it.topic_name == '/bla')
keep(it.topic_type == 'std_msgs.msg.Int32')
keep(it.value == '{\"data\": 4}')
wait elapsed(1s)
wait elapsed(2s)
topic_publish() with:
keep(it.topic_name == '/bla')
keep(it.topic_type == 'std_msgs.msg.Int32')
keep(it.value == '{\"data\": 5}')
wait elapsed(1s)
topic_publish() with:
keep(it.topic_name == '/bla')
keep(it.topic_type == 'std_msgs.msg.Int32')
keep(it.value == '{\"data\": 6}')
wait elapsed(1s)
topic_publish() with:
keep(it.topic_name == '/bla')
keep(it.topic_type == 'std_msgs.msg.Int32')
keep(it.value == '{\"data\": 7}')
wait elapsed(1s)
topic_publish() with:
keep(it.topic_name == '/bla')
keep(it.topic_type == 'std_msgs.msg.Int32')
keep(it.value == '{\"data\": 8}')
wait elapsed(1s)
topic_publish() with:
keep(it.topic_name == '/bla')
keep(it.topic_type == 'std_msgs.msg.Int32')
keep(it.value == '{\"data\": 9}')
wait elapsed(1s)
topic_publish() with:
keep(it.topic_name == '/bla')
keep(it.topic_type == 'std_msgs.msg.Int32')
keep(it.value == '{\"data\": 10}')
wait elapsed(1s)
topic_publish() with:
keep(it.topic_name == '/bla')
keep(it.topic_type == 'std_msgs.msg.Int32')
keep(it.value == '{\"data\": 11}')
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ scenario test_ros_set_node_parameter:
keep(it.node_name == '/test_node')
keep(it.parameter_name == 'testBoolParam')
keep(it.parameter_value == 'True')
wait elapsed(3s)
4 changes: 2 additions & 2 deletions scenario_execution_ros/test/test_ros_service_call_blocking.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,6 @@ def test_success(self):
for elem in self.received_msgs[1:]:
self.assertGreater(elem[1].data, prev_elem[1].data)
time_since_last = elem[0]-prev_elem[0]
self.assertGreaterEqual(time_since_last, rclpy.duration.Duration(seconds=0.5))
self.assertLessEqual(time_since_last, rclpy.duration.Duration(seconds=1.7))
self.assertGreaterEqual(time_since_last, rclpy.duration.Duration(seconds=1.0))
self.assertLessEqual(time_since_last, rclpy.duration.Duration(seconds=3.0))
prev_elem = elem
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument, SetLaunchConfiguration
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration, PythonExpression, EnvironmentVariable
from launch.substitutions.path_join_substitution import PathJoinSubstitution
from launch.conditions import IfCondition, UnlessCondition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def generate_launch_description():
tf_to_pose_publisher_dir = get_package_share_directory('tf_to_pose_publisher')
try:
nav2_minimal_tb4_sim_dir = get_package_share_directory('nav2_minimal_tb4_sim')
except:
except Exception: # pylint: disable=broad-except
nav2_minimal_tb4_sim_dir = ""

scenario = LaunchConfiguration('scenario')
Expand Down

0 comments on commit 6b37d9c

Please sign in to comment.