我已成功安装了REDHAWK版本1.8.3的UHD设备。我不清楚如何将波形中的组件连接到由设备管理器管理的设备。我也不清楚IDL接口和USRP设备上的数据端口之间的相互作用。
我无法找到一个简单的示例来发送和接收利用USRP设备的波形(例如,信号发生器组件向USRP发送正弦波)。有没有人有这个或任何建议的经验?
答案 0 :(得分:5)
在运行环境中将组件连接到设备的一种方法是通过REDHAWK python模块。它能够连接到正在运行的域,查询任何已启动的应用程序并将端口从组件连接到设备。以下是一个示例python脚本(注意端口必须是相同的类型才能使连接成功):
from ossie.utils import redhawk
from ossie.cf import CF
# Connect to the running domain
domain = redhawk.attach("REDHAWK_DEV")
# Gets a reference to the running application
for app in domain.apps:
# Find desired application
if app.name == 'desired_name':
application = app
# Gets the component from the application
for comp in application.comps:
# Find desired component
if comp.name == 'desired_name':
component = comp
# Gets the device to connect
for devMgr in domain.devMgrs:
for dev in devMgr.devs:
# Find desired device
if dev.name = 'desired_name':
device = dev
# Gets the references to the input and output ports
comp_port = component.getPort('port_name')._narrow(CF.Port)
dev_port = device.getPort('port_name')
# Makes the actual connection
comp_port.connectPort(dev_port, 'ConnectionID')
# Make sure device is started
device.start()
# Start application
application.start()
# To disconnect:
# Stop device and application
application.stop()
device.stop()
comp_port.disconnectPort('ConnectionID')
答案 1 :(得分:3)
根据您的具体情况,有多种方法可以实现此目的。以下是一些:
A。)问题:您正在调试IDE中的问题并且很快想要将设备端口连接到组件端口
解决方案:在组件和设备都在域或沙箱中运行的情况下,展开SCA Explorer视图中的组件和设备以显示端口。单击输出端口,然后按住Ctrl键并单击要连接的输入端口。突出显示两个端口后,您现在可以右键单击并选择“连接”。
B。)问题:无论语言实现如何,您都需要一种将组件输入端口(无论实现语言)连接到特定类型的设备输出端口的通用方法。
解决方案:这是一个多步骤的过程,起初并不直观。我建议您查看SCA规范页面D-43,了解下面步骤10及更高版本的其他详细信息。
1。)在编辑器中打开组件,然后导航到“实施”选项卡。
2。)右键单击要用于此连接的实现(例如python)
3.。)选择New-> Use the Device
4.。)为此连接生成(或输入)唯一的DCE ID
5.。)输入类型“usesDevice”虽然我不是100%确定类型是否重要,我使用了usesDevice
6。)右键单击Uses Device选择新的Property Ref。您不会直接将组件X连接到设备Y.而是将组件X连接到符合此处设置的属性限制的设备。即。型号,类型等
7.。)在您的设备中,在属性选项卡中,将device_kind或device_model的Name字段等属性设置为您要匹配的属性。我们将以XYZ123为例。保存并将其部署到SDR ROOT
8。)返回我们设置属性Ref的组件,选择浏览并选择您刚设置为匹配属性的设备上的属性。
9。)将Value设置为您将其设置为ex XYZ123的值。保存并部署组件
10。)现在在波形中,您需要手动编辑SAD文件并添加类似的内容,其中[[TEXT]]表示可以更改的内容:
<connections>
<connectinterface id="[[Connection_Name]]">
<usesport>
<usesidentifier>[[Output Port Name]]</usesidentifier>
<deviceusedbythiscomponentref refid="[[DCE matching the componentinstantiationID]]" usesrefid="[[DCE matching the generated ID from step 4]]"/>
</usesport>
<providesport>
<providesidentifier>[[Input Port Name]]</providesidentifier>
<componentinstantiationref refid="[[DCE matching the componentinstantiationID]]"/>
</providesport>
</connectinterface>
我建议您在SAD编辑器中添加一个虚拟组件,并将虚拟组件连接到实际组件,这样就可以使用connectinterface块填充SAD文件,您可以看到一个连接示例。
进行这些更改后,IDE可能会告诉您SAD文件中存在错误,无论如何都要保存,关闭SAD编辑器并重新打开。如果没有显示错误,那么您的语法很好。部署波形并照常启动。
C。)问题:您希望通过REDHAWK之外的python脚本,REDHAWK中的python服务或波形中的python组件连接到设备。
解决方案:参见Adam的解决方案。