完结撒花

This commit is contained in:
KYOSG 2024-04-25 20:10:52 +08:00
parent 559a94c55a
commit fbc632a324
52 changed files with 415 additions and 69 deletions

Binary file not shown.

Binary file not shown.

View File

@ -5,7 +5,7 @@
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="jdk" jdkName="Python 3.10 (graduation_design)" jdkType="Python SDK" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

7
.idea/misc.xml generated Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.10 (graduation_design)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (graduation_design)" project-jdk-type="Python SDK" />
</project>

147
.idea/workspace.xml generated
View File

@ -4,31 +4,69 @@
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="31e8b3f2-5159-47b8-a798-4b06368c40f5" name="更改" comment="1. 调试了模型预测的输出结果&#10;2. 成功控制机械臂移动">
<change beforePath="$PROJECT_DIR$/.idea/copilot/chatSessions/00000000000.xd" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/copilot/chatSessions/00000000000.xd" afterDir="false" />
<list default="true" id="31e8b3f2-5159-47b8-a798-4b06368c40f5" name="更改" comment="1.大体实现机械臂跟随物体移动&#10;2.使用线程队列将机器人控制与视觉识别解耦,大大提高了系统的流畅性">
<change afterPath="$PROJECT_DIR$/abandon_code/hand_control.py" afterDir="false" />
<change afterPath="$PROJECT_DIR$/abandon_code/img_process/Log/OrbbecSDK.log.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/copilot/chatSessions/00000000000.xd" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/copilot/chatSessions/blobs/version" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/graduation_design.iml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/graduation_design.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/img_process/ObjectClassify.py" beforeDir="false" afterPath="$PROJECT_DIR$/ObjectClassify.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/img_process/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/img_process/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/img_process/orbbec_camera/OrbbecCamera.py" beforeDir="false" afterPath="$PROJECT_DIR$/orbbec_camera/OrbbecCamera.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/img_process/orbbec_camera/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/orbbec_camera/__init__.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/img_process/orbbec_camera/utils.py" beforeDir="false" afterPath="$PROJECT_DIR$/orbbec_camera/utils.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/img_process/take_photos.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/img_process/take_photos.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/img_process/train/package-seg.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/img_process/train/package-seg.yaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/img_process/train/train.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/img_process/train/train.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/img_process/train/yolov8n-seg.pt" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/img_process/train/yolov8n-seg.pt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/img_process/train/yolov8n.pt" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/img_process/train/yolov8n.pt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/img_process/yolo.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/img_process/yolo.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/img_process/yolov8n-seg.pt" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/img_process/yolov8n-seg.pt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/img_process/yolov8n.pt" beforeDir="false" afterPath="$PROJECT_DIR$/yolov8n.pt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/ObjectClassify.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/ObjectClassify.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/integration_testing/__init__.py" beforeDir="false" afterPath="$PROJECT_DIR$/App.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/integration_testing/integration_tests.py" beforeDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/FRRobot.py" beforeDir="false" afterPath="$PROJECT_DIR$/robot_control/FRRobot.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/control.py" beforeDir="false" afterPath="$PROJECT_DIR$/robot_control/control.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/control.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/control.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/ConveyorTrack.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/ConveyorTrack.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/ConveyorTrackRecord.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/ConveyorTrackRecord.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/ConveyorTrackSet.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/ConveyorTrackSet.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/TrajectoryJ_repetition.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/TrajectoryJ_repetition.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/force_compliance.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/force_compliance.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/force_control.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/force_control.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/force_find_surface_calcenter.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/force_find_surface_calcenter.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/force_guard.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/force_guard.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/force_load_identification.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/force_load_identification.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/force_payload_identify.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/force_payload_identify.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/force_rot_insertion.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/force_rot_insertion.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/force_sensor_set.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/force_sensor_set.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/force_spiral_search.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/force_spiral_search.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/froce_line_insertion.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/froce_line_insertion.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/getDHcomp.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/getDHcomp.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/get_robot_data.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/get_robot_data.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/getversion.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/getversion.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/io_interface.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/io_interface.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/jog.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/jog.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/movec&amp;circle&amp;newspiral.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/movec&amp;circle&amp;newspiral.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/movej&amp;movel&amp;movecart.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/movej&amp;movel&amp;movecart.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/offset.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/offset.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/robot_basic_interface.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/robot_basic_interface.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/robot_common_set.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/robot_common_set.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/robot_external_device.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/robot_external_device.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/robot_log_interface.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/robot_log_interface.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/robot_lua_test.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/robot_lua_test.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/robot_point_table_download.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/robot_point_table_download.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/robot_point_table_switch.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/robot_point_table_switch.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/robot_point_table_upload.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/robot_point_table_upload.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/robot_safety_set.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/robot_safety_set.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/robot_updata_lua.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/robot_updata_lua.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/servo.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/servo.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/spline.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/spline.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/tpd_record.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/tpd_record.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/tpd_repetition.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/tpd_repetition.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/webapp_program_use_interface.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/webapp_program_use_interface.py" afterDir="false" />
<change beforePath="$PROJECT_DIR$/robot_control/examples/weld.py" beforeDir="false" afterPath="$PROJECT_DIR$/abandon_code/examples/weld.py" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Python Script" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
@ -44,23 +82,25 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"Python.FRRobot.executor": "Run",
"Python.ObjectClassify.executor": "Run",
"Python.control.executor": "Run",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"last_opened_file_path": "F:/Jetbrains/PyCharm Professional",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"settings.editor.selected.configurable": "settings.saveactions",
"vue.rearranger.settings.migration": "true"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;Python.App.executor&quot;: &quot;Run&quot;,
&quot;Python.FRRobot.executor&quot;: &quot;Run&quot;,
&quot;Python.ObjectClassify.executor&quot;: &quot;Run&quot;,
&quot;Python.control.executor&quot;: &quot;Run&quot;,
&quot;Python.hand_control.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.OpenProjectViewOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;last_opened_file_path&quot;: &quot;C:/Users/SF/Downloads/PathPlanningVisualizer&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;com.jetbrains.python.configuration.PyActiveSdkModuleConfigurable&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
}
}]]></component>
}</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="F:\Projects\PyCharmProjects\graduation_design\abandon_code" />
@ -68,7 +108,7 @@
</key>
</component>
<component name="RunManager">
<configuration name="ObjectClassify" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<configuration name="App" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
<module name="graduation_design" />
<option name="ENV_FILES" value="" />
<option name="INTERPRETER_OPTIONS" value="" />
@ -82,7 +122,7 @@
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/ObjectClassify.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/App.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="false" />
@ -93,7 +133,7 @@
</configuration>
<recent_temporary>
<list>
<item itemvalue="Python.ObjectClassify" />
<item itemvalue="Python.App" />
</list>
</recent_temporary>
</component>
@ -118,7 +158,21 @@
<workItem from="1711857077648" duration="18301000" />
<workItem from="1711885626226" duration="118000" />
<workItem from="1711885752611" duration="4821000" />
<workItem from="1711935133710" duration="14551000" />
<workItem from="1711935133710" duration="14700000" />
<workItem from="1712289981625" duration="1075000" />
<workItem from="1712296765330" duration="703000" />
<workItem from="1712298076053" duration="141000" />
<workItem from="1712563399610" duration="252000" />
<workItem from="1713339327589" duration="714000" />
<workItem from="1713340213432" duration="598000" />
<workItem from="1713341195668" duration="11000" />
<workItem from="1713620291532" duration="596000" />
<workItem from="1713708584211" duration="31000" />
<workItem from="1713965477865" duration="3980000" />
<workItem from="1714008271871" duration="13419000" />
<workItem from="1714038806197" duration="1530000" />
<workItem from="1714040350736" duration="5195000" />
<workItem from="1714045786345" duration="1233000" />
</task>
<task id="LOCAL-00001" summary="调试了模型预测的输出结果">
<option name="closed" value="true" />
@ -144,7 +198,15 @@
<option name="project" value="LOCAL" />
<updated>1711895216612</updated>
</task>
<option name="localTasksCounter" value="4" />
<task id="LOCAL-00004" summary="1.大体实现机械臂跟随物体移动&#10;2.使用线程队列将机器人控制与视觉识别解耦,大大提高了系统的流畅性">
<option name="closed" value="true" />
<created>1711951173395</created>
<option name="number" value="00004" />
<option name="presentableId" value="LOCAL-00004" />
<option name="project" value="LOCAL" />
<updated>1711951173395</updated>
</task>
<option name="localTasksCounter" value="5" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
@ -153,11 +215,14 @@
<component name="VcsManagerConfiguration">
<MESSAGE value="调试了模型预测的输出结果" />
<MESSAGE value="1. 调试了模型预测的输出结果&#10;2. 成功控制机械臂移动" />
<option name="LAST_COMMIT_MESSAGE" value="1. 调试了模型预测的输出结果&#10;2. 成功控制机械臂移动" />
<MESSAGE value="1.大体实现机械臂跟随物体移动&#10;2.使用线程队列将机器人控制与视觉识别解耦,大大提高了系统的流畅性" />
<option name="LAST_COMMIT_MESSAGE" value="1.大体实现机械臂跟随物体移动&#10;2.使用线程队列将机器人控制与视觉识别解耦,大大提高了系统的流畅性" />
</component>
<component name="com.intellij.coverage.CoverageDataManagerImpl">
<SUITE FILE_PATH="coverage/graduation_design$FRRobot.coverage" NAME="FRRobot 覆盖结果" MODIFIED="1711950740512" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/robot_control" />
<SUITE FILE_PATH="coverage/graduation_design$ObjectClassify.coverage" NAME="ObjectClassify 覆盖结果" MODIFIED="1711950908435" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/graduation_design$FRRobot.coverage" NAME="FRRobot 覆盖结果" MODIFIED="1714043618392" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/robot_control" />
<SUITE FILE_PATH="coverage/graduation_design$App.coverage" NAME="App 覆盖结果" MODIFIED="1714046470593" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/graduation_design$ObjectClassify.coverage" NAME="ObjectClassify 覆盖结果" MODIFIED="1714038967757" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$" />
<SUITE FILE_PATH="coverage/graduation_design$hand_control.coverage" NAME="hand_control 覆盖结果" MODIFIED="1713967324533" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/robot_control" />
<SUITE FILE_PATH="coverage/graduation_design$control.coverage" NAME="control 覆盖结果" MODIFIED="1711950717891" SOURCE_PROVIDER="com.intellij.coverage.DefaultCoverageFileProvider" RUNNER="coverage.py" COVERAGE_BY_TEST_ENABLED="true" COVERAGE_TRACING_ENABLED="false" WORKING_DIRECTORY="$PROJECT_DIR$/robot_control" />
</component>
</project>

