Skip to content

Commit

Permalink
Merge branch 'main' into dev_image
Browse files Browse the repository at this point in the history
  • Loading branch information
fred-labs authored Jul 30, 2024
2 parents f6c0b71 + 4640a4e commit f925e76
Show file tree
Hide file tree
Showing 33 changed files with 378 additions and 192 deletions.
193 changes: 101 additions & 92 deletions docs/libraries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,107 @@ Actors
A general robot actor.


Nav2
----

The library contains actions to interact with the `Nav2 <https://docs.nav2.org/>`__ navigation stack. Import it with ``import osc.nav2``. It is provided by the package :repo_link:`libs/scenario_execution_nav2`.

Actions
^^^^^^^

``differential_drive_robot.init_nav2()``
""""""""""""""""""""""""""""""""""""""""

Initialize nav2.

.. list-table::
:widths: 15 15 5 65
:header-rows: 1
:class: tight-table

* - Parameter
- Type
- Default
- Description
* - ``initial_pose``
- ``pose_3d``
-
- The initial pose to set during initialization
* - ``base_frame_id``
- ``string``
- ``base_link``
- Base Frame ID
* - ``use_initial_pose``
- ``bool``
- ``true``
- If false, no initial_pose is needed (useful when using slam instead of amcl for localization)
* - ``namespace_override``
- ``string``
-
- If set, it's used as namespace (instead of the associated actor's namespace)
* - ``wait_for_initial_pose``
- ``bool``
- ``false``
- If true the initial pose needs to be set externally (e.g. manually through rviz)

``differential_drive_robot.nav_through_poses()``
""""""""""""""""""""""""""""""""""""""""""""""""

Use nav2 to navigate through poses.

.. list-table::
:widths: 15 15 5 65
:header-rows: 1
:class: tight-table

* - Parameter
- Type
- Default
- Description
* - ``goal_poses``
- ``list of pose_3d``
-
- Goal poses to navigate through
* - ``namespace_override``
- ``string``
- ``''``
- If set, it's used as namespace (instead of the associated actor's namespace)
* - ``monitor_progress``
- ``bool``
- ``true``
- If yes, the action returns after the goal is reached or on failure. If no, the action returns after request.

``differential_drive_robot.nav_to_pose()``
""""""""""""""""""""""""""""""""""""""""""
Use nav2 to navigate to goal pose.

.. list-table::
:widths: 15 15 5 65
:header-rows: 1
:class: tight-table

* - Parameter
- Type
- Default
- Description
* - ``goal_pose``
- ``pose_3d``
-
- Goal pose to navigate to
* - ``namespace_override``
- ``string``
-
- If set, it's used as namespace (instead of the associated actor's namespace)
* - ``action_topic``
- ``string``
- ``navigate_to_pose``
- Action name
* - ``monitor_progress``
- ``bool``
- ``true``
- If yes, the action returns after the goal is reached or on failure. If no, the action returns after request.


ROS
---

Expand Down Expand Up @@ -567,98 +668,6 @@ Compare received topic messages using the given ``comparison_operator``, against
- ``true``
- start checking with the first received message after action execution. If false, the check is executed on the last received message.

``differential_drive_robot.init_nav2()``
""""""""""""""""""""""""""""""""""""""""

Initialize nav2.

.. list-table::
:widths: 15 15 5 65
:header-rows: 1
:class: tight-table

* - Parameter
- Type
- Default
- Description
* - ``initial_pose``
- ``pose_3d``
-
- The initial pose to set during initialization
* - ``base_frame_id``
- ``string``
- ``base_link``
- Base Frame ID
* - ``use_initial_pose``
- ``bool``
- ``true``
- If false, no initial_pose is needed (useful when using slam instead of amcl for localization)
* - ``namespace_override``
- ``string``
-
- If set, it's used as namespace (instead of the associated actor's namespace)
* - ``wait_for_initial_pose``
- ``bool``
- ``false``
- If true the initial pose needs to be set externally (e.g. manually through rviz)

``differential_drive_robot.nav_through_poses()``
""""""""""""""""""""""""""""""""""""""""""""""""

Use nav2 to navigate through poses.

.. list-table::
:widths: 15 15 5 65
:header-rows: 1
:class: tight-table

