ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

I think the nodes directory should be directly under the package rather than src folder. According to REP8-Style Guide for Python Code,

"The recommended layout is to put all of your package's importable Python code in the src folder of your package and in a "Python package" with the same name as your package. In this case a "Python package" is a folder which contains a __init__.py file, indicating that the folder contains additional Python packages and modules."

The src folder thus should store Python packages and modules if you want to make them importable into other ROS packages.

Also, does it matter where this file is located within the package? I've seen other places where Python files are in a dir called scripts as opposed to src.

As far as I know, technically, it does not matter where the file is located within the package since rosrun is able to find the location of the executable for a package recursively (rosrun-source code). So as long as your executable file- python script is in the directory of your ROS package (under src in the catkin workspace, since catkin_make command only looks for packages under src dir) and your local workspace is properly sourced, rosrun should be able to find that executable.

However, conventionally, according to an excerpt from REP8-Style Guide for Python Code,

"We distinguish between "nodes" and "scripts" for clarity to users. Nodes are executable Python files that conform to the ROS node API. Scripts are executable Python files that do not conform to the ROS node API."

Aslo from Installing Python scripts and modules

“Standard ROS practice is to place all executable Python programs in a package subdirectory named nodes/ or scripts/. Their usage is the same, the two names distinguish ROS nodes from other executable Python scripts.”

So I think, conventionally, an executable python script that contains ROS nodes should go to nodes folder.

I guess distinctions are the convention and good practices to make your package structure more clear.

I think the rationale that most people put python scripts into scripts folder is based on the common practice for python packages. People usually put top-level executable scripts in the /scripts (or /bin) directory and place python packages and modules (used by scripts) into the /src directory. As for the distinction between nodes and scripts, I don't really know if it's a horrible practice to not separate nodes and scripts. Tbh, personally, I've seldom seen nodes folder. My guess is perhaps people generally consider /nodes as a subset of /scripts, since scripts are any executable python scripts for any purpose.

I think the nodes directory should be directly under the package rather than src folder. According to REP8-Style Guide for Python Code,

"The recommended layout is to put all of your package's importable Python code in the src folder of your package and in a "Python package" with the same name as your package. In this case a "Python package" is a folder which contains a __init__.py file, indicating that the folder contains additional Python packages and modules."

The src folder thus should store Python packages and modules if you want to make them importable into other ROS packages.

Also, does it matter where this file is located within the package? I've seen other places where Python files are in a dir called scripts as opposed to src.

As far as I know, technically, it does not matter where the file is located within the package since rosrun is able to find the location of the executable for a package recursively (rosrun-source code). So as long as your executable file- python script is in the directory of your ROS package (under src in the catkin workspace, since catkin_make command only looks for packages under src dir) and your local workspace is properly sourced, rosrun should be able to find that executable.

However, conventionally, according to an excerpt from REP8-Style Guide for Python Code,

"We distinguish between "nodes" and "scripts" for clarity to users. Nodes are executable Python files that conform to the ROS node API. Scripts are executable Python files that do not conform to the ROS node API."

Aslo from Installing Python scripts and modules

“Standard ROS practice is to place all executable Python programs in a package subdirectory named nodes/ or scripts/. Their usage is the same, the two names distinguish ROS nodes from other executable Python scripts.”

So I think, conventionally, an executable python script that contains ROS nodes should go to nodes folder.

I guess distinctions are the convention and good practices to make your package structure more clear.

I think the rationale is that most people put python scripts into scripts folder is based on the common practice for python packages. People usually put top-level executable scripts in the /scripts (or /bin) directory and place python packages and modules (used by scripts) into the /src directory. As for the distinction between nodes and scripts, I don't really know if it's a horrible practice to not separate nodes and scripts. Tbh, personally, I've seldom seen nodes folder. My guess is perhaps people generally consider /nodes as a subset of /scripts, since scripts are any executable python scripts for any purpose.

I think the nodes directory should be directly under the package rather than src folder. According to REP8-Style Guide for Python Code,

"The recommended layout is to put all of your package's importable Python code in the src folder of your package and in a "Python package" with the same name as your package. In this case a "Python package" is a folder which contains a __init__.py file, indicating that the folder contains additional Python packages and modules."

The src folder thus should store Python packages and modules if you want to make them importable into other ROS packages.

Also, does it matter where this file is located within the package? I've seen other places where Python files are in a dir called scripts as opposed to src.

As far as I know, technically, it does not matter where the file is located within the package since rosrun is able to find the location of the executable for a package recursively (rosrun-source code). So as long as your executable file- python script is in the directory of your ROS package (under src in the catkin workspace, since catkin_make command only looks for packages under src dir) and your local workspace is properly sourced, rosrun should be able to find that executable.

However, conventionally, according to an excerpt from REP8-Style Guide for Python Code,

"We distinguish between "nodes" and "scripts" for clarity to users. Nodes are executable Python files that conform to the ROS node API. Scripts are executable Python files that do not conform to the ROS node API."

