Quiz#
This quiz covers the key concepts from Lecture 12: Namespaces, Remapping, and Behavior Trees. Topics include namespace isolation, node/topic/parameter remapping, behavior tree composites (Sequence, Selector), decorators, conditions, actions, and the tick mechanism.
Note
Instructions:
Answer all questions to the best of your ability.
Multiple choice questions have exactly one correct answer.
True/False questions require you to determine if the statement is correct.
Essay questions require short written responses (2-4 sentences).
Click the dropdown after each question to reveal the answer.
Multiple Choice#
Question 1
A ROS 2 node publishes on the topic image_raw (relative name).
You launch it with --ros-args -r __ns:=/front. What is the
fully-qualified topic name?
/image_raw/front/image_raw/front/camera_node/image_rawimage_raw
Answer
B – /front/image_raw.
A namespace prefixes all relative names. Since image_raw
does not start with /, the namespace /front is prepended.
Absolute names (starting with /) are not affected.
Question 2
In a behavior tree, what does a Sequence node do when one of its children returns FAILURE?
It continues ticking the remaining children.
It immediately returns FAILURE without ticking remaining children.
It retries the failed child.
It returns RUNNING.
Answer
B – It immediately returns FAILURE.
A Sequence node (logical AND) fails as soon as any child fails. It does not tick the remaining children.
Question 3
In py_trees, what is the difference between a Selector and
a Sequence?
A Selector ticks children in reverse order.
A Selector succeeds on the first child SUCCESS; a Sequence succeeds only if all children succeed.
A Selector always returns RUNNING.
There is no difference; they are aliases.
Answer
B – A Selector (Fallback) succeeds on the first SUCCESS (logical OR). A Sequence succeeds only if all children succeed (logical AND).
Question 4
What does a py_trees.decorators.Timeout decorator do?
It makes the child node tick faster.
It returns FAILURE if the child is still RUNNING after a set duration.
It retries the child on FAILURE.
It converts SUCCESS to RUNNING.
Answer
B – Returns FAILURE if the child is still RUNNING after the configured duration. This is used to detect when a navigation or driving action is taking too long.
Question 5
What does memory=False mean on a py_trees Sequence?
The Sequence forgets which child was running and re-evaluates all children from the beginning on every tick.
The Sequence caches the last result and never re-ticks children.
The Sequence uses less RAM.
The Sequence does not store any internal state.
Answer
A – With memory=False, the Sequence is reactive: it
starts from the first child on every tick. This means condition
nodes are re-checked each tick, allowing the tree to react
immediately to changes (e.g., goal reached, battery low).
Question 6
You run the same executable twice in the same namespace without remapping the node name. What happens?
Both nodes run normally.
The second node fails to start because the name is already taken.
Both nodes share the same publishers and subscribers.
ROS 2 automatically assigns unique names.
Answer
B – The second node fails because every node in a ROS 2 system
must have a unique name. Use --ros-args -r __node:=new_name or
the name argument in a launch file to resolve this.
True/False#
Question 7
A namespace affects absolute topic names (those starting with
/).
Answer
False – Namespaces only affect relative names. Absolute names bypass the namespace entirely.
Question 8
A condition node in a behavior tree should never return RUNNING.
Answer
True – Condition nodes must give an instantaneous yes/no answer: SUCCESS or FAILURE. Only action nodes return RUNNING.
Question 9
A py_trees Selector with memory=True always starts from the
first child on every tick.
Answer
False – With memory=True, the Selector remembers which
child was last ticked. If a child returned FAILURE, the Selector
resumes from the next child on the following tick, rather than
starting over.
Essay Questions#
Question 10
Explain the difference between a namespace and remapping in ROS 2. When would you use one over the other?
Answer
A namespace is a bulk operation that prepends a prefix to all
relative names (topics, services, parameters) associated with a
node. It is used to isolate multiple instances of the same node
(e.g., three cameras). Remapping is a surgical operation that
changes one specific name (e.g., redirecting image_raw to
/sensors/front/image). Use namespaces first for isolation, then
remapping to fine-tune individual names that the namespace alone
does not handle correctly.
Question 11
In the bt_demo behavior tree, the root Sequence uses
memory=False while the Selector (DriveOrRecover) uses
memory=True. Explain why each choice is appropriate.
Answer
The root Sequence uses memory=False so that the
GoalNotReached? condition is re-evaluated on every tick.
This makes the tree reactive: the moment the robot reaches the
goal, the condition returns FAILURE and the Sequence stops
immediately. The Selector uses memory=True so that once
DriveForward times out (FAILURE), the Selector stays on the Spin
recovery child rather than retrying DriveForward immediately on the
next tick. Spin runs until it reaches the target yaw (SUCCESS),
then the Selector resets and gives DriveForward a fresh attempt.