Beispiel #1
0
    def draw2(self): 
        j1=self.hslider1.value()
        j2=self.hslider2.value()
        j3=self.hslider3.value()
        j=fk.dh_par(j1,j2,j3)
        Tm=fk.dh_kine(j)
        ee=fk.el_xyzpos(Tm)
        p0,p1,p2,p3,p4,p5=fk.el_pos2base(Tm)
        X1,Y1,Z1=ee[0,0:3],ee[1,0:3],ee[2,0:3]
        X2,Y2,Z2=ee[0,2:4],ee[1,2:4],ee[2,2:4]
        X3,Y3,Z3=ee[0,3:5],ee[1,3:5],ee[2,3:5]
        X4,Y4,Z4=ee[0,4:6],ee[1,4:6],ee[2,4:6]

        self.MplWidget.canvas.axes.clear () 
        self.MplWidget.canvas.axes.plot (X1,Y1,Z1, color='green', marker='o', linestyle='solid', linewidth=10, markersize=20)
        self.MplWidget.canvas.axes.plot (X2,Y2,Z2, color='red', marker='o', linestyle='solid', linewidth=10, markersize=20)
        self.MplWidget.canvas.axes.plot (X3,Y3,Z3, color='blue', marker='o', linestyle='solid', linewidth=10, markersize=20)
        self.MplWidget.canvas.axes.plot (X4,Y4,Z4, color='goldenrod', marker='o', linestyle='solid', linewidth=10, markersize=20)
        x4=X4[1]
        y4=Y4[1]
        z4=Z4[1]
        self.MplWidget.canvas.axes.text(x4,y4,z4,'({:.2f}, {:.2f}, {:.2f})'.format(x4,y4,z4), weight='bold', fontsize=12,)
        self.MplWidget.canvas.axes.set_xlabel('x')
        self.MplWidget.canvas.axes.set_ylabel('y')
        self.MplWidget.canvas.axes.set_zlabel('z')
        
        self.MplWidget.canvas.axes.set_xlim([-120,120])
        self.MplWidget.canvas.axes.set_ylim([0,120])
        self.MplWidget.canvas.axes.set_zlim([0,40])
        
        #self.MplWidget.canvas.axes.legend (( 'cosinus', 'sinus' ), loc = 'upper right' ) 
        #self.MplWidget.canvas.axes.set_title ( ' Cosinus - Sinus Signal' ) 
        self.MplWidget.canvas.draw() 
Beispiel #2
0
    def drawfk(self,a,b,c): 
        j=fk.dh_par(a,b,c)
        self.Tm=fk.dh_kine(j)
        ee=fk.el_xyzpos(self.Tm)
        p0,p1,p2,p3,p4,p5=fk.el_pos2base(self.Tm)
        X1,Y1,Z1=ee[0,0:3],ee[1,0:3],ee[2,0:3]
        X2,Y2,Z2=ee[0,2:4],ee[1,2:4],ee[2,2:4]
        X3,Y3,Z3=ee[0,3:5],ee[1,3:5],ee[2,3:5]
        X4,Y4,Z4=ee[0,4:6],ee[1,4:6],ee[2,4:6]
        
        self.x4=X4[1]
        self.y4=Y4[1]
        self.z4=Z4[1]

        #self.doubleSpinBox_ik1.setValue(round(self.x4,2))
        #self.doubleSpinBox_ik2.setValue(round(self.y4,2))
        #self.doubleSpinBox_ik3.setValue(round(self.z4,2))

        self.label_x4.setText(str(round(self.x4,2)))
        self.label_y4.setText(str(round(self.y4,2)))
        self.label_z4.setText(str(round(self.z4,2)))

        self.MplWidget.canvas.axes.clear () 
        self.MplWidget.canvas.axes.plot (X1,Y1,Z1, color='green', marker='o', linestyle='solid', linewidth=5, markersize=10)
        self.MplWidget.canvas.axes.plot (X2,Y2,Z2, color='red', marker='o', linestyle='solid', linewidth=5, markersize=10)
        self.MplWidget.canvas.axes.plot (X3,Y3,Z3, color='blue', marker='o', linestyle='solid', linewidth=5, markersize=10)
        self.MplWidget.canvas.axes.plot (X4,Y4,Z4, color='purple', marker="h", linestyle='solid', linewidth=5, markersize=10)


        self.MplWidget.canvas.axes.text(self.x4,self.y4,self.z4,'({:.2f}, {:.2f}, {:.2f})'.format(self.x4,self.y4,self.z4), weight='bold', fontsize=12,)
        self.MplWidget.defcanvas()
        self.MplWidget.canvas.draw()
Beispiel #3
0
    def draw1(self): 
        j1=self.hslider1.value()
        j2=self.hslider2.value()
        j3=self.hslider3.value()
        j=fk.dh_par(j1,j2,j3)
        Tm=fk.dh_kine(j)
        ee=fk.el_xyzpos(Tm)
        p0,p1,p2,p3,p4,p5=fk.el_pos2base(Tm)
        x,y,z = ee[0,:],ee[1,:],ee[2,:]

        self.MplWidget.canvas.axes.clear () 
        self.MplWidget.canvas.axes.plot (x,y,z,marker='o', color='green', linewidth=2, markersize=0)
        self.MplWidget.canvas.axes.set_xlabel('x')
        self.MplWidget.canvas.axes.set_ylabel('y')
        self.MplWidget.canvas.axes.set_zlabel('z')
        
        self.MplWidget.canvas.axes.set_xlim([-100,100])
        self.MplWidget.canvas.axes.set_ylim([0,100])
        self.MplWidget.canvas.axes.set_zlim([0,100])
        
        #self.MplWidget.canvas.axes.legend (( 'cosinus', 'sinus' ), loc = 'upper right' ) 
        #self.MplWidget.canvas.axes.set_title ( ' Cosinus - Sinus Signal' ) 
        self.MplWidget.canvas.draw()   
Beispiel #4
0
import numpy as np
import p_fkdh as fk

j=fk.dh_par(90,60,-60)
Tm=fk.dh_kine(j)
ee=fk.el_xyzpos(Tm)
p0,p1,p2,p3,p4,p5=fk.el_pos2base(Tm)
fk.fk_draw2(ee)