Skip to content

Instantly share code, notes, and snippets.

@TheProjectsGuy
Last active December 8, 2018 06:06
Show Gist options
  • Save TheProjectsGuy/d8cd4c62aa096da15a5649db4f5b6dcb to your computer and use it in GitHub Desktop.
Save TheProjectsGuy/d8cd4c62aa096da15a5649db4f5b6dcb to your computer and use it in GitHub Desktop.
CPP Argument parser using ROS
// Include the main header file
#include "ros/ros.h"
int main(int argc, char **argv) {
// Initialize the node
ros::init(argc, argv, "ArgumentParser");
// Print information about the arguments passed
std::cout<<argc<<" arguments"<<std::endl;
for (int i = 0; i < argc; i++) {
std::cout<<"Argument "<<i<<": "<<argv[i]<<std::endl;
}
// End program
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment