You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the documentation, the optenv substitution argument can be used without the default_value supplied.
In an eval expression, the substitution arguments are converted into Python functions.
In rosmon, the optenv is defined as a function with two arguments using make_handler2 here:
If optenv is used with a single argument, we have the following error:
Could not load launch file: /home/rre/open_mower_ros/src/open_mower/launch/include/_gps.launch:14: Substitution error: Caught Python exception while evaluating $(eval optenv('OM_GPS_BAUDRATE')!=''):
ArgumentError: Python argument types in
None.None(str)
did not match C++ signature:
None(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)
This seems not so simple to replace the make_handler2 with a function with a default argument because we do not use the py::def() like in the Boost examples.
A basic workaround that works is to create a small wrapper in Python in the local context:
According to the documentation, the
optenv
substitution argument can be used without thedefault_value
supplied.In an
eval
expression, the substitution arguments are converted into Python functions.In
rosmon
, theoptenv
is defined as a function with two arguments usingmake_handler2
here:rosmon/rosmon_core/src/launch/substitution_python.cpp
Line 114 in 4b00745
If
optenv
is used with a single argument, we have the following error:This usage has been found in this open source project.
The following unit test allows to catch it:
With the following output:
To resolve the issue, we need to find how to have a variable number of arguments for a Python function with Boost::Python, like
*args
.Edit: Overloading and default arguments is actually part of the BoostPython tutorial.
The text was updated successfully, but these errors were encountered: