Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. decoding/splitting mqtt data received
Forum Updated to NodeBB v4.3 + New Features

decoding/splitting mqtt data received

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 202 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dinesh Lama
    wrote on last edited by
    #1

    I am using mqtt_bridge on remote machine which is converting ros data into mqtt and sending to qt appliction where qtmqtt library is used to read those topic data.
    Currently i'm reading odom topic of nav_msgs/Odometry type but i'm getting somethign like:

    ��header��seq�A��stamp��secs�/�nsecs�+6�@�frame_id�odom�child_frame_id�base_footprint�pose��pose��position��x˿���#��y˿����3���z˿P�V��@Ыorientation��x˾���6���y�?Zwڪ �z�?P��
    

    This is the function where i'm trying to decode this json msg to appropriate data.

    void QmlMqttSubscription::handleMessage(const QMqttMessage &qmsg)
    {
        auto items = qmsg.payload();
        qDebug() << items;
        emit messageReceived(qmsg.payload());
    }
    

    I'm using quicksubscription example code from mqtt package. Can anyone tell me how do i split this data properly and save in some variable?

    SGaistS 1 Reply Last reply
    0
    • D Dinesh Lama

      I am using mqtt_bridge on remote machine which is converting ros data into mqtt and sending to qt appliction where qtmqtt library is used to read those topic data.
      Currently i'm reading odom topic of nav_msgs/Odometry type but i'm getting somethign like:

      ��header��seq�A��stamp��secs�/�nsecs�+6�@�frame_id�odom�child_frame_id�base_footprint�pose��pose��position��x˿���#��y˿����3���z˿P�V��@Ыorientation��x˾���6���y�?Zwڪ �z�?P��
      

      This is the function where i'm trying to decode this json msg to appropriate data.

      void QmlMqttSubscription::handleMessage(const QMqttMessage &qmsg)
      {
          auto items = qmsg.payload();
          qDebug() << items;
          emit messageReceived(qmsg.payload());
      }
      

      I'm using quicksubscription example code from mqtt package. Can anyone tell me how do i split this data properly and save in some variable?

      SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      @Dinesh-Lama said in decoding/splitting mqtt data received:

      This is the function where i'm trying to decode this json msg to appropriate data.

      Since it's json, you can use QJsonDocument::fromJson and then go from there to extract the information you want.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved