• Home
    • Site Map
    • reveal
    • blog
  • about
  • 2人分組作業
    • 設計理念
    • 自動吹笛子機
    • 程式模擬
  • 4人分組作業
    • 多功能腳踏車衝擊測試機
      • 1.腳踏車架衝擊測試
      • 2.前叉衝擊測試
      • 3.踏板衝擊測試
      • 4.登山車輪組能量吸收測試
    • 0319 繪圖
    • 成品
  • 8人分組作業
    • 機械手臂
      • 繪圖成果
  • 影片
    • 第一周
    • 第二周
    • 第四周
    • 第五周
    • 第六周
    • 第七周
    • 第九周
    • 第九周2
  • 小組直播影片
    • 第11週
    • 第13週
    • 第15週
  • 討論
    • 2人分組討論
    • 4人分組討論
      • 第一次
      • 第二次
    • 8人分組討論
      • 8人討論第一次
      • 8人討論第二次
      • 8人討論第三次
      • 8人討論第四次
      • 8人討論第五次
      • 8人討論第六次
      • 8人討論第七次
  • 遇到的問題
    • blog
    • reveal
  • W5
  • w16

40823225 cd2021

  • Home
    • Site Map
    • reveal
    • blog
  • about
  • 2人分組作業
    • 設計理念
    • 自動吹笛子機
    • 程式模擬
  • 4人分組作業
    • 多功能腳踏車衝擊測試機
      • 1.腳踏車架衝擊測試
      • 2.前叉衝擊測試
      • 3.踏板衝擊測試
      • 4.登山車輪組能量吸收測試
    • 0319 繪圖
    • 成品
  • 8人分組作業
    • 機械手臂
      • 繪圖成果
  • 影片
    • 第一周
    • 第二周
    • 第四周
    • 第五周
    • 第六周
    • 第七周
    • 第九周
    • 第九周2
  • 小組直播影片
    • 第11週
    • 第13週
    • 第15週
  • 討論
    • 2人分組討論
    • 4人分組討論
      • 第一次
      • 第二次
    • 8人分組討論
      • 8人討論第一次
      • 8人討論第二次
      • 8人討論第三次
      • 8人討論第四次
      • 8人討論第五次
      • 8人討論第六次
      • 8人討論第七次
  • 遇到的問題
    • blog
    • reveal
  • W5
  • w16
自動吹笛子機 << Previous Next >> 4人分組作業

程式模擬

Stage1-bg6自動吹笛子機remoteApi

控制:

f,d,s,j,k,l分別控制六根不同的桿子往下

r,e,w,u,i,o控制六根桿子往上

此為40823214製作

下載

吹笛子程式.rar

自動吹笛子remoteApi.ttt

參考影片

程式參考

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import sim as vrep
import math
import random
import time
import keyboard
import math
#from winsound import Beep
 
  
print ('Start')
  
 
vrep.simxFinish(-1)
 
clientID = vrep.simxStart('127.0.0.1', 19997, True, True, 5000, 5)
  
if clientID != -1:
    print ('Connected to remote API server')
      
    res = vrep.simxAddStatusbarMessage(
        clientID, "test-25",
        vrep.simx_opmode_oneshot)
    if res not in (vrep.simx_return_ok, vrep.simx_return_novalue_flag):
        print("Could not add a message to the status bar.")
  
     
    opmode = vrep.simx_opmode_oneshot_wait
    STREAMING = vrep.simx_opmode_streaming
  
     
    vrep.simxStartSimulation(clientID, opmode)
    ret,joint1=vrep.simxGetObjectHandle(clientID,"Revolute3_1",opmode)
    ret,joint2=vrep.simxGetObjectHandle(clientID,"Revolute3_2",opmode)
    ret,joint3=vrep.simxGetObjectHandle(clientID,"Revolute3_3",opmode)
    ret,joint4=vrep.simxGetObjectHandle(clientID,"Revolute3_4",opmode)
    ret,joint5=vrep.simxGetObjectHandle(clientID,"Revolute3_5",opmode)
    ret,joint6=vrep.simxGetObjectHandle(clientID,"Revolute3_6",opmode)
 
    ret,joint01=vrep.simxGetObjectHandle(clientID,"joint0_1",opmode)
    ret,joint02=vrep.simxGetObjectHandle(clientID,"joint0_2",opmode)
    ret,joint03=vrep.simxGetObjectHandle(clientID,"joint0_3",opmode)
    ret,joint04=vrep.simxGetObjectHandle(clientID,"joint0_4",opmode)
    ret,joint05=vrep.simxGetObjectHandle(clientID,"joint0_5",opmode)
    ret,joint06=vrep.simxGetObjectHandle(clientID,"joint0_6",opmode)
 
    degr=-12*math.pi/180
    py=0.05
    set1=False
    set2=False
    set3=False
    set4=False
    set5=False
    set6=False
 
    vrep.simxSetJointTargetPosition(clientID,joint1,0,opmode)
    vrep.simxSetJointTargetPosition(clientID,joint01,0,opmode)
    vrep.simxSetJointTargetPosition(clientID,joint2,0,opmode)
    vrep.simxSetJointTargetPosition(clientID,joint02,0,opmode)
    vrep.simxSetJointTargetPosition(clientID,joint3,0,opmode)
    vrep.simxSetJointTargetPosition(clientID,joint03,0,opmode)
    vrep.simxSetJointTargetPosition(clientID,joint4,0,opmode)
    vrep.simxSetJointTargetPosition(clientID,joint04,0,opmode)
    vrep.simxSetJointTargetPosition(clientID,joint5,0,opmode)
    vrep.simxSetJointTargetPosition(clientID,joint05,0,opmode)
    vrep.simxSetJointTargetPosition(clientID,joint6,0,opmode)
    vrep.simxSetJointTargetPosition(clientID,joint06,0,opmode)
 
    while True:
         
        if keyboard.is_pressed("f"):
            if set1==False:
                vrep.simxSetJointTargetPosition(clientID,joint1,degr,opmode)
                vrep.simxSetJointTargetPosition(clientID,joint01,py,opmode)
                set1=True
        if keyboard.is_pressed("d"):
            if set2==False:
                vrep.simxSetJointTargetPosition(clientID,joint2,degr,opmode)
                vrep.simxSetJointTargetPosition(clientID,joint02,py,opmode)
                set2=True
        if keyboard.is_pressed("s"):
            if set3==False:
                vrep.simxSetJointTargetPosition(clientID,joint3,degr,opmode)
                vrep.simxSetJointTargetPosition(clientID,joint03,py,opmode)
                set3=True
        if keyboard.is_pressed("j"):
            if set4==False:
                vrep.simxSetJointTargetPosition(clientID,joint4,degr,opmode)
                vrep.simxSetJointTargetPosition(clientID,joint04,py,opmode)
                set4=True
        if keyboard.is_pressed("k"):
            if set5==False:
                vrep.simxSetJointTargetPosition(clientID,joint5,degr,opmode)
                vrep.simxSetJointTargetPosition(clientID,joint05,py,opmode)
                set5=True
        if keyboard.is_pressed("l"):
            if set6==False:
                vrep.simxSetJointTargetPosition(clientID,joint6,degr,opmode)
                vrep.simxSetJointTargetPosition(clientID,joint06,py,opmode)
                set6=True
 
         
        if keyboard.is_pressed("r"):
            if set1==True:
                vrep.simxSetJointTargetPosition(clientID,joint1,0,opmode)
                vrep.simxSetJointTargetPosition(clientID,joint01,0,opmode)
                set1=False
        if keyboard.is_pressed("e"):
            if set2==True:
                vrep.simxSetJointTargetPosition(clientID,joint2,0,opmode)
                vrep.simxSetJointTargetPosition(clientID,joint02,0,opmode)
                set2=False
        if keyboard.is_pressed("w"):
            if set3==True:
                vrep.simxSetJointTargetPosition(clientID,joint3,0,opmode)
                vrep.simxSetJointTargetPosition(clientID,joint03,0,opmode)
                set3=False
        if keyboard.is_pressed("u"):
            if set4==True:
                vrep.simxSetJointTargetPosition(clientID,joint4,0,opmode)
                vrep.simxSetJointTargetPosition(clientID,joint04,0,opmode)
                set4=False
        if keyboard.is_pressed("i"):
            if set5==True:
                vrep.simxSetJointTargetPosition(clientID,joint5,0,opmode)
                vrep.simxSetJointTargetPosition(clientID,joint05,0,opmode)
                set5=False
        if keyboard.is_pressed("o"):
            if set6==True:
                vrep.simxSetJointTargetPosition(clientID,joint6,0,opmode)
                vrep.simxSetJointTargetPosition(clientID,joint06,0,opmode)
                set6=False
         
        #if(set1==true ):
            #Beep(422, 3000)
         
  
  
else:
    print ('Failed connecting to remote API server')
    print ('End')


自動吹笛子機 << Previous Next >> 4人分組作業

Copyright ©2025 All rights reserved | This template is made with by Colorlib