Skip to content

Commit

Permalink
Merge pull request #518 from k-okada/ros-o
Browse files Browse the repository at this point in the history
[ros-o] julius: use system install julius
  • Loading branch information
k-okada authored Jan 9, 2025
2 parents 79210f3 + d1d2022 commit 5b37f2c
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
15 changes: 15 additions & 0 deletions 3rdparty/julius/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ add_custom_command(
COMMAND make -f ${PROJECT_SOURCE_DIR}/Makefile.dictation-kit MD5SUM_DIR=${MD5SUM_DIR} PATCH_DIR=${PATCH_DIR} INSTALL_DIR=${INSTALL_DIR}
)

# on ROS-O do not download grammer_kit, dictation_kit, instead install download script
if(NOT $ENV{ROS_DISTRO} STREQUAL "debian")
add_custom_target(all_installed ALL DEPENDS julius_installed grammar_kit_installed dictation_kit_installed)

install(DIRECTORY
Expand All @@ -36,3 +38,16 @@ install(DIRECTORY
${INSTALL_DIR}/model
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
USE_SOURCE_PERMISSIONS)
else()
install(PROGRAMS
download_julius_data.sh
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(FILES
Makefile.grammar-kit
Makefile.dictation-kit
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION})
install(FILES
md5sum/dictation-kit-v4.4.zip.md5sum
md5sum/grammar-kit-v4.3.1.tar.gz.md5sum
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/md5sum)
endif()
11 changes: 11 additions & 0 deletions 3rdparty/julius/download_julius_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -xe

SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
MD5SUM_DIR=${SCRIPT_DIR}/md5sum
INSTALL_DIR=$(rospack find julius)

DIR=$(mktemp -d /tmp/julius-XXXX)
cd $DIR
make -f ${SCRIPT_DIR}/Makefile.dictation-kit MD5SUM_DIR=${MD5SUM_DIR} INSTALL_DIR=${INSTALL_DIR}
make -f ${SCRIPT_DIR}/Makefile.grammar-kit MD5SUM_DIR=${MD5SUM_DIR} INSTALL_DIR=${INSTALL_DIR}
rm -fr $DIR
26 changes: 25 additions & 1 deletion julius_ros/scripts/run_julius.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,28 @@ for OPT in "$@"; do
esac
done

exec rosrun julius julius $ARGS
if [ "$ROS_DISTRO" = "debian" ]; then
print_error() {
local message="$1"
echo -e "\e[1m\e[31m${message}\e[0m" >&2
}
if ! test -e $(rospack find julius)/conf -a -e $(rospack find julius)/model; then
print_error "[${BASH_SOURCE[0]}] ----"
print_error "[${BASH_SOURCE[0]}] ----"
print_error "[${BASH_SOURCE[0]}] ---- julius need install grammer and dictation kit, run 'sudo PATH=\$PATH LD_LIBRARY_PATH=\$LD_LIBRARY_PATH ROS_PACKAGE_PATH=\$ROS_PACKAGE_PATH $(rospack find julius)/download_julius_data.sh'"
print_error "[${BASH_SOURCE[0]}] ----"
print_error "[${BASH_SOURCE[0]}] ----"
exit 1
fi
if ! command -v julius >/dev/null 2>&1; then
print_error "[${BASH_SOURCE[0]}] ----"
print_error "[${BASH_SOURCE[0]}] ----"
print_error "[${BASH_SOURCE[0]}] ---- executable file 'julius' not found, run 'sudo apt install julius'"
print_error "[${BASH_SOURCE[0]}] ----"
print_error "[${BASH_SOURCE[0]}] ----"
exit 1
fi
exec julius $ARGS
else
exec rosrun julius julius $ARGS
fi

0 comments on commit 5b37f2c

Please sign in to comment.