Hi,
I see in documents, you usually put python code in the scripts folder instead of the src folder.
Could you share the reason why you do it?
Is it a way to organize folder in reality?
Hi,
I see in documents, you usually put python code in the scripts folder instead of the src folder.
Could you share the reason why you do it?
Is it a way to organize folder in reality?
Yes, it’s an attempt to organize folders in reality, but can you give a specific example for better context?
No, I am a newbie. I just wonder if you will organize folders as same as the course in reality. And in reality, what will you organize? and Why?
Don’t bother so much about this now, just keep learning. You will be able to figure it out along the line, as you increase your learning.
Let me explain how we manage ROS workspace
In ROS (Robot Operating System), the convention of separating code into different folders within a ROS workspace, such as src and scripts , is a matter of organization and helps to maintain a clean project structure. While these conventions are not strictly enforced by ROS itself, they are widely adopted by the ROS community for clarity and consistency.
Here’s a brief explanation of the common usage of the src and scripts folders:
So this is how we maintain our ROS workspace
Regards
Raunak Abhani
Yeah, your question is valid. Before doing my course of ROS2 python, I was also very inconsistent with the placement of python script file, my mission was just to make the package work correctly. So I also had difficulty adopting this method. But so far it worked perfect, so I just got along with it.
So your question was
I see in documents, you usually put python code in the scripts folder instead of the src folder.
Could you share the reason why you do it?
Is it a way to organize folder in reality?
Actually, this is a convention that has been adopted by the ROS community for organizational purposes.
The src
directory is typically used for C++ source files, while the scripts
directory is used for Python scripts.
But yes, you can place your script file wherever u like.
But the exercise given for quiz will have some restrictions. Like, it will require that you have named the package, launch file and executable node as specified. Also, the gradebot checks that you have placed all the files in their respective places. Otherwise, it can fail your quiz. You know bots, they have clear instructions. So if you want to save time and don’t want to waste your attempt count due to such a minute error, then just follow the format given in the examples.
Also an advice, do keep in mind the grading steps given in the quiz instructions. The gradebot checks your package step by step, and if any step fails, then the following steps would be skipped and attempted would be wasted.
Hope it helps u around the course.
Regards,
Awais Adis
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.