diff options
24 files changed, 0 insertions, 1435 deletions
| diff --git a/noetic-llama/.catkin_workspace b/noetic-llama/.catkin_workspace deleted file mode 100644 index 52fd97e..0000000 --- a/noetic-llama/.catkin_workspace +++ /dev/null @@ -1 +0,0 @@ -# This file currently only serves to mark the location of a catkin workspace for tool integration diff --git a/noetic-llama/src/CMakeLists.txt b/noetic-llama/src/CMakeLists.txt deleted file mode 100755 index cd58121..0000000 --- a/noetic-llama/src/CMakeLists.txt +++ /dev/null @@ -1,69 +0,0 @@ -# toplevel CMakeLists.txt for a catkin workspace -# catkin/cmake/toplevel.cmake - -cmake_minimum_required(VERSION 3.0.2) - -project(Project) - -set(CATKIN_TOPLEVEL TRUE) - -# search for catkin within the workspace -set(_cmd "catkin_find_pkg" "catkin" "${CMAKE_SOURCE_DIR}") -execute_process(COMMAND ${_cmd} -  RESULT_VARIABLE _res -  OUTPUT_VARIABLE _out -  ERROR_VARIABLE _err -  OUTPUT_STRIP_TRAILING_WHITESPACE -  ERROR_STRIP_TRAILING_WHITESPACE -) -if(NOT _res EQUAL 0 AND NOT _res EQUAL 2) -  # searching fot catkin resulted in an error -  string(REPLACE ";" " " _cmd_str "${_cmd}") -  message(FATAL_ERROR "Search for 'catkin' in workspace failed (${_cmd_str}): ${_err}") -endif() - -# include catkin from workspace or via find_package() -if(_res EQUAL 0) -  set(catkin_EXTRAS_DIR "${CMAKE_SOURCE_DIR}/${_out}/cmake") -  # include all.cmake without add_subdirectory to let it operate in same scope -  include(${catkin_EXTRAS_DIR}/all.cmake NO_POLICY_SCOPE) -  add_subdirectory("${_out}") - -else() -  # use either CMAKE_PREFIX_PATH explicitly passed to CMake as a command line argument -  # or CMAKE_PREFIX_PATH from the environment -  if(NOT DEFINED CMAKE_PREFIX_PATH) -    if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "") -      if(NOT WIN32) -        string(REPLACE ":" ";" CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) -      else() -        set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) -      endif() -    endif() -  endif() - -  # list of catkin workspaces -  set(catkin_search_path "") -  foreach(path ${CMAKE_PREFIX_PATH}) -    if(EXISTS "${path}/.catkin") -      list(FIND catkin_search_path ${path} _index) -      if(_index EQUAL -1) -        list(APPEND catkin_search_path ${path}) -      endif() -    endif() -  endforeach() - -  # search for catkin in all workspaces -  set(CATKIN_TOPLEVEL_FIND_PACKAGE TRUE) -  find_package(catkin QUIET -    NO_POLICY_SCOPE -    PATHS ${catkin_search_path} -    NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) -  unset(CATKIN_TOPLEVEL_FIND_PACKAGE) - -  if(NOT catkin_FOUND) -    message(FATAL_ERROR "find_package(catkin) failed. catkin was neither found in the workspace nor in the CMAKE_PREFIX_PATH. One reason may be that no ROS setup.sh was sourced before.") -  endif() -endif() - -catkin_workspace() diff --git a/noetic-llama/src/ollamamessages/CMakeLists.txt b/noetic-llama/src/ollamamessages/CMakeLists.txt deleted file mode 100644 index b67d181..0000000 --- a/noetic-llama/src/ollamamessages/CMakeLists.txt +++ /dev/null @@ -1,206 +0,0 @@ -cmake_minimum_required(VERSION 3.0.2) -project(ollamamessages) - -## Compile as C++11, supported in ROS Kinetic and newer -# add_compile_options(-std=c++11) - -## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages -find_package(catkin REQUIRED COMPONENTS -  roscpp -  rospy -  std_msgs -  message_generation -) - -## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) - - -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() - -################################################ -## Declare ROS messages, services and actions ## -################################################ - -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -##   your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -##   * add a build_depend tag for "message_generation" -##   * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET -##   * If MSG_DEP_SET isn't empty the following dependency has been pulled in -##     but can be declared for certainty nonetheless: -##     * add a exec_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -##   * add "message_generation" and every package in MSG_DEP_SET to -##     find_package(catkin REQUIRED COMPONENTS ...) -##   * add "message_runtime" and every package in MSG_DEP_SET to -##     catkin_package(CATKIN_DEPENDS ...) -##   * uncomment the add_*_files sections below as needed -##     and list every .msg/.srv/.action file to be processed -##   * uncomment the generate_messages entry below -##   * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - -## Generate messages in the 'msg' folder -add_message_files( -  FILES -  WhisperTranscription.msg -  WhisperListening.msg -) - -## Generate services in the 'srv' folder -add_service_files( -  FILES -  OllamaCall.srv -) - -## Generate actions in the 'action' folder -# add_action_files( -#   FILES -#   Action1.action -#   Action2.action -# ) - -## Generate added messages and services with any dependencies listed here -generate_messages( -  DEPENDENCIES -  std_msgs -) - -################################################ -## Declare ROS dynamic reconfigure parameters ## -################################################ - -## To declare and build dynamic reconfigure parameters within this -## package, follow these steps: -## * In the file package.xml: -##   * add a build_depend and a exec_depend tag for "dynamic_reconfigure" -## * In this file (CMakeLists.txt): -##   * add "dynamic_reconfigure" to -##     find_package(catkin REQUIRED COMPONENTS ...) -##   * uncomment the "generate_dynamic_reconfigure_options" section below -##     and list every .cfg file to be processed - -## Generate dynamic reconfigure parameters in the 'cfg' folder -# generate_dynamic_reconfigure_options( -#   cfg/DynReconf1.cfg -#   cfg/DynReconf2.cfg -# ) - -################################### -## catkin specific configuration ## -################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if your package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need -catkin_package( -#  INCLUDE_DIRS include -  LIBRARIES ollamamessages -  CATKIN_DEPENDS roscpp rospy std_msgs message_runtime -  DEPENDS system_lib -) - -########### -## Build ## -########### - -## Specify additional locations of header files -## Your package locations should be listed before other locations -include_directories( -# include -  ${catkin_INCLUDE_DIRS} -) - -## Declare a C++ library -# add_library(${PROJECT_NAME} -#   src/${PROJECT_NAME}/ollamamessages.cpp -# ) - -## Add cmake target dependencies of the library -## as an example, code may need to be generated before libraries -## either from message generation or dynamic reconfigure -# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) - -## Declare a C++ executable -## With catkin_make all packages are built within a single CMake context -## The recommended prefix ensures that target names across packages don't collide -# add_executable(${PROJECT_NAME}_node src/ollamamessages_node.cpp) - -## Rename C++ executable without prefix -## The above recommended prefix causes long target names, the following renames the -## target back to the shorter version for ease of user use -## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node" -# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "") - -## Add cmake target dependencies of the executable -## same as for the library above -# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) - -## Specify libraries to link a library or executable target against -# target_link_libraries(${PROJECT_NAME}_node -#   ${catkin_LIBRARIES} -# ) - -############# -## Install ## -############# - -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html - -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -# catkin_install_python(PROGRAMS -#   scripts/my_python_script -#   DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) - -## Mark executables for installation -## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html -# install(TARGETS ${PROJECT_NAME}_node -#   RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) - -## Mark libraries for installation -## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html -# install(TARGETS ${PROJECT_NAME} -#   ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -#   LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -#   RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} -# ) - -## Mark cpp header files for installation -# install(DIRECTORY include/${PROJECT_NAME}/ -#   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} -#   FILES_MATCHING PATTERN "*.h" -#   PATTERN ".svn" EXCLUDE -# ) - -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -#   # myfile1 -#   # myfile2 -#   DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) - -############# -## Testing ## -############# - -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_ollamamessages.cpp) -# if(TARGET ${PROJECT_NAME}-test) -#   target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() - -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) diff --git a/noetic-llama/src/ollamamessages/msg/WhisperListening.msg b/noetic-llama/src/ollamamessages/msg/WhisperListening.msg deleted file mode 100644 index e2a1506..0000000 --- a/noetic-llama/src/ollamamessages/msg/WhisperListening.msg +++ /dev/null @@ -1 +0,0 @@ -bool listening
\ No newline at end of file diff --git a/noetic-llama/src/ollamamessages/msg/WhisperTranscription.msg b/noetic-llama/src/ollamamessages/msg/WhisperTranscription.msg deleted file mode 100644 index 985e998..0000000 --- a/noetic-llama/src/ollamamessages/msg/WhisperTranscription.msg +++ /dev/null @@ -1,6 +0,0 @@ -string text -string language -float64 temperature -float64 avg_logprob -float64 compression_ratio -float64 no_speech_prob
\ No newline at end of file diff --git a/noetic-llama/src/ollamamessages/package.xml b/noetic-llama/src/ollamamessages/package.xml deleted file mode 100644 index 8e6c9b6..0000000 --- a/noetic-llama/src/ollamamessages/package.xml +++ /dev/null @@ -1,70 +0,0 @@ -<?xml version="1.0"?> -<package format="2"> -  <name>ollamamessages</name> -  <version>0.0.0</version> -  <description>The ollamamessages package</description> - -  <!-- One maintainer tag required, multiple allowed, one person per tag --> -  <!-- Example:  --> -  <!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> --> -  <maintainer email="eden@todo.todo">eden</maintainer> - - -  <!-- One license tag required, multiple allowed, one license per tag --> -  <!-- Commonly used license strings: --> -  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 --> -  <license>TODO</license> - - -  <!-- Url tags are optional, but multiple are allowed, one per tag --> -  <!-- Optional attribute type can be: website, bugtracker, or repository --> -  <!-- Example: --> -  <!-- <url type="website">http://wiki.ros.org/ollamamessages</url> --> - - -  <!-- Author tags are optional, multiple are allowed, one per tag --> -  <!-- Authors do not have to be maintainers, but could be --> -  <!-- Example: --> -  <!-- <author email="jane.doe@example.com">Jane Doe</author> --> - - -  <!-- The *depend tags are used to specify dependencies --> -  <!-- Dependencies can be catkin packages or system dependencies --> -  <!-- Examples: --> -  <!-- Use depend as a shortcut for packages that are both build and exec dependencies --> -  <!--   <depend>roscpp</depend> --> -  <!--   Note that this is equivalent to the following: --> -  <!--   <build_depend>roscpp</build_depend> --> -  <!--   <exec_depend>roscpp</exec_depend> --> -  <!-- Use build_depend for packages you need at compile time: --> -  <!--   <build_depend>message_generation</build_depend> --> -  <!-- Use build_export_depend for packages you need in order to build against this package: --> -  <!--   <build_export_depend>message_generation</build_export_depend> --> -  <!-- Use buildtool_depend for build tool packages: --> -  <!--   <buildtool_depend>catkin</buildtool_depend> --> -  <!-- Use exec_depend for packages you need at runtime: --> -  <!--   <exec_depend>message_runtime</exec_depend> --> -  <!-- Use test_depend for packages you need only for testing: --> -  <!--   <test_depend>gtest</test_depend> --> -  <!-- Use doc_depend for packages you need only for building documentation: --> -  <!--   <doc_depend>doxygen</doc_depend> --> -  <build_depend>message_generation</build_depend> -  <exec_depend>message_runtime</exec_depend> -  <buildtool_depend>catkin</buildtool_depend> -  <build_depend>roscpp</build_depend> -  <build_depend>rospy</build_depend> -  <build_depend>std_msgs</build_depend> -  <build_export_depend>roscpp</build_export_depend> -  <build_export_depend>rospy</build_export_depend> -  <build_export_depend>std_msgs</build_export_depend> -  <exec_depend>roscpp</exec_depend> -  <exec_depend>rospy</exec_depend> -  <exec_depend>std_msgs</exec_depend> - - -  <!-- The export tag contains other, unspecified, tags --> -  <export> -    <!-- Other tools can request additional information be placed here --> - -  </export> -</package> diff --git a/noetic-llama/src/ollamamessages/srv/OllamaCall.srv b/noetic-llama/src/ollamamessages/srv/OllamaCall.srv deleted file mode 100755 index aedae15..0000000 --- a/noetic-llama/src/ollamamessages/srv/OllamaCall.srv +++ /dev/null @@ -1,7 +0,0 @@ -string input ---- -int64 total_duration -int64 load_duration -int64 prompt_eval_duration -int64 eval_count -int64 eval_duration diff --git a/noetic-llama/src/ollamawrapper/CMakeLists.txt b/noetic-llama/src/ollamawrapper/CMakeLists.txt deleted file mode 100644 index 82b4be4..0000000 --- a/noetic-llama/src/ollamawrapper/CMakeLists.txt +++ /dev/null @@ -1,218 +0,0 @@ -cmake_minimum_required(VERSION 3.0.2) -project(ollamawrapper) - -## Compile as C++11, supported in ROS Kinetic and newer -# add_compile_options(-std=c++11) - -## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages -find_package(catkin REQUIRED COMPONENTS -  roscpp -  rospy -  std_msgs -  message_generation -) - -## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) - - -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -catkin_python_setup() - -################################################ -## Declare ROS messages, services and actions ## -################################################ - -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -##   your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -##   * add a build_depend tag for "message_generation" -##   * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET -##   * If MSG_DEP_SET isn't empty the following dependency has been pulled in -##     but can be declared for certainty nonetheless: -##     * add a exec_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -##   * add "message_generation" and every package in MSG_DEP_SET to -##     find_package(catkin REQUIRED COMPONENTS ...) -##   * add "message_runtime" and every package in MSG_DEP_SET to -##     catkin_package(CATKIN_DEPENDS ...) -##   * uncomment the add_*_files sections below as needed -##     and list every .msg/.srv/.action file to be processed -##   * uncomment the generate_messages entry below -##   * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - -## Generate messages in the 'msg' folder -# add_message_files( -#   FILES -#   Message1.msg -#   Message2.msg -# ) - -## Generate services in the 'srv' folder -#add_service_files( -#  FILES -#  OllamaCall.srv -#) - -## Generate actions in the 'action' folder -# add_action_files( -#   FILES -#   Action1.action -#   Action2.action -# ) - -## Generate added messages and services with any dependencies listed here -generate_messages( -  DEPENDENCIES -  std_msgs -) - -################################################ -## Declare ROS dynamic reconfigure parameters ## -################################################ - -## To declare and build dynamic reconfigure parameters within this -## package, follow these steps: -## * In the file package.xml: -##   * add a build_depend and a exec_depend tag for "dynamic_reconfigure" -## * In this file (CMakeLists.txt): -##   * add "dynamic_reconfigure" to -##     find_package(catkin REQUIRED COMPONENTS ...) -##   * uncomment the "generate_dynamic_reconfigure_options" section below -##     and list every .cfg file to be processed - -## Generate dynamic reconfigure parameters in the 'cfg' folder -# generate_dynamic_reconfigure_options( -#   cfg/DynReconf1.cfg -#   cfg/DynReconf2.cfg -# ) - -################################### -## catkin specific configuration ## -################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if your package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need -catkin_package( -#  INCLUDE_DIRS include -  LIBRARIES ollamawrapper -  CATKIN_DEPENDS roscpp rospy std_msgs message_runtime -  DEPENDS system_lib -) - -########### -## Build ## -########### - -## Specify additional locations of header files -## Your package locations should be listed before other locations -include_directories( -# include -  ${catkin_INCLUDE_DIRS} -) - -## Declare a C++ library -# add_library(${PROJECT_NAME} -#   src/${PROJECT_NAME}/ollamawrapper.cpp -# ) - -## Add cmake target dependencies of the library -## as an example, code may need to be generated before libraries -## either from message generation or dynamic reconfigure -# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) - -## Declare a C++ executable -## With catkin_make all packages are built within a single CMake context -## The recommended prefix ensures that target names across packages don't collide -# add_executable(${PROJECT_NAME}_node src/ollamawrapper_node.cpp) - -## Rename C++ executable without prefix -## The above recommended prefix causes long target names, the following renames the -## target back to the shorter version for ease of user use -## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node" -# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "") - -## Add cmake target dependencies of the executable -## same as for the library above -# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) - -## Specify libraries to link a library or executable target against -# target_link_libraries(${PROJECT_NAME}_node -#   ${catkin_LIBRARIES} -# ) - -############# -## Install ## -############# - -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html - -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -catkin_install_python(PROGRAMS -  src/ollamawrapper.py -  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -) - -install( -  DIRECTORY src/capabilities/ -  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}/capabilities -) - -install(FILES -  src/Modelfile.jinja2 -  src/ollamafunctiongrammar.ppeg -  src/parser.py -  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -) - -## Mark executables for installation -## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html -# install(TARGETS ${PROJECT_NAME}_node -#   RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) - -## Mark libraries for installation -## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html -# install(TARGETS ${PROJECT_NAME} -#   ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -#   LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -#   RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} -# ) - -## Mark cpp header files for installation -# install(DIRECTORY include/${PROJECT_NAME}/ -#   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} -#   FILES_MATCHING PATTERN "*.h" -#   PATTERN ".svn" EXCLUDE -# ) - -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -#   # myfile1 -#   # myfile2 -#   DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) - -############# -## Testing ## -############# - -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_ollamawrapper.cpp) -# if(TARGET ${PROJECT_NAME}-test) -#   target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() - -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) diff --git a/noetic-llama/src/ollamawrapper/package.xml b/noetic-llama/src/ollamawrapper/package.xml deleted file mode 100755 index cfad2a4..0000000 --- a/noetic-llama/src/ollamawrapper/package.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0"?> -<package format="2"> -  <name>ollamawrapper</name> -  <version>0.0.0</version> -  <description>The ollamawrapper package</description> - -  <!-- One maintainer tag required, multiple allowed, one person per tag --> -  <!-- Example:  --> -  <!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> --> -  <maintainer email="root@todo.todo">root</maintainer> - - -  <!-- One license tag required, multiple allowed, one license per tag --> -  <!-- Commonly used license strings: --> -  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 --> -  <license>TODO</license> - - -  <!-- Url tags are optional, but multiple are allowed, one per tag --> -  <!-- Optional attribute type can be: website, bugtracker, or repository --> -  <!-- Example: --> -  <!-- <url type="website">http://wiki.ros.org/ollamawrapper</url> --> - - -  <!-- Author tags are optional, multiple are allowed, one per tag --> -  <!-- Authors do not have to be maintainers, but could be --> -  <!-- Example: --> -  <!-- <author email="jane.doe@example.com">Jane Doe</author> --> - - -  <!-- The *depend tags are used to specify dependencies --> -  <!-- Dependencies can be catkin packages or system dependencies --> -  <!-- Examples: --> -  <!-- Use depend as a shortcut for packages that are both build and exec dependencies --> -  <!--   <depend>roscpp</depend> --> -  <!--   Note that this is equivalent to the following: --> -  <!--   <build_depend>roscpp</build_depend> --> -  <!--   <exec_depend>roscpp</exec_depend> --> -  <!-- Use build_depend for packages you need at compile time: --> -  <build_depend>message_generation</build_depend> -  <!-- Use build_export_depend for packages you need in order to build against this package: --> -  <!--   <build_export_depend>message_generation</build_export_depend> --> -  <!-- Use buildtool_depend for build tool packages: --> -  <!--   <buildtool_depend>catkin</buildtool_depend> --> -  <!-- Use exec_depend for packages you need at runtime: --> -  <exec_depend>message_runtime</exec_depend> -  <!-- Use test_depend for packages you need only for testing: --> -  <!--   <test_depend>gtest</test_depend> --> -  <!-- Use doc_depend for packages you need only for building documentation: --> -  <!--   <doc_depend>doxygen</doc_depend> --> -  <buildtool_depend>catkin</buildtool_depend> -  <build_depend>roscpp</build_depend> -  <build_depend>rospy</build_depend> -  <build_depend>std_msgs</build_depend> -  <build_export_depend>roscpp</build_export_depend> -  <build_export_depend>rospy</build_export_depend> -  <build_export_depend>std_msgs</build_export_depend> -  <exec_depend>roscpp</exec_depend> -  <exec_depend>rospy</exec_depend> -  <exec_depend>std_msgs</exec_depend> - - -  <!-- The export tag contains other, unspecified, tags --> -  <export> -    <!-- Other tools can request additional information be placed here --> - -  </export> -</package> diff --git a/noetic-llama/src/ollamawrapper/setup.py b/noetic-llama/src/ollamawrapper/setup.py deleted file mode 100644 index 221ba55..0000000 --- a/noetic-llama/src/ollamawrapper/setup.py +++ /dev/null @@ -1,9 +0,0 @@ -from setuptools import setup -from catkin_pkg.python_setup import generate_distutils_setup - -setup_args = generate_distutils_setup( -    packages = ["capabilities"], -    package_dir = {"": "src"} -) - -setup(**setup_args)
\ No newline at end of file diff --git a/noetic-llama/src/ollamawrapper/src/Modelfile b/noetic-llama/src/ollamawrapper/src/Modelfile deleted file mode 100644 index bc66595..0000000 --- a/noetic-llama/src/ollamawrapper/src/Modelfile +++ /dev/null @@ -1,28 +0,0 @@ -FROM nexusraven:13b-v2-q3_K_S -SYSTEM """ -Function: -def get_weather_data(coordinates): -    ''' -    Fetches weather data from the Open-Meteo API for the given latitude and longitude. - -    Args: -    coordinates (tuple): The latitude of the location. - -    Returns: -    float: The current temperature in the coordinates you've asked for -    ''' - -Function: -def get_coordinates_from_city(city_name): -    ''' -    Fetches the latitude and longitude of a given city name using the Maps.co Geocoding API. - -    Args: -    city_name (str): The name of the city. - -    Returns: -    tuple: The latitude and longitude of the city. -    ''' - -User Query: {query}<human_end> -"""
\ No newline at end of file diff --git a/noetic-llama/src/ollamawrapper/src/Modelfile.jinja2 b/noetic-llama/src/ollamawrapper/src/Modelfile.jinja2 deleted file mode 100644 index 25af1bc..0000000 --- a/noetic-llama/src/ollamawrapper/src/Modelfile.jinja2 +++ /dev/null @@ -1,11 +0,0 @@ -FROM {{ model }} -SYSTEM """ -{%- for functioncapability in functioncapabilities %} -Function: -def {{ functioncapability.functioname }}({{ ", ".join(functioncapability.argnames) }}): -    ''' -    {{ functioncapability.docstring|indent(4, False) }} -    ''' -{% endfor %} -User Query: {query}<human_end> -"""
\ No newline at end of file diff --git a/noetic-llama/src/ollamawrapper/src/capabilities/__init__.py b/noetic-llama/src/ollamawrapper/src/capabilities/__init__.py deleted file mode 100644 index daf617c..0000000 --- a/noetic-llama/src/ollamawrapper/src/capabilities/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from .weather import * -from .basicmaths import * -# from .gestures import *
\ No newline at end of file diff --git a/noetic-llama/src/ollamawrapper/src/capabilities/basicmaths.py b/noetic-llama/src/ollamawrapper/src/capabilities/basicmaths.py deleted file mode 100644 index ebad59c..0000000 --- a/noetic-llama/src/ollamawrapper/src/capabilities/basicmaths.py +++ /dev/null @@ -1,55 +0,0 @@ -import rospy - - -def add(num1, num2): -    """Returns the output of two numbers added together - -    Args: -        num1 (int): The first number to add together -        num2 (int): The second number to add together - -    Returns: -        int: The sum of the two numbers -    """ -    print("%f + %f = %f" % (num1, num2, num1 + num2)) -    return num1 + num2 - -def sub(num1, num2): -    """Returns the output of two numbers subtracted from each other - -    Args: -        num1 (int): The first number -        num2 (int): A number to subtract the first number from -    """ -    print("%f - %f = %f" % (num1, num2, num1 - num2)) -    return num1 - num2 - - -def mult(num1, num2): -    """Returns the output of two numbers multiplied with each other - -    Args: -        num1 (int): The first number to multiply together -        num2 (int): The second number to multiply together -    """ -    print("%f × %f = %f" % (num1, num2, num1 * num2)) -    return  num1 * num2 - -def div(num1, num2): -    """Returns the output of two numbers divided with each other - -    Args: -        num1 (int): The enumerator -        num2 (int): The denominator -    """ -    print("%f ÷ %f = %f" % (num1, num2, num1 / num2)) -    return num1 / num2 - -"""class A: -    def funct(): - - -a = A() - -def func(): -    a.funct()""" diff --git a/noetic-llama/src/ollamawrapper/src/capabilities/gestures.py b/noetic-llama/src/ollamawrapper/src/capabilities/gestures.py deleted file mode 100644 index 683a7a3..0000000 --- a/noetic-llama/src/ollamawrapper/src/capabilities/gestures.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python -import sys -import rospy -from move_base_msgs.msg import MoveBaseAction , MoveBaseGoal -import moveit_commander -import actionlib -from pal_interaction_msgs.msg import TtsActionGoal, TtsAction, TtsGoal -from geometry_msgs.msg import PoseStamped - -class arm_move: -    def __init__(self): -        moveit_commander.roscpp_initialize(sys.argv) -        self.ac = actionlib.SimpleActionClient('/tts' , TtsAction) -        self.ac.wait_for_server() -        self.tts_goal = TtsActionGoal() -        self.tts_goal.goal.rawtext.text = 'Hi,_I_am_up' -        self.tts_goal.goal.rawtext.lang_id = 'en_GB' -        self.ac.send_goal(self.tts_goal.goal) -        self.scene = moveit_commander.PlanningSceneInterface() -        self.arm = moveit_commander.MoveGroupCommander('arm') -        self.reference_frame = 'arm_1_link' -        self.arm.set_pose_reference_frame(self.reference_frame) -        self.arm.allow_replanning(True) -        self.target_pose = PoseStamped() -        self.target_pose.header.frame_id = self.reference_frame -        self.object1_move_1 = [0.27 , 0.30 , -1.47 , 1.63 , -0.70 , -0.11 , 0.94] -        self.object1_move_2 = [0.27 , 0.30 , -1.47 , 1.63 , -0.70 , -0.11 , 0.94] -        self.object1_move_3 = [0.27 , 0.30 , -1.47 , 1.63 , -0.70 , -0.11 , 0.94] -        self.object2_move_1 = [0.27 , 0.30 , -1.47 , 1.63 , -0.70 , -0.11 , 0.94] -        self.object2_move_2 = [0.27 , 0.30 , -1.47 , 1.63 , -0.70 , -0.11 , 0.94] -        self.object2_move_3 = [0.27 , 0.30 , -1.47 , 1.63 , -0.70 , -0.11 , 0.94] -        self.object3_move_1 = [0.27 , 0.30 , -1.47 , 1.63 , -0.70 , -0.11 , 0.94] -        self.object3_move_2 = [0.27 , 0.30 , -1.47 , 1.63 , -0.70 , -0.11 , 0.94] -        self.object3_move_3 = [0.27 , 0.30 , -1.47 , 1.63 , -0.70 , -0.11 , 0.94] - -    def goto_obj1(self): -        """ -        A Function for reaching to object 1 # change the name of the object here -        """ -        self.arm.go(self.object1_move_1 , wait=True) -        rospy.sleep(5) -        self.arm.go(self.object1_move_2 , wait=True) -        rospy.sleep(5) -        self.arm.go(self.object1_move_3 , wait=True) - -    def goto_obj2(self): -        """ -        A Function for reaching to object 1 # change the name of the object here -        """ -        self.arm.go(self.object2_move_1 , wait=True) -        rospy.sleep(5) -        self.arm.go(self.object2_move_2 , wait=True) -        rospy.sleep(5) -        self.arm.go(self.object2_move_3 , wait=True) - -    def goto_obj3(self): -        """ -        A Function for reaching to object 1 # change the name of the object here -        """ -        self.arm.go(self.object3_move_1 , wait=True) -        rospy.sleep(5) -        self.arm.go(self.object3_move_2 , wait=True) -        rospy.sleep(5) -        self.arm.go(self.object3_move_3 , wait=True) - -    def speak(self, params): -        """ -        A function to speaking  -         -        """ -        self.goal.goal.rawtext.text = params # 'Please_take_the_bottle_from_my_hand' -        self.ac.send_goal(self.goal.goal  ) - -arm = arm_move() - -def speak(tosay): -    """Function to make the tiago speak arbitrary words - -    Args: -        tosay (string): A string to say using the speaker -    """ -    arm.speak(tosay)
\ No newline at end of file diff --git a/noetic-llama/src/ollamawrapper/src/capabilities/weather.py b/noetic-llama/src/ollamawrapper/src/capabilities/weather.py deleted file mode 100644 index 4d6e073..0000000 --- a/noetic-llama/src/ollamawrapper/src/capabilities/weather.py +++ /dev/null @@ -1,80 +0,0 @@ -import os -import dotenv -import geocoder -import requests  - -APIKEYS_PATH = "/home/eden/Documents/noetic-llama/noetic-llama/apikeys.env" -# APIKEYS_PATH = os.path.join(os.path.dirname(__file__), "..", "..", "..", "apikeys.env") -if os.path.exists(APIKEYS_PATH): -    dotenv.load_dotenv(APIKEYS_PATH) - -if "BINGMAPS" not in os.environ: -    raise Exception("'BINGMAPS' API key environment variable not found") - -WEATHER_CODES = { -    0: "Clear sky", -    1: "Mainly clear, partly cloudy, and overcast", -    2: "Mainly clear, partly cloudy, and overcast", -    3: "Mainly clear, partly cloudy, and overcast", -    45: "Fog and depositing rime fog", -    48: "Fog and depositing rime fog", -    51: "Drizzle: Light, moderate, and dense intensity", -    53: "Drizzle: Light, moderate, and dense intensity", -    55: "Drizzle: Light, moderate, and dense intensity", -    56: "Freezing Drizzle: Light and dense intensity", -    57: "Freezing Drizzle: Light and dense intensity", -    61: "Rain: Slight, moderate and heavy intensity", -    63: "Rain: Slight, moderate and heavy intensity", -    65: "Rain: Slight, moderate and heavy intensity", -    66: "Freezing Rain: Light and heavy intensity", -    67: "Freezing Rain: Light and heavy intensity", -    71: "Snow fall: Slight, moderate, and heavy intensity", -    73: "Snow fall: Slight, moderate, and heavy intensity", -    75: "Snow fall: Slight, moderate, and heavy intensity", -    77:	"Snow grains", -    80: "Rain showers: Slight, moderate, and violent", -    81: "Rain showers: Slight, moderate, and violent", -    82: "Rain showers: Slight, moderate, and violent", -    85: "Snow showers slight and heavy", -    86: "Snow showers slight and heavy", -    95: "Thunderstorm: Slight or moderate", -    96: "Thunderstorm with slight and heavy hail", -    99: "Thunderstorm with slight and heavy hail" -} - -def get_weather_data(coordinates): -    ''' -    Fetches weather data from the Open-Meteo API for the given latitude and longitude. - -    Args: -        coordinates (tuple): The latitude of the location. - -    Returns: -        float: The current temperature in the coordinates you've asked for -    ''' -    req = requests.get("https://api.open-meteo.com/v1/forecast?latitude=%f&longitude=%f¤t=temperature_2m¤t=weather_code" % coordinates) -    j = req.json() -    o = "The current temperature is %f°C with an outlook of '%s'" % (j["current"]["temperature_2m"], WEATHER_CODES[j["current"]["weather_code"]]) -    print(o) -    return o - - -def get_coordinates_from_city(city_name): -    ''' -    Fetches the latitude and longitude of a given city name using the Bing Geocoding API. - -    Args: -        city_name (str): The name of the city. - -    Returns: -        tuple: The latitude and longitude of the city. -    ''' - -    g = geocoder.bing(city_name, key = os.environ["BINGMAPS"]).json -    print("By '%s' I am assuming you mean '%s'" % (city_name, g["address"])) - -    # print(g["lat"], g["lng"]) -    return g["lat"], g["lng"] - -if __name__ == "__main__": -    print(get_weather_data(get_coordinates_from_city("Lincoln"))) diff --git a/noetic-llama/src/ollamawrapper/src/ollamafunctiongrammar.ppeg b/noetic-llama/src/ollamawrapper/src/ollamafunctiongrammar.ppeg deleted file mode 100644 index b89e47f..0000000 --- a/noetic-llama/src/ollamawrapper/src/ollamafunctiongrammar.ppeg +++ /dev/null @@ -1,12 +0,0 @@ -functioncall = alphanums lparen argdecl* rparen -argdecl = alphanums equals value comma? -value = functioncall / string / real / int -equals = ws? "=" ws? -comma = ws? "," ws? -lparen = ws? "(" ws? -rparen = ws? ")" ws? -alphanums = ~r"[a-z0-9_]+" -string = ~r"['\"].*['\"]" -real = ~r"\d*\.\d+" -int = ~r"\d+" -ws = ~"\s*" diff --git a/noetic-llama/src/ollamawrapper/src/ollamawrapper.py b/noetic-llama/src/ollamawrapper/src/ollamawrapper.py deleted file mode 100644 index 400816e..0000000 --- a/noetic-llama/src/ollamawrapper/src/ollamawrapper.py +++ /dev/null @@ -1,103 +0,0 @@ -#!/usr/bin/env python3 - -from dataclasses import dataclass -from ollamamessages.srv import OllamaCall, OllamaCallResponse -import inspect -import typing -import jinja2 -import ollama -import rospy -import time -import sys -import os - -ollama_api_url = rospy.get_param("/stt/ollama_api_url", "127.0.0.1:11434") -base_ollama_model = rospy.get_param("/stt/ollama_base_model", "nexusraven:13b-v2-q2_K") - -def handle_ollama_call(req): -    print("Recieved ollama request '%s'" % req.input) -    o = main(req.input) -    # print(o.keys()) -    return OllamaCallResponse( -        o["total_duration"], -        o["load_duration"], -        o["prompt_eval_duration"], -        o["eval_count"], -        o["eval_duration"] -    ) - -rospy.init_node("ollama_wrapper_server") - -print("hello?") -import capabilities -from capabilities import * -s = rospy.Service("/stt/ollamacall", OllamaCall, handle_ollama_call) -print("spin") -rospy.spin() - -def getfunctioncapabilities(): -    functioncapabilities = FunctionCapablilites() - -    # not very complicated inspection... the library basically must -    # consist only of multiple modules each with multiple functions, -    # no classes or submodules will be dealt with -    for modulename, module in inspect.getmembers(capabilities): -                                        #  \/ horrible -        if inspect.ismodule(module) and 'capabilities' in inspect.getfile(module): -            for functionname, function in inspect.getmembers(module): -                if inspect.isfunction(function): -                    # print(functionname, function) -                    docstring = inspect.getdoc(function) -                    # only very simple arguments are fetched, i.e. no **kwargs, or default arguments -                    # will be dealt with -                    argnames = inspect.getfullargspec(function).args -                    functioncapabilities.append(FunctionCapability(modulename, module, functionname, function, docstring, argnames)) - -    return functioncapabilities - -@dataclass -class FunctionCapability: -    modulename: str -    module: None -    functioname: str -    function: None -    docstring: str -    argnames: list - -class FunctionCapablilites(list): -    def to_modelfile(self, model): -        environment = jinja2.Environment(loader = jinja2.FileSystemLoader(os.path.dirname(__file__))) -        template = environment.get_template("Modelfile.jinja2") - -        return template.render(functioncapabilities = self, model = model) - -def get_functions(ollama_output): -    return [f.strip() for f in ollama_output[8:].strip().split(";") if f != ""] - -MODEL_NAME = "noeticllama:" + str(int(time.time())) -client = ollama.Client(host = "http://%s" % ollama_api_url) - -for mn in [m["name"] for m in client.list()["models"]]: -    if mn.startswith("noeticllama"): -        client.delete(mn) - -functioncapabilities = getfunctioncapabilities() -modelfile = functioncapabilities.to_modelfile(base_ollama_model) -client.create(model = MODEL_NAME, modelfile = modelfile) - -def main(prompt): -    # with open("Modelfile", "r") as f: -    #    ollama.create(model = "temp", modelfile= f.read()) -    ollama_output = client.generate( -        model = MODEL_NAME,  -        prompt = prompt,  -        options = {"stop": ["Thought:"]}, -        keep_alive = "30m" -    ) -    #print(ollama_output) - -    for func_str in get_functions(ollama_output["response"]): -        rospy.loginfo("Generated function: " + func_str + ":") -        exec(func_str) - -    return ollama_output
\ No newline at end of file diff --git a/noetic-llama/src/ollamawrapper/src/parser.py b/noetic-llama/src/ollamawrapper/src/parser.py deleted file mode 100644 index 001db97..0000000 --- a/noetic-llama/src/ollamawrapper/src/parser.py +++ /dev/null @@ -1,37 +0,0 @@ -"""This is a WIP that parses the ollama output with the idea being to call -functions using the python API instead of using `exec()` which is rather unsafe -Since the structure is rather complicated it requires defining a grammar to do  -parsing with. - -The grammar works but navigating the abstract syntax tree requires some work. -""" -from parsimonious.grammar import Grammar -from parsimonious.nodes import NodeVisitor - -class FunctionCaller(NodeVisitor): - -    cur_args = {} - -    def visit_functioncall(self, node, visited_children): -        """ Gets each key/value pair, returns a tuple. """ -        print("***functioncall***", node.text, self.cur_args, "sneed") -        self.cur_args = {} -        # key, _, value, *_ = node.children -        # return key.text, value.text - -    def visit_argdecl(self, node, visited_children): -        """ Gets each key/value pair, returns a tuple. """ -        key, _, value, *_ = node.children -        self.cur_args[key.text] = value.text -        return {key.text: value.text} - -    def generic_visit(self, node, visited_children): -        """ The generic visit method. """ -        return visited_children or node - -with open("ollamafunctiongrammar.ppeg", "r") as f: -    grammar = Grammar(f.read()) - -tree = grammar.parse("get_weather_data(coordinates=get_coordinates_from_city(city_name='Lincoln'), add=sum(num1=2, num2=3))") -iv = FunctionCaller() -print(iv.visit(tree))
\ No newline at end of file diff --git a/noetic-llama/src/pal_msgs b/noetic-llama/src/pal_msgs deleted file mode 160000 -Subproject d101a28f5911e8e5d3c8d42eefdf1dc3924821a diff --git a/noetic-llama/src/whisperwrapper/CMakeLists.txt b/noetic-llama/src/whisperwrapper/CMakeLists.txt deleted file mode 100644 index 6d3f9a4..0000000 --- a/noetic-llama/src/whisperwrapper/CMakeLists.txt +++ /dev/null @@ -1,206 +0,0 @@ -cmake_minimum_required(VERSION 3.0.2) -project(whisperwrapper) - -## Compile as C++11, supported in ROS Kinetic and newer -# add_compile_options(-std=c++11) - -## Find catkin macros and libraries -## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz) -## is used, also find other catkin packages -find_package(catkin REQUIRED COMPONENTS -  roscpp -  rospy -  std_msgs -) - -## System dependencies are found with CMake's conventions -# find_package(Boost REQUIRED COMPONENTS system) - - -## Uncomment this if the package has a setup.py. This macro ensures -## modules and global scripts declared therein get installed -## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html -# catkin_python_setup() - -################################################ -## Declare ROS messages, services and actions ## -################################################ - -## To declare and build messages, services or actions from within this -## package, follow these steps: -## * Let MSG_DEP_SET be the set of packages whose message types you use in -##   your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...). -## * In the file package.xml: -##   * add a build_depend tag for "message_generation" -##   * add a build_depend and a exec_depend tag for each package in MSG_DEP_SET -##   * If MSG_DEP_SET isn't empty the following dependency has been pulled in -##     but can be declared for certainty nonetheless: -##     * add a exec_depend tag for "message_runtime" -## * In this file (CMakeLists.txt): -##   * add "message_generation" and every package in MSG_DEP_SET to -##     find_package(catkin REQUIRED COMPONENTS ...) -##   * add "message_runtime" and every package in MSG_DEP_SET to -##     catkin_package(CATKIN_DEPENDS ...) -##   * uncomment the add_*_files sections below as needed -##     and list every .msg/.srv/.action file to be processed -##   * uncomment the generate_messages entry below -##   * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...) - -## Generate messages in the 'msg' folder -# add_message_files( -#   FILES -#   Message1.msg -#   Message2.msg -# ) - -## Generate services in the 'srv' folder -# add_service_files( -#   FILES -#   Service1.srv -#   Service2.srv -# ) - -## Generate actions in the 'action' folder -# add_action_files( -#   FILES -#   Action1.action -#   Action2.action -# ) - -## Generate added messages and services with any dependencies listed here -# generate_messages( -#   DEPENDENCIES -#   std_msgs -# ) - -################################################ -## Declare ROS dynamic reconfigure parameters ## -################################################ - -## To declare and build dynamic reconfigure parameters within this -## package, follow these steps: -## * In the file package.xml: -##   * add a build_depend and a exec_depend tag for "dynamic_reconfigure" -## * In this file (CMakeLists.txt): -##   * add "dynamic_reconfigure" to -##     find_package(catkin REQUIRED COMPONENTS ...) -##   * uncomment the "generate_dynamic_reconfigure_options" section below -##     and list every .cfg file to be processed - -## Generate dynamic reconfigure parameters in the 'cfg' folder -# generate_dynamic_reconfigure_options( -#   cfg/DynReconf1.cfg -#   cfg/DynReconf2.cfg -# ) - -################################### -## catkin specific configuration ## -################################### -## The catkin_package macro generates cmake config files for your package -## Declare things to be passed to dependent projects -## INCLUDE_DIRS: uncomment this if your package contains header files -## LIBRARIES: libraries you create in this project that dependent projects also need -## CATKIN_DEPENDS: catkin_packages dependent projects also need -## DEPENDS: system dependencies of this project that dependent projects also need -catkin_package( -#  INCLUDE_DIRS include -#  LIBRARIES whisperwrapper -#  CATKIN_DEPENDS roscpp rospy std_msgs -#  DEPENDS system_lib -) - -########### -## Build ## -########### - -## Specify additional locations of header files -## Your package locations should be listed before other locations -include_directories( -# include -  ${catkin_INCLUDE_DIRS} -) - -## Declare a C++ library -# add_library(${PROJECT_NAME} -#   src/${PROJECT_NAME}/whisperwrapper.cpp -# ) - -## Add cmake target dependencies of the library -## as an example, code may need to be generated before libraries -## either from message generation or dynamic reconfigure -# add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) - -## Declare a C++ executable -## With catkin_make all packages are built within a single CMake context -## The recommended prefix ensures that target names across packages don't collide -# add_executable(${PROJECT_NAME}_node src/whisperwrapper_node.cpp) - -## Rename C++ executable without prefix -## The above recommended prefix causes long target names, the following renames the -## target back to the shorter version for ease of user use -## e.g. "rosrun someones_pkg node" instead of "rosrun someones_pkg someones_pkg_node" -# set_target_properties(${PROJECT_NAME}_node PROPERTIES OUTPUT_NAME node PREFIX "") - -## Add cmake target dependencies of the executable -## same as for the library above -# add_dependencies(${PROJECT_NAME}_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS}) - -## Specify libraries to link a library or executable target against -# target_link_libraries(${PROJECT_NAME}_node -#   ${catkin_LIBRARIES} -# ) - -############# -## Install ## -############# - -# all install targets should use catkin DESTINATION variables -# See http://ros.org/doc/api/catkin/html/adv_user_guide/variables.html - -## Mark executable scripts (Python etc.) for installation -## in contrast to setup.py, you can choose the destination -catkin_install_python(PROGRAMS -  src/whisperwrapper.py -  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -) - -## Mark executables for installation -## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_executables.html -# install(TARGETS ${PROJECT_NAME}_node -#   RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} -# ) - -## Mark libraries for installation -## See http://docs.ros.org/melodic/api/catkin/html/howto/format1/building_libraries.html -# install(TARGETS ${PROJECT_NAME} -#   ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -#   LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} -#   RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION} -# ) - -## Mark cpp header files for installation -# install(DIRECTORY include/${PROJECT_NAME}/ -#   DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION} -#   FILES_MATCHING PATTERN "*.h" -#   PATTERN ".svn" EXCLUDE -# ) - -## Mark other files for installation (e.g. launch and bag files, etc.) -# install(FILES -#   # myfile1 -#   # myfile2 -#   DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION} -# ) - -############# -## Testing ## -############# - -## Add gtest based cpp test target and link libraries -# catkin_add_gtest(${PROJECT_NAME}-test test/test_whisperwrapper.cpp) -# if(TARGET ${PROJECT_NAME}-test) -#   target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME}) -# endif() - -## Add folders to be run by python nosetests -# catkin_add_nosetests(test) diff --git a/noetic-llama/src/whisperwrapper/package.xml b/noetic-llama/src/whisperwrapper/package.xml deleted file mode 100644 index 52f3fd7..0000000 --- a/noetic-llama/src/whisperwrapper/package.xml +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0"?> -<package format="2"> -  <name>whisperwrapper</name> -  <version>0.0.0</version> -  <description>The whisperwrapper package</description> - -  <!-- One maintainer tag required, multiple allowed, one person per tag --> -  <!-- Example:  --> -  <!-- <maintainer email="jane.doe@example.com">Jane Doe</maintainer> --> -  <maintainer email="eden@todo.todo">eden</maintainer> - - -  <!-- One license tag required, multiple allowed, one license per tag --> -  <!-- Commonly used license strings: --> -  <!--   BSD, MIT, Boost Software License, GPLv2, GPLv3, LGPLv2.1, LGPLv3 --> -  <license>TODO</license> - - -  <!-- Url tags are optional, but multiple are allowed, one per tag --> -  <!-- Optional attribute type can be: website, bugtracker, or repository --> -  <!-- Example: --> -  <!-- <url type="website">http://wiki.ros.org/whisperwrapper</url> --> - - -  <!-- Author tags are optional, multiple are allowed, one per tag --> -  <!-- Authors do not have to be maintainers, but could be --> -  <!-- Example: --> -  <!-- <author email="jane.doe@example.com">Jane Doe</author> --> - - -  <!-- The *depend tags are used to specify dependencies --> -  <!-- Dependencies can be catkin packages or system dependencies --> -  <!-- Examples: --> -  <!-- Use depend as a shortcut for packages that are both build and exec dependencies --> -  <!--   <depend>roscpp</depend> --> -  <!--   Note that this is equivalent to the following: --> -  <!--   <build_depend>roscpp</build_depend> --> -  <!--   <exec_depend>roscpp</exec_depend> --> -  <!-- Use build_depend for packages you need at compile time: --> -  <!--   <build_depend>message_generation</build_depend> --> -  <!-- Use build_export_depend for packages you need in order to build against this package: --> -  <!--   <build_export_depend>message_generation</build_export_depend> --> -  <!-- Use buildtool_depend for build tool packages: --> -  <!--   <buildtool_depend>catkin</buildtool_depend> --> -  <!-- Use exec_depend for packages you need at runtime: --> -  <!--   <exec_depend>message_runtime</exec_depend> --> -  <!-- Use test_depend for packages you need only for testing: --> -  <!--   <test_depend>gtest</test_depend> --> -  <!-- Use doc_depend for packages you need only for building documentation: --> -  <!--   <doc_depend>doxygen</doc_depend> --> -  <buildtool_depend>catkin</buildtool_depend> -  <build_depend>roscpp</build_depend> -  <build_depend>rospy</build_depend> -  <build_depend>std_msgs</build_depend> -  <build_export_depend>roscpp</build_export_depend> -  <build_export_depend>rospy</build_export_depend> -  <build_export_depend>std_msgs</build_export_depend> -  <exec_depend>roscpp</exec_depend> -  <exec_depend>rospy</exec_depend> -  <exec_depend>std_msgs</exec_depend> - - -  <!-- The export tag contains other, unspecified, tags --> -  <export> -    <!-- Other tools can request additional information be placed here --> - -  </export> -</package> diff --git a/noetic-llama/src/whisperwrapper/src/list_microphones.py b/noetic-llama/src/whisperwrapper/src/list_microphones.py deleted file mode 100644 index d5b49ff..0000000 --- a/noetic-llama/src/whisperwrapper/src/list_microphones.py +++ /dev/null @@ -1,4 +0,0 @@ -import speech_recognition as sr - -for index, name in enumerate(sr.Microphone.list_microphone_names()): -    print("Microphone with name \"{1}\" found for `Microphone(device_index={0})`".format(index, name))
\ No newline at end of file diff --git a/noetic-llama/src/whisperwrapper/src/whisperwrapper.py b/noetic-llama/src/whisperwrapper/src/whisperwrapper.py deleted file mode 100644 index 4cd703b..0000000 --- a/noetic-llama/src/whisperwrapper/src/whisperwrapper.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python3 - -from ollamamessages.msg import WhisperTranscription, WhisperListening -from ollamamessages.srv import OllamaCall, OllamaCallResponse - -import speech_recognition as sr -import threading -import tempfile -import requests -import rospy  -import time -import json -import os - -whisper_api_url = rospy.get_param("/stt/whisper_api_url", "127.0.0.1:9000") -pause = rospy.get_param("/stt/speech_recogn_pause_time", 0.8) -energy = rospy.get_param("/stt/speech_recogn_energy", 400)  -dynamic_energy = rospy.get_param("/stt/speech_recogn_dyn_energy_flag", False) -microphone_device = rospy.get_param("/stt/microphone_device", 1) -no_speech_thresh = rospy.get_param("/stt/speech_confidence_thresh", 0.1) - -class WhisperWrapper: - -    listening = False - -    def __init__(self) -> None: -        self.transcription_pub = rospy.Publisher("/stt/transcription", WhisperTranscription, queue_size = 1) -        self.listening_sub = rospy.Subscriber("/stt/listening", WhisperListening, self.listening_sub_cb) - -        self.record_audio(pause, energy, dynamic_energy, microphone_device) - -    def listening_sub_cb(self, set_listening): -        rospy.loginfo("Set listening = %s" % str(set_listening.listening)) -        self.listening = set_listening.listening - -    def record_audio(self, pause, energy, dynamic_energy, microphone_device): -        recogniser = sr.Recognizer() -        recogniser.energy_threshold = energy -        recogniser.pause_threshold = pause -        recogniser.dynamic_energy_threshold = dynamic_energy - -        with sr.Microphone(sample_rate = 10000) as microphone: -            rospy.loginfo("Listening...") -            while True and not rospy.is_shutdown(): -                audio = recogniser.listen(microphone) - -                if not self.listening: -                    rospy.loginfo("I heard something but I'm stopping here because we've been set to not listen") -                    continue - -                with tempfile.NamedTemporaryFile(mode = "wb", suffix = ".wav", delete = False) as f: -                    audio_path = f.name -                    f.write(audio.get_wav_data()) - -                rospy.loginfo("I heard something... Written to %s" % audio_path) -                req = requests.post( -                    "http://%s/asr?output=json" % whisper_api_url, -                    files = {"audio_file": open(audio_path, "rb")} -                ) -                os.remove(audio_path) -                o = req.json() -                rospy.loginfo("Transcribed '%s'" % o["text"]) -                if o["text"] != "": -                    self.transcription_pub.publish( -                        text = o["text"], -                        language = o["language"], -                        temperature = o["segments"][0]["temperature"], -                        avg_logprob = o["segments"][0]["avg_logprob"], -                        compression_ratio = o["segments"][0]["compression_ratio"], -                        no_speech_prob = o["segments"][0]["no_speech_prob"] -                    ) - -                    if o["segments"][0]["no_speech_prob"] < no_speech_thresh: -                        self.run_ollama(o["text"]) -                    else: -                        rospy.loginfo("Skipped due to low confidence it's actually speech.") - -    def run_ollama(self, text): -        service_call = rospy.ServiceProxy("/stt/ollamacall", OllamaCall) -        response = service_call(input = text) -        print(response) - - -                     - -if __name__ == "__main__": -    rospy.init_node("whisper_wrapper") -    whisperwrapper = WhisperWrapper() -     - - | 
