Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Special characters in group name break build #96

Open
orzechow opened this issue Nov 23, 2017 · 1 comment
Open

Special characters in group name break build #96

orzechow opened this issue Nov 23, 2017 · 1 comment

Comments

@orzechow
Copy link

Special characters like "(" in the parameter group name break the build, but might be desirable to put a short description in brackets.

Example:

fov_sub = gen.add_group("Field of view (relative to vehicle frame)")

generates C++ classes named FIELD_OF_VIEW_(RELATIVE_TO_VEHICLE_FRAME), which are obviously bad syntax.

To serve the need for group descriptions (that show up in rqt_reconfigure for example), I see two possiblities:

  1. Support special characters in the group name
  2. Add a description argument to add_group
@mikaelarguedas
Copy link
Member

Thanks @orzechow for reporting it.

Support special characters in the group name

Supporting special characters may be challenging as this would (maybe there is an alternative I'm not seeing) require stripping or substituting such characters and could en up in different groups in the same .cfg to collide as they would result in the same class name.

Add a description argument to add_group

This sounds good to me. As this would likely break API we would need to make this feature available in ROS Melodic and later.
For the existing ROS distributions (Indigo Kinetic and Lunar) we could check the name string when processing the cfg file to fail earlier with a better error message (such functions are already available and used for parameter names and description strings).

def check_description(description):
quotes = ['"', "'"]
for quote in quotes:
if description.find(quote) != -1:
raise Exception(r"""quotes not allowed in description string `%s`""" % description)
def check_name(name):
pattern = r'^[a-zA-Z][a-zA-Z0-9_]*$'
if not re.match(pattern, name):
raise Exception("The name of field \'%s\' does not follow the ROS naming conventions, see http://wiki.ros.org/ROS/Patterns/Conventions" % name)

See #97 for a a possible implementation of the suggested solution for existing ROS distributions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants