-
Notifications
You must be signed in to change notification settings - Fork 2
00.4 Coding Conventions
AlexSp edited this page Apr 15, 2021
·
5 revisions
Please make sure to have a look at the official ROS website for more details (Link to Best Practices)
Markdown syntax: Cheatsheet
A quick summary of PEP 8, very similar to ROS REP8 and ROS C++ below:
- Packages:
package_name
- Classes/types:
ClassName
- Functions/methods:
field_name
- Private Variables:
private_something
orself.__really_private_field
- Global variables:
global
- 4 space indentation
- Files:
under_scored
, exception for .msg files,CMakeLists.txt
- Classes/types:
CamelCase
- Functions/methods:
camelCase
- Variables:
under_scored
and DESCRIPTIVE - Constants:
ALL_CAPITALS
- Global variables: AVOID except special cases. Rather have parameters defined in
config.yaml
Thanks to AMZ for the nice overview: We use the naming conventions defined at http://wiki.ros.org/ROS/Patterns/Conventions
work_package
, lowercase and _
as separator, e.g. lidar
.
workpackage_somename
, lowercase and _
as separator, e.g. lidar_trimmer
, as to make it clear what the package is used for.
node_name
, lowercase and _
as separator. Can be short.
topic_name
, lowercase and _
as separator.
CamelCased.msg
for message filenames. Message types are always CamelCase, whereas message fields are lowercase and _
as separator, e.g.
MyMessage.msg:
Header header
Float64 my_float
geometry_msgs/Point my_point