Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » MQTT Implementation in 4diac
MQTT Implementation in 4diac [message #1806267] Tue, 07 May 2019 08:40 Go to next message
ardianto vn is currently offline ardianto vnFriend
Messages: 31
Registered: May 2019
Member
I've followed the instructions at https://www.eclipse.org/4diac/documentation/html/communication/mqttPaho.html to install and use mqttPaho. When I tried it, I encountered INVALID STATUS constraints as shown in image below. How to deal with it?
BlockAppindex.php/fa/35475/0/
EMB_RESindex.php/fa/35476/0/
Re: MQTT Implementation in 4diac [message #1806281 is a reply to message #1806267] Tue, 07 May 2019 11:25 Go to previous messageGo to next message
Martin Melik Merkumians is currently offline Martin Melik MerkumiansFriend
Messages: 117
Registered: March 2016
Senior Member
Hi,

do you have an MQTT broker running on localhost?

Best,
Martin

[Updated on: Tue, 07 May 2019 11:29]

Report message to a moderator

Re: MQTT Implementation in 4diac [message #1806344 is a reply to message #1806281] Wed, 08 May 2019 03:15 Go to previous messageGo to next message
ardianto vn is currently offline ardianto vnFriend
Messages: 31
Registered: May 2019
Member
How do I ensure that I already have an MQTT broker on localhost?
This is my CMake screenshoot
index.php/fa/35509/0/

There is an error after I run the command ¨Make¨ in the terminal in the directory¨FORTE_FOLDER_ROOT / bin / posix¨ :

In file included from /home/nughii/4diac/forte/bin/posix/core/cominfra/comlayersmanager.cpp:21:
/home/nughii/4diac/forte/src/modules/mqtt_paho/MQTTComLayer.h:19:12: fatal error: MQTTAsync.h: No such file or directory
   #include <MQTTAsync.h>
            ^~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/CMakeFiles/FORTE_LITE.dir/build.make:232: src/CMakeFiles/FORTE_LITE.dir/__/core/cominfra/comlayersmanager.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:178: src/CMakeFiles/FORTE_LITE.dir/all] Error 2
make: *** [Makefile:130: all] Error 2


  • Attachment: mqttcmake.png
    (Size: 84.43KB, Downloaded 1010 times)

[Updated on: Wed, 08 May 2019 14:38]

Report message to a moderator

Re: MQTT Implementation in 4diac [message #1806367 is a reply to message #1806344] Wed, 08 May 2019 08:15 Go to previous messageGo to next message
Martin Melik Merkumians is currently offline Martin Melik MerkumiansFriend
Messages: 117
Registered: March 2016
Senior Member
The MQTT broker setting are for the demo programs, and are not relevant for FORTE.
Your compile error teills you, that MQTTAsync.h from the Paho MQTT cannot be found, so you should check your FORTE settings for the location of Paho
Re: MQTT Implementation in 4diac [message #1806371 is a reply to message #1806367] Wed, 08 May 2019 08:53 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1560
Registered: January 2014
Senior Member

Maybe to add here to Martin's comment. MQTT requires for communication a dedicated broker. This is a program outside of your 4diac FORTEs. There are different brokers available. In 4diac FORTE we only provide the MQTT clients enable 4diac FORTE to connect to a broker. But it does not makes sense to have broker inside of a 4diac FORTE. There is a nice overivew on MQTT here [1].

[1] https://doc.qt.io/QtMQTT/mqtt-overview.html
Re: MQTT Implementation in 4diac [message #1806448 is a reply to message #1806371] Thu, 09 May 2019 09:09 Go to previous messageGo to next message
ardianto vn is currently offline ardianto vnFriend
Messages: 31
Registered: May 2019
Member
Ok, I have checked the location of Paho on FORTE and now there is no error.
index.php/fa/35521/0/



Then I tried another method based on my understanding of your answer:
1. I installed and ran mosquitto on my laptop as a broker.
2. I am doing 4diac FORTE mapping to raspberry pi.
However, why is there still an error?
index.php/fa/35520/0/

[Updated on: Thu, 09 May 2019 09:17]

Report message to a moderator

Re: MQTT Implementation in 4diac [message #1806450 is a reply to message #1806448] Thu, 09 May 2019 09:19 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1560
Registered: January 2014
Senior Member

I think if your application is running on the raspberry pi and your broker on your laptop then the address given in the Id parameter of your FBs has to be the address of your laptop where the broker is running.
Re: MQTT Implementation in 4diac [message #1806454 is a reply to message #1806450] Thu, 09 May 2019 09:44 Go to previous messageGo to next message
ardianto vn is currently offline ardianto vnFriend
Messages: 31
Registered: May 2019
Member
deleted

[Updated on: Thu, 09 May 2019 16:21]

Report message to a moderator

Re: MQTT Implementation in 4diac [message #1806483 is a reply to message #1806454] Thu, 09 May 2019 16:23 Go to previous messageGo to next message
ardianto vn is currently offline ardianto vnFriend
Messages: 31
Registered: May 2019
Member

Now, I tried another case. I encountered an error like the following.
index.php/fa/35528/0/
How to deal with it?
  • Attachment: soket.png
    (Size: 77.35KB, Downloaded 945 times)
Re: MQTT Implementation in 4diac [message #1806489 is a reply to message #1806483] Thu, 09 May 2019 18:52 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1560
Registered: January 2014
Senior Member

0.0.0.0 is not a valid ip address. You need the ip address from which your broker is reachable from your raspberry pi. On windows machines you can find that by typing ipconfig /all in a console and look for the correct interface. Also both have to be in the same network and reachable from each other. But I assume that you have that as you are able to download from your laptop to your raspberry pi.
Re: MQTT Implementation in 4diac [message #1806831 is a reply to message #1806489] Wed, 15 May 2019 22:34 Go to previous messageGo to next message
Greg Adams is currently offline Greg AdamsFriend
Messages: 1
Registered: May 2019
Junior Member
Hello all,
I have a problem in the form of MQTT connection.
As a broker, Mosquitto is used by turning it on to the Raspberry Pi 3 B + console. Then the subscription function is activated via: mosquitto_sub -t "input"
I do not understand what clientID to set in 4DIAC.
When connecting from a computer to Rpi without using 4DIAC for publication, I am using a command with an IP address Rpi and a message is displayed.
In addition, as a colleague above, there is the "NO_SOCKET" problem.
I still working on version 4DIAC 1.8.4, but I hope it's not problem :)

Best regards,
Greg
Re: MQTT Implementation in 4diac [message #1806871 is a reply to message #1806831] Thu, 16 May 2019 18:34 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1560
Registered: January 2014
Senior Member

Hi Greg,

as we did solve some issues in the MQTT code my default answer would be: try to upgrade 4diac FORTE to 1.10.2. You can even use 4diac IDE 1.8.4 ( but here I would even more recommend an upgrade soon, because here we changed so much under and over the hood. Especially the stability of 4diac IDE >1.9.2 is a reason).

The client ID is just an identifier used by the mqtt library for identifying your FORTE instance to the broker. You can set it to any value as long as it is equal across all FBs in your 4dica FORTE. Maybe we should rework that and handle it under the hood.

Also please note that 4diac FORTE is currently only connectable to one broker.

One thing is that you need to enable normal tcp access enable on your broker or build paho with openssh and adapt your protocol. However I haven't tested that yet.

Alois

Re: MQTT Implementation in 4diac [message #1807691 is a reply to message #1806871] Thu, 06 June 2019 09:16 Go to previous messageGo to next message
Grzegorz Wach is currently offline Grzegorz WachFriend
Messages: 1
Registered: November 2018
Junior Member
Thank You Alois Zoitl! I reinstalled the entire program both on the computer and on RPi.
I am currently testing the operation of the process visualization system that I would like to perform.
I imported libraries from FBRT from the older version to be able to work on the latest 4diac version.
Unfortunately, the code from the visualization works on the older version, while the latest ones are popping up with problems.
I will analyze the blocks carefully and in case of any problems I will ask for further help :)
Re: MQTT Implementation in 4diac [message #1807760 is a reply to message #1807691] Fri, 07 June 2019 15:52 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1560
Registered: January 2014
Senior Member

Hi, we are happy to help here. I hope we can sort out the issues soon.
Re: MQTT Implementation in 4diac [message #1808058 is a reply to message #1807760] Sat, 15 June 2019 10:19 Go to previous messageGo to next message
ardianto vn is currently offline ardianto vnFriend
Messages: 31
Registered: May 2019
Member
How to write QoS message in FB interface?
Re: MQTT Implementation in 4diac [message #1808174 is a reply to message #1808058] Tue, 18 June 2019 13:59 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1560
Registered: January 2014
Senior Member

I don't think we have an APi for setting any QoS params in 4diac yet. What would you need?
Re: MQTT Implementation in 4diac [message #1808192 is a reply to message #1808174] Tue, 18 June 2019 20:28 Go to previous messageGo to next message
Martin Melik Merkumians is currently offline Martin Melik MerkumiansFriend
Messages: 117
Registered: March 2016
Senior Member
Hi,

as far as I remember the QoS setting of Paho is backed into binary. I think we cannot change QoS via 4diac without changes in Paho but perhaps this has already changed.

Best,
Martin
Re: MQTT Implementation in 4diac [message #1808194 is a reply to message #1808192] Wed, 19 June 2019 02:47 Go to previous message
ardianto vn is currently offline ardianto vnFriend
Messages: 31
Registered: May 2019
Member
I want to publish a message with qos=2 and subscribe the message with qos=1

[Updated on: Wed, 19 June 2019 02:48]

Report message to a moderator

Previous Topic:Installing WAGO-PFC-BSP-2018.2.1
Next Topic:4DIAC portability and use on custom hardware
Goto Forum:
  


Current Time: Fri Mar 29 04:51:44 GMT 2024

Powered by FUDForum. Page generated in 0.03043 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top