ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

tq1992's profile - activity

2021-12-21 10:42:15 -0500 commented answer Error : rospy.init_node() has already been called with different arguments:

thanks man

2021-12-21 10:42:08 -0500 received badge  Supporter (source)
2021-12-21 10:34:29 -0500 marked best answer 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

2021-12-21 10:33:08 -0500 received badge  Famous Question (source)
2021-12-21 10:33:08 -0500 received badge  Notable Question (source)
2021-12-21 10:33:08 -0500 received badge  Popular Question (source)
2021-02-12 10:47:03 -0500 asked a question Error : rospy.init_node() has already been called with different arguments:

Error : rospy.init_node() has already been called with different arguments: In my project i have one publisher file ( pu