nerian_stereo_node.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (c) 2022 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:
21  StereoNode(): privateNhInternal("~") { }
22 
26  int run() {
28  try {
29  while(ros::ok()) {
30  // Dispatch any queued ROS callbacks
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();
60  try {
62  } catch(...) {
63  ROS_ERROR("Handshake with parameter server failed; no dynamic parameters - please verify firmware version. Image transport is unaffected.");
64  }
65  node.publishTransform(); // initial transform
66  return node.run();
67  } catch(const std::exception& ex) {
68  ROS_FATAL("Exception occured: %s", ex.what());
69  return 1;
70  }
71 }
72 
nerian_stereo::StereoNode::privateNhInternal
ros::NodeHandle privateNhInternal
Definition: nerian_stereo_node.cpp:71
nerian_stereo::StereoNodeBase::prepareAsyncTransfer
void prepareAsyncTransfer()
Connects to the image service to request the stream of image sets.
Definition: nerian_stereo_node_base.cpp:196
nerian_stereo::StereoNodeBase::processDataChannels
void processDataChannels()
Definition: nerian_stereo_node_base.cpp:732
nerian_stereo::StereoNode::run
int run()
The main loop of this node.
Definition: nerian_stereo_node.cpp:50
ros::init
ROSCPP_DECL void init(const M_string &remappings, const std::string &name, uint32_t options=0)
nerian_stereo::StereoNodeBase::init
void init()
Performs general initializations.
Definition: nerian_stereo_node_base.cpp:88
nerian_stereo::StereoNode::getNH
ros::NodeHandle & getNH() override
Definition: nerian_stereo_node.cpp:72
nerian_stereo::StereoNodeBase::publishTransform
void publishTransform()
Definition: nerian_stereo_node_base.cpp:782
ros::spinOnce
ROSCPP_DECL void spinOnce()
nerian_stereo::StereoNodeBase::processOneImageSet
void processOneImageSet()
Definition: nerian_stereo_node_base.cpp:202
ros::ok
ROSCPP_DECL bool ok()
nerian_stereo::StereoNodeBase
Definition: nerian_stereo_node_base.h:73
nerian_stereo::StereoNodeBase::initDynamicReconfigure
void initDynamicReconfigure()
Definition: nerian_stereo_node_base.cpp:56
main
int main(int argc, char **argv)
Definition: nerian_stereo_node.cpp:54
nerian_stereo::StereoNode::StereoNode
StereoNode()
Definition: nerian_stereo_node.cpp:45
ROS_FATAL
#define ROS_FATAL(...)
nerian_stereo::StereoNode
Definition: nerian_stereo_node.cpp:31
nerian_stereo::StereoNode::getPrivateNH
ros::NodeHandle & getPrivateNH() override
Definition: nerian_stereo_node.cpp:73
nerian_stereo::StereoNodeBase::initDataChannelService
void initDataChannelService()
Definition: nerian_stereo_node_base.cpp:192
ROS_ERROR
#define ROS_ERROR(...)
ros::Duration::sleep
bool sleep() const
nerian_stereo
A driver node that receives data from Nerian stereo devices and forwards it to ROS.
Definition: nerian_stereo_node.cpp:17
nerian_stereo::StereoNode::nhInternal
ros::NodeHandle nhInternal
Definition: nerian_stereo_node.cpp:70
nerian_stereo_node_base.h
ros::Duration
ros::NodeHandle


nerian_stereo
Author(s): Nerian Vision Technologies
autogenerated on Wed Jan 24 2024 04:06:47