#includeint main(int argc, char **argv) { // Initialize the node ros::init(argc, argv, "example_node"); // Create a NodeHandle object for the node ros::NodeHandle nh; // Do node-related tasks here return 0; }
#includeIn this example, the tilde character (~) is added to the NodeHandle constructor to indicate that the node will be using private parameters. The getParam function is then used to retrieve the value of a parameter named "some_param" from the launch file. Package/library: ROSint main(int argc, char **argv) { // Initialize the node ros::init(argc, argv, "example_node"); // Create a NodeHandle object for the node ros::NodeHandle nh("~"); // Get parameters from the launch file int some_param; nh.getParam("some_param", some_param); // Do node-related tasks here return 0; }