Closed
Description
I would like to set default values for ports with generic types.
This code from tutorial 3 compiles and works as expected:
return {InputPort<Position2D>("target", description)};
But this one produces an error - no matching function for call to ‘to_string(BT::Position2D&)’
return {InputPort<Position2D>("target", {1.0, 2.0}, description)};
Is this not implemented or am I missing something in my code?
Metadata
Metadata
Assignees
Labels
No labels
Activity
OPerepadia commentedon Jun 9, 2023
Solved. I added
toStr
function so it knows how to convert this type back to string, and now it compiles and works as expected.OPerepadia commentedon Jun 9, 2023
@facontidavide Maybe we should include this function in the tutorial 03?
facontidavide commentedon Jun 9, 2023
interesting, I would say that this is almost a bug. Let me add a more useful error message
facontidavide commentedon Jun 9, 2023
changed the message error to be more useful
facontidavide commentedon Jun 10, 2023
Sooooo...
The solution to this problem was finally more complicated that I expected.
I have a new branch v4.3, where I implemented a considerable improvement of the default value for custom types.
You may try that, if you want.
Fix BehaviorTree#580 : more informative error when not specializing B…