A ROS workspace is a folder where you build and organize your ROS packages. It helps keep your projects separate and manageable.
Click to reveal answer
beginner
Name the three main folders inside a typical ROS workspace.
The three main folders are: 1. src - where your packages live 2. build - where build files are generated 3. devel - where development setup files are stored
Click to reveal answer
beginner
What is a ROS package?
A ROS package is a folder that contains code, data, and configuration files for a specific functionality or robot feature. It is the basic unit of organization in ROS.
Click to reveal answer
beginner
What important file must every ROS package have?
Every ROS package must have a package.xml file. It describes the package, its dependencies, and metadata.
Click to reveal answer
beginner
Why do we use the src folder inside a ROS workspace?
The src folder holds all the ROS packages you create or clone. It keeps your source code organized and ready for building.
Click to reveal answer
Which folder in a ROS workspace contains your source code packages?
Ainstall
Bbuild
Cdevel
Dsrc
✗ Incorrect
The src folder is where all your ROS packages and source code live.
What file describes a ROS package and its dependencies?
Apackage.xml
BCMakeLists.txt
CREADME.md
Dsetup.py
✗ Incorrect
The package.xml file contains metadata and dependency info for a ROS package.
What is the purpose of the build folder in a ROS workspace?
AStore source code
BStore build files generated during compilation
CStore runtime logs
DStore installed packages
✗ Incorrect
The build folder holds files created when compiling your packages.
Which folder contains setup files to use your workspace environment?
Asrc
Bbuild
Cdevel
Dinstall
✗ Incorrect
The devel folder contains setup files to configure your shell to use the workspace.
Why do we organize code into packages in ROS?
ATo separate different functionalities and manage dependencies easily
BTo make the workspace bigger
CTo avoid using version control
DTo run code faster
✗ Incorrect
Packages help keep code organized by functionality and manage dependencies clearly.
Explain the structure of a ROS workspace and the role of its main folders.
Think about where you put your code, where the computer builds it, and where it keeps environment info.
You got /3 concepts.
Describe what a ROS package is and what essential files it contains.
A package is like a small project inside your workspace.
You got /3 concepts.
Practice
(1/5)
1. What is the main purpose of a ROS workspace?
easy
A. To organize multiple ROS packages and build them together
B. To store robot hardware components physically
C. To run ROS nodes directly without packages
D. To replace the operating system for robots
Solution
Step 1: Understand what a ROS workspace is
A ROS workspace is a directory where you keep your ROS packages organized and ready to build.
Step 2: Identify the workspace role
The workspace allows you to build all packages together and manage dependencies easily.
Final Answer:
To organize multiple ROS packages and build them together -> Option A
Quick Check:
Workspace = Organize and build packages [OK]
Hint: Workspace groups packages for building and management [OK]
Common Mistakes:
Confusing workspace with physical robot parts
Thinking workspace runs nodes directly
Assuming workspace replaces OS
2. Which file must every ROS package contain to define its metadata?
easy
A. package.xml
B. CMakeLists.txt
C. README.md
D. setup.py
Solution
Step 1: Identify metadata files in ROS packages
Every ROS package must have a package.xml file that describes the package name, version, dependencies, and other metadata.
Step 2: Differentiate from build files
CMakeLists.txt is for build instructions, not metadata. README.md is documentation, and setup.py is for Python packages but not mandatory in ROS.
Final Answer:
package.xml -> Option A
Quick Check:
Metadata file = package.xml [OK]
Hint: Metadata always in package.xml file [OK]
Common Mistakes:
Confusing CMakeLists.txt with metadata
Thinking README.md defines package info
Assuming setup.py is mandatory for all packages
3. Given a ROS workspace with packages pkg1 and pkg2, what happens after running colcon build and then source install/setup.bash?
medium
A. The packages are deleted from the workspace
B. Only pkg1 is built and pkg2 is ignored
C. The workspace is built and environment is set to use the packages
D. The ROS master node starts automatically
Solution
Step 1: Understand colcon build role
This command builds all packages in the workspace, compiling code and preparing install files.
Step 2: Understand source install/setup.bash role
This command sets environment variables so ROS can find and use the newly built packages.
Final Answer:
The workspace is built and environment is set to use the packages -> Option C
Quick Check:
Build + source = ready to use packages [OK]
Hint: Build then source to use packages in ROS [OK]
Common Mistakes:
Thinking only one package builds
Assuming packages get deleted after build
Believing ROS master starts automatically
4. You created a new package inside your ROS workspace but forgot to run colcon build. What problem will you face?
medium
A. The package will run but with errors
B. The package will build automatically when you run any node
C. The package will be deleted from the workspace
D. ROS will not recognize the new package when you try to use it
Solution
Step 1: Understand build necessity
ROS requires running colcon build to compile and register new packages in the workspace environment.
Step 2: Consequence of skipping build
If you skip building, ROS environment does not know about the new package, so it cannot find or use it.
Final Answer:
ROS will not recognize the new package when you try to use it -> Option D
Quick Check:
Build missing = package not recognized [OK]
Hint: Always build after adding new packages [OK]
Common Mistakes:
Assuming packages build automatically
Thinking package deletion happens without build
Believing package runs with errors without build
5. You want to add a new ROS package that depends on an existing package std_msgs. Which steps correctly update your workspace to include this dependency?
hard
A. Run rosdep install std_msgs without modifying any files
B. Add std_msgs to package.xml dependencies, update CMakeLists.txt, then run colcon build
C. Delete package.xml and create a new one with std_msgs listed
D. Only add std_msgs to README.md and run colcon build
Solution
Step 1: Add dependency in package.xml
You must declare std_msgs as a dependency in package.xml so ROS knows your package needs it.
Step 2: Update CMakeLists.txt for build
Modify CMakeLists.txt to find and link std_msgs during build.
Step 3: Build workspace
Run colcon build to compile your package with the new dependency.
Final Answer:
Add std_msgs to package.xml dependencies, update CMakeLists.txt, then run colcon build -> Option B