Ask Your Question
0

[ROS2] How to check for incoming param type?

asked 2019-08-12 11:27:09 -0500

madmax gravatar image

If I receive a parameter update and want to check if its the correct type, how could I do this?
Because if I set a param over cmd line and write 1 instead of 1.0, no exception is thrown when receiving the param with false type.

void handleChangedParameters( const rcl_interfaces::msg::ParameterEvent::SharedPtr& event )
   {
      for ( auto& changed_parameter : event->changed_parameters )
      {
         auto paramName = changed_parameter.name;
         if ( paramName == controllerFrequency )
         {
            log_info(" is integer: {}", changed_parameter.value. == XXX  ? "true" : "false" )
            updateFrequencyParam( changed_parameter.value.integer_value );
         }
      }
   }
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-08-12 11:33:58 -0500

madmax gravatar image

Ok, found the answer...

rclcpp::ParameterType::PARAMETER_BOOL
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-08-12 11:27:09 -0500

Seen: 11 times

Last updated: Aug 12