File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -462,7 +462,17 @@ CameraNode::declareParameters()
462
462
throw std::runtime_error (" minimum and maximum parameter array sizes do not match" );
463
463
464
464
// clamp default ControlValue to min/max range and cast ParameterValue
465
- const rclcpp::ParameterValue value = cv_to_pv (clamp (info.def (), info.min (), info.max ()));
465
+ rclcpp::ParameterValue value;
466
+ try {
467
+ value = cv_to_pv (clamp (info.def (), info.min (), info.max ()));
468
+ }
469
+ catch (const invalid_conversion &e) {
470
+ RCLCPP_ERROR_STREAM (get_logger (), " unsupported control '"
471
+ << id->name ()
472
+ << " ' (type: " << std::to_string (info.def ().type ()) << " ): "
473
+ << e.what ());
474
+ continue ;
475
+ }
466
476
467
477
// get smallest bounds for minimum and maximum set
468
478
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 <
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