File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -459,8 +459,16 @@ CameraNode::declareParameters()
459
459
throw std::runtime_error (" minimum and maximum parameter array sizes do not match" );
460
460
461
461
// clamp default ControlValue to min/max range and cast ParameterValue
462
- const rclcpp::ParameterValue value =
463
- cv_to_pv (clamp (info.def (), info.min (), info.max ()));
462
+ rclcpp::ParameterValue value;
463
+ try {
464
+ value = cv_to_pv (clamp (info.def (), info.min (), info.max ()));
465
+ }
466
+ catch (const invalid_conversion &e) {
467
+ RCLCPP_ERROR_STREAM (get_logger (), " unsupported control '" << id->name () << " ' (type: "
468
+ << std::to_string (info.def ().type ())
469
+ << " ): " << e.what ());
470
+ continue ;
471
+ }
464
472
465
473
// get smallest bounds for minimum and maximum set
466
474
rcl_interfaces::msg::IntegerRange range_int;
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ template<typename T,
48
48
rclcpp::ParameterValue
49
49
cv_to_pv_array (const std::vector<T> & /* values*/ )
50
50
{
51
- throw std::runtime_error (" ParameterValue only supported for arithmetic types" );
51
+ throw invalid_conversion (" ParameterValue only supported for arithmetic types" );
52
52
}
53
53
54
54
template <typename T,
Original file line number Diff line number Diff line change 4
4
#include < rclcpp/parameter_value.hpp>
5
5
6
6
7
+ class invalid_conversion : public std ::runtime_error
8
+ {
9
+ public:
10
+ explicit invalid_conversion (const std::string &msg) : std::runtime_error(msg) {};
11
+ };
12
+
13
+
7
14
rclcpp::ParameterValue
8
15
cv_to_pv (const libcamera::ControlValue &value);
9
16
You can’t perform that action at this time.
0 commit comments