Loading the lesson...
In the print dialog, choose "Save as PDF" as the destination.
Understanding how ROS organizes code, messages, and configuration
my_ros_package/
├── CMakeLists.txt
├── package.xml
├── launch/
├── src/
├── include/
├── msg/
├── srv/
├── scripts/
└── config/CMakeLists.txt and package.xmlCMakeLists.txtCMake, ROS's build system. It defines how to compile and link code, which dependencies to include, and how to generate messages and services.package.xmlsrc/, include/, scripts/#include <ros/ros.h>
int main(int argc, char **argv) {
ros::init(argc, argv, "my_node");
ros::NodeHandle nh;
ROS_INFO("Node is running");
ros::spin();
return 0;
}src/C++ or Python.include/C++ projects.scripts/Python scripts and tools.msg/ and srv/msg/int32 field named data.srv/launch/ and config/launch/XML and help manage large, multi-node robot systems.config/YAML, used to pass parameters to nodes.catkin_create_pkg my_ros_package roscpp rospy std_msgs
cd ~/catkin_ws
catkin_make
rosrun my_ros_package my_node
roslaunch my_ros_package my_robot.launchmkdir ros_ws && cd ros_ws && mkdir src
catkin_make
cd src && catkin_create_pkg helloworld_pkg roscpp rospy std_msgs
source devel/setup.bash
rosrun helloworld_pkg publisher_node
rosrun helloworld_pkg subscriber_nodecatkin workspace with a src/ folder, then build it once with catkin_makesrc/ with catkin_create_pkgcatkin_makedevel/setup.bash after every build is critical, skip it and new packages won't be foundrosrun to see them communicateCMakeLists.txt and package.xml define how a package builds and what it depends onmsg/ and srv/ define custom communication types for topics and serviceslaunch/ files start multiple nodes together; config/ holds their YAML parameterscatkin_create_pkg, catkin_make, and rosrun/roslaunch form the core package workflowMahmoud Abas|Structure of a ROS Package