Skip to content

Commit

Permalink
add app_manager_utils in jsk_common
Browse files Browse the repository at this point in the history
  • Loading branch information
knorth55 committed Mar 20, 2023
1 parent dbefb4c commit 9264a31
Show file tree
Hide file tree
Showing 100 changed files with 3,155 additions and 0 deletions.
42 changes: 42 additions & 0 deletions app_manager_utils/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# app_manager_utils

## Dependency

- [PR2/app_manager kinetic-devel branch](https://github.com/PR2/app_manager)
- [python-dateutil >= 2.7.0](https://github.com/dateutil/dateutil)

## app_scheduler

Scheduler for `app_manager`

For detailed information, please read [app_scheduler](app_scheduler/README.md).

## app_recorder

Recorder plugin for `app_manager`

For detailed information, please read [app_recorder](app_recorder/README.md).

## app_uploader

Uploader plugin for `app_manager`

For detailed information, please read [app_uploader](app_uploader/README.md).

## app_notifier

Notifier plugin for `app_manager`

For detailed information, please read [app_notifier](app_notifier/README.md).

## app_notification_saver

Notification saver plugin for `app_manager`

For detailed information, please read [app_notification_saver](app_notification_saver/README.md).

## app_publisher

Publisher plugin for `app_manager`

For detailed information, please read [app_publisher](app_publisher/README.md).
33 changes: 33 additions & 0 deletions app_manager_utils/app_manager_utils/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package app_manager_utils
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.0.6 (2022-07-29)
------------------

0.0.5 (2022-02-08)
------------------

0.0.4 (2021-12-27)
------------------

0.0.3 (2021-12-17)
------------------

0.0.2 (2021-12-11)
------------------

0.0.1 (2021-10-06)
------------------
* Merge pull request `#26 <https://github.com/knorth55/app_manager_utils/issues/26>`_ from 708yamaguchi/app-publisher
Add rostopic_publisher_plugin
* Add rostopic_publisher_plugin
* remove app_manager_plugin package
* Merge pull request `#7 <https://github.com/knorth55/app_manager_utils/issues/7>`_ from knorth55/add-plugins
* update app_manager_utils package.xml
* Merge pull request `#3 <https://github.com/knorth55/app_manager_utils/issues/3>`_ from knorth55/add-app-manager-plugin
* add test_app_manager package
* use exec_depend
* add build_depend
* initial commit
* Contributors: Naoya Yamaguchi, Shingo Kitagawa
4 changes: 4 additions & 0 deletions app_manager_utils/app_manager_utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cmake_minimum_required(VERSION 2.8.3)
project(app_manager_utils)
find_package(catkin REQUIRED)
catkin_metapackage()
21 changes: 21 additions & 0 deletions app_manager_utils/app_manager_utils/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<package format="2">
<name>app_manager_utils</name>
<version>2.2.12</version>
<description>The app_manager_utils meta package</description>
<maintainer email="[email protected]">Shingo Kitagawa</maintainer>
<author email="[email protected]">Shingo Kitagawa</author>
<license>BSD</license>

<buildtool_depend>catkin</buildtool_depend>
<exec_depend>app_notification_saver</exec_depend>
<exec_depend>app_notifier</exec_depend>
<exec_depend>app_publisher</exec_depend>
<exec_depend>app_recorder</exec_depend>
<exec_depend>app_scheduler</exec_depend>
<exec_depend>app_uploader</exec_depend>

<export>
<metapackage />
</export>
</package>
53 changes: 53 additions & 0 deletions app_manager_utils/app_notification_saver/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package app_notification_saver
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.0.6 (2022-07-29)
------------------

0.0.5 (2022-02-08)
------------------

0.0.4 (2021-12-27)
------------------

0.0.3 (2021-12-17)
------------------

0.0.2 (2021-12-11)
------------------

0.0.1 (2021-10-06)
------------------
* add python-dateutil in package.xml
* update app_notification_saver/README.md
* update app_notification_saver/README.md
* update app_notification_saver/README.md
* add json_path arg in smach_notification_saver.launch
* add json_path arg in service_notification_saver.launch
* Merge pull request `#18 <https://github.com/knorth55/app_manager_utils/issues/18>`_ from 708yamaguchi/add-smach-notification
* Do not update json if active_states is empty
* Move sample_smach_notification_saver.launch to sample directory
* Update README.md using sample_smach_notification_saver
* Split sample_smach_notification_server and smach_notification_server
* Add smach_notification_saver plugin to yaml
* add usage of smach_notification_saver
* Add arg to use rosbag in smach_notification_saver.launch
* Add sample rosbag which contains smach topics
* Add smach_notification_saver to notify smach states
* Use roslaunch instead of rosrun in README usage
* flake8
* import from __init\_\_
* rename to app_notification_saver_base.py
* add app_notification_saver_plugin
* add executable in node_scripts
* app_notification_saver as python package
* Fix typo in README.md
* Set language for code block
* Add location field to notification
* Update README.md
* Use title field instead of type field because of python reserved word
* Make base class AppNotificationSaver
* Add json sample to README
* Add app_notification_saver to pass messages to app_notifier
* Contributors: Naoya Yamaguchi, Shingo Kitagawa
19 changes: 19 additions & 0 deletions app_manager_utils/app_notification_saver/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
cmake_minimum_required(VERSION 2.8.3)
project(app_notification_saver)

find_package(catkin REQUIRED COMPONENTS
message_generation
rospy
)

add_service_files(
FILES SaveAppNotification.srv
)

catkin_python_setup()

generate_messages()

catkin_package(
CATKIN_DEPENDS message_runtime
)
180 changes: 180 additions & 0 deletions app_manager_utils/app_notification_saver/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# app_notification_saver

Plugins and nodes to save notification to json file and pass it to `app_notifier`

## `app_manager` plugins

### `app_notification_saver/service_notification_saver`: General notification saver plugin

This plugin saves notification via service call.

#### `plugin_args`: Plugin arguments

`None`

#### `launch_args`: Plugin launch arguments

- `json_path` : JSON path

#### Sample plugin description

```yaml
plugins:
- name: service_notification_saver
type: app_notification_saver/service_notification_saver
launch_args:
json_path: /tmp/app_notification.json
```
#### Save app notification
You can save app notification with service call.
```bash
rosservice call /service_notification_saver/save_app_notification "title: 'object recognition'
stamp:
secs: 1627467479
nsecs: 13279914
location: 'kitchen'
message: 'Dish is found'"
```
#### Clear app notification
You can also clear app notification.
```bash
rosservice call /service_notification_saver/clear_app_notification "{}"
```
### `app_notification_saver/smach_notification_saver`: SMACH notification saver plugin

This plugin saves notification via service call.

#### `plugin_args`: Plugin arguments

`None`

#### `launch_args`: Plugin launch arguments

- `json_path` : JSON path
- `smach_status_topic`: SMACH status topic name

#### Sample plugin description

```yaml
plugins:
- name: smach_notification_saver
type: app_notification_saver/smach_notification_saver
launch_args:
json_path: /tmp/app_notification.json
smach_status_topic: /server_name/smach/container_status
```

## Nodes

### `service_notification_saver_node.py`: Node for general notification saver

Save notification node via service call.

#### Services

- `~save_app_notification` (`app_notification_saver/SaveAppNotification`)

Service to save app notification to JSON.

- `~clear_app_notification` (`std_srvs/Empty`)

Service to clear app notification in JSON.

#### Parameters

- `~json_path` (`String`, default: `/tmp/app_notification.json`)

Path to json file which contains app notification

#### Sample

##### Launch service_notification_saver node

```bash
roslaunch app_notification_saver service_notification_saver.launch
```

##### Save app notification

You can save app notification with service call.

```bash
rosservice call /service_notification_saver/save_app_notification "title: 'object recognition'
stamp:
secs: 1627467479
nsecs: 13279914
location: 'kitchen'
message: 'Dish is found'"
```

##### Clear app notification

You can also clear app notification.

```bash
rosservice call /service_notification_saver/clear_app_notification "{}"
```

##### Check output JSON

The sample output of the json file is like below:

```json
{
"object recognition": [
{
"date": "2021-07-28T19:17:59",
"message": "Dish is found",
"location": "kitchen"
},
{
"date": "2021-07-28T19:18:09",
"message": "Cup is found",
"location": "kitchen"
}
],
"navigation failure": [
{
"date": "2021-07-28T19:18:29",
"message": "Stucked in front of the chair",
"location": "living room"
}
]
}
```

### `smach_notification_saver_node.py`: Node for SMACH notification saver

Save notification of smach state.

#### Subscribe topics

- `~smach/container_status` (`smach_msgs/SmachContainerStatus`, default: `/server_name/smach/container_status`)

Smach status topic

#### Parameters

- `~json_path` (`String`, default: `/tmp/app_notification.json`)

Path to json file which contains app notification

#### Sample

##### Launch smach_notification_saver node

```bash
# Launch only smach_notification_saver node
roslaunch app_notification_saver smach_notification_saver.launch
# Sample
# Launch smach_notification_saver node and rosbag
roslaunch app_notification_saver sample_smach_notification_saver.launch --screen
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- name: app_notification_saver/service_notification_saver
launch: app_notification_saver/service_notification_saver.launch
module: null
- name: app_notification_saver/smach_notification_saver
launch: app_notification_saver/smach_notification_saver.launch
module: null
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<launch>
<!-- start: arguments -->
<arg name="json_path" default="/tmp/app_notification.json" />
<!-- end: arguments -->

<node name="service_notification_saver" pkg="app_notification_saver"
type="service_notification_saver_node.py">
<rosparam subst_value="true">
json_path: $(arg json_path)
</rosparam>
</node>
</launch>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<launch>
<!-- start: arguments -->
<arg name="json_path" default="/tmp/app_notification.json" />
<arg name="smach_status_topic" default="/server_name/smach/container_status" />
<!-- end: arguments -->

<node name="smach_notification_saver" pkg="app_notification_saver"
type="smach_notification_saver_node.py" >
<remap from="~smach/container_status" to="$(arg smach_status_topic)" />
<rosparam subst_value="true">
json_path: $(arg json_path)
</rosparam>
</node>
</launch>
Loading

0 comments on commit 9264a31

Please sign in to comment.