node.cpp
Go to the documentation of this file.
1 #include <nodelet/loader.h>
2 #include <ros/ros.h>
3 #include <cstdlib>
4 
5 int main(int argc, char** argv)
6 {
7  try
8  {
9  ros::init(argc, argv, "zivid_camera");
10  }
11  catch (const std::exception& e)
12  {
13  std::cerr << "Failed to initialize ROS: " << e.what() << std::endl;
14  return EXIT_FAILURE;
15  }
16  catch (...)
17  {
18  std::cerr << "Failed to initialize ROS (unknown exception)" << std::endl;
19  return EXIT_FAILURE;
20  }
21 
22  try
23  {
24  ROS_INFO("Creating a nodelet::Loader");
27  nodelet::V_string nargv;
28 
29  const auto nodelet_name = "zivid_camera/nodelet";
30  ROS_INFO("Loading nodelet '%s'", nodelet_name);
31 
32  const bool loaded = nodelet.load(ros::this_node::getName(), nodelet_name, remap, nargv);
33  if (!loaded)
34  {
35  ROS_FATAL("Failed to load nodelet '%s'!", nodelet_name);
36  return EXIT_FAILURE;
37  }
38 
39  ROS_INFO("Successfully loaded nodelet '%s'", nodelet_name);
40  ros::spin();
41  return EXIT_SUCCESS;
42  }
43  catch (const std::exception& e)
44  {
45  std::cerr << "Exception occurred: " << e.what() << std::endl;
46  return EXIT_FAILURE;
47  }
48  catch (...)
49  {
50  std::cerr << "Unknown exception occurred" << std::endl;
51  return EXIT_FAILURE;
52  }
53 }
#define ROS_FATAL(...)
bool load(const std::string &name, const std::string &type, const M_string &remappings, const V_string &my_argv)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL const std::string & getName()
ROSCPP_DECL void spin(Spinner &spinner)
ROSCPP_DECL const M_string & getRemappings()
ROSCPP_DECL std::string remap(const std::string &name)
#define ROS_INFO(...)
int main(int argc, char **argv)
Definition: node.cpp:5
std::vector< std::string > V_string
std::map< std::string, std::string > M_string


zivid_camera
Author(s): Zivid
autogenerated on Sat Apr 17 2021 02:51:05