RosBridge Websocket between W10 and Ubuntu 22.04

Hi,

I am currently struggling with coding layout about this issue. In one side, there is W10 OS and it gets real-time sensor data from various of sensors. It has a code itself that parses RS485 sensor data. I need to retrieve those sensor data and display on the web through Rosbridge websocket between two devices via Ethernet LAN.

If I try to generate software architecture for the data transfer from W10 and Ubuntu 22.04, what should I do? There are some documentation and samples on the web but they are definitely not satisfying.

How is this a Django issue? From what I can tell, Rosbridge is a self-contained package, so I’m not seeing where Django fits into this picture.

Django is a receiver. On the sensor page, it will display the real-time sensor data that was obtained from another I/PC.

Basically, I/PC reads RS485 sensory data via MODBUS and outputs data passed back to the rosbridge (Port 9001). Then RS485 sensor data was passed from IPC to Rosbridge-Celery. Once we get the sensor data, we can write to our consumers and transmit the data to the websocket on the sensor page. There is rosbridge web server between Django and I/PC.

Rephrasing this to hopefully confirm my understanding, what you’re describing is this:

[ device(s) ] -- modbus -> [ I/PC ] 
   [ I/PC ] -- websocket -> [ Rosbridge ] 
   [ Rosbridge ] -- websocket -> [ Django ]
   [ Django ] -- websocket -> [ browser(s) ]

Is this what you’re describing here?

If so, what then is your question?

If not, what am I missing, or misstating?

I think you understand this issue properly.

Rosbridge is a websocket server and it adds an extra layer onto ROS communication. There is a Python code that parses sensor data from Windows 10 side.

My assumptions are that we need ROS2 for both devices (Ubuntu and W10) because of usage of rosbridge. And I assume that I need to implement publisher from Windows 10 side with a specific topic whereas my Django application on Ubuntu 22.04 needs to have subscriber to subscribe that topic. And then, once I got the sensor data, I can fill the specific pages related to your last step django->websocket->browser(s).

The thing I ask is coding layout or software architecture for this issue. How Django can listen those incoming sensor data via rosbridge websocket and fill the specific graph?

That’s where Django Channels comes into play. Exactly how this gets architected will depend upon which side opens the websocket connection and which side is listening for the connection to be made.

If rosbridge is going to open the connection to Django, then Django is the websocket server here, and you can use a standard Channels consumer.

If it’s the Django side that needs to establish the connection, then you might want to write a standalone Python program as a websocket client that can then send messages through the Channels channel_layer to your Django Channels environment. (What the specifics of that will look like depends upon the specific details of what you want to have happen with that data.) It will also make a difference here whether the data flow is one-way or bi-directional.

So I assume that the usage of rosbridge websocket is providing JSON API to non-ROS programs. The non-ROS program here is Django. I think the main issue here is that how Django communicates with external software. The publishers/subscribers that I use in rosbridge (ex: with roslibjs) are not “real” publishers/subscribers. I think this is simple but I feel like missing something.