def add_extra_menu()

in robogym/viewer/robot_control_viewer.py [0:0]


    def add_extra_menu(self):
        self.add_overlay(
            const.GRID_TOPRIGHT, "De[b]ug", str(self.env.unwrapped.parameters.debug)
        )
        self.add_overlay(
            const.GRID_TOPRIGHT,
            "Go backward/forward/left/right",
            "[up]/[down]/[left]/[right] arrow",
        )
        self.add_overlay(const.GRID_TOPRIGHT, "Go up/down", "[Z]/[X]")
        self.add_overlay(const.GRID_TOPRIGHT, "Open/Close gripper", "[V]/[C]")
        self.add_overlay(const.GRID_TOPRIGHT, "Rotate wrist CW/CCW", "[Q]/[W]")
        self.add_overlay(const.GRID_TOPRIGHT, "Tilt Wrist", "[Y]/[U]")
        self.add_overlay(const.GRID_TOPRIGHT, "Slow down/Speed up", "[-]/[=]")

        self.add_overlay(
            const.GRID_BOTTOMRIGHT,
            "Reset took",
            "%.2f sec." % (sum(self.elapsed) / len(self.elapsed)),
        )
        self.add_overlay(const.GRID_BOTTOMRIGHT, "Action", pretty(self._get_action()))
        self.add_overlay(
            const.GRID_BOTTOMRIGHT,
            "Control Mode",
            str(self.env.unwrapped.parameters.robot_control_params.control_mode.value),
        )
        self.add_overlay(
            const.GRID_BOTTOMRIGHT,
            "TCP Solver Mode",
            str(
                self.env.unwrapped.parameters.robot_control_params.tcp_solver_mode.value
            ),
        )
        gripper_force = self.controller.get_gripper_actuator_force()
        if gripper_force is not None:
            self.add_overlay(
                const.GRID_BOTTOMRIGHT, "Gripper Force", "%.2f" % gripper_force
            )
        # - - - - > re-grasp
        regrasp = self.controller.get_gripper_regrasp_status()
        regrasp_str = "Unknown"
        if regrasp is not None:
            regrasp_str = "ON!" if regrasp else "Off"
        self.add_overlay(const.GRID_BOTTOMRIGHT, "Gripper Auto Re-grasp", regrasp_str)
        # < - - - - re-grasp
        self.add_overlay(
            const.GRID_BOTTOMRIGHT,
            "Wrist Angle",
            str(np.rad2deg(self.env.observe()["robot_joint_pos"][5])),
        )

        if self.last_step_result:
            obs, reward, done, info = self.last_step_result
            self.add_overlay(
                const.GRID_TOPRIGHT,
                "Is goal achieved?",
                str(bool(obs["is_goal_achieved"].item())),
            )
            for k, v in info.get("goal_max_dist", {}).items():
                self.add_overlay(const.GRID_TOPRIGHT, f"max_goal_dist_{k}", f"{v:.2f}")

            if info.get("wrist_cam_contacts", {}):
                contacts = info["wrist_cam_contacts"]
                self.add_overlay(
                    const.GRID_TOPRIGHT,
                    "wrist_cam_collision",
                    str(any(contacts.values())),
                )
                active_contacts = [
                    contact_obj
                    for contact_obj, contact_st in contacts.items()
                    if contact_st
                ]
                self.add_overlay(
                    const.GRID_TOPRIGHT, "wrist_cam_contacts", str(active_contacts)
                )