How to I use a var from input() into ros.loginfo()?

asked 2021-07-06 07:05:03 -0500

Hi there! I'm completely new to ROS and using kinetic. During practicing with nodes, i got an issue. In the code I attached below, I want to use the x variable from input() into ros.loginfo() but the error says that, the {input name} is not defined. How do I do it properly?

the node code is below:

!/usr/bin/env python

a must ; creating file in linux

import rospy from std_msgs.msg import String


x = input("what's your name?:")

while not rospy.is_shutdown(): str="Hi there %s" %x ros.loginfo(str)

edit retag flag offensive close merge delete