multi_node.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # coding=utf-8
00003 
00004 import multiprocessing
00005 import time
00006 import rospy
00007 
00008 class Process1(multiprocessing.Process):
00009     def __init__(self):
00010         multiprocessing.Process.__init__(self)
00011         rospy.init_node('hello1')
00012 
00013 
00014     def run(self):        
00015         #rospy.init_node('hello1')
00016         print 'hello1'
00017         rospy.spin()
00018 
00019 class Process2(multiprocessing.Process):
00020     def __init__(self):
00021         multiprocessing.Process.__init__(self)
00022 
00023     def run(self):
00024         rospy.init_node('hello2')
00025         print 'hello2'
00026         rospy.spin() 
00027 
00028 if __name__ == '__main__':
00029     p1 = Process1()
00030     p2 = Process2()
00031     p1.start()
00032     p2.start()


micros_mars_task_alloc
Author(s): Minglong Li , Xiaodong Yi , Yanzhen Wang , Zhongxuan Cai
autogenerated on Mon Jul 1 2019 19:55:03