140
App.py Normal file
View File

@ -0,0 +1,140 @@
import tkinter as tk
from PIL import Image, ImageTk
import torch
from ultralytics import YOLO
import cv2
from orbbec_camera.OrbbecCamera import OrbbecCamera
from robot_control.FRRobot import FRRobot
# 全局变量
model = YOLO('yolov8n.pt')
camera = OrbbecCamera('HW', True, image_width=640)
robot_controller = FRRobot()
correction_factor = 1
center_point = 320
class App:
def __init__(self, window, window_title):
self.window = window
self.window.title(window_title)
self.window.geometry("1280x720") # 设置窗口大小
# 设置图像帧,并固定大小
self.frame = tk.Label(self.window)
self.frame.grid(row=0, column=0, columnspan=3, padx=320, pady=20)
# 设置文本输出区域
self.text = tk.Text(self.window, height=10, width=50)
self.text.grid(row=3, column=0, columnspan=3, padx=320, pady=20)
# 控制按钮,居中对齐
self.btn_start = tk.Button(self.window, text="Start", command=self.start)
self.btn_start.grid(row=4, column=0, sticky="ew", padx=(106, 3))
self.btn_stop = tk.Button(self.window, text="Stop", command=self.stop)
self.btn_stop.grid(row=4, column=2, sticky="ew", padx=(3, 106))
self.btn_home = tk.Button(self.window, text="Home", command=self.to_home)
self.btn_home.grid(row=4, column=1, sticky="ew")
# 机械臂运动标志位
self.is_arm_moving_label = tk.Label(self.window, text="机械臂运动标志位: False", font=("Arial", 12))
self.is_arm_moving_label.grid(row=5, column=0, columnspan=1, sticky="ew", pady=10)
# 抓取动作标志位
self.is_catch_moving_label = tk.Label(self.window, text="抓取动作标志位: False", font=("Arial", 12))
self.is_catch_moving_label.grid(row=6, column=0, columnspan=1, sticky="ew", pady=10)
self.running = False
self.update_flag() # 初始化定时更新
self.window.mainloop()
def log(self, message):
self.text.insert(tk.END, message + '\n')
self.text.see(tk.END)
def start(self):
self.running = True
self.log("启动摄像头...")
camera.run()
self.to_home()
self.process_video_frame()
def stop(self):
self.running = False
self.log("停止中...")
camera.stop()
robot_controller.add_move_command("home")
robot_controller.add_move_command("stop")
def to_home(self):
self.log("回到原点...")
robot_controller.add_move_command("home")
def process_video_frame(self):
if self.running:
color_image = camera.get_color_image()
if color_image is not None:
self.display_image(color_image)
results = model.predict(source=color_image,
show=True,
conf=0.5,
half=True,
imgsz=640,
verbose=False)
self.handle_detection_results(results)
self.window.after(30, self.process_video_frame)
def display_image(self, img):
img_cv = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
img_pil = Image.fromarray(img_cv)
img_tk = ImageTk.PhotoImage(image=img_pil)
self.frame.imgtk = img_tk
self.frame.configure(image=img_tk)
def handle_detection_results(self, results):
for r in results:
if len(r.boxes.xywh) > 0 and not robot_controller.catch_moving and not robot_controller.is_arm_moving:
positions = r.boxes.xywh.tolist()
x_pos, y_pos, high, width = positions[0]
x_distance = (x_pos - center_point) * correction_factor
y_distance = (y_pos - center_point) * correction_factor
self.log(f"X距离: {x_distance}, Y距离: {y_distance}")
move_commands = []
if abs(x_distance) > 15:
move_commands.append(("x", x_distance))
if abs(y_distance) > 15:
move_commands.append(("y", y_distance))
if abs(x_distance) < 15 and abs(y_distance) < 15:
self.log("到达指定位置")
robot_controller.catch_moving = True
if camera.get_center_distance() <= 0:
self.log("抓取物体距离过近或相机参数错误,无法执行抓取")
robot_controller.catch_moving = False
continue
robot_controller.add_catch_commands(["catch", camera.get_center_distance()])
self.log(f"执行抓取命令,深度: {camera.get_center_distance()} mm")
if move_commands:
self.log(f"添加移动指令: {move_commands}")
if not robot_controller.is_arm_moving:
self.log(f"发送指令: {move_commands}")
robot_controller.add_move_command(move_commands)
def update_flag(self):
self.is_arm_moving_label.config(text='机械臂运动标志位: ' + str(robot_controller.is_arm_moving))
self.is_catch_moving_label.config(text='抓取动作标志位: ' + str(robot_controller.catch_moving))
# 每1000毫秒1秒调用一次自身持续更新标志位
self.window.after(500, self.update_flag)
# 主运行环境
if __name__ == '__main__':
root = tk.Tk()
app = App(root, "Robot Camera Control")

