我們來看看節(jié)點(diǎn)管理器master是如何被啟動(dòng)的,再回到parent.pystart()函數(shù),如下。
我們發(fā)現(xiàn)它啟動(dòng)了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ù)實(shí)例化了ROSLaunchRunner類,這個(gè)類的定義在launch.py里。
def _init_runner(self):
self.runner = roslaunch.launch.ROSLaunchRunner(self.run_id, self.config, server_uri=self.server.uri, ...)
實(shí)例化完成后,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ù)肯定是啟動(dòng)節(jié)點(diǎn)管理器master的,它調(diào)用了create_master_process函數(shù),這個(gè)函數(shù)在nodeprocess.py里。
所以我們打開nodeprocess.py,create_master_process函數(shù)使用了LocalProcess類。這個(gè)類繼承自Process類。nodeprocess.py文件引用了python中用于創(chuàng)建新的進(jìn)程的subprocess模塊。
create_master_process函數(shù)實(shí)例化LocalProcess類用的是’rosmaster’,即ros_comm-noetic-develtoolsrosmaster中的包。
main.py文件中的rosmaster_main函數(shù)使用了master.py中的Master類。
Master類中又用到了master_api.py中的ROSMasterHandler類,這個(gè)類包含所有的XMLRPC服務(wù)器接收的遠(yuǎn)程調(diào)用,一共24個(gè),如下。
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文章
254瀏覽量
19051 -
MASTER
+關(guān)注
關(guān)注
0文章
109瀏覽量
11739 -
ROS
+關(guān)注
關(guān)注
1文章
288瀏覽量
17742
發(fā)布評(píng)論請(qǐng)先 登錄
ROS讓機(jī)器人開發(fā)更便捷,基于RK3568J+Debian系統(tǒng)發(fā)布!
問GPIB卡安裝正確,為什么在資源管理器中沒有板卡GPIB0?
從終端啟動(dòng)許可證管理器
怎樣去使用ROS中的launch啟動(dòng)文件呢
搭建ARM+ROS的硬件載體之ROS的移植及測試方法
ROS讓機(jī)器人開發(fā)更便捷,基于RK3568J+Debian系統(tǒng)發(fā)布!
Protel DXP設(shè)計(jì)管理器
Windows XP系統(tǒng)任務(wù)管理器幾個(gè)另類用法
數(shù)據(jù)庫的項(xiàng)目管理器是什么?項(xiàng)目管理器詳細(xì)資料總結(jié)

項(xiàng)目管理器及其操作的詳細(xì)資料說明
ROS是如何設(shè)計(jì)的 ROS客戶端庫

ROS節(jié)點(diǎn)是什么 如何誕生的
ROS中XMLRPC是什么
EE-146:為ADSP-218x系列DSP實(shí)施啟動(dòng)管理器

評(píng)論