Class CameraAravisNodeBase
Defined in File camera_aravis_node_base.h
Inheritance Relationships
Base Type
public rclcpp::Node
Derived Types
public camera_aravis2::CameraDriver
(Class CameraDriver)public camera_aravis2::CameraXmlExporter
(Class CameraXmlExporter)
Class Documentation
-
class CameraAravisNodeBase : public rclcpp::Node
Subclassed by camera_aravis2::CameraDriver, camera_aravis2::CameraXmlExporter
Public Functions
-
explicit CameraAravisNodeBase(const std::string &name, const rclcpp::NodeOptions &options = rclcpp::NodeOptions())
Initialization constructor.
- Parameters:
name – [in] Node name.
options – [in] Node options.
-
virtual ~CameraAravisNodeBase()
Default destructor.
-
bool isInitialized() const
Returns true, if node is is initialized. False, otherwise.
-
uint listAvailableCameraDevices() const
List available camera devices.
- Returns:
Number of available devices.
Protected Functions
-
virtual void setupParameters()
Set the up launch parameters.
-
bool discoverAndOpenCameraDevice()
Discover attached camera devices found by Aravis and open device specified by guid.
- Returns:
True if successful. False, otherwise.
-
bool getNestedParameter(const std::string &parent_name, const std::string ¶m_name, rclcpp::ParameterValue ¶m_value) const
Get nested parameter with ‘param_name’ with ‘parent_name’ as parent.
- Parameters:
parent_name – [in] Name of the parent parameter.
param_name – [in] Name of the nested parameter underneath the parent.
param_value – [out] Parameter value.
- Returns:
True if parameter is found in ‘parameter_overrides_’ and, thus, given by the user. False otherwise.
-
bool getNestedParameterList(const std::string &parent_name, const std::string ¶m_name, std::vector<std::pair<std::string, rclcpp::ParameterValue>> ¶m_values) const
Get list of nested parameter with ‘param_name’ with ‘parent_name’ as parent.
- Parameters:
parent_name – [in] Name of the parent parameter.
param_name – [in] Name of the nested parameter underneath the parent. If ‘param_name’ is left empty, all nested parameters will be searched for underneath ‘parent_name’.
param_values – [out] List of parameter values associated with feature names.
- Returns:
True if sub category is found in ‘parameter_overrides_’ and, thus, given by the user. False otherwise.
-
template<typename T>
bool getFeatureValue(const std::string &feature_name, T &value) const Get feature value if it is available.
- Template Parameters:
T – Type of feature value.
- Parameters:
feature_name – [in] Name of feature.
value – [out] Value of feature name. If method returns false, value is unchanged.
- Returns:
Returns true if successful, false otherwise.
-
template<typename T>
bool setFeatureValue(const std::string &feature_name, const T &value) const Set feature value if it is available.
- Template Parameters:
T – Type of feature value.
- Parameters:
feature_name – [in] Name of feature.
value – [in] Value to set.
- Returns:
Returns true if successful, false otherwise.
-
template<typename T>
bool setFeatureValue(const std::string &feature_name, const T &value, const T &min, const T &max) const Set feature value if it is available.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This will truncate the value at the given minimum and maximum bound prior to setting.
- Template Parameters:
T – Type of feature value.
- Parameters:
feature_name – [in] Name of feature.
value – [in] Value to set.
min – [in] Minimum bound of the value that is to be set.
max – [in] Maximum bound of the value that is to be set.
- Returns:
Returns true if successful, false otherwise.
-
template<typename T>
bool setBoundedFeatureValue(const std::string &feature_name, const T &value, T *min = nullptr, T *max = nullptr) const Set bounded feature value if it is available.
This will first get the bounds and then truncate the value accordingly before setting it.
- Template Parameters:
T – Type of feature value.
- Parameters:
feature_name – [in] Name of feature.
value – [in] Value to set.
min – [out] Optional pointer to variable in which to store minimum bound.
max – [out] Optional pointer to variable in which to store maximum bound.
- Returns:
Returns true if successful, false otherwise.
-
template<typename T>
bool setFeatureValueFromParameter(const std::string &feature_name, const rclcpp::ParameterValue ¶meter_value, const uint &idx = 0) const Set feature from parameter value if it is available.
This will first check if the parameter is an array type. If so, it will use ‘idx’ to access the parameter. If the given index outside of the range, the last value of the list is used.
- Template Parameters:
T – Type of feature value.
- Parameters:
feature_name – [in] Name of feature.
parameter_value – [in] Specified parameter values.
idx – [in] Index of parameter value that is to be set. Only used if parameter values are given as array.
- Returns:
Returns true if successful, false otherwise.
-
template<typename T>
bool setFeatureValueFromParameter(const std::string &feature_name, const rclcpp::ParameterValue ¶meter_value, const T &min, const T &max, const uint &idx = 0) const Set feature from parameter value if it is available.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This will first check if the parameter is an array type. If so, it will use ‘idx’ to access the parameter. If the given index outside of the range, the last value of the list is used.
This will also truncate the value at the given minimum and maximum bound prior to setting.
- Template Parameters:
T – Type of feature value.
- Parameters:
feature_name – [in] Name of feature.
parameter_value – [in] Specified parameter values.
min – [in] Minimum bound of the value that is to be set.
max – [in] Maximum bound of the value that is to be set.
idx – [in] Index of parameter value that is to be set. Only used if parameter values are given as array.
- Returns:
Returns true if successful, false otherwise.
-
bool setFeatureValuesFromParameterList(const std::vector<std::pair<std::string, rclcpp::ParameterValue>> ¶m_values, const uint &idx = 0) const
Set features from list of parameter values.
This will loop through the list of parameter value associated with the feature names and call setFeatureValueFromParameter accordingly.
- Parameters:
param_values – [in] List of parameter values associated with feature names.
idx – [in] Index of parameter value that is to be set. Only used if parameter values are given as array.
- Returns:
Returns true if successful, false otherwise.
-
template<typename T>
bool setBoundedFeatureValueFromParameter(const std::string &feature_name, const rclcpp::ParameterValue ¶meter_value, T *min = nullptr, T *max = nullptr, const uint &idx = 0) const Set bounded feature from parameter value if it is available.
If the parameter is available, this will first check if the parameter is an array type. If so, it will use ‘idx’ to access the parameter. If the given index outside of the range, the last value of the list is used.
Values outside of the range specified by ‘min’ and ‘max’, will be truncated to the range.
- Template Parameters:
T – Type of feature value.
- Parameters:
feature_name – [in] Name of feature.
parameter_value – [in] Specified parameter values.
min – [out] Optional pointer to variable in which to store minimum bound.
max – [out] Optional pointer to variable in which to store maximum bound.
idx – [in] Index of parameter value that is to be set. Only used if parameter values are given as array.
- Returns:
Returns true if successful, false otherwise.
-
template<typename T>
bool isParameterValueEqualTo(const rclcpp::ParameterValue ¶meter_value, const T &test_value, const uint &idx = 0) const Check if parameter value is equal to given test value.
- Template Parameters:
T – Type of test value.
- Parameters:
parameter_value – [in] Specified parameter values.
test_value – [in] Test value at which the parameter value is to be checked against.
idx – [in] Index of parameter value that is to be set. Only used if parameter values are given as array.
- Returns:
Returns true if equal, false otherwise.
-
bool executeCommand(const std::string &feature_name) const
Execute command with given feature name.
- Parameters:
feature_name – [in] Name of command feature.
- Returns:
Returns true if successful, false otherwise (e.g. command feature is not available).
Protected Attributes
-
bool is_initialized_
Flag indicating if node is initialized.
-
rclcpp::Logger logger_
Logger object of node.
-
ArvDevice *p_device_
Pointer to Aravis device.
-
ArvCamera *p_camera_
Pointer to Aravis camera.
-
std::string guid_
GUID of camera.
-
std::map<std::string, rclcpp::ParameterValue> parameter_overrides_
List of parameter overrides, including parameters that have not been declared.
-
bool is_verbose_enable_
Flag indicating verbose output.
Protected Static Functions
-
static bool isIpAddress(const std::string &str)
Check if given string is an IP Adress.
-
static std::string constructCameraGuidStr(ArvCamera *p_cam)
Construct GUID string of given camera, using vendor name, model name and device serial number.
- Returns:
GUID in the format: <vendor_name>-<model_name>-<device_sn | device_id>.
-
static void handleControlLostSignal(ArvDevice *p_device, gpointer p_user_data)
Handle ‘control-lost’ signal emitted by aravis.
- Parameters:
p_device – [in] Pointer to aravis device.
p_user_data – [in] Pointer to associated user data.
-
explicit CameraAravisNodeBase(const std::string &name, const rclcpp::NodeOptions &options = rclcpp::NodeOptions())