* - Parameter
- Type
- Default
- Description
* - ``goal_poses``
- ``list of pose_3d``
-
- Goal poses to navigate through
* - ``namespace_override``
- ``string``
- ``''``
- If set, it's used as namespace (instead of the associated actor's namespace)
* - ``monitor_progress``
- ``bool``
- ``true``
- If yes, the action returns after the goal is reached or on failure. If no, the action returns after request.

``differential_drive_robot.nav_to_pose()``
""""""""""""""""""""""""""""""""""""""""""
Use nav2 to navigate to goal pose.

.. list-table::
:widths: 15 15 5 65
:header-rows: 1
:class: tight-table

* - Parameter
- Type
- Default
- Description
* - ``goal_pose``
- ``pose_3d``
-
- Goal pose to navigate to
* - ``namespace_override``
- ``string``
-
- If set, it's used as namespace (instead of the associated actor's namespace)
* - ``action_topic``
- ``string``
- ``navigate_to_pose``
- Action name
* - ``monitor_progress``
- ``bool``
- ``true``
- If yes, the action returns after the goal is reached or on failure. If no, the action returns after request.

``differential_drive_robot.odometry_distance_traveled()``
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import osc.helpers
import osc.ros
import osc.gazebo
import osc.nav2

scenario multi_robot:
timeout(240s)
Expand Down
1 change: 1 addition & 0 deletions examples/example_nav2/example_nav2.osc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import osc.helpers
import osc.ros
import osc.nav2

scenario example_nav2:
timeout(60s)
Expand Down
1 change: 1 addition & 0 deletions examples/example_scenario_control/scenarios/init_nav2.osc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import osc.ros
import osc.nav2

scenario initialize_nav2:
turtlebot4: differential_drive_robot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import osc.ros
import osc.nav2

scenario nav2_simulation_nav_to_pose_1:
turtlebot4: differential_drive_robot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import osc.ros
import osc.nav2

scenario nav2_simulation_nav_to_pose_2:
turtlebot4: differential_drive_robot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import osc.helpers
import osc.ros
import osc.gazebo
import osc.nav2

scenario example_simulation:
timeout(120s)
Expand Down
1 change: 1 addition & 0 deletions libs/scenario_execution_floorplan_dsl/example/example.osc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import osc.helpers
import osc.floorplan_dsl
import osc.ros
import osc.nav2

scenario test:
timeout(120s)
Expand Down
1 change: 1 addition & 0 deletions libs/scenario_execution_nav2/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include scenario_execution_nav2/lib_osc/*.osc
8 changes: 8 additions & 0 deletions libs/scenario_execution_nav2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Scenario Execution Library for Nav2

The `scenario_execution_nav2` package provides actions to interact with the [nav2](https://docs.nav2.org/) navigation stack.

It provides the following scenario execution library:

- `nav2.osc`: Actions specific to nav2 navigation stack

28 changes: 28 additions & 0 deletions libs/scenario_execution_nav2/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?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>scenario_execution_nav2</name>
<version>1.1.0</version>
<description>Scenario Execution library for Nav2</description>
<author email="[email protected]">Intel Labs</author>
<maintainer email="[email protected]">Intel Labs</maintainer>
<license file="../../LICENSE">Apache-2.0</license>

<depend>scenario_execution_ros</depend>

<exec_depend>rclpy</exec_depend>
<exec_depend>nav2_simple_commander</exec_depend>
<exec_depend>nav2_msgs</exec_depend>
<exec_depend>geometry_msgs</exec_depend>
<exec_depend>tf2_ros</exec_depend>
<exec_depend>lifecycle_msgs</exec_depend>

<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
<test_depend>python3-pytest</test_depend>

<export>
<build_type>ament_python</build_type>
</export>
</package>
Empty file.
21 changes: 21 additions & 0 deletions libs/scenario_execution_nav2/scenario_execution_nav2/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (C) 2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0

from . import actions

__all__ = [
'actions'
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright (C) 2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
from datetime import datetime, timedelta
import py_trees

from .nav2_common import NamespaceAwareBasicNavigator, get_pose_stamped, NamespacedTransformListener
from .nav2_common import NamespaceAwareBasicNavigator
from scenario_execution_ros.actions.common import get_pose_stamped, NamespacedTransformListener
from scenario_execution.actions.base_action import BaseAction


Expand Down
Loading

0 comments on commit f925e76

Please sign in to comment.