This project is to develop new voice commands and features for Vector (VECTORX stands for VECTOR eXtended). It runs on top of Wirepod setups. The goals of this project:
NOTE: VectorX has been tested with Vector 1.0 only. Vector 2.0 may not support all needed SDK commands. If you'd like to fund Vector 2.0 development, contact me. I don't currently have any Vector 2.0 to try.
Hey Vector...
Since RELEASE_19, the redesigned VIM (Vector Instant Messaging) feature is enabled by default. The chat server uses websockets and runs on the local network (it is part of VectorX web server). To use this feature, it is mandatory that you give your Vector a name. This name is used as chat username.
Hey Vector...
When a messge is received from another user, Vector will play a tune and then say:
[username] says: [sentence]
In the special case that an emoticon is received, Vector will show the emoticon. Available emoticons: angel, angry, annoyed, blue, devil, disappointed, eheh, happy, heart, hmm, hurt, inlove, kiss, lol, nooo, ok, panic, polemic, sad, shades, sick, smile, star, surprised, tear, tongue, wink, wow, xxx
If you plan to use VectorX on a Raspberry Pi, I recommend you to use the pre-built VectorX RPi4 Image. It currently ships with VectorX v. 20.
VectorX works by injecting a special system intent into Wirepod's custom intents table. This special intent is not editable from Wirepod's front end and matches any utterance. Therefore, VectorX basically acts as a pre-processor for any intent. If user's utterance matches a VectorX keyphrase, VectorX voice command is executed. This way it is possible even to override the behavior of Wirepod default commands.
That is meant to be very simple, to inspire anyone to contribute to the project. The file pkg/intents/voicecommand-helloworld.go is commented to guide you through. You just need to implement 3 simple steps. 1) Write a registration function like this:
func HelloWorld_Register(intentList *[]IntentDef) error {
utterances := make(map[string][]string)
utterances[LOCALE_ENGLISH] = []string{"hello world"}
utterances[LOCALE_ITALIAN] = []string{"ciao mondo"}
utterances[LOCALE_SPANISH] = []string{"hola Mundo"}
utterances[LOCALE_FRENCH] = []string{"bonjour le monde"}
utterances[LOCALE_GERMAN] = []string{"Hallo Welt"}
var intent = IntentDef{
IntentName: "extended_intent_hello_world",
Utterances: utterances,
Parameters: []string{},
Handler: helloWorld,
}
*intentList = append(*intentList, intent)
addLocalizedString("STR_HELLO_WORLD", []string{"hello world!", "ciao mondo!", "hola mundo!", "bonjour le monde!", "hallo welt"})
return nil
}
Where you declare that you are adding a new intent named extended_intent_hello_world that is triggered by the utterances: "hello world" in English "ciao mondo" in Italian "hola Mundo" in Spanish "bonjour le monde" in French "Hallo Welt" in German don't worry about case since all comparisons are always done in lowercase, so no matter what capitalization you use, it will work. The intent will be handled by a function called helloWorld. Also, you may add as many addLocalizedString calls you want to add the command-specific multi-language text resources to the localization engine. In this case we add just one, for a generic answer.
2) Next, you'we got to write this handler function:
func helloWorld(intent IntentDef, params IntentParams) string {
returnIntent := STANDARD_INTENT_GREETING_HELLO
sdk_wrapper.SayText(getText("STR_HELLO_WORLD"))
return returnIntent
}
Here you program what Vector does when the intent is matched. The Robot will simply say "Hello world" in the current STT laguage (the one Chipper is using right now) and return to Wirepod the standard intent STANDARD_INTENT_GREETING_HELLO to have Vector play its stock greeting animation.
3) Thid step, you go into pkg/intengts/intents.go and add your registration function to RegisterIntents(), like this:
func RegisterIntents() {
...
HelloWorld_Register(&intents)
}
This way the new intent is added to the supported intent list. Next you can just try right away how it works!
Data files are stored in the vectorfs directory. There are three different directories there: 1) tmp holds temporary data 2) nvm holds (r/w) bot-specific data (configuration files), it is organized into different subdirectories, one for each robot serial number 3) data holds (read-only) data files. For an example of how to use data files, look at the "roll a die" example. The resource files for the roll-a-die voice commands are located under vectorfs/data/images/dice.
You can update VectorX as you would with any other git repository: "git pull". However, if you are not a developer and thus you are not making changes to the source code, you can use the same update script that the web server does, it will do everything for you in one shot:
./update.sh
The assumptions to run the script are: 1) You haven't done changes to the source code files. Else the script will fail to update VectorX git repository 2) You have run setup.sh at least once, and thus you have a valid source.sh file 3) You are connected to the Internet
The update script will do the following things: 1) Stop all services 2) Update VectorX and Wire-Pod (my own fork of it) repositories 3) Rebuild chipper, VectorX and its web server 4) Run again the VectorX setup in slient mode (no user input is required) 5) Start again all services
If you want to uninstall the hooks VectorX provides and remove all services, run as root the uninstall.sh script:
sudo ./uninstall.sh
You can always re-setup everything by launching setup.sh and starting over.