Skip to content

Commit 67e8948

Browse files
committed
add app_manager_utils in jsk_common
1 parent dbefb4c commit 67e8948

File tree

93 files changed

+2689
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+2689
-0
lines changed

app_manager_utils/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# app_manager_utils
2+
3+
## Dependency
4+
5+
- [PR2/app_manager kinetic-devel branch](https://github.com/PR2/app_manager)
6+
- [python-dateutil >= 2.7.0](https://github.com/dateutil/dateutil)
7+
8+
## app_scheduler
9+
10+
Scheduler for `app_manager`
11+
12+
For detailed information, please read [app_scheduler](app_scheduler/README.md).
13+
14+
## app_recorder
15+
16+
Recorder plugin for `app_manager`
17+
18+
For detailed information, please read [app_recorder](app_recorder/README.md).
19+
20+
## app_uploader
21+
22+
Uploader plugin for `app_manager`
23+
24+
For detailed information, please read [app_uploader](app_uploader/README.md).
25+
26+
## app_notifier
27+
28+
Notifier plugin for `app_manager`
29+
30+
For detailed information, please read [app_notifier](app_notifier/README.md).
31+
32+
## app_notification_saver
33+
34+
Notification saver plugin for `app_manager`
35+
36+
For detailed information, please read [app_notification_saver](app_notification_saver/README.md).
37+
38+
## app_publisher
39+
40+
Publisher plugin for `app_manager`
41+
42+
For detailed information, please read [app_publisher](app_publisher/README.md).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
cmake_minimum_required(VERSION 2.8.3)
2+
project(app_manager_utils)
3+
find_package(catkin REQUIRED)
4+
catkin_metapackage()
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0"?>
2+
<package format="2">
3+
<name>app_manager_utils</name>
4+
<version>2.2.12</version>
5+
<description>The app_manager_utils meta package</description>
6+
<maintainer email="[email protected]">Shingo Kitagawa</maintainer>
7+
<author email="[email protected]">Shingo Kitagawa</author>
8+
<license>BSD</license>
9+
10+
<buildtool_depend>catkin</buildtool_depend>
11+
<exec_depend>app_notification_saver</exec_depend>
12+
<exec_depend>app_notifier</exec_depend>
13+
<exec_depend>app_publisher</exec_depend>
14+
<exec_depend>app_recorder</exec_depend>
15+
<exec_depend>app_scheduler</exec_depend>
16+
<exec_depend>app_uploader</exec_depend>
17+
18+
<export>
19+
<metapackage />
20+
</export>
21+
</package>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
cmake_minimum_required(VERSION 2.8.3)
2+
project(app_notification_saver)
3+
4+
find_package(catkin REQUIRED COMPONENTS
5+
message_generation
6+
rospy
7+
)
8+
9+
add_service_files(
10+
FILES SaveAppNotification.srv
11+
)
12+
13+
catkin_python_setup()
14+
15+
generate_messages()
16+
17+
catkin_package(
18+
CATKIN_DEPENDS message_runtime
19+
)
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
# app_notification_saver
2+
3+
Plugins and nodes to save notification to json file and pass it to `app_notifier`
4+
5+
## `app_manager` plugins
6+
7+
### `app_notification_saver/service_notification_saver`: General notification saver plugin
8+
9+
This plugin saves notification via service call.
10+
11+
#### `plugin_args`: Plugin arguments
12+
13+
`None`
14+
15+
#### `launch_args`: Plugin launch arguments
16+
17+
- `json_path` : JSON path
18+
19+
#### Sample plugin description
20+
21+
```yaml
22+
plugins:
23+
- name: service_notification_saver
24+
type: app_notification_saver/service_notification_saver
25+
launch_args:
26+
json_path: /tmp/app_notification.json
27+
```
28+
29+
#### Save app notification
30+
31+
You can save app notification with service call.
32+
33+
```bash
34+
rosservice call /service_notification_saver/save_app_notification "title: 'object recognition'
35+
stamp:
36+
secs: 1627467479
37+
nsecs: 13279914
38+
location: 'kitchen'
39+
message: 'Dish is found'"
40+
```
41+
42+
#### Clear app notification
43+
44+
You can also clear app notification.
45+
46+
```bash
47+
rosservice call /service_notification_saver/clear_app_notification "{}"
48+
```
49+
50+
### `app_notification_saver/smach_notification_saver`: SMACH notification saver plugin
51+
52+
This plugin saves notification via service call.
53+
54+
#### `plugin_args`: Plugin arguments
55+
56+
`None`
57+
58+
#### `launch_args`: Plugin launch arguments
59+
60+
- `json_path` : JSON path
61+
- `smach_status_topic`: SMACH status topic name
62+
63+
#### Sample plugin description
64+
65+
```yaml
66+
plugins:
67+
- name: smach_notification_saver
68+
type: app_notification_saver/smach_notification_saver
69+
launch_args:
70+
json_path: /tmp/app_notification.json
71+
smach_status_topic: /server_name/smach/container_status
72+
```
73+
74+
## Nodes
75+
76+
### `service_notification_saver_node.py`: Node for general notification saver
77+
78+
Save notification node via service call.
79+
80+
#### Services
81+
82+
- `~save_app_notification` (`app_notification_saver/SaveAppNotification`)
83+
84+
Service to save app notification to JSON.
85+
86+
- `~clear_app_notification` (`std_srvs/Empty`)
87+
88+
Service to clear app notification in JSON.
89+
90+
#### Parameters
91+
92+
- `~json_path` (`String`, default: `/tmp/app_notification.json`)
93+
94+
Path to json file which contains app notification
95+
96+
#### Sample
97+
98+
##### Launch service_notification_saver node
99+
100+
```bash
101+
roslaunch app_notification_saver service_notification_saver.launch
102+
```
103+
104+
##### Save app notification
105+
106+
You can save app notification with service call.
107+
108+
```bash
109+
rosservice call /service_notification_saver/save_app_notification "title: 'object recognition'
110+
stamp:
111+
secs: 1627467479
112+
nsecs: 13279914
113+
location: 'kitchen'
114+
message: 'Dish is found'"
115+
```
116+
117+
##### Clear app notification
118+
119+
You can also clear app notification.
120+
121+
```bash
122+
rosservice call /service_notification_saver/clear_app_notification "{}"
123+
```
124+
125+
##### Check output JSON
126+
127+
The sample output of the json file is like below:
128+
129+
```json
130+
{
131+
"object recognition": [
132+
{
133+
"date": "2021-07-28T19:17:59",
134+
"message": "Dish is found",
135+
"location": "kitchen"
136+
},
137+
{
138+
"date": "2021-07-28T19:18:09",
139+
"message": "Cup is found",
140+
"location": "kitchen"
141+
}
142+
],
143+
"navigation failure": [
144+
{
145+
"date": "2021-07-28T19:18:29",
146+
"message": "Stucked in front of the chair",
147+
"location": "living room"
148+
}
149+
]
150+
}
151+
```
152+
153+
### `smach_notification_saver_node.py`: Node for SMACH notification saver
154+
155+
Save notification of smach state.
156+
157+
#### Subscribe topics
158+
159+
- `~smach/container_status` (`smach_msgs/SmachContainerStatus`, default: `/server_name/smach/container_status`)
160+
161+
Smach status topic
162+
163+
#### Parameters
164+
165+
- `~json_path` (`String`, default: `/tmp/app_notification.json`)
166+
167+
Path to json file which contains app notification
168+
169+
#### Sample
170+
171+
##### Launch smach_notification_saver node
172+
173+
```bash
174+
# Launch only smach_notification_saver node
175+
roslaunch app_notification_saver smach_notification_saver.launch
176+
177+
# Sample
178+
# Launch smach_notification_saver node and rosbag
179+
roslaunch app_notification_saver sample_smach_notification_saver.launch --screen
180+
```
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- name: app_notification_saver/service_notification_saver
2+
launch: app_notification_saver/service_notification_saver.launch
3+
module: null
4+
- name: app_notification_saver/smach_notification_saver
5+
launch: app_notification_saver/smach_notification_saver.launch
6+
module: null
8.7 KB
Binary file not shown.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<launch>
2+
<!-- start: arguments -->
3+
<arg name="json_path" default="/tmp/app_notification.json" />
4+
<!-- end: arguments -->
5+
6+
<node name="service_notification_saver" pkg="app_notification_saver"
7+
type="service_notification_saver_node.py">
8+
<rosparam subst_value="true">
9+
json_path: $(arg json_path)
10+
</rosparam>
11+
</node>
12+
</launch>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<launch>
2+
<!-- start: arguments -->
3+
<arg name="json_path" default="/tmp/app_notification.json" />
4+
<arg name="smach_status_topic" default="/server_name/smach/container_status" />
5+
<!-- end: arguments -->
6+
7+
<node name="smach_notification_saver" pkg="app_notification_saver"
8+
type="smach_notification_saver_node.py" >
9+
<remap from="~smach/container_status" to="$(arg smach_status_topic)" />
10+
<rosparam subst_value="true">
11+
json_path: $(arg json_path)
12+
</rosparam>
13+
</node>
14+
</launch>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env python
2+
3+
import rospy
4+
5+
from app_notification_saver import ServiceNotificationSaver
6+
7+
8+
if __name__ == '__main__':
9+
rospy.init_node('service_notification_saver_node')
10+
ServiceNotificationSaver()
11+
rospy.spin()

0 commit comments

Comments
 (0)