Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-labs committed Mar 2, 2024
1 parent 67e2a8e commit 417a8f2
Show file tree
Hide file tree
Showing 33 changed files with 12 additions and 697 deletions.
4 changes: 4 additions & 0 deletions scenario_execution/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Scenario Execution

The `scenario_execution` package is the ROS2 middleware implementation of the scenario execution. It uses the `py_trees_ros` packages as the `py_trees`'s implementation for ROS2.

It provides the following scenario execution libraries:

- `ros.osc`: ROS specific actions like topic publish and service call.
2 changes: 1 addition & 1 deletion scenario_execution/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<package format="3">
<name>scenario_execution</name>
<version>1.0.0</version>
<description>ROS Scenario Execution</description>
<description>Scenario Execution for ROS</description>
<author email="[email protected]">Intel Labs</author>
<maintainer email="[email protected]">Intel Labs</maintainer>
<license file="../LICENSE">Apache-2.0</license>
Expand Down
2 changes: 0 additions & 2 deletions scenario_execution/scenario_execution/actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@
# and limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

""" Entry for module action plugins """
5 changes: 2 additions & 3 deletions scenario_execution/scenario_execution/actions/init_nav2.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#
# SPDX-License-Identifier: Apache-2.0

""" Class for initializing nav2 by setting an initial pose and activate required nodes """

from enum import Enum


Expand Down Expand Up @@ -54,7 +52,8 @@ class InitNav2State(Enum):

class InitNav2(py_trees.behaviour.Behaviour):
"""
Class to initialize nav2
Class for initializing nav2 by setting an initial pose and activate required nodes """

