//
// Created by zx on 23-3-14.
//

#ifndef SOCKETIO__ROBOTMONITORNODE_H_
#define SOCKETIO__ROBOTMONITORNODE_H_
#include <string>
#include <thread>
#include "emqx-client/paho_client.h"
#include "pose2d.h"
#include <functional>
class RobotMonitorNode
{
 public:

    RobotMonitorNode(std::string nodeId,std::string pubTopic,std::string subTopic);
    virtual ~RobotMonitorNode();

    bool Connect(std::string ip,int port);

 protected:
    void update();
    void ChangeSpeed(double v ,double vth);
    static void SpeedChangeCallback(std::string topic,int QOS,MqttMsg& msg,void* context);

 protected:
    Paho_client* client_;
    bool exit_;
    std::thread* thread_;
    std::string nodeId_;
    std::string pubTopic_;
    std::string subTopic_;
    Pose2d pose_;
    double v_;
    double vth_;
};


#endif //SOCKETIO__ROBOTMONITORNODE_H_
