44#include " depthai_ros_driver/utils.hpp"
55#include " rclcpp/logger.hpp"
66#include " rclcpp/node.hpp"
7+ #include " rclcpp/parameter.hpp"
8+ #include " rclcpp/parameter_value.hpp"
9+
10+ #include < stdexcept>
711
812namespace depthai_ros_driver {
913namespace param_handlers {
@@ -22,6 +26,17 @@ DriverParamHandler::~DriverParamHandler() = default;
2226dai::UsbSpeed DriverParamHandler::getUSBSpeed () {
2327 return utils::getValFromMap (getParam<std::string>(" i_usb_speed" ), usbSpeedMap);
2428}
29+ std::string DriverParamHandler::getPipelineAutoCalibrationMode () {
30+ rclcpp::Parameter param;
31+ getROSNode ()->get_parameter (getFullParamName (" i_pipeline_auto_calibration_mode" ), param);
32+ if (param.get_type () == rclcpp::ParameterType::PARAMETER_STRING ) {
33+ return param.as_string ();
34+ }
35+ if (param.get_type () == rclcpp::ParameterType::PARAMETER_BOOL ) {
36+ return param.as_bool () ? " ON_START" : " OFF" ;
37+ }
38+ throw std::invalid_argument (" Invalid driver.i_pipeline_auto_calibration_mode parameter type. Use OFF, ON_START, CONTINUOUS, empty, true, or false." );
39+ }
2540void DriverParamHandler::declareParams () {
2641 declareAndLogParam<bool >(" i_enable_ir" , true );
2742 declareAndLogParam<std::string>(" i_usb_speed" , " SUPER" );
@@ -31,7 +46,11 @@ void DriverParamHandler::declareParams() {
3146 declareAndLogParam<bool >(" i_pipeline_dump" , false );
3247 declareAndLogParam<bool >(" i_calibration_dump" , false );
3348 declareAndLogParam<std::string>(" i_external_calibration_path" , " " );
34- declareAndLogParam<std::string>(" i_pipeline_auto_calibration_mode" , " " );
49+ auto autoCalibrationDescriptor = rcl_interfaces::msg::ParameterDescriptor ();
50+ autoCalibrationDescriptor.dynamic_typing = true ;
51+ if (!getROSNode ()->has_parameter (getFullParamName (" i_pipeline_auto_calibration_mode" ))) {
52+ getROSNode ()->declare_parameter (getFullParamName (" i_pipeline_auto_calibration_mode" ), rclcpp::ParameterValue (std::string ()), autoCalibrationDescriptor);
53+ }
3554 declareAndLogParam<float >(" r_laser_dot_intensity" , 0.6 , getRangedFloatDescriptor (0.0 , 1.0 ));
3655 declareAndLogParam<float >(" r_floodlight_intensity" , 0.6 , getRangedFloatDescriptor (0.0 , 1.0 ));
3756 declareAndLogParam<bool >(" i_restart_on_diagnostics_error" , false );
0 commit comments