Aslo from Installing Python scripts and modules

“Standard ROS practice is to place all executable Python programs in a package subdirectory named nodes/ or scripts/. Their usage is the same, the two names distinguish ROS nodes from other executable Python scripts.”

So I think, conventionally, an executable python script that contains ROS nodes should go to nodes folder.

I guess distinctions are the convention and good practices to make your package structure more clear.

I think the rationale is that most people put python scripts into scripts folder is based on the common practice for python packages. People usually put top-level executable scripts in the /scripts scripts/ (or /bin) bin/) directory and place python packages and modules (used by scripts) into the /src src/ directory. As for the distinction between nodes and scripts, I don't really know if it's a horrible practice to not separate nodes and scripts. Tbh, personally, I've seldom seen nodes folder. My guess is perhaps people generally consider /nodes nodes/ as a subset of /scripts, scripts/, since scripts are any executable python scripts for any purpose.

I think the nodes directory should be directly under the package rather than src folder. According to REP8-Style Guide for Python Code,

"The recommended layout is to put all of your package's importable Python code in the src folder of your package and in a "Python package" with the same name as your package. In this case a "Python package" is a folder which contains a __init__.py file, indicating that the folder contains additional Python packages and modules."

The src folder thus should store Python packages and modules if you want to make them importable into other ROS packages.

Also, does it matter where this file is located within the package? I've seen other places where Python files are in a dir called scripts as opposed to src.

As far as I know, technically, it does not matter where the file is located within the package since rosrun is able to find the location of the executable for a package recursively (rosrun-source code). So as long as your executable file- python script is in the directory of your ROS package (under src in the catkin workspace, since catkin_make command only looks for packages under src dir) and your local workspace is properly sourced, rosrun should be able to find that executable.

However, conventionally, according to an excerpt from REP8-Style Guide for Python Code,

"We distinguish between "nodes" and "scripts" for clarity to users. Nodes are executable Python files that conform to the ROS node API. Scripts are executable Python files that do not conform to the ROS node API."

Aslo from Installing Python scripts and modules

“Standard ROS practice is to place all executable Python programs in a package subdirectory named nodes/ or scripts/. Their usage is the same, the two names distinguish ROS nodes from other executable Python scripts.”

So I think, conventionally, an executable python script that contains ROS nodes should go to nodes folder.

I guess distinctions are the convention and good practices to make your package structure more clear.

I think the rationale is that most people put python scripts into scripts folder is based on the common practice for python packages. People usually put top-level executable scripts in the scripts/ (or bin/) directory and place python packages and modules (used by scripts) into the src/ directory. As for the distinction between nodes and scripts, scripts for ROS, I don't really know if it's a horrible practice to not separate nodes and scripts. Tbh, personally, I've seldom seen nodes folder. My guess is perhaps people generally consider nodes/ as a subset of scripts/, since scripts are any executable python scripts for any purpose.

I think the nodes directory should be directly under the package rather than src folder. According to REP8-Style Guide for Python Code,

"The recommended layout is to put all of your package's importable Python code in the src folder of your package and in a "Python package" with the same name as your package. In this case a "Python package" is a folder which contains a __init__.py file, indicating that the folder contains additional Python packages and modules."

The src folder thus should store Python packages and modules if you want to make them importable into other ROS packages.

Also, does it matter where this file is located within the package? I've seen other places where Python files are in a dir called scripts as opposed to src.

As far as I know, technically, it does not matter where the file is located within the package since rosrun is able to find the location of the executable for a package recursively (rosrun-source code). So as long as your executable file- python script is in the directory of your ROS package (under src in the catkin workspace, since catkin_make command only looks for packages under src dir) and your local workspace is properly sourced, rosrun should be able to find that executable.

However, conventionally, according to an excerpt from REP8-Style Guide for Python Code,

"We distinguish between "nodes" and "scripts" for clarity to users. Nodes are executable Python files that conform to the ROS node API. Scripts are executable Python files that do not conform to the ROS node API."

Aslo from Installing Python scripts and modules

“Standard ROS practice is to place all executable Python programs in a package subdirectory named nodes/ or scripts/. Their usage is the same, the two names distinguish ROS nodes from other executable Python scripts.”

So I think, conventionally, an executable python script that contains ROS nodes should go to nodes folder.

I guess distinctions are the convention and good practices to make your package structure more clear.

I think the rationale is that most people put for ROS users putting python scripts into scripts folder is based on the common practice for python packages. People In Python, people usually put top-level executable scripts in the scripts/ (or bin/) directory and place python packages and modules (used by scripts) into the src/ directory. As for the distinction between nodes and scripts for in ROS, I don't really know if it's a horrible practice to not separate nodes and scripts. Tbh, personally, I've seldom seen nodes folder. My guess is perhaps people ROS users generally consider nodes/ as a subset of scripts/, since scripts are any executable python scripts for any purpose.