-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
1,164 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#goal definition | ||
string request | ||
int32 wait | ||
--- | ||
#result definition | ||
int32 success | ||
--- | ||
#feedback | ||
string execution_state |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
string action | ||
string characteristic | ||
string complement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
frida_interfaces/Command[] commands |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
*.user | ||
**/.vscode/ | ||
**/__pychache__/ | ||
**/models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
cmake_minimum_required(VERSION 3.8) | ||
project(nlp) | ||
|
||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") | ||
add_compile_options(-Wall -Wextra -Wpedantic) | ||
endif() | ||
|
||
# find dependencies | ||
find_package(ament_cmake REQUIRED) | ||
find_package(ament_cmake_python REQUIRED) | ||
find_package(rclcpp REQUIRED) | ||
find_package(rclpy REQUIRED) | ||
find_package(frida_interfaces REQUIRED) | ||
|
||
install(DIRECTORY launch config | ||
DESTINATION share/${PROJECT_NAME}) | ||
|
||
# Add Cpp executable | ||
# add_executable(ignore_laser src/ignore_laser.cpp) | ||
# ament_target_dependencies(audio_common_msgs) | ||
|
||
# Install Cpp executables | ||
# install(TARGETS | ||
# ignore_laser | ||
# DESTINATION lib/${PROJECT_NAME}) | ||
|
||
ament_python_install_package(${PROJECT_NAME}) | ||
|
||
# Install the Python module | ||
install( | ||
DIRECTORY scripts/ | ||
DESTINATION ${PYTHON_INSTALL_DIR}/${PROJECT_NAME} | ||
FILES_MATCHING PATTERN "*.py" | ||
) | ||
|
||
# Install ONNX files | ||
# install( | ||
# DIRECTORY assets/ | ||
# DESTINATION lib/${PROJECT_NAME} | ||
# FILES_MATCHING PATTERN "*.onnx" | ||
# ) | ||
|
||
# Install JSON files | ||
# install( | ||
# DIRECTORY assets/ | ||
# DESTINATION lib/${PROJECT_NAME} | ||
# FILES_MATCHING PATTERN "*.json" | ||
# ) | ||
|
||
file(GLOB PYTHON_SCRIPTS scripts/*.py) | ||
|
||
# Install python scripts | ||
install(PROGRAMS | ||
${PYTHON_SCRIPTS} | ||
DESTINATION lib/${PROJECT_NAME} | ||
) | ||
|
||
if(BUILD_TESTING) | ||
find_package(ament_lint_auto REQUIRED) | ||
# the following line skips the linter which checks for copyrights | ||
# comment the line when a copyright and license is added to all source files | ||
set(ament_cmake_copyright_FOUND TRUE) | ||
# the following line skips cpplint (only works in a git repo) | ||
# comment the line when this package is in a git repo and when | ||
# a copyright and license is added to all source files | ||
set(ament_cmake_cpplint_FOUND TRUE) | ||
ament_lint_auto_find_test_dependencies() | ||
endif() | ||
|
||
ament_package() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
command_interpreter: | ||
ros__parameters: | ||
base_url: "http://localhost:11434/v1" | ||
model: "llama3.2" | ||
speech_command_topic: "/speech/raw_command" | ||
publish_command_topic: "/task_manager/commands" | ||
temperature: 1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import os | ||
|
||
from ament_index_python.packages import get_package_share_directory | ||
from launch import LaunchDescription | ||
from launch_ros.actions import Node | ||
|
||
|
||
def generate_launch_description(): | ||
command_interpreter_config = os.path.join( | ||
get_package_share_directory("nlp"), "config", "command_interpreter.yaml" | ||
) | ||
|
||
return LaunchDescription( | ||
[ | ||
Node( | ||
package="nlp", | ||
executable="command_interpreter.py", | ||
name="command_interpreter", | ||
output="screen", | ||
emulate_tty=True, | ||
parameters=[command_interpreter_config], | ||
), | ||
] | ||
) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,114 @@ | ||
from datetime import datetime | ||
|
||
import pytz | ||
|
||
CURRENT_CONTEXT = """ | ||
Today is {CURRENT_DATE}. | ||
Your name is FRIDA (Friendly robotic interactive domestic assistant), a domestic assistant developed by RoBorregos. | ||
RoBorregos is the representative Robotic team from Tec de Monterrey, Campus Monterrey. It has around 40 members. | ||
You compete in the Robocup@home competition. Last summer you competed in the Netherlands, at the international competition. Last March you competed in TMR, obtaining 2nd place in Mexico. | ||
""" | ||
|
||
SYSTEM_PROMPT_CI_V2 = """ | ||
You will be presented with an instruction from a human. The instruction may skip details, contain grammar mistakes or be ambiguous. The instruction could also make no sense at all. | ||
Your task is to divide the provided instruction into small commands. The commands contain an action, and could contain an optional characteristic and complement. The commands should also be listed in the correct order such the initial instruction can be achieved. | ||
You may break a given instruction into the following commands: | ||
1. [ | ||
action = "clarification" (call when the provided instruction is unclear, and you need more information to proceed). | ||
complement = Explain what you need to know. | ||
characteristic = "" | ||
] | ||
2. [ | ||
action = "remember" (store information for later use). | ||
complement = The information to store. | ||
characteristic = "" | ||
] | ||
3. [ | ||
action = "go" (move to a location). | ||
complement = The location to move to. Specify "past location" to return to a location stored with the "remember" action. Other ONLY available options are: "living_room", "office", "kitchen" and "entrance". | ||
characteristic = "" Does not need to be specified, always leave empty. | ||
] | ||
4. [ | ||
action = "find" (search for an object). | ||
complement = The object to search for. | ||
characteristic = "" | ||
] | ||
5. [ | ||
action = "pick" (grab an object). | ||
complement = The object to grab. Can be either "bowl" or "cereal_box" | ||
characteristic = "" | ||
] | ||
6. [ | ||
action = "place" (place an object on the table). | ||
complement = The object to place. Can be either "bowl" or "cereal_box" | ||
characteristic = "" | ||
] | ||
7. [ | ||
action = "approach" (move closer to a person). | ||
complement = The person to approach. | ||
characteristic = "" | ||
] | ||
8. [ | ||
action = "give" (hand an object to a person). | ||
complement = The object to hand. Can be either "bowl" or "cereal_box". | ||
characteristic = "" | ||
] | ||
9. [ | ||
action = "describe" (describe a person). | ||
complement = "" | ||
characteristic = "" | ||
] | ||
10. [ | ||
action = "speak" (answer back using voice. ONLY use this command when a question is asked). | ||
complement = The textual response to the user's question. To answer a question, you can use the following context: [{CURRENT_CONTEXT}] | ||
characteristic = "". | ||
] | ||
""" | ||
|
||
SYSTEM_PROMPT_CI_V_EXPO = """ | ||
You will be presented with an instruction from a human. The instruction may skip details, contain grammar mistakes or be ambiguous. The instruction could also make no sense at all. | ||
Your task is to divide the provided instruction into small commands. The commands contain an action, and could contain an optional characteristic and complement. The commands should also be listed in the correct order such the initial instruction can be achieved. | ||
You may break a given instruction into the following commands: | ||
1. [ | ||
action = "clarification" (call when the provided instruction is unclear, and you need more information to proceed). | ||
complement = Explain what you need to know. | ||
characteristic = "" | ||
] | ||
2. [ | ||
action = "describe" (describe a person, assume that this describes any person talking to the robot and that only one person can talk to it at the same time). | ||
complement = "" | ||
characteristic = "" | ||
] | ||
3. [ | ||
action = "speak" (answer back using voice. ONLY use this command when a question is asked). | ||
complement = The textual response to the user's question. To answer a question, you can use the following context: [{CURRENT_CONTEXT}] | ||
characteristic = "" or "describe". If describe is specified, the robot will say the description saved with the describe command. | ||
] | ||
""" | ||
|
||
|
||
def get_system_prompt_ci_v2(): | ||
timezone = pytz.timezone("America/Mexico_City") | ||
current_date = datetime.now(timezone).strftime("%Y-%m-%d %H:%M:%S") | ||
return SYSTEM_PROMPT_CI_V2.format( | ||
CURRENT_CONTEXT=CURRENT_CONTEXT.format(CURRENT_DATE=current_date) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0"?> | ||
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?> | ||
<package format="3"> | ||
<name>nlp</name> | ||
<version>0.0.0</version> | ||
<description>TODO: Package description</description> | ||
<maintainer email="[email protected]">RoBorregos</maintainer> | ||
<license>TODO: License declaration</license> | ||
|
||
<buildtool_depend>ament_cmake</buildtool_depend> | ||
<buildtool_depend>ament_cmake_python</buildtool_depend> | ||
|
||
<depend>rclcpp</depend> | ||
<depend>rclpy</depend> | ||
<depend>frida_interfaces</depend> | ||
|
||
<test_depend>ament_lint_auto</test_depend> | ||
<test_depend>ament_lint_common</test_depend> | ||
|
||
<export> | ||
<build_type>ament_cmake</build_type> | ||
</export> | ||
</package> |
Oops, something went wrong.