ROS code formatting

One thing that needs to be taken care of while developing code is its formatting. One of the basic things to remember with formatting is that each code block in ROS is separated by two spaces. The following is a code snippet showing the formatting:

if(a < b) 
{ 
  // do stuff 
} 
else 
{ 
  // do other stuff 
} 

The following is an example code snippet in the ROS standard formatting style:

#include <boost/tokenizer.hpp> #include <moveit/macros/console_colors.h> #include <moveit/move_group/node_name.h> static const std::string ROBOT_DESCRIPTION = "robot_description"; // name of the robot description (a param name, so it can be changed externally) namespace move_group { class MoveGroupExe { public: MoveGroupExe(const planning_scene_monitor::PlanningSceneMonitorPtr& ...

Get Mastering ROS for Robotics Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.