12#include <pylon/PylonIncludes.h>
71 bool close()
override;
79 bool getRgbFOV(
double& horizontalFov,
double& verticalFov)
override;
80 bool setRgbFOV(
double horizontalFov,
double verticalFov)
override;
104 int height()
const override;
105 int width()
const override;
110 bool setFramerate(
const float _fps);
112 bool setOption(
const std::string& option, T value,
bool isEnum =
false)
114 std::lock_guard<std::mutex> guard(m_mutex);
118 auto& node_map = m_camera_ptr->GetNodeMap();
122 yCDebug(PYLON_CAMERA) <<
"Setting " << option <<
"to" << value;
123 if constexpr (std::is_same<T, float>::value || std::is_same<T, double>::value)
125 Pylon::CFloatParameter(node_map, option.c_str()).SetValue(value);
127 else if constexpr (std::is_same<T, bool>::value)
129 Pylon::CBooleanParameter(node_map, option.c_str()).SetValue(value);
131 else if constexpr (std::is_same<T, int>::value)
133 Pylon::CIntegerParameter(node_map, option.c_str()).SetValue(value);
135 else if constexpr (std::is_same<T, const char*>::value)
139 Pylon::CEnumParameter(node_map, option.c_str()).SetValue(value);
143 Pylon::CStringParameter(node_map, option.c_str()).SetValue(value);
148 yCError(PYLON_CAMERA) <<
"Option" << option <<
"has a type not supported, type" <<
typeid(T).name();
153 catch (
const Pylon::GenericException& e)
156 yCError(PYLON_CAMERA) <<
"Camera" << m_serial_number <<
"cannot set" << option <<
"to:" << value <<
"error:" << e.GetDescription();
159 return startCamera() && ok;
163 bool getOption(
const std::string& option, T& value,
bool isEnum =
false)
165 auto& node_map = m_camera_ptr->GetNodeMap();
170 if constexpr (std::is_same<T, float*>::value || std::is_same<T, double*>::value)
172 *value = Pylon::CFloatParameter(node_map, option.c_str()).GetValue();
173 yCDebug(PYLON_CAMERA) <<
"Getting" << option <<
"value:" << *value;
175 else if constexpr (std::is_same<T, bool*>::value)
177 *value = Pylon::CBooleanParameter(node_map, option.c_str()).GetValue();
178 yCDebug(PYLON_CAMERA) <<
"Getting" << option <<
"value:" << *value;
180 else if constexpr (std::is_same<T, int*>::value)
182 *value = Pylon::CIntegerParameter(node_map, option.c_str()).GetValue();
183 yCDebug(PYLON_CAMERA) <<
"Getting" << option <<
"value:" << *value;
185 else if constexpr (std::is_same<T, std::string>::value)
189 value = Pylon::CEnumParameter(node_map, option.c_str()).GetValue();
190 yCDebug(PYLON_CAMERA) <<
"Getting" << option <<
"value:" << value;
194 value = Pylon::CStringParameter(node_map, option.c_str()).GetValue();
195 yCDebug(PYLON_CAMERA) <<
"Getting" << option <<
"value:" << value;
200 yCError(PYLON_CAMERA) <<
"Option" << option <<
"has a type not supported, type" <<
typeid(T).name();
204 catch (
const Pylon::GenericException& e)
207 yCError(PYLON_CAMERA) <<
"Camera" << m_serial_number <<
"cannot get" << option <<
"error:" << e.GetDescription();
216 mutable std::mutex m_mutex;
219 mutable std::string m_lastError{
""};
220 bool m_verbose{
false};
221 bool m_initialized{
false};
223 double m_rotation{0.0};
224 uint32_t m_width{640};
225 uint32_t m_height{480};
226 Pylon::String_t m_serial_number{
""};
227 std::unique_ptr<Pylon::CInstantCamera> m_camera_ptr;
228 bool m_rotationWithCrop{
false};
contains the definition of a Matrix type
int getRgbWidth() override
Return the width of each frame.
bool getActive(int feature, bool *isActive) override
bool getRgbResolution(int &width, int &height) override
Get the resolution of the rgb image from the camera.
~pylonCameraDriver() override=default
bool setActive(int feature, bool onoff) override
bool setRgbMirroring(bool mirror) override
Set the mirroring setting of the sensor.
bool setOnePush(int feature) override
bool getRgbMirroring(bool &mirror) override
Get the mirroring setting of the sensor.
bool getRgbIntrinsicParam(Property &intrinsic) override
Get the intrinsic parameters of the rgb camera.
bool close() override
Close the DeviceDriver.
bool getRgbSupportedConfigurations(yarp::sig::VectorOf< yarp::dev::CameraConfig > &configurations) override
int height() const override
Return the height of each frame.
bool getCameraDescription(CameraDescriptor *camera) override
bool getMode(int feature, FeatureMode *mode) override
bool setRgbResolution(int width, int height) override
Set the resolution of the rgb image from the camera.
int width() const override
Return the width of each frame.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool getFeature(int feature, double *value) override
bool setFeature(int feature, double value) override
int getRgbHeight() override
Return the height of each frame.
bool setMode(int feature, FeatureMode mode) override
bool setRgbFOV(double horizontalFov, double verticalFov) override
Set the field of view (FOV) of the rgb camera.
pylonCameraDriver()=default
bool getImage(yarp::sig::ImageOf< yarp::sig::PixelRgb > &image) override
Get an image from the frame grabber.
bool getRgbFOV(double &horizontalFov, double &verticalFov) override
Get the field of view (FOV) of the rgb camera.
Interface implemented by all device drivers.
Control interface for frame grabber devices.
An interface for retrieving intrinsic parameter from a rgb camera.
A class for storing options and configuration information.
A base class for nested structures that can be searched.
An abstraction for a time stamp and/or sequence number.
Image class with user control of representation details.
#define yCError(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)