nerian_stereo_node.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (c) 2021 Nerian Vision GmbH
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a copy
5  * of this software and associated documentation files (the "Software"), to deal
6  * in the Software without restriction, including without limitation the rights
7  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8  * copies of the Software, and to permit persons to whom the Software is
9  * furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *******************************************************************************/
14 
16 
17 namespace nerian_stereo {
18 
19 class StereoNode: public StereoNodeBase {
20 public:
22 
26  int run() {
28  try {
29  while(ros::ok()) {
30  // Dispatch any queued ROS callbacks
31  ros::spinOnce();
32  // Get a single image set and process it (if available)
34  // Process available data from supplemental channels (IMU ...)
36  ros::Duration(0.001).sleep();
37  }
38  } catch(const std::exception& ex) {
39  ROS_FATAL("Exception occured: %s", ex.what());
40  return 1;
41  }
42  return 0;
43  }
44 private:
45  // The standalone node has its own private node handles
48  inline ros::NodeHandle& getNH() override { return nhInternal; }
49  inline ros::NodeHandle& getPrivateNH() override { return privateNhInternal; }
50 };
51 
52 } // namespace
53 
54 int main(int argc, char** argv) {
55  try {
56  ros::init(argc, argv, "nerian_stereo");
58  node.init();
61  node.publishTransform(); // initial transform
62  return node.run();
63  } catch(const std::exception& ex) {
64  ROS_FATAL("Exception occured: %s", ex.what());
65  return 1;
66  }
67 }
68 
void prepareAsyncTransfer()
Connects to the image service to request the stream of image sets.
ros::NodeHandle & getNH() override
#define ROS_FATAL(...)
int main(int argc, char **argv)
bool sleep() const
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
ROSCPP_DECL bool ok()
A driver node that receives data from Nerian stereo devices and forwards it to ROS.
ros::NodeHandle & getPrivateNH() override
ROSCPP_DECL void spinOnce()
int run()
The main loop of this node.
void init()
Performs general initializations.


nerian_stereo
Author(s): Nerian Vision Technologies
autogenerated on Fri Apr 16 2021 02:11:19