def update_patterns_page(dimensions_json, poses_json, relayout_data, figure): dimensions = helpers.load_params(dimensions_json, "dims") poses = helpers.load_params(poses_json, "pose") hexapod = VirtualHexapod(dimensions) try: hexapod.update(poses) except Exception as alert: return figure, helpers.make_alert_message(alert) BASE_PLOTTER.update(figure, hexapod) helpers.change_camera_view(figure, relayout_data) return figure, ""
def update_kinematics_page(dimensions_json, poses_json, relayout_data, figure): if figure is None: return BASE_FIGURE, "" dimensions = helpers.load_dimensions(dimensions_json) poses = json.loads(poses_json) hexapod = VirtualHexapod(dimensions) try: hexapod.update(poses) except Exception as alert: return figure, helpers.make_alert_message(alert) BASE_PLOTTER.update(figure, hexapod) helpers.change_camera_view(figure, relayout_data) return figure, ""
def update_inverse_page(dimensions_json, ik_parameters_json, relayout_data, figure): dimensions = helpers.load_params(dimensions_json, "dims") ik_parameters = helpers.load_params(ik_parameters_json, "ik") hexapod = VirtualHexapod(dimensions) try: poses, hexapod = inverse_kinematics_update(hexapod, ik_parameters) except Exception as alert: return figure, helpers.make_alert_message(alert) if RECOMPUTE_HEXAPOD: try: hexapod = recompute_hexapod(dimensions, ik_parameters, poses) except Exception as alert: return figure, helpers.make_alert_message(alert) BASE_PLOTTER.update(figure, hexapod) helpers.change_camera_view(figure, relayout_data) return figure, helpers.make_poses_message(poses)