state_space_response_viz

RViz playback of RobotTrajectory files. See the guide for the ROS interface table.

playback — the transport state machine

PlaybackClock: the transport state machine, independent of ROS and UI.

Answers exactly one question — “what simulation time is it?” — as a pure function of an injected wall-clock reading, so it is unit-testable with fake clocks and shared conceptually with the JS twin in the setup assistant. Every mutation (play, pause, seek, speed change) rebases the (wall_anchor, sim_anchor) pair, so a speed change never makes the cursor jump and dropped ticks never accumulate error.

class state_space_response_viz.playback.PlaybackClock(duration: float, *, speed: float = 1.0, loop: bool = False, t0: float = 0.0)[source]

Bases: object

property speed: float
property t_end: float
now(wall: float) float[source]

Current simulation time; advances state on end-of-trajectory.

play(wall: float) None[source]
pause(wall: float) None[source]
reset() None[source]
seek(t_sim: float, wall: float) None[source]

Jump the cursor; playing stays playing, paused stays paused.

set_speed(speed: float, wall: float) None[source]

renderers — TrajectoryRenderer interface

TrajectoryRenderer: put a sampled RobotFrame on a screen.

The playback engine operates on frames and delegates to whichever renderers are active — how a frame becomes pixels (JointState + TF for RViz, setJointValue for the web viewer, an encoder for video export) is an implementation detail hidden behind render(frame). Renderers hold transport handles created in setup; they are stateless between frames.

class state_space_response_viz.renderers.TrajectoryRenderer[source]

Bases: object

Interface: setup once before playback, render per frame.

setup(traj: RobotTrajectory) None[source]
render(frame: RobotFrame) None[source]
class state_space_response_viz.renderers.RVizRenderer(node, *, joint_states_topic: str = 'joint_states', base_frame: str = 'base_link', world_frame: str = 'world')[source]

Bases: TrajectoryRenderer

Renders frames into RViz by publishing sensor_msgs/JointState (and a world→base TF when the trajectory carries a base pose). Those transport details stay invisible above this class.

Mimic joints are intentionally absent from trajectories — robot_state_publisher derives them from the URDF.

setup(traj: RobotTrajectory) None[source]
render(frame: RobotFrame) None[source]

player_node — the response_player node

response_player: RobotTrajectory playback node.

Pure composition — PlaybackClock (what time is it?) × FrameSampler (what does the robot look like then?) × TrajectoryRenderer (put it on screen). The node itself only wires transport control to the clock:

ros2 run state_space_response_viz response_player –ros-args -p trajectory:=/path/to/trajectory.npz

ros2 service call /response_player/pause std_srvs/srv/Trigger ros2 param set /response_player speed 0.5 ros2 param set /response_player seek 1.25

class state_space_response_viz.player_node.ResponsePlayer(*args: Any, **kwargs: Any)[source]

Bases: Node

state_space_response_viz.player_node.main(args=None)[source]