Skip to content

Commit

Permalink
Merge branch 'master' into fetch15
Browse files Browse the repository at this point in the history
  • Loading branch information
knorth55 committed Aug 18, 2022
2 parents 49fc997 + bfc5081 commit f2dbf9f
Show file tree
Hide file tree
Showing 38 changed files with 1,122 additions and 37 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/aques_talk/CMakeLists.txt
Expand Up @@ -24,7 +24,7 @@ externalproject_add(aqtk2-lnx-eva
TIMEOUT 120
CONFIGURE_COMMAND bash -c "echo configure"
BUILD_COMMAND bash -c "(cd ${AQTK2_LNX_LIB_DIR} && ln -sf libAquesTalk2Eva.so.2.3 libAquesTalk2.so && ln -sf libAquesTalk2Eva.so.2.3 libAquesTalk2.so.2)"
INSTALL_COMMAND bash -c "cp -P ${AQTK2_LNX_LIB_DIR}/libAquesTalk2* ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION} && cp phont/* ${CMAKE_CURRENT_SOURCE_DIR}/phont/"
INSTALL_COMMAND bash -c "cp -P ${AQTK2_LNX_LIB_DIR}/libAquesTalk2* ${CATKIN_DEVEL_PREFIX}/${CATKIN_PACKAGE_LIB_DESTINATION} && mkdir -p ${CMAKE_CURRENT_SOURCE_DIR}/phont/ && cp phont/* ${CMAKE_CURRENT_SOURCE_DIR}/phont/"
BUILD_IN_SOURCE 1
)

Expand Down
17 changes: 15 additions & 2 deletions dialogflow_task_executive/CMakeLists.txt
Expand Up @@ -51,9 +51,17 @@ if("$ENV{ROS_DISTRO}" STREQUAL "indigo")
message(WARNING "to prevent upgrading to latest pip, which is not Python2 compatible")
file(COPY requirements.txt.indigo DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/requirements.txt.indigo requirements.txt)
catkin_generate_virtualenv()
catkin_generate_virtualenv(PYTHON_INTERPRETER python2)
elseif("$ENV{ROS_DISTRO}" STRGREATER "melodic")
catkin_generate_virtualenv(
INPUT_REQUIREMENTS requirements.in
PYTHON_INTERPRETER python3
)
else()
catkin_generate_virtualenv(INPUT_REQUIREMENTS requirements.in)
catkin_generate_virtualenv(
INPUT_REQUIREMENTS requirements.in
PYTHON_INTERPRETER python2
)
endif()

