Why do I get an "Target IP Address is empty" error when I try connect to Speedgoat hardware from a deployed SLRT app?
24 ビュー (過去 30 日間)
古いコメントを表示
MathWorks Support Team
2022 年 6 月 23 日
編集済み: MathWorks Support Team
2024 年 2 月 20 日
I've created a hand-written Simulink Real-Time (SLRT) app in App Designer to control my Speedgoat hardware. In my app code, I create a target object as follows:Then, I compiled the SLRT app into a standalone application using MATLAB Compiler. I can successfully run this standalone app on the computer where I designed it. But when I try to deploy it to another computer that is connected to a Speedgoat target, I get an error saying:
app.tg = slrealtime;
"Error communicating with target 'TargetPC1': Cannot connect
to target 'TargetPC1': Target IP Address is empty.
Why am I getting this error and how can I fix it so I use this standalone application on another host computer?
採用された回答
MathWorks Support Team
2024 年 2 月 20 日
編集済み: MathWorks Support Team
2024 年 2 月 20 日
You will see this error if the IP address has not been properly defined in the app code.
The standalone application by default does not have any targets defined. So when you define a target just with the command "tg = slrealtime", a default target object is created where the address of the target is empty:
>> app.tg = slrealtime;
>> app.tg.TargetSettings
ans =
TargetSettings with properties:
name: 'TargetPC1'
address: ''
sshPort: 22
xcpPort: 5555
username: 'slrt'
userPassword: 'slrt'
rootPassword: 'root'
To resolve the error, explicitly set the address of the target machine using the target object in the App Designer app source code. For example:
app.tg = slrealtime;
app.tg.TargetSettings.address='192.168.7.5'
where 192.168.7.5 is replaced with the IP address of the Speedgoat target hardware. Specify other custom settings such as 'userPassword' if applicable.
ALTERNATIVE WORKFLOW:
By using a Target Selector component in your app, the end user will be able to specify a custom IP address without the need to hardcode it. The "Enter_IP_Address_Here" feature is available in R2022b and later:The recommended approach is to use SLRT App Generator to regenerate the app for your real-time application. An app generated by this tool will include a Target Selector by default.
If you add a Target Selector to your existing app, make sure that every UI component is pointing to that Target Selector by using the 'TargetSource' property. For more information, see slrealtime.ui Properties.
IMPORTANT NOTE:
In order to connect to the Speedgoat target, any standalone applications generated with MATLAB must be allowed to communicate through antivirus software or firewalls such as Windows Defender. See the following MATLAB answers for more info:
0 件のコメント
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!