MQTT Modules with Mosquitto and Godot Sim

Hello,

I am fairly new to Ignition, MQTT, SparkPlugB and the Cirrus Link MQTT Modules, but can’t really get the results I want (yet). Here’s what I want to do:

  1. I have a simulator to send data from a videogame (Godot game) which is sending updates as if it was a PLC from an AGV, mainly sending position data and fuel updates.
  2. I want to build a basic MES in Ignition, mainly to learn how to use the Designer. So I want my simulated data to be sent to Ignition using MQTT Protocol in SparkPlug B.
  3. Eventually I would also like to be able to manage orders that my AGV would execute and send updates to my simulator, so I want my simulator to also start consuming data from Ignition in MQTT format.

For now though mainly I am stuck in step 1, trying to understand the minimum setup to get basic communication between my simulator and Ignition with MQTT.
I’ve been browsing this forum for a while and found this guide which I am trying to use as reference for my own testing setup:

The guide suggests setting up Ignition and Ignition Edge in 2 different computers, but I am not sure if it’s actually needed for what I want to do.

Currently this is the setup I am working on:

(Ignition Engine) ↔ (Mosquitto MQTT Server) ↔ (Godot MQTT Client)

  • Everything is running on my local PC.
  • l’ve installed all the Cirrus Link MQTT Modules.
  • Currently all modules are stopped except for the MQTT Engine, which is connecting to the Mosquitto MQTT Server that I’ve setup.
  • My simulator is also connecting to the Mosquitto MQTT server, sending updates in SparkPlug B format. First sending a NBIRTH and NDATA, followed by DBIRTH and DDATA messages for each of my AGVs.

When I start my Mosquitto server I can see that MQTT Module connects to it and suscribes to the right tag patterns:

1753105085: Received SUBSCRIBE from ME-8d77e676-6a6e-434c
1753105085: 	+/LSD/# (QoS 0)
1753105085: ME-8d77e676-6a6e-434c 0 +/LSD/#
1753105085: 	JPG/# (QoS 0)
1753105085: ME-8d77e676-6a6e-434c 0 JPG/#
1753105085: 	RBE/# (QoS 0)
1753105085: ME-8d77e676-6a6e-434c 0 RBE/#
1753105085: 	cmd/# (QoS 0)
1753105085: ME-8d77e676-6a6e-434c 0 cmd/#
1753105085: 	spAv1.0/# (QoS 0)
1753105085: ME-8d77e676-6a6e-434c 0 spAv1.0/#
1753105085: 	spBv1.0/# (QoS 0)
1753105085: ME-8d77e676-6a6e-434c 0 spBv1.0/#
1753105085: 	sys/# (QoS 0)
1753105085: ME-8d77e676-6a6e-434c 0 sys/#
1753105085: 	tags/# (QoS 0)
1753105085: ME-8d77e676-6a6e-434c 0 tags/#

When I start my simulator, I can see in the Mosquitto console how my simulator is sending the DBIRTH and NBIRTH messages, and starts to send updates every 10 secs if the AGV is idle, and every 1 second if the equipment is moving (this is how I’m designing the simulator).

And when I start my simulator these are the updates on the Mosquitto console after I start the simulator:

1753103177: Received PUBLISH from godot_client (d0, q0, r0, m0, 'spBv1.0/LOCAL-GROUP/GODOT-SIM/NBIRTH', ... (28 bytes))
1753103177: Sending PUBLISH to ME-a2e71cef-9534-40d6 (d0, q0, r0, m0, 'spBv1.0/LOCAL-GROUP/GODOT-SIM/NBIRTH', ... (28 bytes))
1753103177: Received PUBLISH from godot_client (d0, q0, r0, m0, 'spBv1.0/LOCAL-GROUP/GODOT-SIM/DBIRTH/CHE_SH01', ... (976 bytes))
1753103177: Sending PUBLISH to ME-a2e71cef-9534-40d6 (d0, q0, r0, m0, 'spBv1.0/LOCAL-GROUP/GODOT-SIM/DBIRTH/CHE_SH01', ... (976 bytes))

So Ignition Engine is receiving the updates. However in my MQTT Engine tags I don’t see

Based on this video: https://www.youtube.com/watch?v=v7ZaJFet3dc&ab_channel=InductiveAutomation

I was expecting that I would be able to see a new Edge Node with my Node + Device data. However I am able to see Node Data but it doesn’t seem like any Device data is being processed.

Could anyone comment on the setup I would need to make all the Modules work together? In this case for example I don’t know if:

  • Would it make sense to get rid of the Mosquitto Server and just used the MQTT Distributor as my core server?
  • I truly don’t understand if there is any point in using the MQTT Transmission module at all given how I already have my godot_client publishing data to my servers?

Any other advise on how to diagnose would be greatly appreaciated.

In order for this to work properly, you will need to ensure your custom Sparkplug client is indeed Sparkplug compliant. Has your application passed the Sparkplug TCK? sparkplug/tck/UserGuide.adoc at develop · eclipse-sparkplug/sparkplug · GitHub

Thanks for your response! I spent yesterday installing the TCK and reading on the different tests. It seems like my simulator is missing a lot of the expected functionality to be SparkPlugB compliant. Now I guess I understand better why it’s recommended to have an Ignition Gateway that gets the tag updates and communicates them over the network in the right format with the MQTT Transmission module.

I think for what I want to do it might be simpler to change my approach to have an Ignition Gateway that takes updates from a DB and then let the MQTT Transmission Module sort out the correct SparkPlugB compliance. Otherwise I may have to spend a lot of time and effort working on a simulator that in the end is just a means to an end. Out of curiosity, are there any advisable simulators or other tools available that are open source and able to communicate using the SparkPlugB standard?

You might find this helpful:

Cirrus Link uses the Java implementation in the MQTT modules. I also use the Python implementation for lots of adhoc testing and playing around.

1 Like

Ohh this is great, thank you! Actually Godot is able to run C# scripts so maybe I will look into using that version. Thanks a lot for the help!