file(GLOB NODE_SCRIPTS_FILES node_scripts/*.py)
Expand All @@ -67,3 +75,8 @@ install(DIRECTORY launch
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
USE_SOURCE_PERMISSIONS
)

if(CATKIN_ENABLE_TESTING)
find_package(catkin REQUIRED COMPONENTS roslaunch)
roslaunch_add_file_check(launch)
endif()
6 changes: 5 additions & 1 deletion dialogflow_task_executive/launch/dialogflow_ros.launch
@@ -1,11 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<launch>
<arg name="launch_dialogflow" default="true" />
<arg name="use_audio" default="false" />
<arg name="use_tts" default="true" />
<arg name="language" default="ja-JP" />
<arg name="soundplay_action_name" default="robotsound_jp" />
<arg name="volume" default="1.0" />
<arg name="credential" default="$(optenv GOOGLE_APPLICATION_CREDENTIALS false)" doc="Read credentials JSON from this value when use_yaml is false." />
<arg name="project_id" default="$(optenv DIALOGFLOW_PROJECT_ID false)"/>
<arg name="enable_hotword" default="true" />
<arg name="always_publish_result" default="false" doc="Always publish dialog_response topic even the node gets actionlib request." />

<node name="dialogflow_client"
pkg="dialogflow_task_executive" type="dialogflow_client.py"
Expand All @@ -19,6 +22,7 @@
project_id: $(arg project_id)
google_cloud_credentials_json: $(arg credential)
enable_hotword: $(arg enable_hotword)
always_publish_result: $(arg always_publish_result)
</rosparam>
<rosparam command="load" ns="/dialogflow_client/hotword"
file="$(find dialogflow_task_executive)/config/dialogflow_hotword.yaml"/>
Expand Down
32 changes: 14 additions & 18 deletions dialogflow_task_executive/launch/dialogflow_task_executive.launch
@@ -1,9 +1,10 @@
<launch>
<arg name="run_app_manager" default="false" />
<arg name="applist" default="" />
<arg name="credential" default="$(optenv GOOGLE_APPLICATION_CREDENTIALS)" doc="Read credentials JSON from this value when use_yaml is false." />
<arg name="project_id" default="$(optenv DIALOGFLOW_PROJECT_ID)"/>
<arg name="credential" default="$(optenv GOOGLE_APPLICATION_CREDENTIALS false)" doc="Read credentials JSON from this value when use_yaml is false." />
<arg name="project_id" default="$(optenv DIALOGFLOW_PROJECT_ID false)"/>
<arg name="enable_hotword" default="true" />
<arg name="always_publish_result" default="false" doc="Always publish dialog_response topic even the node gets actionlib request." />

<!-- options for dialogflow_client -->
<arg name="launch_dialogflow" default="true" />
Expand All @@ -20,22 +21,17 @@
</node>

<group if="$(arg launch_dialogflow)">
<node name="dialogflow_client"
pkg="dialogflow_task_executive" type="dialogflow_client.py"
output="screen">
<rosparam subst_value="true">
use_audio: $(arg use_audio)
use_tts: $(arg use_tts)
language: $(arg language)
soundplay_action_name: $(arg soundplay_action_name)
volume: $(arg volume)
project_id: $(arg project_id)
google_cloud_credentials_json: $(arg credential)
enable_hotword: $(arg enable_hotword)
</rosparam>
<rosparam command="load" ns="/dialogflow_client/hotword"
file="$(find dialogflow_task_executive)/config/dialogflow_hotword.yaml"/>
</node>
<include file="$(find dialogflow_task_executive)/launch/dialogflow_ros.launch">
<arg name="use_audio" value="$(arg use_audio)" />
<arg name="use_tts" value="$(arg use_tts)" />
<arg name="language" value="$(arg language)" />
<arg name="soundplay_action_name" value="$(arg soundplay_action_name)" />
<arg name="volume" value="$(arg volume)" />
<arg name="credential" value="$(arg credential)" />
<arg name="project_id" value="$(arg project_id)" />
<arg name="enable_hotword" value="$(arg enable_hotword)" />
<arg name="always_publish_result" value="$(arg always_publish_result)" />
</include>
</group>

<node name="task_executive"
Expand Down
21 changes: 14 additions & 7 deletions dialogflow_task_executive/msg/DialogResponse.msg
@@ -1,8 +1,15 @@
Header header
string action
string query
string response
bool fulfilled
string parameters
float32 speech_score
float32 intent_score

# query: The text send by user
string query # The query created by user

# action, response, parameters: The response from Dialogflow
string action # Inferred action name, which is registered at Dialogflow config
# Dialogflow has Default Fallback Intent by default, and it returns input.unknown as action name, when it gets unknown queries
string response # The response from Dialogflow based on action name
string parameters # The action's parameters

# fulfilled, speech_score, intent_score: Parameters related to results
bool fulfilled # Whether all required parameters are present
float32 speech_score # Speech recognition confidence
float32 intent_score # Intent detection confidence
11 changes: 7 additions & 4 deletions dialogflow_task_executive/node_scripts/dialogflow_client.py
Expand Up @@ -83,6 +83,10 @@ def __init__(self):
)
if self.project_id is None:
rospy.logerr('project ID is not set')
self.pub_res = rospy.Publisher(
"dialog_response", DialogResponse, queue_size=1)
self.always_publish_result = rospy.get_param(
"~always_publish_result", False)

def detect_intent_text(self, data, session):
query = df.types.QueryInput(
Expand All @@ -94,7 +98,7 @@ def detect_intent_text(self, data, session):
def make_dialog_msg(self, result):
msg = DialogResponse()
msg.header.stamp = rospy.Time.now()
if result.action != 'input.unknown':
if result.action == 'input.unknown':
rospy.logwarn("Unknown action")
msg.action = result.action

Expand Down Expand Up @@ -143,6 +147,8 @@ def cb(self, goal):
self._as.publish_feedback(feedback)
result.done = success
self._as.set_succeeded(result)
if df_result and self.always_publish_result:
self.pub_res.publish(result.response)


class DialogflowAudioClient(DialogflowBase):
Expand Down Expand Up @@ -185,9 +191,6 @@ def __init__(self):
else:
self.sound_action = None

self.pub_res = rospy.Publisher(
"dialog_response", DialogResponse, queue_size=1)

if self.use_audio:
self.audio_config = df.types.InputAudioConfig(
audio_encoding=df.enums.AudioEncoding.AUDIO_ENCODING_LINEAR_16,
Expand Down
2 changes: 2 additions & 0 deletions dialogflow_task_executive/package.xml
Expand Up @@ -22,7 +22,9 @@
<run_depend>app_manager</run_depend>
<run_depend>message_runtime</run_depend>
<run_depend>speech_recognition_msgs</run_depend>
<run_depend>topic_tools</run_depend>
<!-- <run_depend>python-dialogflow-pip</run_depend> install via catkin_virtualenv -->
<test_depend>roslaunch</test_depend>

<export>
<pip_requirements>requirements.txt</pip_requirements>
Expand Down
2 changes: 1 addition & 1 deletion dialogflow_task_executive/samples/demo.launch
@@ -1,5 +1,5 @@
<launch>
<arg name="google_cloud_credentials_json" default="$(optenv GOOGLE_APPLICATION_CREDENTIALS)" doc="Read credentials JSON from this value when use_yaml is false." />
<arg name="google_cloud_credentials_json" default="$(optenv GOOGLE_APPLICATION_CREDENTIALS false)" doc="Read credentials JSON from this value when use_yaml is false." />
<arg name="project_id" default="eternal-byte-236613" />
<arg name="run_app_manager" default="true" doc="Run app_manager or not"/>

Expand Down
Binary file added influxdb_store/.media/influxdb_grafana.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions influxdb_store/CMakeLists.txt
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 2.8.3)
project(influxdb_store)

find_package(catkin REQUIRED)

catkin_python_setup()

catkin_package()

file(GLOB NODE_SCRIPTS_FILES node_scripts/*)
catkin_install_python(
PROGRAMS ${NODE_SCRIPTS_FILES}
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(
DIRECTORY launch sample
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
USE_SOURCE_PERMISSIONS
)
161 changes: 161 additions & 0 deletions influxdb_store/README.md
@@ -0,0 +1,161 @@
# influxdb_store

ROS package for influxdb store

![influxdb_grafana](./.media/influxdb_grafana.png)

## Sample

```bash
roslaunch influxdb_store influxdb_logger.launch
```

## Logger

### `joint_states_logger.py`

Logger for `sensor_msgs/JointStates`

#### Subscribing topic

- `~input` (`sensor_msgs/JointStates`)

Joint states topic name

#### Parameters

- `~host` (default: `localhost`)

Influxdb host address

- `~port` (default: `8086`)

Influxdb port number

- `~database` (default: `test`)

Influxdb database name

### `map_transform_logger.py`

Logger for transfrom relative to `map_frame`

#### Parameters

- `~host` (default: `localhost`)

Influxdb host address

- `~port` (default: `8086`)

Influxdb port number

- `~database` (default: `test`)

Influxdb database name

- `~map_frame_id` (default: `map`)

Map frame id

- `~update_rate` (default: `0.5`)

Update rate

### `battery_states_logger.py`

Logger for `pr2_msgs/BatteryServer2`

#### Subscribing topic

- `~input` (`pr2_msgs/BatteryServer2`)

Battery topic name

#### Parameters

- `~host` (default: `localhost`)

Influxdb host address

- `~port` (default: `8086`)

Influxdb port number

- `~database` (default: `test`)

Influxdb database name

### `network_states_logger.py`

Logger for network information published by [`jsk_network_tools/network_status.py`](https://github.com/jsk-ros-pkg/jsk_common/tree/master/jsk_network_tools)

#### Subscribing topic

- `~input/receive` (`std_msgs/Float32`)

receiving bps topic name

- `~input/transmit` (`std_msgs/Float32`)

Transmitting bps topic name

#### Parameters

- `~host` (default: `localhost`)

Influxdb host address

- `~port` (default: `8086`)

Influxdb port number

- `~database` (default: `test`)

Influxdb database name

## For JSK PR2 users

### PR1012

```bash
rossetip
rossetmaster pr1012
roslaunch influxdb_store pr2_influxdb_logger.launch robot_name:=pr1012
```

### PR1040

```bash
rossetip
rossetmaster pr1040
roslaunch influxdb_store pr2_influxdb_logger.launch robot_name:=pr1040
```

### Fetch15

```bash
rossetip
rossetmaster fetch15
roslaunch influxdb_store fetch_influxdb_logger.launch robot_name:=fetch15
```

### Fetch1075

```bash
rossetip
rossetmaster fetch1075
roslaunch influxdb_store fetch_influxdb_logger.launch robot_name:=fetch1075
```

### Baxter

```bash
rossetip
rossetmaster baxter
roslaunch influxdb_store baxter_influxdb_logger.launch robot_name:=baxter
```

### Systemctl services

Please see [jsk_database](https://github.com/knorth55/jsk_database).
17 changes: 17 additions & 0 deletions influxdb_store/launch/fetch_battery_logger.launch
@@ -0,0 +1,17 @@
<launch>
<arg name="host" />
<arg name="port" />
<arg name="database" />
<arg name="battery_states_topic" />

<node name="battery_states_logger" pkg="influxdb_store" type="fetch_battery_states_logger.py"
output="screen" respawn="true" >
<remap from="~input" to="$(arg battery_states_topic)" />
<rosparam subst_value="true">
host: $(arg host)
port: $(arg port)
database: $(arg database)
</rosparam>
</node>

</launch>

0 comments on commit f2dbf9f

Please sign in to comment.