BIN
Log/OrbbecSDK.log.txt Normal file

Binary file not shown.

View File

@ -1,11 +1,5 @@
import asyncio
import os
import threading
from time import sleep
import Robot
import torch
from torch import tensor
from ultralytics import YOLO
import cv2
from orbbec_camera.OrbbecCamera import OrbbecCamera
@ -28,7 +22,7 @@ def init():
global image_width
# 检测GPU是否存在
if not torch.cuda.is_available():
print("你忘了打开独显,大聪明")
print("独立显卡未启用")
exit(1)
# 输入的视频的宽度
image_width = 640
@ -38,7 +32,6 @@ def init():
if __name__ == '__main__':
# 初始化
init()
# 处理循环
while True:
color_image = camera.get_color_image()
@ -60,7 +53,9 @@ if __name__ == '__main__':
high = 0
width = 0
for r in results:
if len(r.boxes.xywh) > 0:
print("robot_controller.catch_moving: ", robot_controller.catch_moving)
print("robot_controller.is_arm_moving: ", robot_controller.is_arm_moving)
if len(r.boxes.xywh) > 0 and robot_controller.catch_moving is False and robot_controller.is_arm_moving is False:
positions = r.boxes.xywh.tolist()
x_pos = positions[0][0]
y_pos = positions[0][1]
@ -87,8 +82,15 @@ if __name__ == '__main__':
y_dir = 1 if y_distance < 0 else 0
move_commands.append(("y", y_distance))
if abs(x_distance) < 15 and abs(y_distance) < 15:
print("到达指定位置")
robot_controller.catch_moving = True
robot_controller.add_catch_commands(["catch", camera.get_center_distance()])
if len(move_commands) > 0:
if not robot_controller.is_action:
print("添加移动指令: ", move_commands)
if not robot_controller.is_arm_moving:
print("发送指令: ", move_commands)
# 添加移动指令
robot_controller.add_move_command(move_commands)

View File

@ -0,0 +1,38 @@
import requests
url = 'http://192.168.3.200/motor'
is_open = False
def open_hand():
params = {
'direction': 'cw',
'speed': 2000
}
response = requests.get(url, params=params)
print(response.text) # 打印响应内容
print(response.status_code) # 打印响应状态码
if response.status_code == 200:
flag = True
def close_hand():
params = {
'direction': 'ccw',
'speed': 2000
}
response = requests.get(url, params=params)
print(response.text) # 打印响应内容
print(response.status_code) # 打印响应状态码
if response.status_code == 200:
flag = False
if __name__ == '__main__':
# close_hand()
open_hand()

Binary file not shown.

View File

@ -1,26 +1,35 @@
import queue
import threading
import requests
import Robot
import time
# todo 1. 添加软限位
# todo 2. 添加回零点功能(完成)
# todo 3. 将抓取流程封装成一个函数(完成)
# todo 4. 将物品移至指定位置(完成)
class FRRobot:
def __init__(self):
# 机械臂相关
self.robotCTL = Robot.RPC('192.168.3.102')
self.is_action = False # 是否正在执行动作
self.speed = 100 # 速度百分比,[0~100]默认20
self.home = [] # 回零点
self.tool = 1 # 工具坐标系编号
self.user = 1 # 工件坐标系编号
# 100% 60mm/s; 50% 30mm/s; 20% 12mm/s
self.velocity = 60 # 速度(mm/s)
self.is_arm_moving = False # 是否正在执行动作
# 线程相关
self.command_queue = queue.Queue()
self.listener_thread = threading.Thread(target=self.process_commands)
self.listener_thread.daemon = True # 设置为守护线程,确保主程序退出时线程也会退出
self.listener_thread.start()
# 夹爪相关
self.is_open = False # 夹爪是否打开
self.catch_moving = False # 是否在执行抓取动作
speed_error_code = self.robotCTL.SetSpeed(self.speed)
if speed_error_code != 0:
@ -30,42 +39,127 @@ class FRRobot:
def add_move_command(self, command):
self.command_queue.put(command)
def add_catch_commands(self, command):
self.command_queue.put(command)
def process_commands(self):
while True:
move_commands = self.command_queue.get()
if move_commands is None:
continue
print("接收到指令: ", move_commands)
if move_commands[0] == "catch":
self.catch(move_commands[1])
continue
if move_commands == "home":
self.run_script("/fruser/Home.lua")
continue
if move_commands == "stop":
self.robotCTL.ImmStopJOG()
break # 通过发送一个特定的"stop"命令来停止线程
break
# 停止线程
# axis, distance, direction = move_commands
print("接收到指令: ", move_commands)
# 机械臂移动
# todo:这地方写的不好,其实不用for直接和上面一样判断就行
for command in move_commands:
self.is_action = True
self.is_arm_moving = True
axis, distance = command
if axis == "x":
print("x移动距离: ", distance)
move_time = abs(distance) / self.velocity
direction = 1 if distance > 0 else 0
self.move_x(distance, direction)
print("x移动时间: ", move_time)
time.sleep(move_time)
self.robotCTL.ImmStopJOG()
elif axis == "y":
print("y移动距离: ", distance)
move_time = abs(distance) / self.velocity
direction = 1 if distance < 0 else 0
self.move_y(distance, direction)
print("y移动时间: ", move_time)
time.sleep(move_time)
self.robotCTL.ImmStopJOG()
self.is_action = False
self.command_queue.task_done()
def move_x(self, distance=30, direction=1):
# direction为0代表负方向为1代表正方向
dis = int(distance)
move_time = abs(distance) / self.velocity
self.robotCTL.StartJOG(ref=4, nb=1, dir=direction, max_dis=100, vel=20.0, acc=100.0)
time.sleep(move_time)
print("x移动时间: ", move_time)
self.robotCTL.ImmStopJOG()
self.is_arm_moving = False
def move_y(self, distance=30, direction=1):
dis = int(distance)
move_time = abs(distance) / self.velocity
self.robotCTL.StartJOG(ref=4, nb=2, dir=direction, max_dis=100, vel=20.0, acc=100.0)
time.sleep(move_time)
print("y移动时间: ", move_time)
self.robotCTL.ImmStopJOG()
self.is_arm_moving = False
def move_z(self, distance=30, direction=1):
move_time = (abs(distance - 100)) / self.velocity
self.robotCTL.StartJOG(ref=4, nb=3, dir=direction, max_dis=300, vel=20.0, acc=100.0)
time.sleep(move_time)
self.robotCTL.ImmStopJOG()
def run_script(self, script_name):
self.is_arm_moving = True
# 0自动模式1手动模式
self.robotCTL.Mode(0)
self.robotCTL.ProgramLoad(script_name)
self.robotCTL.ProgramRun()
while self.robotCTL.GetProgramState() == 2:
time.sleep(0.1)
self.is_arm_moving = False
self.robotCTL.Mode(1)
def catch(self, distance):
if not self.is_open:
self.catch_moving = True
self.open_hand()
# 1向上0向下
direction = 1 if distance < 0 else 0
self.is_arm_moving = True
self.move_z(distance, direction)
self.close_hand()
# 抬起物品
self.move_z(distance, 1)
self.run_script("/fruser/home2.lua")
time.sleep(0.5)
self.open_hand()
self.run_script("/fruser/Home.lua")
self.close_hand()
self.catch_moving = False
self.is_arm_moving = False
# 夹爪控制
def open_hand(self):
params = {
'direction': 'cw',
'speed': 2000
}
response = requests.get('http://192.168.3.200/motor', params=params)
print(response.text) # 打印响应内容
print(response.status_code) # 打印响应状态码
time.sleep(1)
if response.status_code == 200:
self.is_open = True
def close_hand(self):
params = {
'direction': 'ccw',
'speed': 2000
}
response = requests.get('http://192.168.3.200/motor', params=params)
print(response.text) # 打印响应内容
print(response.status_code) # 打印响应状态码
time.sleep(1)
if response.status_code == 200:
self.is_open = False
# if __name__ == '__main__':
# robot_controller = FRRobot()
# robot_controller.run_script("/fruser/home2.lua")