BallAerospace / COSMOS

Ball Aerospace COSMOS
https://ballaerospace.github.io/cosmos-website/
Other
361 stars 129 forks source link

Using the Ethernet Bridge #1620

Closed gminn-apl closed 2 years ago

gminn-apl commented 2 years ago

Hello, I've been trying to use the ethernet bridge per the instructions in this issue in order to be able to connect to local devices, however, I'm getting the error Connection Failed: ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:2950 in COSMOS after I load the plugin .gem file and try to connect.

My local device is an FTDI chip (appears on COM5) that is connected to an Opal Kelly (this is a test setup to verify register reads and writes work since our hardware hasn't come in yet).

This is my bridge.txt file:

INTERFACE OPAL_KELLY_INT serial_interface.rb COM5 COM5 115200 ODD 1 10.0 nil BURST

ROUTER SERIAL_ROUTER tcpip_server_interface.rb 2950 2950 10.0 nil BURST
  ROUTE OPAL_KELLY_INT

This is my plugin.txt file:

VARIABLE opal_kelly_target_name OPAL_KELLY

TARGET OPAL_KELLY <%= opal_kelly_target_name %>
INTERFACE <%= opal_kelly_target_name %>_INT tcpip_client_interface.rb localhost 2950 2950 10.0 nil BURST
  MAP_TARGET <%= opal_kelly_target_name %>

When I run cosmos bridge I get the following output which makes it appear that the bridge is working. I've also verified that it is opening the com port because I can't open it in another application. Note: I've changed my hostname to hostname below for privacy.

{"time":1652294590212773400,"@timestamp":"2022-05-11T14:43:10.212-04:00","severity":"INFO","container_name":"hostname","log":"Processing Bridge configuration in file: C:/COSMOS-5.0.2/bridge.txt"}
{"time":1652294590293681000,"@timestamp":"2022-05-11T14:43:10.293-04:00","severity":"INFO","container_name":"hostname","log":"Starting packet reading for OPAL_KELLY_INT"}
{"time":1652294590294152900,"@timestamp":"2022-05-11T14:43:10.294-04:00","severity":"INFO","container_name":"hostname","log":"Connecting to OPAL_KELLY_INT..."}
{"time":1652294590295415800,"@timestamp":"2022-05-11T14:43:10.295-04:00","severity":"INFO","container_name":"hostname","log":"Starting packet reading for SERIAL_ROUTER"}
{"time":1652294590295826600,"@timestamp":"2022-05-11T14:43:10.295-04:00","severity":"INFO","container_name":"hostname","log":"Connecting to SERIAL_ROUTER..."}
{"time":1652294590302702900,"@timestamp":"2022-05-11T14:43:10.302-04:00","severity":"INFO","container_name":"hostname","log":"SERIAL_ROUTER Connection Success"}
{"time":1652294590309003600,"@timestamp":"2022-05-11T14:43:10.309-04:00","severity":"INFO","container_name":"hostname","log":"OPAL_KELLY_INT Connection Success"}

OS: Windows COSMOS Version 5.0.2 Cosmos v5 -- [X] Microsoft Edge

My team also reproduced this on Ubuntu 20.04 on Firefox.

Any ideas on what might be the problem? Am I defining the plugin interface correctly as a tcpip client?

gminn-apl commented 2 years ago

Update: I fixed it.

In plugin.txt, I changed the name of my host to host.docker.internal. Therefore a correct plugin.txt looks like:

VARIABLE opal_kelly_target_name OPAL_KELLY

TARGET OPAL_KELLY <%= opal_kelly_target_name %>
INTERFACE <%= opal_kelly_target_name %>_INT tcpip_client_interface.rb host.docker.internal 2950 2950 10.0 nil BURST
  MAP_TARGET <%= opal_kelly_target_name %>

Can this be better documented? The TCPIP Interface specs in the documentation make no mention of using host.docker.internal instead of hostname localhost.

gminn-apl commented 2 years ago

I see now that this was discussed in this issue.

ghost commented 2 years ago

I discuss using host.docker.internal in the Getting Started page I see we're still using localhost on the Interfaces page. Thanks for the reminder to update that!

ghost commented 2 years ago

Interfaces page has been updated to reflect host.docker.internal

gminn-apl commented 2 years ago

Awesome, thank you!