Hint: Use roslaunch with package and .launch file name [OK]
Common Mistakes:
Using rosrun instead of roslaunch for launch files
Swapping package and file names
Adding .py extension to launch files
3. Given this simplified ROS node code snippet for pick and place:
def pick_place():
detected = detect_object()
if detected:
plan = plan_motion()
if plan:
execute_motion()
return 'Success'
return 'Failed'
What will be the output if detect_object() returns False?
medium
A. 'Success'
B. None
C. RuntimeError
D. 'Failed'
Solution
Step 1: Analyze detect_object() return
If detect_object() returns False, the first if condition fails.
Step 2: Follow code flow on False
Since detected is False, the function skips planning and execution, returning 'Failed'.
Final Answer:
'Failed' -> Option D
Quick Check:
detect_object False means return 'Failed' [OK]
Hint: If detection fails, function returns 'Failed' immediately [OK]
Common Mistakes:
Assuming execution still runs when detection is False
Confusing return values with exceptions
Ignoring the if condition structure
4. You wrote a pick and place ROS node but it crashes with 'AttributeError: module has no attribute detect_object'. What is the likely cause?
medium
A. The detect_object function has a syntax error
B. You forgot to import the module that defines detect_object
C. ROS master is not running
D. The robot hardware is disconnected
Solution
Step 1: Understand AttributeError meaning
This error means the code tries to use detect_object but it is not found in the module.
Step 2: Identify common cause
Usually, this happens if the module defining detect_object was not imported properly.
Final Answer:
You forgot to import the module that defines detect_object -> Option B
Quick Check:
AttributeError often means missing import [OK]
Hint: Check imports first when AttributeError occurs [OK]
Common Mistakes:
Assuming syntax error causes AttributeError
Blaming ROS master or hardware for code attribute errors
Ignoring import statements
5. In a pick and place pipeline, you want to add a feature that retries motion planning up to 3 times if planning fails. Which approach fits best in ROS node design?
hard
A. Use a loop inside the planning function to retry planning before returning
B. Restart the entire ROS node each time planning fails
C. Ignore planning failure and proceed to execute motion anyway
D. Use a separate node to handle retries and communicate via topics
Solution
Step 1: Understand retry logic placement
Retrying planning is best handled inside the planning function to keep logic clear and local.
Step 2: Evaluate other options
Restarting nodes or ignoring failures are poor design; separate node adds unnecessary complexity.
Final Answer:
Use a loop inside the planning function to retry planning before returning -> Option A
Quick Check:
Retry logic inside planning function = Use a loop inside the planning function to retry planning before returning [OK]
Hint: Retry inside function, not by restarting nodes [OK]
Common Mistakes:
Restarting nodes wastes resources
Ignoring failure causes errors
Overcomplicating with extra nodes
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.