Extend the estimator to a robot arm
Each sample contains a timestamp and positions for seven joints. Return the seven signed velocities. Reject a sample if its joint count changes.
Make the mechanism intuitive.
Convert the positions to an immutable tuple at the boundary so a caller cannot mutate stored state.
Joint velocities do not directly equal Cartesian end-effector velocity; that conversion involves the manipulator Jacobian and is a different problem.
One decision at a time.
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.
Validate before updating state, then prove the nominal and boundary cases with deterministic tests.
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)Joint velocities do not directly equal Cartesian end-effector velocity; that conversion involves the manipulator Jacobian and is a different problem.
Finish like an engineer.
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