Getting an <unexpected keyword argument 'queue_size> error with python3
Hello,
I am currently running ROS Noetic on ubuntu20.04 on a raspberry pi 4. I made a simple publisher node and subscriber node with C++ and ran them together flawlessly.
I would like to replicate the results with Python(3).
However, when running my publisher's script, I get this error:
> Traceback (most recent call last): > File "pub1.py", line 7, in <module> > rospy.init_node('publisher_1', String, queue_size=10) > TypeError: init_node() got an unexpected keyword argument 'queue_size'
I have found a few previous discussions regarding this topic, but they all involve software from over 5 years ago.
Any ideas what could be causing this error?
Here is the script in question:
#!/usr/bin/env python3
import rospy
from std_msgs.msg import String
if __name__=='__main__':
rospy.init_node('robot_news_radio_transmitter', String, queue_size=10)
#publisher w name, type (string), queue-size
rate = rospy.Rate(2)
while not rospy.is_shutdown():
msg = String() #create message string
msg.data = "transmition test" #data inside string
pub.publish(msg) #publish
rate.sleep()
#doing something every 0.5 seconds
rospy.loginfo("Node was STOPPED")
This appears to be a duplicate of #q379874.
@angad: please decide which one you want to keep open, and close -- and delete -- the other one.