Ros node Startup and shutdown

1. ros Operating unit :

Ros The unit of program operation is ros node.

2. ros Start of node :

(1) initialization ros node : By calling ros::init() Interface implementation ; The default node name can be specified by a parameter , The reason is default , It's because when you execute a program on the command line , The node name can be modified .

(2) start-up ros node : By calling ros::NodeHnadle establish NodeHnadle example nh realization , When you first create an instance , Will call ros::start(), Start this node at this time .

3. ros Node shutdown :

(1) By calling ros::shutdown() Interface , close ros node , This interface turns off the subscription topic , Release topic , Request service and provide service .

(2) In the last one ros::NodeHnadle When the object is destroyed , Will be called automatically ros::shutdown(), To close ros node .

4. testing ros Is the node down :

(1)ros::ok() Interface : return false, Indicates that the node is down .

(2)ros::isShuttingDown() Interface : return true, explain ros::shutdown() Called , But the node ratio must end .

notes : So it is generally used ros::ok() judge , The node that ends at but doesn't end at , for example “ prolonged service
callback” in , You can only use ros::isShuttingDown(), Because this node will not be shut down , I wonder what node this is ?

5. interrupt :

(1) stay ros::init() Options , There is an option ros::init_options::NoSigintHandler, Decide whether to install the default SIGINT Processing function , If this parameter is not used , Then install , The program received SIGINT signal (ctrl+c) Time ,ros::ok() return false, Nodes can go through the closing process . If this parameter is used , You need to install it yourself SIGINT Processing function , To ensure that the node can end .

Technology
©2020 ioDraw All rights reserved
django Do not close CSRF middleware , Custom through CSRF Tested post request Understanding neural network machine translation in three minutes error: (-215:Assertion failed) Solution ETL tool kettle And datax Comparison test cases Oracle to Oracle Tiktok The matrix - Code rain ( Free delivery ) Interview questions : Handwritten list ( Include reverse linked list )-bash The Trojan horse , Have you ever met one ? Implementation and challenge of metadata service in data Lake PHP call shell command Notes on core principles of reverse engineering ( One )——Hello World-1