mqttCmdMain work with ros
This commit is contained in:
Regular → Executable
+1
-1
@@ -15,7 +15,7 @@ import rospy
|
||||
def init_dataFormat(cfg:Read_CMD_Config):
|
||||
if cfg.msg_format == "Json":
|
||||
Json_msg_to_ros.rate = rospy.Rate(10)
|
||||
Json_msg_to_ros.Cmd_Broadcast_topicToMqtt = rospy.Publisher(cfg.ROStopicName_Cmd_Broadcast_Receiver,String,queue_size=10)
|
||||
Json_msg_to_ros.publisher_Cmd_Broadcast = rospy.Publisher(cfg.ROStopicName_Cmd_Broadcast_Receiver,String,queue_size=10)
|
||||
client.on_message = Json_msg_to_ros.on_message
|
||||
Json_msg_to_ros.Cmd_Broadcast_topicToMqtt = cfg.Cmd_Broadcast_topicToMqtt
|
||||
elif cfg.msg_format == "Proto":
|
||||
|
||||
@@ -35,7 +35,7 @@ def on_publish(self, userdata, mid):
|
||||
|
||||
|
||||
connect_flag = False
|
||||
mqtt_config = {"host": "192.168.50.118", "port": 1883, "topic": "cmd/broadcast", "name": "Tower"}
|
||||
mqtt_config = {"host": "140.120.31.133", "port": 1883, "topic": "cmd/broadcast", "name": "Tower"}
|
||||
client = initialise_clients(mqtt_config["name"])
|
||||
client.on_publish = on_publish
|
||||
client.on_connect = on_connect
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
MQTT:
|
||||
msg_format: Json
|
||||
MQTTClientNameCmd: Drone550Cmd
|
||||
host: 192.168.50.118
|
||||
host: 140.120.31.133
|
||||
port: 1883
|
||||
keepalive: 600
|
||||
# Mqtt topic
|
||||
|
||||
Reference in New Issue
Block a user