toddlerbot.visualization package¶
Submodules¶
toddlerbot.visualization.vis_plot module¶
- toddlerbot.visualization.vis_plot.plot_ankle_mapping(joint_limits: Dict[str, List[float]], ankle_ik: Callable[[...], List[float]], save_path: str, file_name: str = 'ankle_mapping')¶
- toddlerbot.visualization.vis_plot.plot_bar_graph(y: Any, x: Any | None = None, fig_size: Tuple[int, int] = (10, 6), legend_labels: List[str] = [], bar_colors: List[str] = [], title: str = '', x_label: str = '', y_label: str = '', save_config: bool = False, save_path: str = '', file_name: str = '', file_suffix: str = '', ax: Any | None = None, bar_width: float = 0.25, joint_labels: List[str] = [], number_font_size: int = 0)¶
- toddlerbot.visualization.vis_plot.plot_footsteps(foot_pos_list: ndarray[Any, dtype[float32]], support_leg_list: List[int], foot_size: Tuple[float, float], foot_to_com_y: float, fig_size: Tuple[int, int] = (10, 6), title: str = '', x_label: str = '', y_label: str = '', save_config: bool = False, save_path: str = '', file_name: str = '', file_suffix: str = '', ax: Any | None = None) Callable[[], None] ¶
- toddlerbot.visualization.vis_plot.plot_joint_tracking(time_seq_dict: Dict[str, List[float]], time_seq_ref_dict: Dict[str, List[float]], joint_data_dict: Dict[str, List[float]], joint_data_ref_dict: Dict[str, List[float]], joint_limits: Dict[str, List[float]], save_path: str, x_label: str = 'Time (s)', y_label: str = 'Position (rad)', file_name: str = 'motor_pos_tracking', file_suffix: str = '', title_list: List[str] = [], set_ylim: bool = False, line_suffix: List[str] = ['_obs', '_act'])¶
- toddlerbot.visualization.vis_plot.plot_joint_tracking_frequency(time_seq_dict: Dict[str, List[float]], time_seq_ref_dict: Dict[str, List[float]], joint_data_dict: Dict[str, List[float]], joint_data_ref_dict: Dict[str, List[float]], save_path: str, x_label: str = 'Frequency (Hz)', y_label: str = 'Magnitude', file_name: str = 'motor_freq_tracking', file_suffix: str = '', title_list: List[str] = [], set_ylim: bool = False, line_suffix: List[str] = ['_obs', '_ref'])¶
- toddlerbot.visualization.vis_plot.plot_joint_tracking_single(time_seq_dict: Dict[str, List[float]], joint_data_dict: Dict[str, List[float]], save_path: str, x_label: str = 'Time (s)', y_label: str = 'Velocity (rad/s)', file_name: str = 'motor_vel_tracking', file_suffix: str = '', title_list: List[str] = [], set_ylim: bool = False)¶
- toddlerbot.visualization.vis_plot.plot_line_graph(y: Any, x: Any | None = None, fig_size: Tuple[int, int] = (10, 6), legend_labels: List[str] = [], line_styles: List[str] = [], line_colors: List[str] = [], title: str = '', x_label: str = '', y_label: str = '', save_config: bool = False, save_path: str = '', file_name: str = '', file_suffix: str = '', ax: Any | None = None, checkpoint_period: List[int] = [])¶
- toddlerbot.visualization.vis_plot.plot_loop_time(loop_time_dict: Dict[str, List[float]], save_path: str, file_name: str = 'loop_time')¶
- toddlerbot.visualization.vis_plot.plot_motor_vel_tor_mapping(motor_vel_list: List[float], motor_tor_list: List[float], save_path: str, file_name: str = 'motor_vel_tor_mapping')¶
- toddlerbot.visualization.vis_plot.plot_one_footstep(ax: Axes, center: ndarray[Any, dtype[float32]], size: Tuple[float, float], angle: float, side: int)¶
- toddlerbot.visualization.vis_plot.plot_path_tracking(time_obs_list: List[float], pos_obs_list: List[ndarray[Any, dtype[float32]]], euler_obs_list: List[ndarray[Any, dtype[float32]]], control_inputs_dict: Dict[str, List[float]], save_path: str, file_name: str = 'path_tracking')¶
Plots the observed path (pos_obs_list) and the integrated path of walk commands.
- toddlerbot.visualization.vis_plot.plot_scatter_graph(y: ndarray[Any, dtype[float32]], x: ndarray[Any, dtype[float32]], colors: ndarray[Any, dtype[float32]] | str, fig_size: Tuple[int, int] = (10, 6), title: str = '', x_label: str = '', y_label: str = '', legend_label: str = '', save_config: bool = False, save_path: str = '', file_name: str = '', file_suffix: str = '', ax: Any | None = None)¶
- toddlerbot.visualization.vis_plot.plot_sim2real_gap_bar(rmse_dict: Dict[str, float], rmse_label: str, save_path: str, title: str = 'Root Mean Squared Error by Joint', x_label: str = 'Joints', y_label: str = 'Root Mean Squared Error', file_name: str = 'sim2real_gap', file_suffix: str = '')¶
- toddlerbot.visualization.vis_plot.plot_sim2real_gap_line(time_sim_list: List[float], time_real_list: List[float], data_sim: ndarray[Any, dtype[float32]], data_real: ndarray[Any, dtype[float32]], save_path: str, title: str = 'Euler Angles', x_label: str = 'Time (s)', y_label: str = 'Euler Angles (rad)', axis_names: List[str] = ['roll', 'pitch', 'yaw'], file_name: str = 'euler_gap', file_suffix: str = '')¶
- toddlerbot.visualization.vis_plot.plot_teleop_dataset(action_data: ndarray[Any, dtype[float32]], episode_ends: ndarray, save_path: str, file_name: str, file_suffix: str = '')¶
- toddlerbot.visualization.vis_plot.plot_waist_mapping(joint_limits: Dict[str, List[float]], waist_ik: Callable[[...], List[float]], save_path: str, file_name: str = 'waist_mapping')¶
toddlerbot.visualization.vis_utils module¶
- toddlerbot.visualization.vis_utils.is_x11_available()¶
Check if the X11 server is available on the system.
- Returns:
True if X11 is available, False otherwise.
- Return type:
bool
- toddlerbot.visualization.vis_utils.load_and_run_visualization(config_path: str)¶
Loads a configuration from a pickle file and executes a specified visualization function.
- Parameters:
config_path (str) – The file path to the pickle configuration file.
- Raises:
FileNotFoundError – If the configuration file does not exist or is not a pickle file.
The configuration file must contain a dictionary with the keys: - “function”: A string specifying the full path of the function to be executed. - “parameters”: A dictionary of parameters to be passed to the function.
- toddlerbot.visualization.vis_utils.make_vis_function(func: Callable[[...], Any], ax: Any | None = None, title: str = '', x_label: str = '', y_label: str = '', save_config: bool = False, save_path: str = '', file_name: str = '', file_suffix: str = '', blocking: bool = True)¶
Executes a visualization function with specified parameters and optional configuration saving.
- Parameters:
func (Callable[..., Any]) – The visualization function to execute.
ax (Any, optional) – The axes object for the plot. Defaults to None.
title (str, optional) – The title of the plot. Defaults to an empty string.
x_label (str, optional) – The label for the x-axis. Defaults to an empty string.
y_label (str, optional) – The label for the y-axis. Defaults to an empty string.
save_config (bool, optional) – Whether to save the configuration. Defaults to False.
save_path (str, optional) – The directory path to save the configuration. Defaults to an empty string.
file_name (str, optional) – The name of the file to save the configuration. Defaults to an empty string.
file_suffix (str, optional) – The suffix for the saved file. Defaults to an empty string.
blocking (bool, optional) – Whether the function call should be blocking. Defaults to True.