无法通过可执行设备发送的BullkIO端口接收数据包数据(Cannot receive packet data over BullkIO port sent from Executable Devic

编程入门 行业动态 更新时间:2024-10-25 20:23:48
无法通过可执行设备发送的BullkIO端口接收数据包数据(Cannot receive packet data over BullkIO port sent from Executable Device) python

我想在设备上创建数据,并通过BulkIO端口将其发送到在设备上的波形内部运行的组件。 我相信这是从硬件创建数据流到组件的正确方法。

我在设备上有一个usesport:

port_dataChar = usesport(name="dataChar", repid="IDL:BULKIO/dataChar:1.0", type_="data")

我在设备上运行的组件上有一个提供端口:

port_dataChar = providesport(name="dataChar", repid="IDL:BULKIO/dataChar:1.0", type_="data")

我可以使用这个python片段以编程方式连接这些端口:

comp_port = domain.devMgrs[0].devs[0].getPort('dataChar') dev_port = domain.apps[0].comps[0].getPort('dataChar') comp_port.connectPort(dev_port, 'ConnectionId')

这一切都非常有效,与我在同一组件/设备对上连接FrontEnd 2.0 DigitalTuner端口的方式非常相似。 那些FE 2.0端口运行良好并通过所有测试。

现在,我继续启动设备:

domain.devMgrs[0].devs[0].start()

它正在执行此代码:

data = ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c'] ts = time.time() tstamp = BULKIO.PrecisionUTCTime(BULKIO.TCM_CPU,BULKIO.TCS_VALID,0.0, int(ts),ts - int(ts)) EOS = False streamId = "1" print "Sending data of length", len(data) self.port_dataChar.pushPacket(data, tstamp, EOS, streamId) return NOOP

这打印在Dev Mgr上:

Sending data of length 27 Sending data of length 27 Sending data of length 27 Sending data of length 27 Sending data of length 27 Sending data of length 27 ...

这一切似乎都很好

然后我继续开始波形:

wave.start()

它正在执行此代码:

print "Iteration number ", self.numIter data, T, EOS, streamID, sri, sriChanged, inputQueueFlushed = self.port_dataChar.getPacket() if (data != None): print "Got data of length ", len(data) else: print "Got no data, streamId ", streamID return NOOP

但是,它永远不会从dataChar端口获取任何数据包/数据:

Iteration number 1 Got no data, streamId None Sending data of length 27 Iteration number 2 Got no data, streamId None Sending data of length 27 Iteration number 3 Sending data of length 27 Got no data, streamId None Sending data of length 27 Iteration number 4 Got no data, streamId None

难道我做错了什么? 是否可以通过设备从BulkIO接收数据? 我也试图弄清楚如何监控BulkIO端口以找出问题所在,但我无法找到如何监控文档中的端口。

我可以使用以下代码接收Sandbox中组件的数据:

b = sb.Component("MyComponent") kw = sb.SRIKeyword("SOME_RF",155000000.0,'double') keywords = [kw] i = sb.DataSource() data = ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c'] i.connect(b) sb.start() i.push(data,SRIKeywords=keywords)

我试图在数据包数据之前推送SRI而没有运气:

keywords = [] H = BULKIO.StreamSRI(1, 0.0, 0.0, BULKIO.UNITS_TIME, 0, 0.0, 0.0, BULKIO.UNITS_NONE, 0, "1", True, keywords) self.port_dataChar.pushSRI(H) self.port_dataChar.pushPacket(data, tstamp, EOS, streamID)

更新:我现在可以自己回答这个问题。 问题在于发送到pushPacket()的格式。 它应该是一个字符串而不是通过dataChar BulkIO端口发送的字符数组。 基本上这个:

data = ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c'] self.port_dataChar.pushPacket(data, tstamp, EOS, streamId)

应改为:

data = "testing123" self.port_dataChar.pushPacket(data, tstamp, EOS, streamId)

I want to create data on a Device and send it over a BulkIO port to a Component running inside of a Waveform on the Device. I believe this is the correct way to create data flow from hardware into a Component.

I have a usesport on the Device:

port_dataChar = usesport(name="dataChar", repid="IDL:BULKIO/dataChar:1.0", type_="data")

I have a providesport on the Component running on the Device:

port_dataChar = providesport(name="dataChar", repid="IDL:BULKIO/dataChar:1.0", type_="data")

I am able to connect these ports programatically using this python snippet:

comp_port = domain.devMgrs[0].devs[0].getPort('dataChar') dev_port = domain.apps[0].comps[0].getPort('dataChar') comp_port.connectPort(dev_port, 'ConnectionId')

This all works great and is very similar to how I have connected the FrontEnd 2.0 DigitalTuner ports on the same Component/Device pair. Those FE 2.0 ports work well and pass all tests.

Now, I go ahead and start the device:

domain.devMgrs[0].devs[0].start()

It is executing this code:

data = ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c'] ts = time.time() tstamp = BULKIO.PrecisionUTCTime(BULKIO.TCM_CPU,BULKIO.TCS_VALID,0.0, int(ts),ts - int(ts)) EOS = False streamId = "1" print "Sending data of length", len(data) self.port_dataChar.pushPacket(data, tstamp, EOS, streamId) return NOOP

This prints out on the Dev Mgr:

Sending data of length 27 Sending data of length 27 Sending data of length 27 Sending data of length 27 Sending data of length 27 Sending data of length 27 ...

This all seems good

Then I go ahead and start the waveform:

wave.start()

It is executing this code:

print "Iteration number ", self.numIter data, T, EOS, streamID, sri, sriChanged, inputQueueFlushed = self.port_dataChar.getPacket() if (data != None): print "Got data of length ", len(data) else: print "Got no data, streamId ", streamID return NOOP

However, it never gets any of the packets/data from the dataChar port:

Iteration number 1 Got no data, streamId None Sending data of length 27 Iteration number 2 Got no data, streamId None Sending data of length 27 Iteration number 3 Sending data of length 27 Got no data, streamId None Sending data of length 27 Iteration number 4 Got no data, streamId None

Am I doing something wrong? Is it possible to receive data over BulkIO from a Device? I am also trying to figure out how to monitor the BulkIO port(s) to figure out what is going wrong, but I cannot find out how to monitor the ports in the documentation.

I can receive data on the component in the Sandbox using this code:

b = sb.Component("MyComponent") kw = sb.SRIKeyword("SOME_RF",155000000.0,'double') keywords = [kw] i = sb.DataSource() data = ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c'] i.connect(b) sb.start() i.push(data,SRIKeywords=keywords)

I attempted to push the SRI before the packet data with no luck:

keywords = [] H = BULKIO.StreamSRI(1, 0.0, 0.0, BULKIO.UNITS_TIME, 0, 0.0, 0.0, BULKIO.UNITS_NONE, 0, "1", True, keywords) self.port_dataChar.pushSRI(H) self.port_dataChar.pushPacket(data, tstamp, EOS, streamID)

UPDATE: I can now answer this question myself. The problem lies in the format being sent to pushPacket(). It should be a string instead of an array of chars to be sent over a dataChar BulkIO port. Essentially this:

data = ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c'] self.port_dataChar.pushPacket(data, tstamp, EOS, streamId)

should be changed to this:

data = "testing123" self.port_dataChar.pushPacket(data, tstamp, EOS, streamId)

最满意答案

问题是您的pushPacket()调用导致CORBA.BAD_PARAM(omniORB.BAD_PARAM_WrongPythonType, CORBA.COMPLETED_NO)异常并以静默方式失败(使用版本1.9.0的REDHAWK)。 dataChar旨在用于字符数据,并且事实证明底层的omniORBpy / BulkIO映射期望字符串值,而不是数据变量的字符串列表。 如果您需要将设备中的字符数据发送到组件,则应使用:

data = "your text here" self.port_dataChar.pushPacket(data, tstamp, EOS, streamId)

如果您的目的只是让BulkIO数据从您的设备流向您的组件,我建议您使用dataFloat端口。

如果要监视端口的输出, REDHAWK IDE中的端口监视器数据列表视图可用于调试。

The issue is that your pushPacket() call is causing a CORBA.BAD_PARAM(omniORB.BAD_PARAM_WrongPythonType, CORBA.COMPLETED_NO) exception and failing silently (using version 1.9.0 of REDHAWK). dataChar is intended to be used for character data, and it turns out that the underlying omniORBpy / BulkIO mappings are expecting a string value, and not a list of strings for the data variable. If you need to send character data from your device to your component, you should use:

data = "your text here" self.port_dataChar.pushPacket(data, tstamp, EOS, streamId)

If your intention is simply to have BulkIO data flow from your device to your component, I would suggest using a dataFloat port.

If you want to monitor the output of your ports, the Port Monitor and Data List views in the REDHAWK IDE can be useful for debugging.

更多推荐

本文发布于:2023-08-07 17:23:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1465128.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据包   可执行   端口   数据   设备

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!