1. (Python & C++) What is a CMakeList? Is it related to a make file used for compiling C++ objects? If yes then what is the difference between the two?
1.What is a CMakeList?
The file CMakeLists.txt is the input to the CMake build system for building software packages. Any CMake-compliant package contains one or more CMakeLists.txt file that describe how to build the code and where to install it to. The CMakeLists.txt file used for a catkin project is a standard vanilla CMakeLists.txt file with a few additional constraints.
2.Is it related to a make file used for compiling C++ objects?
Yes,a CMakeLists.txt file is related to building C++ projects, but it serves a different purpose compared to traditional Makefiles.
3.If yes then what is the difference between the two?
While both CMakeLists.txt files and Makefiles are used for building C++ projects, CMake provides a more flexible and cross-platform approach to project configuration and generation of build files.
2. (Python & C++) Are you using CMakeList.txt for Python in ROS? Is there a executable object being created for Python?
1.Are you using CMakeList.txt for Python in ROS?
No,but in ROS, CMakeLists.txt files are primarily used for building C++ code, but they can also be used to build certain types of Python code. While Python scripts themselves are not compiled into executable binaries, CMakeLists.txt files can include directives to handle Python-related tasks such as copying Python scripts to the appropriate locations in the ROS package.
2.Is there a executable object being created for Python?
No, Python scripts are not compiled into executable objects in the same way as C++ code. Python is an interpreted language, which means that Python code is executed line by line by the Python interpreter at runtime.When you run a Python script, the interpreter reads the source code and translates it into bytecode, which is then executed by the Python virtual machine (PVM). This process happens dynamically without the need for pre-compilation into an executable object file.Therefore, in the context of Python in ROS or any other Python programming, there is no separate compilation step that produces an executable object file. Instead, the Python interpreter directly executes the source code of the script.
3. (Python & C++) In which directory would you run catkin make?
Path in the workspace.
4. (Python & C++) The following commands were used in the tutorial:
$ source / opt / ros / kinetic ( melodic )/ setup . bash
$ source devel / setup . bash
Why do we need to source setup.bash? What does it do? Why do we have to different setup.bash files here and what is there difference?
The environment variable (source devel/setup.bash) is set so that the system can find this workspace. The default Ubuntu terminal is bash. You need to set the ros environment variable in bash, preferably in the.bashrc directory in your home directory. So that when a system start to perform the source/opt/ros/kinetic/setup. The bash command, make the environment variables in the workspace can take effect, this system terminal can read ros command, perform the corresponding operation.