Skip to content

Commit

Permalink
merge app_manager_utils into app_manager
Browse files Browse the repository at this point in the history
  • Loading branch information
knorth55 committed Nov 15, 2021
1 parent 15a8615 commit a21c5cf
Show file tree
Hide file tree
Showing 93 changed files with 2,472 additions and 0 deletions.
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# app_manager

[![Build Status](https://travis-ci.com/PR2/app_manager.svg?branch=kinetic-devel)](https://travis-ci.org/PR2/app_manager)

## app_manager

A package for making launch file an application

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

## 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).
18 changes: 18 additions & 0 deletions app_manager_utils/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package app_manager_utils
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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/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/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>0.0.1</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_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>
<exec_depend>test_app_manager</exec_depend>

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

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_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_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
```
6 changes: 6 additions & 0 deletions app_notification_saver/app_notification_saver_plugin.yaml
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 added app_notification_saver/data/smach.bag
Binary file not shown.
12 changes: 12 additions & 0 deletions app_notification_saver/launch/service_notification_saver.launch
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>
14 changes: 14 additions & 0 deletions app_notification_saver/launch/smach_notification_saver.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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env python

import rospy

from app_notification_saver import ServiceNotificationSaver


if __name__ == '__main__':
rospy.init_node('service_notification_saver_node')
ServiceNotificationSaver()
rospy.spin()
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python

import rospy

from app_notification_saver import SmachNotificationSaver

if __name__ == '__main__':
rospy.init_node('smach_notification_saver_node')
SmachNotificationSaver()
rospy.spin()
Loading

0 comments on commit a21c5cf

Please sign in to comment.