SERVO INTERVIEW LAB
01 / 05
Question 4 · understand first

Extend the estimator to a robot arm

THE JOB

Each sample contains a timestamp and positions for seven joints. Return the seven signed velocities. Reject a sample if its joint count changes.

inputsoutputunitsinvalid data
SERVO INTERVIEW LAB
02 / 05
Mental model

Make the mechanism intuitive.

01

Convert the positions to an immutable tuple at the boundary so a caller cannot mutate stored state.

→
02

Joint velocities do not directly equal Cartesian end-effector velocity; that conversion involves the manipulator Jacobian and is a different problem.

SERVO INTERVIEW LAB
03 / 05
Derive the answer

One decision at a time.

STEP 1

Clarify whether the interviewer wants per-joint velocities, speed magnitudes, or end-effector velocity.

→
STEP 2

Joint velocities do not directly equal Cartesian end-effector velocity; that conversion involves the manipulator Jacobian and is a different problem.

→
STEP 3

Validate before updating state, then prove the nominal and boundary cases with deterministic tests.

SERVO INTERVIEW LAB
04 / 05
Python walkthrough

Make the contract visible in code.

class JointVelocityEstimator:
    def __init__(self, joint_count: int) -> None:
        if joint_count <= 0:
            raise ValueError("joint_count must be positive")
        self.joint_count = joint_count
        self.previous: tuple[float, tuple[float, ...]] | None = None

    def update(self, timestamp: float, positions: list[float]) -> tup…
        current = tuple(positions)
        if len(current) != self.joint_count:
            raise ValueError(
                f"expected {self.joint_count} joints, got {len(curren…
            )
        if self.previous is None:
            self.previous = (timestamp, current)
KEY INVARIANT

Joint velocities do not directly equal Cartesian end-effector velocity; that conversion involves the manipulator Jacobian and is a different problem.

validate → calculate → update
SERVO INTERVIEW LAB
05 / 05
Prove + communicate

Finish like an engineer.

normal example
boundary case
invalid input
INTERVIEW CLOSE

Clarify whether the interviewer wants per-joint velocities, speed magnitudes, or end-effector velocity. Joint velocities do not directly equal Cartesian end-effector velocity; that conversion involves the manipulator Jacobian and is a different problem.

invariant · policy · complexity · next step