Welcome to Jetson AGX Thor repository
8.AI large model offline voice assistant
AI Large-Scale Online Voice Assistant
AI Large-Scale Online Voice Assistant1. Online Voice Configuration2. Creating a Startup Script2.1 Creating the Startup Script3. Startup Management3.1 Disabling the Startup Program3.2 Enabling the Startup Program
1. Online Voice Configuration
Before setting up auto-start, we must ensure that the program itself can work independently while online. This requires modifying the configuration file.
- Locate the Configuration File:
In your project code, find and open the configuration file:
config/yahboom.yaml
- Modify Configuration Parameters:
Please check the following parameters in the file and ensure that their values are consistent with those shown below. If the parameters are not present, please add them.
xxxxxxxxxx asr# Voice Node Parameters ros__parameters VAD_MODE2 #VAD Sensitivity sample_rate16000 #ASR Recording Audio Sampling Rate frame_duration_ms30 #VAD frame size (in milliseconds) use_oline_asrTrue # Whether to use online ASR (True: use online; False: use offline) mic_serial_port"/dev/ttyUSB0" #Microphone Serial Port Alias mic_index0 #Microphone Index language'zh' #ASR Language model_service# Model Server Node Parameters ros__parameters language'zh' #Large Language Model API useolinettsTrue # Whether to use online speech synthesis (True for online, False for offline) # Large Model Configuration # llm_platform: 'ollama' # Available Platforms: 'ollama', 'tongyi', 'spark', 'qianfan', 'openrouter' llm_platform'tongyi' # Here, we take Tongyi as an example. use_online_asranduse_online_ttsmust be set totongyi.llm_platformmust be set totongyi.
With these settings, the entire system will operate in a purely online mode.
- Save the file and rebuild the project to apply the changes:
xxxxxxxxxxcd ~/yahboom_wscolcon buildsource install/setup.bashOnce this step is complete, the program will function as a purely online voice service.
2. Creating a Startup Script
Now, we will create a startup script to ensure that largemodel_control.launch.py runs automatically whenever the system boots up.
2.1 Creating the Startup Script
To ensure the system correctly loads the ROS 2 environment, the best practice is to create a simple script that opens a new terminal window to execute the launch command.
- Create the script file:
In the directory
~/yahboom_ws/src/largemodel/, create a file namedstart_largemodel.sh.
xxxxxxxxxxvim ~/yahboom_ws/src/largemodel/start_largemodel.sh- Write the 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"Here, RUN_PROGRAMS specifies the command to be executed.
- Save and exit the editor.
- Grant execute permissions to the script:
xxxxxxxxxxchmod +x ~/yahboom_ws/src/largemodel/start_largemodel.sh- Add the execution command to
.bashrc
Open ~/.bashrc:
xxxxxxxxxxvim ~/.bashrc
Copy and paste the following line to the very end 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: