first working version
This commit is contained in:
		
							
								
								
									
										3
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								Dockerfile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					FROM python:3.7
 | 
				
			||||||
 | 
					RUN apt update && apt install -y libsm6 libxext6 ffmpeg libfontconfig1 libxrender1 libgl1-mesa-glx iputils-ping
 | 
				
			||||||
 | 
					RUN python -m pip install robomaster Pillow myqr
 | 
				
			||||||
							
								
								
									
										2
									
								
								build.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								build.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					# build the docker container
 | 
				
			||||||
 | 
					docker build . -t robomaster
 | 
				
			||||||
							
								
								
									
										3
									
								
								run.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										3
									
								
								run.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					# run script
 | 
				
			||||||
 | 
					docker build . -t robomaster
 | 
				
			||||||
 | 
					docker run -v ./source:/source --network=host -it robomaster:latest python /source/robot-version.py
 | 
				
			||||||
							
								
								
									
										21
									
								
								source/connect.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								source/connect.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,21 @@
 | 
				
			|||||||
 | 
					import time
 | 
				
			||||||
 | 
					import robomaster
 | 
				
			||||||
 | 
					from robomaster import conn
 | 
				
			||||||
 | 
					from MyQR import myqr
 | 
				
			||||||
 | 
					from PIL import Image
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QRCODE_NAME = "qrcode.png"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if __name__ == '__main__':
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    helper = conn.ConnectionHelper()
 | 
				
			||||||
 | 
					    info = helper.build_qrcode_string(ssid="ITL@Bs", password="StStefan202!")
 | 
				
			||||||
 | 
					    myqr.run(words=info)
 | 
				
			||||||
 | 
					    time.sleep(1)
 | 
				
			||||||
 | 
					    #img = Image.open(QRCODE_NAME)
 | 
				
			||||||
 | 
					    #img.show()
 | 
				
			||||||
 | 
					    if helper.wait_for_connection():
 | 
				
			||||||
 | 
					        print("Connected!")
 | 
				
			||||||
 | 
					    else:
 | 
				
			||||||
 | 
					        print("Connect failed!")
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								source/qrcode.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								source/qrcode.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 1001 B  | 
							
								
								
									
										14
									
								
								source/robot-version.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								source/robot-version.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					from robomaster import robot
 | 
				
			||||||
 | 
					from robomaster import config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if __name__ == '__main__':
 | 
				
			||||||
 | 
					    print("starting program..")
 | 
				
			||||||
 | 
					    ep_robot = robot.Robot()
 | 
				
			||||||
 | 
					    # 指定机器人的 SN 号
 | 
				
			||||||
 | 
					    ep_robot.initialize(conn_type="sta", sn="3JKCK7W0030DRU")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ep_version = ep_robot.get_version()
 | 
				
			||||||
 | 
					    print("Robot Version: {0}".format(ep_version))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ep_robot.close()
 | 
				
			||||||
		Reference in New Issue
	
	Block a user