Description
Following the changes made in commit 789ce6e, an error occurs during tree execution when std::nullopt
is set as the default value for an InputPort
of type std::optional<T>
, and the InputPort
's value is subsequently set to an empty string ("").
This issue is exemplified when T
is set to std::optional<geometry_msgs::Pose>
, resulting in the following error message:
You (maybe indirectly) called BT::convertFromString() for type [std::optional<geometry_msgs::Pose_<std::allocator<void> > >], but I can't find the template specialization.
[ERROR] [1707813348.400082594]: [port_utils::getInput] Failed to get input 'poses': You didn't implement the template specialization of convertFromString for this type: std::optional<geometry_msgs::Pose_<std::allocator<void> > >
[ERROR] [1707813348.400098635]: [BT][InputTest][InputTest](UID 1): failed to get inputs
In Groot2, when an InputPort doesn't explicitly have a value assigned by the user, the system automatically assigns an empty string (""). However, this automatic assignment leads to runtime errors when the InputPort is of type std::optional with std::nullopt set as its default value. Ideally, the system should detect when an empty string is auto-assigned to such InputPorts and instead utilize the user-defined std::nullopt default value to prevent these runtime errors.