Coding standard


General

  • Use spaces, not tables

  • Avoid adding trailing whitespace as it creates noise in the diffs.

Python

  • Comments should not exceed 80 columns, code should not exceed 120 columns.

  • All code must be compatible with Python 2.7 and 3.7.

  • Pylint should not give any error or warning (few exceptions apply with external classes like numpy and pygame, see our .pylintrc).

  • Python code follows PEP8 style guide (use autopep8 whenever possible).

ROS

  • Follow the ROS C++ Style Guide for C++ code.

  • Python code for ROS follows the same guidelines as general Python code, including PEP8.

  • Always use roslint to check code style.

  • Ensure compatibility with both ROS Melodic and ROS Noetic.

  • Use catkin_lint to ensure CMakeLists.txt and package.xml files adhere to best practices.

  • Document all ROS nodes with detailed ROS node API documentation.

  • Always provide launch files for starting nodes and ensure they are well-documented.