我們來看看節(jié)點管理器master是如何被啟動的,再回到parent.pystart()函數(shù),如下。
我們發(fā)現(xiàn)它啟動了XMLRPC服務(wù)器后,接下來就調(diào)用了_init_runner()函數(shù)。
def start(self, auto_terminate=True):
self.logger.info("starting roslaunch parent run")
# load config, start XMLRPC servers and process monitor
try:
self._start_infrastructure()
except:
self._stop_infrastructure()
# Initialize the actual runner.
self._init_runner()
# Start the launch
self.runner.launch()
init_runner()函數(shù)實例化了ROSLaunchRunner類,這個類的定義在launch.py里。
def _init_runner(self):
self.runner = roslaunch.launch.ROSLaunchRunner(self.run_id, self.config, server_uri=self.server.uri, ...)
實例化完成后,parent.pystart()函數(shù)就調(diào)用了它的launch()函數(shù)。
我們打開launch.py文件,找到launch()函數(shù),發(fā)現(xiàn)它又調(diào)用了自己類中的_setup()函數(shù),而_setup()函數(shù)又調(diào)用了_launch_master()函數(shù)。
看名字就能猜出來,_launch_master()函數(shù)肯定是啟動節(jié)點管理器master的,它調(diào)用了create_master_process函數(shù),這個函數(shù)在nodeprocess.py里。
所以我們打開nodeprocess.py,create_master_process函數(shù)使用了LocalProcess類。這個類繼承自Process類。nodeprocess.py文件引用了python中用于創(chuàng)建新的進(jìn)程的subprocess模塊。
create_master_process函數(shù)實例化LocalProcess類用的是’rosmaster’,即ros_comm-noetic-develtoolsrosmaster中的包。
main.py文件中的rosmaster_main函數(shù)使用了master.py中的Master類。
Master類中又用到了master_api.py中的ROSMasterHandler類,這個類包含所有的XMLRPC服務(wù)器接收的遠(yuǎn)程調(diào)用,一共24個,如下。
shutdown(self, caller_id, msg='')
getUri(self, caller_id)
getPid(self, caller_id)
deleteParam(self, caller_id, key)
setParam(self, caller_id, key, value)
getParam(self, caller_id, key)
searchParam(self, caller_id, key)
subscribeParam(self, caller_id, caller_api, key)
unsubscribeParam(self, caller_id, caller_api, key)
hasParam(self, caller_id, key)
getParamNames(self, caller_id)
param_update_task(self, caller_id, caller_api, param_key, param_value)
_notify_topic_subscribers(self, topic, pub_uris, sub_uris)
registerService(self, caller_id, service, service_api, caller_api)
lookupService(self, caller_id, service)
unregisterService(self, caller_id, service, service_api)
registerSubscriber(self, caller_id, topic, topic_type, caller_api)
unregisterSubscriber(self, caller_id, topic, caller_api)
registerPublisher(self, caller_id, topic, topic_type, caller_api)
unregisterPublisher(self, caller_id, topic, caller_api)
lookupNode(self, caller_id, node_name)
getPublishedTopics(self, caller_id, subgraph)
getTopicTypes(self, caller_id)
getSystemState(self, caller_id)
-
管理器
+關(guān)注
關(guān)注
0文章
265瀏覽量
19518 -
MASTER
+關(guān)注
關(guān)注
0文章
111瀏覽量
12199 -
ROS
+關(guān)注
關(guān)注
1文章
293瀏覽量
18723
發(fā)布評論請先 登錄
ROS讓機(jī)器人開發(fā)更便捷,基于RK3568J+Debian系統(tǒng)發(fā)布!
問GPIB卡安裝正確,為什么在資源管理器中沒有板卡GPIB0?
從終端啟動許可證管理器
搭建ARM+ROS的硬件載體之ROS的移植及測試方法
ROS讓機(jī)器人開發(fā)更便捷,基于RK3568J+Debian系統(tǒng)發(fā)布!
Protel DXP設(shè)計管理器
Windows XP系統(tǒng)任務(wù)管理器幾個另類用法
數(shù)據(jù)庫的項目管理器是什么?項目管理器詳細(xì)資料總結(jié)
項目管理器及其操作的詳細(xì)資料說明
ROS是如何設(shè)計的 ROS客戶端庫
ROS節(jié)點是什么 如何誕生的
ROS中XMLRPC是什么
EtherCAT主站協(xié)議棧EC-Master在ROS(機(jī)器人操作系統(tǒng))中的應(yīng)用
ROS中節(jié)點管理器master是如何被啟動的
評論