RoboceptionUser.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package VisionX::ArmarXObjects::RoboceptionUser
17  * @author Raphael Grimm ( raphael dot grimm at kit dot edu )
18  * @date 2019
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 #include <rc_genicam_api/device.h>
26 #include <rc_genicam_api/stream.h>
27 
28 #include <Image/ImageProcessor.h>
29 
30 #include <VisionX/interface/components/Calibration.h>
31 
32 
33 namespace rcg
34 {
35  using DevicePtr = std::shared_ptr<rcg::Device>;
36  using StreamPtr = std::shared_ptr<rcg::Stream>;
37  class Image;
38 }
39 
41 {
42  class CNodeMapRef;
43 }
44 
45 namespace visionx
46 {
47  /**
48  * @defgroup Library-RoboceptionUtility RoboceptionUtility
49  * @ingroup Component-RCImageProvider
50  * A description of the library RoboceptionUtility.
51  *
52  * @class RoboceptionUser
53  * @ingroup Library-RoboceptionUtility
54  * @brief This class contains common implementation for
55  * \ref RCImageProvider and \ref RCPointCloudProvider
56  */
58  {
59  //Functions: setup
60  protected:
61  bool initDevice(const std::string& dname);
62 
63  void enableIntensity(bool enabled);
65  void enableDisparity(bool enabled);
66  void enableConfidence(bool enabled);
67  void enableError(bool enabled);
68 
69  void setupStreamAndCalibration(float scalefactor, const std::string& calibSavePath);
70 
71  //Functions: runtime
72  protected:
73  void startRC();
74  void stopRC();
75  void cleanupRC();
76 
77  void printNodeMap() const;
78 
79  static void fillCameraImageRGB(unsigned char* outputPixels, size_t nImage,
80  const uint8_t* inputPixels, size_t width, size_t height, uint64_t pixelFormat, size_t xpadding);
81  static void fillCameraImageRGB(unsigned char* outputPixels, size_t nImage, const rcg::Image& inputRgb);
82  static void fillCameraImageDepth(unsigned char* outputPixels, double f, double t, double scale,
83  const rcg::Image& disparity, size_t upscale = 1);
84 
85  //Data
86  protected:
87  //rc
90  std::shared_ptr<GenApi::CNodeMapRef> nodemap;
91  //settings
92  size_t numImages = 0;
93  float scaleFactor = 1;
94  double focalLengthFactor = 1.0;
95  double baseline = 1.0;
96  //VisionX
97  CByteImage** cameraImages{nullptr};
98  CByteImage** smallImages{nullptr};
99  visionx::StereoCalibration stereoCalibration;
100  visionx::ImageDimension dimensions;
101  };
102 
103 }
visionx::RoboceptionUser::stream
rcg::StreamPtr stream
Definition: RoboceptionUser.h:89
rcg::StreamPtr
std::shared_ptr< rcg::Stream > StreamPtr
Definition: RCImageProvider.h:46
GENAPI_NAMESPACE
Definition: RoboceptionUser.h:40
visionx::RoboceptionUser::printNodeMap
void printNodeMap() const
Definition: RoboceptionUser.cpp:258
visionx::RoboceptionUser::cleanupRC
void cleanupRC()
Definition: RoboceptionUser.cpp:235
visionx
ArmarX headers.
Definition: OpenPoseStressTest.h:38
visionx::RoboceptionUser::dimensions
visionx::ImageDimension dimensions
Definition: RoboceptionUser.h:100
visionx::RoboceptionUser::dev
rcg::DevicePtr dev
Definition: RoboceptionUser.h:88
visionx::RoboceptionUser
This class contains common implementation for RCImageProvider and RCPointCloudProvider.
Definition: RoboceptionUser.h:57
visionx::RoboceptionUser::nodemap
std::shared_ptr< GenApi::CNodeMapRef > nodemap
Definition: RoboceptionUser.h:90
visionx::RoboceptionUser::enableError
void enableError(bool enabled)
Definition: RoboceptionUser.cpp:133
rcg
Definition: RCImageProvider.h:42
visionx::RoboceptionUser::initDevice
bool initDevice(const std::string &dname)
Definition: RoboceptionUser.cpp:57
visionx::RoboceptionUser::fillCameraImageDepth
static void fillCameraImageDepth(unsigned char *outputPixels, double f, double t, double scale, const rcg::Image &disparity, size_t upscale=1)
Definition: RoboceptionUser.cpp:340
enabled
std::atomic< bool > * enabled
Definition: RemoteGuiWidgetController.cpp:75
visionx::RoboceptionUser::enableDisparity
void enableDisparity(bool enabled)
Definition: RoboceptionUser.cpp:121
visionx::RoboceptionUser::stereoCalibration
visionx::StereoCalibration stereoCalibration
Definition: RoboceptionUser.h:99
visionx::RoboceptionUser::cameraImages
CByteImage ** cameraImages
Definition: RoboceptionUser.h:97
rcg::DevicePtr
std::shared_ptr< rcg::Device > DevicePtr
Definition: RCImageProvider.h:45
visionx::RoboceptionUser::baseline
double baseline
Definition: RoboceptionUser.h:95
visionx::RoboceptionUser::numImages
size_t numImages
Definition: RoboceptionUser.h:92
visionx::RoboceptionUser::startRC
void startRC()
Definition: RoboceptionUser.cpp:220
visionx::RoboceptionUser::enableIntensity
void enableIntensity(bool enabled)
Definition: RoboceptionUser.cpp:109
visionx::RoboceptionUser::enableConfidence
void enableConfidence(bool enabled)
Definition: RoboceptionUser.cpp:127
visionx::RoboceptionUser::enableIntensityCombined
void enableIntensityCombined(bool enabled)
Definition: RoboceptionUser.cpp:115
visionx::RoboceptionUser::smallImages
CByteImage ** smallImages
Definition: RoboceptionUser.h:98
visionx::RoboceptionUser::setupStreamAndCalibration
void setupStreamAndCalibration(float scalefactor, const std::string &calibSavePath)
Definition: RoboceptionUser.cpp:139
visionx::RoboceptionUser::focalLengthFactor
double focalLengthFactor
Definition: RoboceptionUser.h:94
visionx::RoboceptionUser::fillCameraImageRGB
static void fillCameraImageRGB(unsigned char *outputPixels, size_t nImage, const uint8_t *inputPixels, size_t width, size_t height, uint64_t pixelFormat, size_t xpadding)
Definition: RoboceptionUser.cpp:275
visionx::RoboceptionUser::stopRC
void stopRC()
Definition: RoboceptionUser.cpp:228
visionx::RoboceptionUser::scaleFactor
float scaleFactor
Definition: RoboceptionUser.h:93