def change_theta(self): joint_num = self.joint_menu.currentIndex() joint = Robot.return_joint(joint_num) text = self.theta_input.text() joint.theta = float(text if text != "" else 0) Robot.update_joint(joint_num) self.openGLWidget.update()
def switch_joint(self): i = self.joint_menu.currentIndex() self.alpha_input.setText(str(Robot.return_joint(i).alpha)) self.a_input.setText(str(Robot.return_joint(i).a)) self.d_input.setText(str(Robot.return_joint(i).d)) self.theta_input.setText(str(Robot.return_joint(i).theta)) self.d_var.setChecked(Robot.return_joint(i).d_var) self.theta_var.setChecked(Robot.return_joint(i).theta_var)
def change_theta_var(self): theta_on = self.theta_var.isChecked() Robot.return_joint(self.joint_menu.currentIndex()).theta_var = theta_on if theta_on: self.d_var.setChecked(False) self.openGLWidget.update()
def remove_joint(self): if Robot.remove_joint(self.joint_menu.currentIndex()): self.joint_menu.removeItem(self.joint_menu.count() - 1) self.switch_joint()
def pop_joint(self): if Robot.pop_joint(): self.joint_menu.removeItem(self.joint_menu.count() - 1)
def insert_joint(self): if Robot.insert_joint(self.joint_menu.currentIndex()): self.joint_menu.addItem(str(Robot.len - 1)) self.joint_menu.setCurrentIndex(self.joint_menu.currentIndex() + 1)
def append_joint(self): if Robot.append_joint(): self.joint_menu.addItem(str(Robot.len - 1)) self.joint_menu.setCurrentIndex(Robot.len - 2)
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file '.\Prototyp2.ui' # # Created by: PyQt5 UI code generator 5.15.2 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import QtCore, QtWidgets from CoordSys import Robot from GLWidget import GLWidget Robot = Robot() class Ui_MainWindow(object): def setupUi(self, glFormat, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(1200, 900) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) MainWindow.setMinimumSize(QtCore.QSize(0, 0)) MainWindow.setMaximumSize(QtCore.QSize(1920, 1080)) self.centralwidget = QtWidgets.QWidget(MainWindow)