Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ros-o] julius: use system install julius #518

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading