diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9b47c01 --- /dev/null +++ b/Dockerfile @@ -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 diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..a462104 --- /dev/null +++ b/build.sh @@ -0,0 +1,2 @@ +# build the docker container +docker build . -t robomaster \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..5fc2339 --- /dev/null +++ b/run.sh @@ -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 diff --git a/source/connect.py b/source/connect.py new file mode 100644 index 0000000..ade5bee --- /dev/null +++ b/source/connect.py @@ -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!") \ No newline at end of file diff --git a/source/qrcode.png b/source/qrcode.png new file mode 100644 index 0000000..4d0c920 Binary files /dev/null and b/source/qrcode.png differ diff --git a/source/robot-version.py b/source/robot-version.py new file mode 100644 index 0000000..47c4316 --- /dev/null +++ b/source/robot-version.py @@ -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()