fix mqtt
This commit is contained in:
@@ -77,8 +77,8 @@ if __name__ == '__main__':
|
|||||||
logger.setLevel(logging.INFO)
|
logger.setLevel(logging.INFO)
|
||||||
logger.addHandler(file_handler)
|
logger.addHandler(file_handler)
|
||||||
logger.addHandler(stream_handler)
|
logger.addHandler(stream_handler)
|
||||||
# logger.info(cfg)
|
logger.info(cfg)
|
||||||
print(cfg.keepalive)
|
print(cfg.msg_format)
|
||||||
|
|
||||||
# Mqtt
|
# Mqtt
|
||||||
client.on_connect = on_connect
|
client.on_connect = on_connect
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class Json_msg_from_ros:
|
|||||||
Formation_data = {"velocity": Formation.velocity, "type": Formation.type}
|
Formation_data = {"velocity": Formation.velocity, "type": Formation.type}
|
||||||
flyFormationMsg = orjson.dumps(Formation_data)
|
flyFormationMsg = orjson.dumps(Formation_data)
|
||||||
cls.mqtt_Pub(message=flyFormationMsg, topics=cls.Fly_Formation_topicToMqtt, qos=cls.Fly_Formation_topicToMqtt_QOS)
|
cls.mqtt_Pub(message=flyFormationMsg, topics=cls.Fly_Formation_topicToMqtt, qos=cls.Fly_Formation_topicToMqtt_QOS)
|
||||||
|
print(flyFormationMsg)
|
||||||
@classmethod
|
@classmethod
|
||||||
def mqtt_Pub(cls, message:str, topics:str, waitForAck:bool=False, qos:int=0):
|
def mqtt_Pub(cls, message:str, topics:str, waitForAck:bool=False, qos:int=0):
|
||||||
mid = cls.client.publish(topics, message, qos)[1]
|
mid = cls.client.publish(topics, message, qos)[1]
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class Read_PUB_Config(Config):
|
|||||||
self.sectionNames[2]:{
|
self.sectionNames[2]:{
|
||||||
"logFileName":(str,True)},
|
"logFileName":(str,True)},
|
||||||
self.sectionNames[3]:{
|
self.sectionNames[3]:{
|
||||||
"msg_format": (str,False),
|
"uavlink_msg_format": (str,False),
|
||||||
"uav_id": (str,False),
|
"uav_id": (str,False),
|
||||||
"baudrate": (int,False),
|
"baudrate": (int,False),
|
||||||
"ttyport": (str,False)}}
|
"ttyport": (str,False)}}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
UAVLINK:
|
UAVLINK:
|
||||||
msg_format: Proto
|
uavlink_msg_format: Proto
|
||||||
uav_id: \x01\x01
|
uav_id: \x01\x01
|
||||||
baudrate: 250000
|
baudrate: 250000
|
||||||
ttyport: /dev/ttyUSB0
|
ttyport: /dev/ttyUSB0
|
||||||
|
|||||||
Reference in New Issue
Block a user