Welcome to Jetson AGX Thor repository
10.AI large model offline voice assistant
10.AI large model offline voice assistant
10.AI large model offline voice assistant1. Offline Voice Configuration2. Create a Startup Service (Systemd)2.1 Create a Startup Script2.2 Creating the Startup File3. Startup Management3.1 Disabling the Startup Program3.2 Enabling the Startup Program
1. Offline Voice Configuration
Before setting up automatic startup, we must ensure that the program itself can operate independently in an offline state. This requires modifying the configuration file.
Locate the Configuration File: In your project code, find and open the configuration file:
config/yahboom.yamlModify Configuration Parameters: Please check the following parameters in the file and ensure that their values match those shown below. If the parameters do not exist, add them.
xasr#Voice node parametersros__parametersVAD_MODE2 #VAD sensitivitysample_rate16000 #ASR audio sampling rateframe_duration_ms30 #VAD frame size in millisecondsuse_oline_asrFalse #Whether to use online ASR recognition (True for online, False for offline)mic_serial_port"/dev/ttyUSB0" #Microphone serial port aliasmic_index0 #Microphone indexlanguage'en' #ASR languageregional_setting "international" #international:International Edition China:China internal versionmodel_service#Model server node parametersros__parameterslanguage'en' #Large Model Interface LanguageuseolinettsFalse #Whether to use online speech synthesis (True to use online, False to use offline)# Large model configuration# llm_platform: 'ollama' # Optional platforms: 'ollama', 'tongyi', 'spark', 'qianfan', 'openrouter'llm_platform'ollama' # Currently selected large model platformregional_setting "international"use_oline_asranduseolinettsmust be set to False.llm_platformmust be set toollama.
This setting will make everything offline.
Save the file and recompile the project to apply the changes:
xxxxxxxxxxcd ~/yahboom_wscolcon buildsource install/setup.bash
After completing this step, the program is already a purely offline voice service.
2. Create a Startup Service (Systemd)
Now, we will create a systemd service to automatically run largemodel_control.launch.py at system startup.
2.1 Create a Startup Script
To ensure systemd can properly load the ROS2 environment, it's best to create a simple bash script to encapsulate our startup commands.
Create the script file:
In the directory (
~/yahboom_ws/src/largemodel/), create a file namedstart_largemodel.sh.xxxxxxxxxxvim ~/yahboom_ws/src/largemodel/start_largemodel.shWrite script content: Copy and paste the following content into the script file.
xxxxxxxxxxsleep 10gnome-terminal -- bash -c "export RUN_PROGRAMS='ros2 launch largemodel largemodel_control.launch.py';exec bash"IMPORTANT: Please make sure to replace
/home/sunrise/in the script with your own user home directory path.Save and exit
Give the script execution permissions:
xxxxxxxxxxchmod +x ~/yahboom_ws/src/largemodel/start_largemodel.shAdd Execution Command to .bashrc
Open ~/.bashrc.
xxxxxxxxxxvim ~/.bashrc
Copy the following content to the very bottom of the file.
xxxxxxxxxxeval $RUN_PROGRAMS
Save and exit.
2.2 Creating the Startup File
- Open the system terminal, then create and edit the
start_largemodel.desktopstartup file:
xxxxxxxxxxvim ~/.config/autostart/start_largemodel.desktop
- Copy the following content into
start_largemodel.desktop, then save and exit.
xxxxxxxxxx[Desktop Entry]Type=ApplicationExec=sh /home/jetson/yahboom_ws/src/largemodel/start_largemodel.shHidden=falseNoDisplay=falseX-GNOME-Autostart-enabled=trueName[en_US]=start_largemodelName=start_largemodelComment[en_US]=Comment=

In the above configuration: Exec specifies the command used to execute the script; X-GNOME-Autostart-enabled determines whether the program launches automatically upon system startup; and Name specifies the display name.
Restart the system, and the startup program will automatically launch upon boot.
xxxxxxxxxxsudo reboot
3. Startup Management
After restarting the system, a system terminal window will pop up, automatically running the voice assistant program. If you need to temporarily exit the program, press the [Ctrl+C] keys, and then close the terminal window.
3.1 Disabling the Startup Program
If you no longer require the program to launch automatically upon system startup, edit the start_largemodel.desktop startup file. Change the X-GNOME-Autostart-enabled parameter to false, then save and exit. This ensures that the program will not launch the next time the system starts up.
xxxxxxxxxxvim ~/.config/autostart/start_largemodel.desktop
Example Content:
xxxxxxxxxx[Desktop Entry]Type=ApplicationExec=sh /home/jetson/yahboom_ws/src/largemodel/start_largemodel.shHidden=falseNoDisplay=falseX-GNOME-Autostart-enabled=falseName[en_US]=start_largemodelName=start_largemodelComment[en_US]=Comment=
3.2 Enabling the Startup Program
If you require the program to launch automatically upon system startup, edit the start_largemodel.desktop startup file. Change the X-GNOME-Autostart-enabled parameter to true, then save and exit. Upon restarting the system, the program will launch automatically.
xxxxxxxxxxvim ~/.config/autostart/start_largemodel.desktop
Example Content:
xxxxxxxxxx[Desktop Entry]Type=ApplicationExec=sh /home/jetson/yahboom_ws/src/largemodel/start_largemodel.shHidden=falseNoDisplay=falseX-GNOME-Autostart-enabled=trueName[en_US]=start_largemodelName=start_largemodelComment[en_US]=Comment=