Error : rospy.init_node() has already been called with different arguments:
In my project i have one publisher file ( publish rpm for a wheel) and one subscriber file (calculate the speed of the wheel based on rpm value )
the code works fine until i try to publish the speed to another node called "speed" and it gives me this error rospy.init_node() has already been called with different arguments:
the subscriber file code as below:
import rospy
from std_msgs.msg import String , Float64
import math
def calculate_speed(rpm):
radius = 5.1
speed = rpm.data*2.0*(math.pi)*radius
print(speed)
def rpm_subscriber():
rospy.init_node('rpm_Subscriber_Node')
rospy.Subscriber('rpm' , Float64 , calculate_speed)
def speed_publish():
rospy.init_node("speed_Publisher_Node")
pub = rospy.Publisher("speed" , Float64 , queue_size=10)
rate = rospy.Rate(5)
pub.publish(speed)
if __name__ == '__main__':
rpm_subscriber()
speed_publish()
print('DONE')
please help i have been stuck here for an hours