Quiz#
This quiz covers the key concepts from Lecture 11: Pose Representation,
Coordinate Frames, TF2, and Mobile Robot Control. Topics include
position and orientation (Euler angles, quaternions, gimbal lock),
coordinate frames (REP 105), the TF2 transform library (static and
dynamic broadcasters, listeners, Buffer), differential drive
kinematics, odometry, and proportional controllers.
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
Which of the following correctly describes a quaternion representing no rotation (the identity)?
\((w, x, y, z) = (0, 0, 0, 0)\)
\((w, x, y, z) = (1, 0, 0, 0)\)
\((w, x, y, z) = (0, 1, 0, 0)\)
\((w, x, y, z) = (0.5, 0.5, 0.5, 0.5)\)
Answer
B – \((w, x, y, z) = (1, 0, 0, 0)\).
In the axis-angle-to-quaternion formula, a rotation angle of \(\theta = 0\) gives \(w = \cos(0) = 1\) and \((x, y, z) = \sin(0) \cdot \mathbf{u} = (0, 0, 0)\). Option A is not a valid quaternion (zero magnitude). Options C and D encode non-zero rotations.
Question 2
What is the gimbal lock problem?
A quaternion becomes invalid when its magnitude is not 1.
Two rotation axes align at certain Euler angle values, causing one degree of freedom to be lost.
The robot’s wheels lock when the angular velocity is too high.
TF2 cannot interpolate between two frames that share a parent.
Answer
B – Two rotation axes align, losing one degree of freedom.
In the Tait-Bryan ZYX convention, when pitch (\(\theta\)) reaches \(\pm 90°\), the yaw and roll axes align. The rotation matrix then depends only on the difference \((\psi - \phi)\), not on \(\psi\) and \(\phi\) independently. This makes certain orientations unreachable through smooth Euler-angle interpolation and is the primary reason ROS 2 uses quaternions instead.
Question 3
In the standard ROS 2 frame hierarchy (REP 105), which frame is locally consistent but drifts over time?
worldmapodombase_link
Answer
C – odom.
The odom frame is computed from wheel odometry and/or IMU
integration. It is locally smooth (never jumps) but accumulates
drift over time. The map frame, in contrast, may jump when a
localization correction occurs (e.g., loop closure) but is
globally consistent. world is the fixed inertial frame, and
base_link moves with the robot.
Question 4
For a differential drive robot, which fields of
geometry_msgs/msg/Twist carry meaningful values?
linear.xandlinear.ylinear.xandangular.zangular.xandangular.zlinear.x,linear.y, andangular.z
Answer
B – linear.x and angular.z.
A differential drive robot can only move forward/backward
(linear.x) and rotate about its vertical axis
(angular.z). It cannot translate sideways
(linear.y = 0) or rotate about the forward or lateral axes
(angular.x = angular.y = 0). All other fields are set to
zero.
Question 5
What does tf_buffer.lookup_transform("odom", "camera_link",
rclpy.time.Time()) return?
The transform that converts points from
odomintocamera_link.The transform that converts points from
camera_linkintoodom.The inverse of the
camera_link→odomtransform.Both B and C.
Answer
D – Both B and C.
lookup_transform(target, source, time) returns the transform
that expresses the source frame in the target frame. This
means it converts points from camera_link (source) into
odom (target). This is equivalent to the inverse of the
camera_link → odom transform, so B and C describe the
same thing.
Question 6
Which topic do static transforms publish on?
/tf/tf_static/tf_tree/transform_static
Answer
B – /tf_static.
Static transforms are published once on /tf_static and are
latched (retained for late-joining subscribers). Dynamic
transforms are published repeatedly on /tf. TF2’s Buffer
subscribes to both topics and treats them differently: static
transforms never expire, while dynamic transforms have a
configurable timeout.
Question 7
In a proportional controller, what happens to the velocity command as the robot approaches the goal?
It increases because the gain is constant.
It remains constant until the robot enters the tolerance zone.
It decreases because the error decreases.
It oscillates between positive and negative values.
Answer
C – It decreases because the error decreases.
The proportional control law is \(u = K_p \cdot e\). As the robot approaches the goal, the error \(e\) (distance or heading difference) decreases, so the commanded velocity decreases proportionally. This natural deceleration is a key property of P-control. However, with very low gains, the robot may stop short of the goal (steady-state error).
Question 8
Given wheel separation \(L\) and wheel radius \(r\), if both wheels spin at the same speed (\(v_L = v_R = v_w\)), what is the angular velocity \(\omega\)?
\(\omega = r \cdot v_w / L\)
\(\omega = 0\)
\(\omega = 2 r \cdot v_w / L\)
\(\omega = v_w / r\)
Answer
B – \(\omega = 0\).
From the differential drive kinematics: \(\omega = r(v_R - v_L) / L\). When both wheels spin at the same speed, \(v_R - v_L = 0\), so \(\omega = 0\). The robot moves in a straight line with linear velocity \(v = r(v_R + v_L) / 2 = r \cdot v_w\).
True/False#
Question 9
True or False: Quaternions \(q\) and \(-q\) represent different rotations.
Answer
False
This is the double cover property. Both \(q\) and \(-q\) map to the same 3D rotation. For example, \((0.707, 0.707, 0, 0)\) and \((-0.707, -0.707, 0, 0)\) both encode a \(90°\) rotation about the \(x\)-axis. This can cause sign-flip artifacts when interpolating or comparing quaternions.
Question 10
True or False: A StaticTransformBroadcaster should be used
for publishing the odom → base_link transform.
Answer
False
The odom → base_link transform changes continuously as the
robot moves. It must be published repeatedly on /tf using a
TransformBroadcaster. A StaticTransformBroadcaster
publishes once on /tf_static and TF2 assumes the transform is
permanent. Using it for a time-varying relationship would cause the
robot to appear frozen in RViz and break all downstream consumers.
Question 11
True or False: Quaternion multiplication is commutative.
Answer
False
Quaternion multiplication is not commutative: \(q_1 \otimes q_2 \neq q_2 \otimes q_1\) in general. The order matters because it determines which rotation is applied first. In a world-frame rotation, the new rotation is pre-multiplied; in a body-frame rotation, it is post-multiplied.
Question 12
True or False: The TF2 transform tree can contain cycles (a frame can have more than one parent).
Answer
False
The TF2 transform tree is a strict tree: every frame has
exactly one parent, and there is exactly one root frame (typically
world). Cycles are not allowed. If two broadcasters publish
conflicting parent relationships for the same frame, TF2 will
report an error. To find the transform between any two frames,
TF2 traverses up to the common ancestor and back down.
Question 13
True or False: Odometry provides a globally accurate estimate of the robot’s position.
Answer
False
Odometry integrates small incremental motions over time, so it
drifts. Small errors in each step (wheel slip, encoder
resolution, uneven terrain) accumulate, causing the estimated pose
to diverge from the true pose. This is why the odom frame is
described as “locally consistent, drift-prone.” Global accuracy
requires an additional localization source (e.g., AMCL against a
known map).
Essay Questions#
Question 14
Explain why ROS 2 uses quaternions instead of Euler angles to represent orientations. In your answer, mention gimbal lock and at least one other advantage of quaternions.
Answer
ROS 2 uses quaternions because they are singularity-free: unlike
Euler angles, which suffer from gimbal lock when two rotation axes
align (e.g., pitch at \(\pm 90°\)), quaternions can represent
any orientation without losing a degree of freedom. Additionally,
quaternions are efficient to compose (a single quaternion
multiplication vs. three matrix multiplications for Euler angles),
produce smooth interpolation (SLERP), and require only four
numbers to store a rotation. The trade-off is reduced human
intuition: reading (0.707, 0, 0, 0.707) is less intuitive
than “yaw = 90°,” which is why scipy or tf_transformations
conversion functions are commonly used.
Question 15
Describe the difference between a static and a dynamic transform in TF2. Give one concrete example of each.
Answer
A static transform describes a fixed geometric relationship
that never changes over time. It is published once on
/tf_static and is latched so that late-joining subscribers
receive it immediately. Example: the offset from base_link to
a rigidly mounted LiDAR (lidar_link).
A dynamic transform describes a relationship that changes over
time and must be re-published continuously on /tf. Example:
the odom → base_link transform, which updates as the
robot moves based on odometry data.
Using a StaticTransformBroadcaster for a dynamic relationship
is incorrect because TF2 treats static transforms as permanent
and will not update or expire them.
Question 16
A proportional controller drives a robot toward a goal 5 m away with gain \(K_p = 0.5\,\text{s}^{-1}\). Explain what happens to the velocity at each step and identify one limitation of using only a P controller for this task.
Answer
At each control step, the velocity command is \(v = K_p \cdot d = 0.5 \times d\), where \(d\) is the remaining distance. Initially \(v = 0.5 \times 5 = 2.5\) m/s; as the robot moves closer, \(d\) decreases and so does \(v\). The robot decelerates smoothly as it approaches the goal.
A key limitation is steady-state error: if external disturbances (wheel slip, friction) oppose the motion, the small velocity near the goal may not overcome them, causing the robot to stop slightly before the target. A PID controller adds an integral term to eliminate this residual error and a derivative term to reduce overshoot.