"""
def __init__(self, name, associated_actor, initial_pose: list, base_frame_id: str, wait_for_initial_pose: bool, use_initial_pose: bool, namespace_override: str):
Expand Down
3 changes: 1 addition & 2 deletions scenario_execution/scenario_execution/actions/nav2_common.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Copyright 2021 Samsung Research America
# Copyright (C) 2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -14,8 +15,6 @@
#
# SPDX-License-Identifier: Apache-2.0

""" Subclass of BasicNavigator to support namespaces """

from geometry_msgs.msg import PoseStamped, PoseWithCovarianceStamped
from rclpy.qos import QoSDurabilityPolicy, QoSHistoryPolicy
from rclpy.qos import QoSProfile, QoSReliabilityPolicy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#
# SPDX-License-Identifier: Apache-2.0

""" Scenario execution plugin for navigating through poses """

from enum import Enum

from rclpy.node import Node
Expand Down
2 changes: 0 additions & 2 deletions scenario_execution/scenario_execution/actions/nav_to_pose.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#
# SPDX-License-Identifier: Apache-2.0

""" Scenario execution plugin for navigating to pose """

from enum import Enum

from rclpy.node import Node
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#
# SPDX-License-Identifier: Apache-2.0

""" Scenario execution plugin for waiting for a certain covered distance, based on odometry """
from math import sqrt
import rclpy
from rclpy.logging import get_logger
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#
# SPDX-License-Identifier: Apache-2.0

""" Class for recording a ros bag """

import py_trees
import py_trees_ros # pylint: disable=import-error
import typing
Expand All @@ -26,7 +24,6 @@ class SubscriberHandler(py_trees_ros.subscribers.Handler):
"""
overrides Handler
"""

def __init__(self,
name: str,
topic_name: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#
# SPDX-License-Identifier: Apache-2.0

""" Class for recording a ros bag """

import os
from datetime import datetime
from enum import Enum
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#
# SPDX-License-Identifier: Apache-2.0

""" Scenario execution plugin to wait for a specific string in the ros log """

import py_trees
from rclpy.qos import QoSProfile, DurabilityPolicy, HistoryPolicy
import rclpy
Expand All @@ -26,9 +24,6 @@
class RosLogCheck(py_trees.behaviour.Behaviour):
"""
Class for scanning the ros log for specific content
Args:
values [str]: Values to look for
"""

def __init__(self, name, values: list):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#
# SPDX-License-Identifier: Apache-2.0

""" Scenario execution plugin to put ros data into the blackboard """
from ast import literal_eval
import importlib
from enum import Enum
Expand All @@ -37,11 +36,6 @@ class ServiceCallActionState(Enum):
class RosServiceCall(py_trees.behaviour.Behaviour):
"""
ros service call behavior
Args:
service_name: name of the topic to connect to
service_type: The service type
call: call content
"""

def __init__(self, name, service_name: str, service_type: str, data: str):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
#
# SPDX-License-Identifier: Apache-2.0

"""
Behavior to set a ros node parameter
"""
from ast import literal_eval

from .ros_service_call import RosServiceCall
Expand All @@ -26,11 +23,6 @@
class RosSetNodeParameter(RosServiceCall):
"""
class for setting a node parameter
Args:
node_name: [str]: name of the node
parameter_name: [str]: name of the parameter
parameter_value: [str]: new value of the parameter
"""

def __init__(self, name, node_name: str, parameter_name: str, parameter_value: str):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,15 @@
#
# SPDX-License-Identifier: Apache-2.0

""" Scenario execution plugin to check data on a ros topic """

import importlib
import py_trees_ros # pylint: disable=import-error
from scenario_execution.action_plugins.conversions import get_qos_preset_profile, \
from scenario_execution.actions.conversions import get_qos_preset_profile, \
get_comparison_operator, get_clearing_policy


class RosTopicCheckData(py_trees_ros.subscribers.CheckData):
"""
Class to check if the message on ROS topic equals to the target message
Args:
topic_name: name of the topic to connect to
topic_type: class of the message type (e.g. std_msgs.msg.String)
qos_profile: qos profile for the subscriber
variable_name: name of the variable to check
expected_value: expected value of the variable
comparison_operator: one from the python `operator module`_
fail_if_no_data: py_trees.common.Status.FAILURE instead
of py_trees.common.Status.RUNNING if there is no data yet
fail_if_bad_comparison: py_trees.common.Status.FAILURE instead of
py_trees.common.Status.RUNNING if comparison failed
clearing_policy: when to clear the data
"""

def __init__(self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
#
# SPDX-License-Identifier: Apache-2.0

"""
Behavior to publish a msg on ROS topic
"""
import importlib
from ast import literal_eval

Expand All @@ -26,18 +23,12 @@
import py_trees
from py_trees.common import Status

from scenario_execution.action_plugins.conversions import get_qos_preset_profile
from scenario_execution.actions.conversions import get_qos_preset_profile


class RosTopicPublish(py_trees.behaviour.Behaviour):
"""
class for publish a message on a ROS topic
Args:
topic_name [str]: name of the topic to connect to
topic_type [str]: class of the message type (e.g. std_msgs.msg.String)
qos_profile [str]: qos profile for the subscriber
value [str]: expected value of the variable
"""

def __init__(self, name, topic_type: str, topic_name: str, qos_profile: str, value: str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@
#
# SPDX-License-Identifier: Apache-2.0

""" Scenario execution plugin to wait for data on a ros topic """

import importlib
import py_trees
from scenario_execution.action_plugins.conversions import get_qos_preset_profile, get_clearing_policy
from scenario_execution.actions.conversions import get_qos_preset_profile, get_clearing_policy
import typing
import rclpy.qos
from .py_trees_ros_common import SubscriberHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,13 @@
#
# SPDX-License-Identifier: Apache-2.0

""" Scenario execution plugin to wait for ros topics to get available """

import py_trees
from rclpy.node import Node


class RosTopicWaitForTopics(py_trees.behaviour.Behaviour):
"""
Class to check if ROS topic are available
Args:
topics[str]: name of the topics to get available
"""

def __init__(self, topics: list):
Expand Down
10 changes: 1 addition & 9 deletions scenario_execution/scenario_execution/actions/tf_close_to.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#
# SPDX-License-Identifier: Apache-2.0

""" Module for checking a robot is close to a reference point using localization"""

from math import sqrt

import rclpy
Expand All @@ -28,18 +26,12 @@
from tf2_ros.buffer import Buffer
from tf2_ros import TransformException # pylint: disable= no-name-in-module

from scenario_execution.action_plugins.nav2_common import NamespacedTransformListener
from scenario_execution.actions.nav2_common import NamespacedTransformListener


class TfCloseTo(py_trees.behaviour.Behaviour):
"""
class for distance condition in ROS Gazebo simulation
Args:
namespace [str]: name of the robot
reference_point [str]: target point to measure distance from \
in the form of 3 number array: [pos_x, pos_y, pos_z]
threshold [str]: threshold to the reference point
"""

def __init__(
Expand Down
39 changes: 0 additions & 39 deletions scenario_execution/scenarios/amr_demo.osc

This file was deleted.

13 changes: 0 additions & 13 deletions scenario_execution/scenarios/test/test_ros_event_to_blackboard.osc

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions scenario_execution/scenarios/test/test_ros_topic_to_blackboard.osc

This file was deleted.

Loading

0 comments on commit 417a8f2

Please sign in to comment.