Standard naming conventions used in ROS

Here we are using the text Helloworld to demonstrate the naming patterns we are using in ROS:

  • HelloWorld: This name starts with an uppercase letter, and each new word starts with an uppercase letter with no space or underscores.
  • helloWorld: In this naming method, the first letter will be lowercase but new words will be in uppercase letters without spaces.
  • hello_world: This only contains lowercase letters. Words are separated with underscores.
  • HELLO_WORLD: All are uppercase letters. Words are separated by an underscore.

The following are the naming conventions followed by each component in ROS:

  • Packages, Topics/Services, Files, Libraries: These ROS components are following the hello_world pattern.
  • Classes/Types: These classes are following the HelloWorld kind of naming conventions, for example, class ExampleClass.
  • Functions/Methods: Functions follow helloWorld naming conventions and function arguments are following the hello_world pattern, for example, void exampleMethod(int sample_arg);.
  • Variables: Generally, variables follow the hello_world pattern.
  • Constants: Constants follow the HELLO_WORLD pattern.
  • Member variables: The member variable inside a class follows the hello_world pattern, with a trailing underscore added, for example, int sample_int_.
  • Global variables: Global variables follow hello_world, with a leading g_, for example, int g_samplevar;.
  •  Namespace: This follows the hello_world naming pattern.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.51.241