From ea0c66a307b56ce7425c11164662ddd7b085e480 Mon Sep 17 00:00:00 2001 From: Xuan0319 <102780750+Xuan0319@users.noreply.github.com> Date: Mon, 30 May 2022 19:30:17 +0800 Subject: [PATCH] Update command.py --- 1toN/command.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/1toN/command.py b/1toN/command.py index d595f9a..9a2a605 100644 --- a/1toN/command.py +++ b/1toN/command.py @@ -1,7 +1,6 @@ -# #!/usr/bin/env python3 -# #coding:utf-8 -# license removed for brevity -import paho.mqtt.client as mqtt +#! /usr/bin/env python3 +#coding:utf-8 + import ssl import rospy from std_msgs.msg import String @@ -24,7 +23,7 @@ def on_connect(self, userdata, flags, rc): def on_message(self, userdata, msg): - msg = msg.payload.decode('utf-8') + #msg = msg.payload.decode('utf-8') print(f"msg.topic {msg}") ros_pub(msg.payload.decode('utf-8')) @@ -48,9 +47,8 @@ if __name__ == '__main__': Mqtt_Node = 'publisher_py' rospy.init_node("cmd_receiver") # initialize Ros node - topicName = 'uav_command' + topicName = 'cmd_receiver' publisher = rospy.Publisher(topicName,String,queue_size=10) rate = rospy.Rate(10) client.loop_forever() -