Compare commits
13 Commits
main
...
calibratio
| Author | SHA1 | Date | |
|---|---|---|---|
| b3c29dbc0b | |||
| ff72592a3c | |||
| aed9f40c18 | |||
| 9b57620232 | |||
| cb66f29777 | |||
| 4054712a35 | |||
| f1316b00b7 | |||
| cfb5277e3c | |||
| 78d278dab7 | |||
| 2640bf9ec7 | |||
| d477e511f5 | |||
| 1ab6ca603f | |||
| cbfb14a843 |
6
.gitignore
vendored
@ -3,7 +3,6 @@
|
|||||||
/Makefile
|
/Makefile
|
||||||
/Makefile.*
|
/Makefile.*
|
||||||
/object_script.*
|
/object_script.*
|
||||||
/*_resource.rc
|
|
||||||
/bin/
|
/bin/
|
||||||
/build/
|
/build/
|
||||||
/build_*/
|
/build_*/
|
||||||
@ -20,8 +19,3 @@
|
|||||||
*.pfx
|
*.pfx
|
||||||
*.p12
|
*.p12
|
||||||
*.key
|
*.key
|
||||||
/build-*/
|
|
||||||
/.qtcreator/
|
|
||||||
__pycache__/
|
|
||||||
*.py[cod]
|
|
||||||
/am-freescan/
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(CmvrControlStation VERSION 1.0.0 LANGUAGES CXX)
|
project(CmvrControlStation VERSION 1.0.0 LANGUAGES CXX)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
@ -30,7 +30,7 @@ set(PROTO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/protos")
|
|||||||
set(GENERATED_ROOT "${CMAKE_CURRENT_BINARY_DIR}/generated_cpp")
|
set(GENERATED_ROOT "${CMAKE_CURRENT_BINARY_DIR}/generated_cpp")
|
||||||
|
|
||||||
find_package(Qt5 5.12 REQUIRED COMPONENTS
|
find_package(Qt5 5.12 REQUIRED COMPONENTS
|
||||||
Core Gui Widgets Svg Network Multimedia 3DCore 3DRender 3DExtras 3DInput 3DAnimation)
|
Core Gui Widgets Multimedia 3DCore 3DRender 3DExtras 3DInput 3DAnimation)
|
||||||
|
|
||||||
get_target_property(CMVR_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
|
get_target_property(CMVR_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
|
||||||
if(CMVR_QMAKE_EXECUTABLE)
|
if(CMVR_QMAKE_EXECUTABLE)
|
||||||
@ -152,57 +152,20 @@ if(CMVR_WITH_MSQUIC)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMVR_SOURCES
|
set(CMVR_SOURCES
|
||||||
src/agvvelocityramp.h
|
|
||||||
src/seeragvmapclient.cpp
|
|
||||||
src/seeragvmapclient.h
|
|
||||||
src/agvmapdocument.cpp
|
|
||||||
src/agvmapdocument.h
|
|
||||||
src/agvmaprasterizer.cpp
|
|
||||||
src/agvmaprasterizer.h
|
|
||||||
src/agvmapeditorwidget.cpp
|
|
||||||
src/agvmapeditorwidget.h
|
|
||||||
src/agvmapviewwidget.cpp
|
|
||||||
src/agvmapviewwidget.h
|
|
||||||
src/audiostreammanager.cpp
|
src/audiostreammanager.cpp
|
||||||
src/audiostreammanager.h
|
src/audiostreammanager.h
|
||||||
src/jointfloweditor.cpp
|
src/configeditorwidget.cpp
|
||||||
src/jointfloweditor.h
|
src/configeditorwidget.h
|
||||||
src/motordebugwidget.h
|
|
||||||
src/motordebugwidget.cpp
|
|
||||||
src/motorplot.h
|
|
||||||
src/motorplot.cpp
|
|
||||||
src/jointpointdata.h
|
|
||||||
src/main.cpp
|
src/main.cpp
|
||||||
src/mainwindow.cpp
|
src/mainwindow.cpp
|
||||||
src/mainwindow_ui.cpp
|
src/mainwindow_ui.cpp
|
||||||
src/mainwindow.h
|
src/mainwindow.h
|
||||||
src/taskorchestrationwidget.cpp
|
|
||||||
src/taskapi.cpp
|
|
||||||
src/taskjointeditor.h
|
|
||||||
src/taskuilabels.h
|
|
||||||
src/taskprotoeditor.cpp
|
|
||||||
src/demosimulator.cpp
|
|
||||||
src/demosimulator.h
|
|
||||||
src/workflowcanvas.h
|
|
||||||
src/workflowgraph.h
|
|
||||||
src/workflowruntime.h
|
|
||||||
src/workflowrobotmanager.h
|
|
||||||
src/workflowhistory.h
|
|
||||||
src/freescaninteropui.h
|
|
||||||
src/freescaninterop.cpp
|
|
||||||
src/freescaninterop.h
|
|
||||||
src/taskdeviceoptions.cpp
|
|
||||||
src/taskdeviceoptions.h
|
|
||||||
src/taskrpcrunner.cpp
|
|
||||||
src/taskorchestrationwidget.h
|
|
||||||
src/quictestserver.cpp
|
src/quictestserver.cpp
|
||||||
src/quictestserver.h
|
src/quictestserver.h
|
||||||
src/rpcservicewidget.cpp
|
src/rpcservicewidget.cpp
|
||||||
src/rpcservicewidget.h
|
src/rpcservicewidget.h
|
||||||
src/robotclient.cpp
|
src/robotclient.cpp
|
||||||
src/robotclient.h
|
src/robotclient.h
|
||||||
src/tactileheatmapwidget.cpp
|
|
||||||
src/tactileheatmapwidget.h
|
|
||||||
src/trendwidget.cpp
|
src/trendwidget.cpp
|
||||||
src/trendwidget.h
|
src/trendwidget.h
|
||||||
src/uiicons.h
|
src/uiicons.h
|
||||||
@ -210,8 +173,6 @@ set(CMVR_SOURCES
|
|||||||
src/urdfviewerwidget.h
|
src/urdfviewerwidget.h
|
||||||
src/videodecoder.cpp
|
src/videodecoder.cpp
|
||||||
src/videodecoder.h
|
src/videodecoder.h
|
||||||
src/camerasnapshotdecoder.h
|
|
||||||
src/snapshotimageview.h
|
|
||||||
src/videoframe.h
|
src/videoframe.h
|
||||||
src/videorenderwidget.cpp
|
src/videorenderwidget.cpp
|
||||||
src/videorenderwidget.h
|
src/videorenderwidget.h
|
||||||
@ -231,19 +192,12 @@ set(CMVR_SOURCES
|
|||||||
resources.qrc)
|
resources.qrc)
|
||||||
|
|
||||||
list(APPEND CMVR_SOURCES
|
list(APPEND CMVR_SOURCES
|
||||||
src/applicationsettings.cpp src/applicationsettings.h
|
src/handeyebridge.cpp src/handeyebridge.h
|
||||||
src/applicationstyle.cpp src/applicationstyle.h
|
|
||||||
src/appmessagebox.h
|
|
||||||
src/handeyebridge.cpp src/handeyebridge.h src/handeyeprocessworker.h
|
|
||||||
src/handeyestore.cpp src/handeyestore.h
|
src/handeyestore.cpp src/handeyestore.h
|
||||||
src/handeyeurdf.cpp src/handeyeurdf.h
|
src/handeyeurdf.cpp src/handeyeurdf.h
|
||||||
src/touchplanner.cpp src/touchplanner.h
|
src/touchplanner.cpp src/touchplanner.h
|
||||||
src/touchsequencecontroller.cpp src/touchsequencecontroller.h
|
src/touchsequencecontroller.cpp src/touchsequencecontroller.h
|
||||||
src/touchvideowidget.cpp src/touchvideowidget.h
|
src/touchvideowidget.cpp src/touchvideowidget.h
|
||||||
src/touchplanestore.cpp src/touchplanestore.h src/cameracapabilities.h src/bioheadoperations.h
|
|
||||||
src/bioheadwidget.cpp src/bioheadwidget.h
|
|
||||||
src/bioheadjointclient.cpp src/bioheadjointclient.h
|
|
||||||
src/bioheadexpressionstore.cpp src/bioheadexpressionstore.h
|
|
||||||
src/touchoperationwidget.cpp src/touchoperationwidget.h
|
src/touchoperationwidget.cpp src/touchoperationwidget.h
|
||||||
src/handeyemotionwidget.cpp src/handeyemotionwidget.h
|
src/handeyemotionwidget.cpp src/handeyemotionwidget.h
|
||||||
src/tcpcalibration.cpp src/tcpcalibration.h
|
src/tcpcalibration.cpp src/tcpcalibration.h
|
||||||
@ -251,11 +205,7 @@ list(APPEND CMVR_SOURCES
|
|||||||
src/tcptoolstore.cpp src/tcptoolstore.h
|
src/tcptoolstore.cpp src/tcptoolstore.h
|
||||||
src/tcpcalibrationwidget.cpp src/tcpcalibrationwidget.h)
|
src/tcpcalibrationwidget.cpp src/tcpcalibrationwidget.h)
|
||||||
add_executable(CmvrControlStation ${CMVR_SOURCES})
|
add_executable(CmvrControlStation ${CMVR_SOURCES})
|
||||||
if(MINGW)
|
|
||||||
target_compile_options(CmvrControlStation PRIVATE -Wa,-mbig-obj)
|
|
||||||
endif()
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_sources(CmvrControlStation PRIVATE resources/application.rc)
|
|
||||||
set_target_properties(CmvrControlStation PROPERTIES WIN32_EXECUTABLE TRUE)
|
set_target_properties(CmvrControlStation PROPERTIES WIN32_EXECUTABLE TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@ -290,7 +240,7 @@ if(CMVR_WITH_MSQUIC)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(CmvrControlStation PRIVATE
|
target_link_libraries(CmvrControlStation PRIVATE
|
||||||
Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Svg Qt5::Network Qt5::Multimedia
|
Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Multimedia
|
||||||
Qt5::3DCore Qt5::3DRender Qt5::3DExtras Qt5::3DInput Qt5::3DAnimation)
|
Qt5::3DCore Qt5::3DRender Qt5::3DExtras Qt5::3DInput Qt5::3DAnimation)
|
||||||
|
|
||||||
# Generate every project-local CMVR message. This avoids source-tree generated
|
# Generate every project-local CMVR message. This avoids source-tree generated
|
||||||
@ -303,11 +253,11 @@ file(GLOB_RECURSE PROTO_FILES CONFIGURE_DEPENDS
|
|||||||
"${PROTO_ROOT}/cmvr/quic_edge/v1/*.proto")
|
"${PROTO_ROOT}/cmvr/quic_edge/v1/*.proto")
|
||||||
|
|
||||||
set(SERVICE_NAMES
|
set(SERVICE_NAMES
|
||||||
cmvr/api/motor_service
|
|
||||||
cmvr/api/agv_service
|
cmvr/api/agv_service
|
||||||
cmvr/api/arm_service
|
cmvr/api/arm_service
|
||||||
cmvr/api/biohead_service
|
cmvr/api/biohead_service
|
||||||
cmvr/api/camera_service
|
cmvr/api/camera_service
|
||||||
|
cmvr/api/configuration_service
|
||||||
cmvr/api/dexhand_service
|
cmvr/api/dexhand_service
|
||||||
cmvr/api/hlc_service
|
cmvr/api/hlc_service
|
||||||
cmvr/api/microphone_service
|
cmvr/api/microphone_service
|
||||||
@ -417,17 +367,6 @@ add_custom_command(TARGET CmvrControlStation POST_BUILD
|
|||||||
"$<TARGET_FILE_DIR:CmvrControlStation>/models")
|
"$<TARGET_FILE_DIR:CmvrControlStation>/models")
|
||||||
|
|
||||||
install(TARGETS CmvrControlStation RUNTIME DESTINATION bin)
|
install(TARGETS CmvrControlStation RUNTIME DESTINATION bin)
|
||||||
add_custom_command(TARGET CmvrControlStation POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND}
|
|
||||||
"-DSOURCE=${CMAKE_CURRENT_SOURCE_DIR}/resources/application_settings.json"
|
|
||||||
"-DDESTINATION=$<TARGET_FILE_DIR:CmvrControlStation>/data/application_settings.json"
|
|
||||||
-P "${CMAKE_CURRENT_SOURCE_DIR}/cmake/SeedApplicationSettings.cmake"
|
|
||||||
VERBATIM)
|
|
||||||
install(CODE "
|
|
||||||
set(SOURCE \"${CMAKE_CURRENT_SOURCE_DIR}/resources/application_settings.json\")
|
|
||||||
set(DESTINATION \"\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/data/application_settings.json\")
|
|
||||||
include(\"${CMAKE_CURRENT_SOURCE_DIR}/cmake/SeedApplicationSettings.cmake\")
|
|
||||||
")
|
|
||||||
add_custom_command(TARGET CmvrControlStation POST_BUILD
|
add_custom_command(TARGET CmvrControlStation POST_BUILD
|
||||||
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:CmvrControlStation>/scripts"
|
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:CmvrControlStation>/scripts"
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
@ -457,11 +396,3 @@ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/models/"
|
|||||||
DESTINATION bin/models)
|
DESTINATION bin/models)
|
||||||
install(PROGRAMS "${CMVR_ASSIMP_SCENE_PARSER}"
|
install(PROGRAMS "${CMVR_ASSIMP_SCENE_PARSER}"
|
||||||
DESTINATION bin/sceneparsers)
|
DESTINATION bin/sceneparsers)
|
||||||
|
|
||||||
if(WIN32 AND MINGW)
|
|
||||||
add_custom_command(TARGET CmvrControlStation POST_BUILD
|
|
||||||
COMMAND powershell.exe -NoProfile -ExecutionPolicy RemoteSigned
|
|
||||||
-File "${CMAKE_CURRENT_SOURCE_DIR}/scripts/repair_qt3d_release.ps1"
|
|
||||||
-RuntimeDirectory "$<TARGET_FILE_DIR:CmvrControlStation>" -IfPresent
|
|
||||||
VERBATIM)
|
|
||||||
endif()
|
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
QT += core gui widgets svg network multimedia 3dcore 3drender 3dextras 3dinput 3danimation
|
QT += core gui widgets multimedia 3dcore 3drender 3dextras 3dinput 3danimation
|
||||||
|
|
||||||
CONFIG += c++17 warn_on debug_and_release
|
CONFIG += c++14 warn_on debug_and_release
|
||||||
win32-g++: QMAKE_CXXFLAGS += -Wa,-mbig-obj
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
|
||||||
DEFINES += QT_DEPRECATED_WARNINGS _WIN32_WINNT=0x0600
|
DEFINES += QT_DEPRECATED_WARNINGS _WIN32_WINNT=0x0600
|
||||||
@ -33,17 +32,17 @@ QT_SCENEPARSER_DIR = $$clean_path($$[QT_INSTALL_PLUGINS]/sceneparsers)
|
|||||||
!exists($$LIB_DIR/liburdfdom_model.dll): error("urdfdom runtime DLL not found in lib.")
|
!exists($$LIB_DIR/liburdfdom_model.dll): error("urdfdom runtime DLL not found in lib.")
|
||||||
|
|
||||||
PROTO_FILES = \
|
PROTO_FILES = \
|
||||||
$$PROTO_ROOT/cmvr/api/motor_service.proto \
|
|
||||||
$$PROTO_ROOT/cmvr/api/common.proto \
|
$$PROTO_ROOT/cmvr/api/common.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/agv_command.proto \
|
$$PROTO_ROOT/cmvr/api/agv_command.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/agv_service.proto \
|
$$PROTO_ROOT/cmvr/api/agv_service.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/arm_command.proto \
|
$$PROTO_ROOT/cmvr/api/arm_command.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/arm_service.proto \
|
$$PROTO_ROOT/cmvr/api/arm_service.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/biohead_command.proto \
|
$$PROTO_ROOT/cmvr/api/biohead_command.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/head_joint_command.proto \
|
|
||||||
$$PROTO_ROOT/cmvr/api/biohead_service.proto \
|
$$PROTO_ROOT/cmvr/api/biohead_service.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/camera_command.proto \
|
$$PROTO_ROOT/cmvr/api/camera_command.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/camera_service.proto \
|
$$PROTO_ROOT/cmvr/api/camera_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/configuration_command.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/configuration_service.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/dexhand_command.proto \
|
$$PROTO_ROOT/cmvr/api/dexhand_command.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/dexhand_service.proto \
|
$$PROTO_ROOT/cmvr/api/dexhand_service.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/hlc_command.proto \
|
$$PROTO_ROOT/cmvr/api/hlc_command.proto \
|
||||||
@ -57,11 +56,11 @@ PROTO_FILES = \
|
|||||||
$$PROTO_ROOT/cmvr/api/test_service.proto
|
$$PROTO_ROOT/cmvr/api/test_service.proto
|
||||||
|
|
||||||
GRPC_PROTO_FILES = \
|
GRPC_PROTO_FILES = \
|
||||||
$$PROTO_ROOT/cmvr/api/motor_service.proto \
|
|
||||||
$$PROTO_ROOT/cmvr/api/agv_service.proto \
|
$$PROTO_ROOT/cmvr/api/agv_service.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/arm_service.proto \
|
$$PROTO_ROOT/cmvr/api/arm_service.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/biohead_service.proto \
|
$$PROTO_ROOT/cmvr/api/biohead_service.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/camera_service.proto \
|
$$PROTO_ROOT/cmvr/api/camera_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/configuration_service.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/dexhand_service.proto \
|
$$PROTO_ROOT/cmvr/api/dexhand_service.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/hlc_service.proto \
|
$$PROTO_ROOT/cmvr/api/hlc_service.proto \
|
||||||
$$PROTO_ROOT/cmvr/api/microphone_service.proto \
|
$$PROTO_ROOT/cmvr/api/microphone_service.proto \
|
||||||
@ -88,13 +87,10 @@ CONFIG_PROTO_FILES = \
|
|||||||
$$PROTO_ROOT/cmvr/config/quic_edge_config/quic_edge_config.proto \
|
$$PROTO_ROOT/cmvr/config/quic_edge_config/quic_edge_config.proto \
|
||||||
$$PROTO_ROOT/cmvr/config/self_collision_task_config/self_collision_task_config.proto \
|
$$PROTO_ROOT/cmvr/config/self_collision_task_config/self_collision_task_config.proto \
|
||||||
$$PROTO_ROOT/cmvr/config/speaker_config/speaker_config.proto \
|
$$PROTO_ROOT/cmvr/config/speaker_config/speaker_config.proto \
|
||||||
$$PROTO_ROOT/cmvr/config/touch_config/touch_config.proto \
|
|
||||||
$$PROTO_ROOT/cmvr/config/task_manager_config/task_manager_config.proto \
|
$$PROTO_ROOT/cmvr/config/task_manager_config/task_manager_config.proto \
|
||||||
$$PROTO_ROOT/cmvr/config/touch_screen_task_config/touch_screen_task_config.proto
|
$$PROTO_ROOT/cmvr/config/touch_screen_task_config/touch_screen_task_config.proto
|
||||||
|
|
||||||
CONFIG_ROOT_PROTO_FILES = \
|
CONFIG_ROOT_PROTO_FILES = \
|
||||||
$$PROTO_ROOT/cmvr/config/collision_config.proto \
|
|
||||||
$$PROTO_ROOT/cmvr/config/joint_motion_config.proto \
|
|
||||||
$$PROTO_ROOT/cmvr/config/cartesian_motion_validation_config.proto \
|
$$PROTO_ROOT/cmvr/config/cartesian_motion_validation_config.proto \
|
||||||
$$PROTO_ROOT/cmvr/config/joint_limits_config.proto \
|
$$PROTO_ROOT/cmvr/config/joint_limits_config.proto \
|
||||||
$$PROTO_ROOT/cmvr/config/lawba_ik_config.proto \
|
$$PROTO_ROOT/cmvr/config/lawba_ik_config.proto \
|
||||||
@ -241,15 +237,6 @@ CONFIG(debug, debug|release) {
|
|||||||
!exists($$ASSIMP_SCENE_PARSER): error("Qt3D Assimp scene parser not found in the selected Qt Kit.")
|
!exists($$ASSIMP_SCENE_PARSER): error("Qt3D Assimp scene parser not found in the selected Qt Kit.")
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
src/bioheadexpressionstore.cpp \
|
|
||||||
src/bioheadjointclient.cpp \
|
|
||||||
src/seeragvmapclient.cpp \
|
|
||||||
src/agvmapdocument.cpp \
|
|
||||||
src/agvmaprasterizer.cpp \
|
|
||||||
src/agvmapeditorwidget.cpp \
|
|
||||||
src/applicationsettings.cpp \
|
|
||||||
src/applicationstyle.cpp \
|
|
||||||
src/taskorchestrationwidget.cpp \
|
|
||||||
src/handeyebridge.cpp \
|
src/handeyebridge.cpp \
|
||||||
src/handeyestore.cpp \
|
src/handeyestore.cpp \
|
||||||
src/handeyeurdf.cpp \
|
src/handeyeurdf.cpp \
|
||||||
@ -262,16 +249,14 @@ SOURCES += \
|
|||||||
src/tcpjogcontroller.cpp \
|
src/tcpjogcontroller.cpp \
|
||||||
src/tcptoolstore.cpp \
|
src/tcptoolstore.cpp \
|
||||||
src/tcpcalibrationwidget.cpp \
|
src/tcpcalibrationwidget.cpp \
|
||||||
src/agvmapviewwidget.cpp \
|
|
||||||
src/audiostreammanager.cpp \
|
src/audiostreammanager.cpp \
|
||||||
|
src/configeditorwidget.cpp \
|
||||||
src/main.cpp \
|
src/main.cpp \
|
||||||
src/mainwindow.cpp \
|
src/mainwindow.cpp \
|
||||||
src/mainwindow_ui.cpp \
|
src/mainwindow_ui.cpp \
|
||||||
src/quictestserver.cpp \
|
src/quictestserver.cpp \
|
||||||
src/rpcservicewidget.cpp \
|
src/rpcservicewidget.cpp \
|
||||||
src/robotclient.cpp \
|
src/robotclient.cpp \
|
||||||
src/tactileheatmapwidget.cpp \
|
|
||||||
src/jointfloweditor.cpp \
|
|
||||||
src/trendwidget.cpp \
|
src/trendwidget.cpp \
|
||||||
src/urdfviewerwidget.cpp \
|
src/urdfviewerwidget.cpp \
|
||||||
src/videodecoder.cpp \
|
src/videodecoder.cpp \
|
||||||
@ -279,19 +264,7 @@ SOURCES += \
|
|||||||
ui/handeyecalibrationwidget.cpp
|
ui/handeyecalibrationwidget.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
src/bioheadexpressionstore.h \
|
|
||||||
src/bioheadjointclient.h \
|
|
||||||
src/agvvelocityramp.h \
|
|
||||||
src/seeragvmapclient.h \
|
|
||||||
src/agvmapdocument.h \
|
|
||||||
src/agvmaprasterizer.h \
|
|
||||||
src/agvmapeditorwidget.h \
|
|
||||||
src/applicationsettings.h \
|
|
||||||
src/applicationstyle.h \
|
|
||||||
src/appmessagebox.h \
|
|
||||||
src/taskorchestrationwidget.h \
|
|
||||||
src/handeyebridge.h \
|
src/handeyebridge.h \
|
||||||
src/handeyeprocessworker.h \
|
|
||||||
src/handeyestore.h \
|
src/handeyestore.h \
|
||||||
src/handeyeurdf.h \
|
src/handeyeurdf.h \
|
||||||
src/touchplanner.h \
|
src/touchplanner.h \
|
||||||
@ -303,20 +276,16 @@ HEADERS += \
|
|||||||
src/tcpjogcontroller.h \
|
src/tcpjogcontroller.h \
|
||||||
src/tcptoolstore.h \
|
src/tcptoolstore.h \
|
||||||
src/tcpcalibrationwidget.h \
|
src/tcpcalibrationwidget.h \
|
||||||
src/agvmapviewwidget.h \
|
|
||||||
src/audiostreammanager.h \
|
src/audiostreammanager.h \
|
||||||
|
src/configeditorwidget.h \
|
||||||
src/mainwindow.h \
|
src/mainwindow.h \
|
||||||
src/quictestserver.h \
|
src/quictestserver.h \
|
||||||
src/rpcservicewidget.h \
|
src/rpcservicewidget.h \
|
||||||
src/robotclient.h \
|
src/robotclient.h \
|
||||||
src/tactileheatmapwidget.h \
|
|
||||||
src/jointfloweditor.h \
|
|
||||||
src/trendwidget.h \
|
src/trendwidget.h \
|
||||||
src/uiicons.h \
|
src/uiicons.h \
|
||||||
src/urdfviewerwidget.h \
|
src/urdfviewerwidget.h \
|
||||||
src/videodecoder.h \
|
src/videodecoder.h \
|
||||||
src/camerasnapshotdecoder.h \
|
|
||||||
src/snapshotimageview.h \
|
|
||||||
src/videoframe.h \
|
src/videoframe.h \
|
||||||
src/videorenderwidget.h \
|
src/videorenderwidget.h \
|
||||||
ui/handeyecalibrationwidget.h
|
ui/handeyecalibrationwidget.h
|
||||||
@ -357,18 +326,9 @@ win32 {
|
|||||||
}
|
}
|
||||||
DISTFILES += scripts/handeye_worker.py scripts/handeye_math.py scripts/handeye_refinement.py
|
DISTFILES += scripts/handeye_worker.py scripts/handeye_math.py scripts/handeye_refinement.py
|
||||||
DISTFILES += scripts/package_handeye_runtime.py
|
DISTFILES += scripts/package_handeye_runtime.py
|
||||||
DISTFILES += resources/application_settings.json cmake/SeedApplicationSettings.cmake
|
|
||||||
|
|
||||||
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$shell_path($$MODEL_DIR)) $$shell_quote($$shell_path($$DESTDIR/models))
|
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$shell_path($$MODEL_DIR)) $$shell_quote($$shell_path($$DESTDIR/models))
|
||||||
|
|
||||||
win32 {
|
|
||||||
QMAKE_POST_LINK += $$escape_expand(\n\t) if not exist $$shell_quote($$shell_path($$DESTDIR/data)) $$QMAKE_MKDIR $$shell_quote($$shell_path($$DESTDIR/data))
|
|
||||||
QMAKE_POST_LINK += $$escape_expand(\n\t) if not exist $$shell_quote($$shell_path($$DESTDIR/data/application_settings.json)) $$QMAKE_COPY_FILE $$shell_quote($$shell_path($$PWD/resources/application_settings.json)) $$shell_quote($$shell_path($$DESTDIR/data/application_settings.json))
|
|
||||||
} else {
|
|
||||||
QMAKE_POST_LINK += $$escape_expand(\n\t) $$QMAKE_MKDIR $$shell_quote($$DESTDIR/data)
|
|
||||||
QMAKE_POST_LINK += $$escape_expand(\n\t) test -e $$shell_quote($$DESTDIR/data/application_settings.json) || $$QMAKE_COPY_FILE $$shell_quote($$PWD/resources/application_settings.json) $$shell_quote($$DESTDIR/data/application_settings.json)
|
|
||||||
}
|
|
||||||
|
|
||||||
win32 {
|
win32 {
|
||||||
isEmpty(HAND_EYE_RUNTIME_DIR): HAND_EYE_RUNTIME_DIR = $$PWD/third_party/handeye-runtime
|
isEmpty(HAND_EYE_RUNTIME_DIR): HAND_EYE_RUNTIME_DIR = $$PWD/third_party/handeye-runtime
|
||||||
!exists($$HAND_EYE_RUNTIME_DIR/manifest.json): error(Build the bundled runtime with scripts/package_handeye_runtime.py first)
|
!exists($$HAND_EYE_RUNTIME_DIR/manifest.json): error(Build the bundled runtime with scripts/package_handeye_runtime.py first)
|
||||||
@ -378,46 +338,4 @@ win32 {
|
|||||||
QMAKE_POST_LINK += $$escape_expand(\n\t) $$QMAKE_COPY_FILE $$shell_quote($$shell_path($$MSQUIC_TEST_CA)) $$shell_quote($$shell_path($$DESTDIR/quic-test-ca.crt))
|
QMAKE_POST_LINK += $$escape_expand(\n\t) $$QMAKE_COPY_FILE $$shell_quote($$shell_path($$MSQUIC_TEST_CA)) $$shell_quote($$shell_path($$DESTDIR/quic-test-ca.crt))
|
||||||
}
|
}
|
||||||
|
|
||||||
win32:RC_ICONS = icons/cmvr-app.ico
|
win32:RC_ICONS =
|
||||||
|
|
||||||
HEADERS += src/calibrationfile.h
|
|
||||||
|
|
||||||
SOURCES += src/touchplanestore.cpp
|
|
||||||
HEADERS += src/touchplanestore.h src/cameracapabilities.h src/bioheadoperations.h
|
|
||||||
SOURCES += src/bioheadwidget.cpp
|
|
||||||
HEADERS += src/bioheadwidget.h src/jointpointdata.h src/motordebugwidget.h
|
|
||||||
SOURCES += src/motordebugwidget.cpp src/motorplot.cpp
|
|
||||||
HEADERS += src/motorplot.h
|
|
||||||
SOURCES += src/usercoordinatewidget.cpp
|
|
||||||
HEADERS += src/usercoordinatewidget.h src/usercoordinatestore.h
|
|
||||||
|
|
||||||
SOURCES += src/actionqueuetestwidget.cpp
|
|
||||||
HEADERS += src/actionqueuetestwidget.h
|
|
||||||
|
|
||||||
SOURCES += src/taskapi.cpp src/taskprotoeditor.cpp src/taskrpcrunner.cpp
|
|
||||||
HEADERS += src/taskapi.h src/taskprotoeditor.h src/taskrpcrunner.h
|
|
||||||
|
|
||||||
HEADERS += src/taskjointeditor.h src/taskuilabels.h
|
|
||||||
|
|
||||||
SOURCES += src/taskdeviceoptions.cpp
|
|
||||||
HEADERS += src/taskdeviceoptions.h
|
|
||||||
|
|
||||||
SOURCES += src/demosimulator.cpp
|
|
||||||
HEADERS += src/demosimulator.h
|
|
||||||
HEADERS += src/workflowcanvas.h
|
|
||||||
SOURCES += src/freescaninterop.cpp
|
|
||||||
HEADERS += src/freescaninterop.h
|
|
||||||
|
|
||||||
# Release diagnostics retain optimization and source line information.
|
|
||||||
QMAKE_CXXFLAGS_RELEASE += -g1
|
|
||||||
QMAKE_LFLAGS_RELEASE -= -Wl,-s
|
|
||||||
win32: QMAKE_LFLAGS_RELEASE += -Wl,-Map,bin/release/CmvrControlStation.map
|
|
||||||
|
|
||||||
win32:CONFIG(release, debug|release) {
|
|
||||||
QMAKE_POST_LINK += $$escape_expand(\n\t) powershell.exe -NoProfile -ExecutionPolicy RemoteSigned -File $$shell_quote($$shell_path($$PWD/scripts/repair_qt3d_release.ps1)) -RuntimeDirectory $$shell_quote($$shell_path($$DESTDIR)) -IfPresent
|
|
||||||
}
|
|
||||||
DISTFILES += scripts/repair_qt3d_release.ps1
|
|
||||||
|
|
||||||
HEADERS += src/workflowgraph.h src/freescaninteropui.h
|
|
||||||
HEADERS += src/workflowruntime.h
|
|
||||||
HEADERS += src/workflowhistory.h src/workflowrobotmanager.h
|
|
||||||
|
|||||||
86
README.md
@ -12,28 +12,36 @@ CMVR Control Station 是一个基于 Qt 5 的桌面控制站,用于连接 CMVR
|
|||||||
- Protobuf 配置查看、校验和编辑
|
- Protobuf 配置查看、校验和编辑
|
||||||
- 可选的 MsQuic/TLS 测试服务器
|
- 可选的 MsQuic/TLS 测试服务器
|
||||||
|
|
||||||
## 设备连接与控制
|
## 设备管理
|
||||||
|
|
||||||
### AGV 手动加减速
|
左侧进入 `gRPC > 设备管理` 后,默认打开“设备总览”:
|
||||||
|
|
||||||
AGV 页右侧“手动控制”可分别设置线加速度、线减速度(m/s²),以及角加速度、角减速度(rad/s²)。默认分别为 0.20、0.30、0.50、0.80,修改后自动保存到本机。X/Y/Z 速度输入仍表示目标速度,按住方向按钮或 Q/W/E/A/S/D 键时逐步接近目标;换向先减至零,再向新方向加速。
|
- 主 gRPC 通道连接成功时自动调用 `GetSystemInfo` 和 `GetSystemStatus`。
|
||||||
|
- `GetSystemInfo` 用于显示边缘端系统名与版本;`GetSystemStatus.device_list`
|
||||||
|
用于展示在线设备 ID、设备大类、厂商和运行时驱动,并随系统状态轮询自动更新。
|
||||||
|
- 设备按 AGV、电池、相机、灵巧手、夹爪、麦克风、机械臂和扬声器分类,
|
||||||
|
支持按设备 ID 或类型搜索。
|
||||||
|
- 点击只读状态下的设备卡片会进入对应控制页面,并自动填写该设备的
|
||||||
|
`device_id`。
|
||||||
|
- 点击“修改”会从 ConfigurationService 加载 `manager/device_manager.pb.txt`
|
||||||
|
及 `devices/*/*.pb.txt`:可以修改设备 ID、类型和品牌/驱动,展开“配置参数”
|
||||||
|
后按 Protobuf 字段逐项编辑,也可以使用卡片右上角删除按钮或末尾的“+”卡片
|
||||||
|
增删设备。
|
||||||
|
- 点击“完成”会先写入各设备配置,再写入 DeviceManager 配置;保存使用远端
|
||||||
|
revision 做并发版本校验。当前只上传配置文件,不会自动重启或重载 cmvr-es。
|
||||||
|
- “配置管理”页签保留远端 Protobuf 配置的读取、字段编辑、校验和保存能力;
|
||||||
|
配置服务默认端口为 `50053`,与主控制 gRPC 通道独立连接。
|
||||||
|
|
||||||
松开按键、点击手动区“停止”或“速度归零”会按设置减速,减速期间车辆仍有移动距离。右侧“停止速度”和“AGV 急停”沿用立即停止请求;失焦、离开手动页面、设备/连接变化及地图直连操作也会取消斜坡。手动速度最多保留一个在途请求,过期请求丢弃,失败或响应超时后停止继续发送速度,须重新按键才能启动。此功能只修改上位机,不修改控制器参数、服务端或接口定义。
|
`GetSystemStatus` 的设备条目包含 `device_type`、稳定的 `device_kind`、
|
||||||
|
`driver_type` 和 `vendor`。上位机优先使用 `device_kind` 判断设备大类,避免 AUBO、
|
||||||
### AGV 地图直连
|
华沿等具体机械臂驱动被错误归类为 AGV;设备卡片副标题会显示如
|
||||||
|
`AUBO · AuboARM` 的厂商与驱动信息。“在线”仍表示设备存在于边缘端
|
||||||
AGV 的地图工作区可选择“通过服务”或“车辆直连”。该选项只改变地图读取、保存和切图的上位机通信路径,不修改服务端或 gRPC/proto 定义;Demo 模式继续使用演示数据。导航、状态、建图和其他设备仍使用原有服务。
|
本次返回的 `device_list` 中。
|
||||||
|
|
||||||
车辆直连需要手动填写车辆 IP,使用标准端口 19204/19205/19207。车辆 TCP 操作在独立线程执行,不占用原有控制请求线程。
|
|
||||||
|
|
||||||
直连保存发送包含顶层 `header` 的完整原始 SMAP,保留未知字段和数字文本。写入前读取最新地图供编辑器合并,并检查车辆速度和导航状态;静止且任务空闲才申请控制权、再次检查状态并发送一次地图请求。切图须同时读取到加载成功和当前地图名称匹配才显示完成。发送后超时、取消或回包异常会显示结果未知,不自动重发;原编辑内容仍保留。直连操作期间,本窗口的导航、运动和建图入口暂时禁用,急停与停止入口保持可用。
|
|
||||||
|
|
||||||
该路径要求本机能访问车辆网络,不会修复服务端持有的断开连接。服务状态与直连切图确认分别显示。实车操作前应确保没有其他控制端同时发起导航或修改地图;本机模拟 TCP 测试通过并不等同于实车保存成功。
|
|
||||||
|
|
||||||
## 机械臂自动识别与切换
|
## 机械臂自动识别与切换
|
||||||
|
|
||||||
机械臂页面的顶部选单来自 `GetSystemStatus` 返回的全部在线机械臂,不再使用
|
机械臂页面的顶部选单来自 `GetSystemStatus` 返回的全部在线机械臂,不再使用
|
||||||
固定的“左臂/右臂”选项。切换该选单后,
|
固定的“左臂/右臂”选项。选择设备管理中的机械臂卡片,或直接切换该选单后,
|
||||||
上位机会以相同的 `device_id` 调用 `ArmService.GetArmInfo` 和
|
上位机会以相同的 `device_id` 调用 `ArmService.GetArmInfo` 和
|
||||||
`ArmService.getRobotState`:
|
`ArmService.getRobotState`:
|
||||||
|
|
||||||
@ -87,14 +95,6 @@ CMake 是 Windows 和 Linux 的统一构建入口。`CmvrControlStation.pro` 继
|
|||||||
|
|
||||||
## Linux 编译
|
## Linux 编译
|
||||||
|
|
||||||
麒麟 Linux x86 可先使用一键安装脚本(采用当前系统已配置的软件源):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
bash scripts/setup_kylin.sh --source "$PWD"
|
|
||||||
```
|
|
||||||
|
|
||||||
仅安装 Qt 与依赖时去掉 `--source "$PWD"`;仅检查时使用 `--check`。如需 Qt Creator,追加 `--with-qtcreator`。脚本支持 APT、DNF/YUM,安装后会验证 Qt5、CMake、gRPC/Protobuf、音视频、模型插件及共享库;缺少必需包会明确失败。它不添加外部仓库,不启动上位机或控制设备。详见 [麒麟脚本使用说明](scripts/setup_kylin_使用说明.txt)。
|
|
||||||
|
|
||||||
### 1. 安装依赖
|
### 1. 安装依赖
|
||||||
|
|
||||||
Debian/Ubuntu 示例:
|
Debian/Ubuntu 示例:
|
||||||
@ -294,43 +294,3 @@ powershell -ExecutionPolicy Bypass `
|
|||||||
- QUIC 无法启动:检查 MsQuic 动态库搜索路径、PFX 文件、密码、监听地址和防火墙。
|
- QUIC 无法启动:检查 MsQuic 动态库搜索路径、PFX 文件、密码、监听地址和防火墙。
|
||||||
|
|
||||||
Proto 约定和目录说明见 [protos/README.md](protos/README.md)。
|
Proto 约定和目录说明见 [protos/README.md](protos/README.md)。
|
||||||
|
|
||||||
## 软件设置与界面主题
|
|
||||||
|
|
||||||
仿生头页面默认显示「常用操作」:从已连接设备中选择仿生头后,可直接调用预设表情、说话动作、停止和检查设备,并查看调用反馈;原有 JSON 调试界面保留在「全部接口」。断开连接或无可用设备时,快捷操作不可用。
|
|
||||||
|
|
||||||
任务编排的画布操作与机械臂点位规划一致:选中节点后在同层后方插入;点击「添加到选中循环」后向循环末尾添加,点击「切换到根流程末尾」返回根流程。右侧标签实时显示添加位置。拖动仅调整同层顺序,右键拖动画布,双击编辑,循环右上角按钮折叠或展开。实线连接循环与子节点,蓝色虚线连接同层的先后节点。执行中禁止编辑节点;空循环在执行前报错,已有 JSON 数据格式保持兼容。
|
|
||||||
|
|
||||||
任务编排可根据已连接设备列表选择仿生头,支持高兴、惊讶、疲惫、愤怒、悲伤、打哈欠、开始/停止说话、紧急停止及检查设备。动作使用服务端预设,不要求手写 JSON。节点检查 gRPC 结果和反馈头中的业务成功标志,失败停止编排;成功后等待设定时间再继续。开始说话仅启动持续动作,不播放音频;需用停止说话节点结束。服务端急停不保证停止说话线程,检查设备也不代表已获得实际运动状态。自定义姿态及流式表情因服务端字段实现不完整,暂不提供快捷编排入口。
|
|
||||||
|
|
||||||
侧栏底部的「软件设置」用于调整界面字体、基础字号、启动页面、窗口大小与位置记忆、启动最大化、日志保留行数和自动滚动。字体与日志设置保存后立即生效,启动选项下次启动生效。
|
|
||||||
|
|
||||||
「启动与机械臂」中的模型预览开关默认关闭,保存后重启程序生效。关闭时不初始化 Qt3D 场景,机械臂连接、遥测和位置控制照常使用。该开关允许用户选择是否加载模型,并不修复特定 Qt3D/显卡组合的渲染兼容性问题。
|
|
||||||
|
|
||||||
软件设置保存在可执行文件旁的 `data/application_settings.json`,采用原子写入。现有连接信息、标定、机械臂点位和任务编排继续使用各自的存储,不因修改软件设置而被清除。目录没有写入权限时,设置弹窗会显示保存失败原因。
|
|
||||||
|
|
||||||
仓库中的 `resources/application_settings.json` 保存随程序分发的初始配置。qmake 构建、CMake 构建和安装时仅在目标目录缺少配置文件时复制,已有的软件设置不会被覆盖;程序的读取路径保持不变。
|
|
||||||
|
|
||||||
全局主题入口为 `src/applicationstyle.cpp` 和 `styles.qss`。新增消息提示/确认请使用 `AppMessageBox`,其按钮返回值兼容原 `QMessageBox`;输入框、文件选择和普通对话框统一使用应用标题栏。新弹窗不要设置 `WindowStaysOnTopHint`,有父窗口时使用窗口级模态。
|
|
||||||
|
|
||||||
程序图标为 `icons/cmvr-app.svg` / `icons/cmvr-app.ico`。修改图标后可运行 `scripts/generate_application_icon.py` 更新 Windows 多尺寸 ICO;qmake 和 CMake 均已嵌入可执行文件图标。
|
|
||||||
|
|
||||||
工作流工作区以 `am-freescan` 的组件库、端口连线、循环容器、右侧参数面板和图数据结构为依据,以原生 Qt 实现。参考仓库位于 `am-freescan/`,独立管理 Git;来源提交为 `6ace9b1`。两个编辑入口均独立全屏打开。
|
|
||||||
|
|
||||||
点位库支持搜索、拖入、重命名、行号排序、组复制和组内多流程。循环和等待可添加到画布;节点可自由移动,循环标题移动时带动容器内节点。任务编排左侧可搜索设备组件,右侧可直接编辑接口参数、超时和等待。端口连线决定执行顺序,Delete 删除选中的连线;不连通、环路和跨容器连线在运行前报错。右键/中键或空白处平移,Ctrl+滚轮缩放,工具栏可显示全部。
|
|
||||||
|
|
||||||
两个画布均支持 Ctrl+C / Ctrl+V 复制粘贴选中节点。循环连同其内部节点一起复制,多节点保留内部连线;粘贴生成新的节点 ID 并偏移位置,外部连线不复制。点位流程粘贴时要求当前点位库中存在所引用的点位。执行期间禁用粘贴,文本输入框继续使用原有文本复制粘贴。
|
|
||||||
|
|
||||||
连线使用方向流动动画,拖动节点时实时跟随端口,选中后可按 Delete 删除。两个编辑器均提供撤销/重做按钮,支持 Ctrl+Z、Ctrl+Shift+Z 和 Ctrl+Y;删除循环时,其内部节点、参数与连线一起恢复。输入框获得焦点时,快捷键用于文字撤销/重做;切换流程会重置当前编辑历史,执行期间禁用图编辑撤销。
|
|
||||||
|
|
||||||
`joint_programs.json` 的组保留点位库和多个流程;每个流程用 `flowData` 字符串存储真实 `{nodes,edges}` 图。任务存储使用 `{flows:[{id,name,flowData}],activeFlowId}`,不再把旧的任务数组作为主存储。节点沿用中心坐标 `x/y`、`properties.parentId`、循环 `children` 和 `sourceNodeId/targetNodeId` 连线。旧文件读取后备份为 `.before-graph.<标识>.bak` 并迁移;转换失败时保留原文件。
|
|
||||||
|
|
||||||
两个入口均能导入/导出 am-freescan 图 JSON。导出保留 cmvr-es 的服务全名、方法名、完整请求、接口超时及 protobuf 描述集;循环和等待使用原生 loop/sleep 节点。组合点位保留多臂并行运动和逐臂关节顺序校验。网页侧通过自身 gRPC 连接调用 cmvr-es,上位机无需保持运行。资源使用参考项目的机器人角色和设备用途绑定,网页导出后在上位机导入时选择实际设备。
|
|
||||||
|
|
||||||
克隆仓库包含对应的网页 JSON 导入/导出、参数面板和 `CMVR_GRPC_UNARY` / `CMVR_ARM_POINT_BATCH` 后端执行适配。这些改动必须由网页项目单独构建部署后才生效,本地修改不代表线上已支持。组合调用先校验所有机械臂,再并行下发同步 MoveJ;失败或取消时取消剩余调用并请求停止。任务编排使用图执行器,支持并行分支、汇合屏障及嵌套循环;每次循环独立记录前驱完成状态,各 RPC 以独立调用标识收取结果。失败和停止会取消全部在途 RPC;已执行的调用不会自动重试。点位执行器保留单路径与组合点位调用。条件分支、运行时参数引用、扫描仪等其他领域动作不能无损转换时明确报错。等待可位于开始之后、任务之后或循环内部。
|
|
||||||
|
|
||||||
2026-11-25:协议同步到 cmvr-es `linbo_dev` 提交 `c8b71b2b380bbc53ce7eda148707362f09a1066d`(已合入 `dev` 的 `7d230fa5`)。API 设备类型新增 Touch=8,BioHead=9、Motor=10、MotorSystem=11。当前服务端不提供 moveJPose、SystemService.ExecuteJsonCommand、命令标识/代际反馈和公制深度元数据;界面禁用末端位姿 MoveJ,动作队列使用 MoveL,缺少身份及深度元数据的触摸定位明确返回不支持。普通关节 MoveJ、相机图像和预览保持可用。
|
|
||||||
|
|
||||||
任务编排的“机器人管理”可添加、编辑、连接或断开多台 cmvr-es,连接记录保存到 `data/workflow_robots.json`,重新打开软件后不自动连接额外机器人。“执行设置”分别选择机器人和该机器人上的同类设备;节点记录 `robotId`,旧节点默认绑定主界面机器人。不同机器人的同名设备、参数查询、演示状态和执行通道独立;离线、删除或找不到设备时明确报错,不会改发到其他机器人。导出 am-freescan 使用独立机器人角色和设备用途,未知机器人导入后须重新绑定。
|
|
||||||
|
|
||||||
任务与点位画布统一为左键框选、Ctrl+左键追加/取消选择、右键拖动画布,左键仍可拖动节点和连接端口。框选节点支持整体拖动和批量删除,删除可撤销。节点参数面板固定显示执行设置和保存按钮,输入参数单独滚动;关节名与角度并排显示,限位单独显示,行高随字体和名称换行调整。
|
|
||||||
|
|||||||
@ -1,202 +0,0 @@
|
|||||||
|
|
||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
@ -1,26 +0,0 @@
|
|||||||
# AGV Demo scan map
|
|
||||||
|
|
||||||
`demo_scan.smap` is a Demo-only conversion of the official TurtleBot 4 depot
|
|
||||||
occupancy sample. It is never a connected robot's downloaded map.
|
|
||||||
|
|
||||||
Sources (TurtleBot 4 `jazzy` branch, Apache-2.0):
|
|
||||||
|
|
||||||
- [depot.pgm](https://github.com/turtlebot/turtlebot4/blob/jazzy/turtlebot4_navigation/maps/depot.pgm)
|
|
||||||
- [depot.yaml](https://github.com/turtlebot/turtlebot4/blob/jazzy/turtlebot4_navigation/maps/depot.yaml)
|
|
||||||
- [LICENSE](https://github.com/turtlebot/turtlebot4/blob/jazzy/LICENSE), copied unchanged to `LICENSE.txt`.
|
|
||||||
|
|
||||||
The original raster is 755 x 380 cells at 0.04 m/cell with origin
|
|
||||||
(-15.1, -7.74), giving bounds (-15.1, -7.74) to (15.1, 7.46).
|
|
||||||
For each 2 x 2 raster block containing an occupied cell (gray < 128), the
|
|
||||||
first occupied cell's center becomes one `normal_pos_list` point. World
|
|
||||||
coordinates use x = origin.x + (column + 0.5) * resolution and
|
|
||||||
y = origin.y + (height - row - 0.5) * resolution. This retains 3,217
|
|
||||||
real scan samples, including thin boundaries, without synthesizing walls.
|
|
||||||
Free and unknown cells do not become scan points.
|
|
||||||
|
|
||||||
The 11 named stations and 10 bidirectional connections are added solely for
|
|
||||||
Demonstration. Routes are serialized by `AgvMapDocument::addRoute`.
|
|
||||||
LM10 and LM4 use y = 0.2 m to avoid occupied samples on y = 0;
|
|
||||||
all station centers and route centerlines were checked against the original
|
|
||||||
PGM at 0.01 m intervals and lie in free cells. This is a visual Demo layout,
|
|
||||||
not a robot navigation or clearance certificate.
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
# Seed a new installation without replacing settings saved by the user.
|
|
||||||
if(NOT DEFINED SOURCE OR NOT DEFINED DESTINATION)
|
|
||||||
message(FATAL_ERROR "SOURCE and DESTINATION must be specified")
|
|
||||||
endif()
|
|
||||||
if(NOT EXISTS "${DESTINATION}")
|
|
||||||
get_filename_component(settings_directory "${DESTINATION}" DIRECTORY)
|
|
||||||
file(MAKE_DIRECTORY "${settings_directory}")
|
|
||||||
configure_file("${SOURCE}" "${DESTINATION}" COPYONLY)
|
|
||||||
endif()
|
|
||||||
@ -1,80 +0,0 @@
|
|||||||
# 单相机自动识别与定位模式
|
|
||||||
|
|
||||||
实现日期:2026-10-12;2026-10-13 合并新版相机页与协议。
|
|
||||||
|
|
||||||
连接服务后,上位机通过 `CameraService.GetStatus` 获取当前物理相机型号、序列号、采集代次和能力。服务端 `AutoCamera` 只启动唯一已连接的相机:RealSense 或 MVS 工业相机。没有相机、发现多台或驱动不可用时不会任意选择设备。
|
|
||||||
|
|
||||||
| 实际数据 | 页面模式 |
|
|
||||||
| --- | --- |
|
|
||||||
| 有效原始图像、内参、采集时间、公制配准深度 | RGBD 深度定位 |
|
|
||||||
| 有效原始图像、内参、采集时间,无深度 | 二维平面定位 |
|
|
||||||
| 其余情况或旧服务没有能力字段 | 视频预览;标定/取点受缺失条件限制 |
|
|
||||||
|
|
||||||
相机选择、标定和末端操作复用现有 gRPC、解码和显示通道。深度预览不能借给标定页:进入标定或末端页时,同相机的深度会话会结束并重新订阅 RGB。修改相机身份、采集代次、分辨率或内参会清除锁定画面、目标点和待执行路径。不会自动恢复旧运动。
|
|
||||||
|
|
||||||
## 服务端配置
|
|
||||||
|
|
||||||
源码在 `F:/cmvr-es/cmvr-es`;新驱动位于 `cmvr-es/devices/camera/auto_camera` 和 `mvs_camera`。把现有相机配置中的独立后端替换成一个 `auto_camera` 条目,保留其逻辑 ID 和 DeviceManager 相机引用;不要同时启用同一硬件的旧 RealSense/MVS 条目。
|
|
||||||
|
|
||||||
以下是 CameraRootConfig 的 protobuf 文本示例。`camera_active` 是示例 ID,实际使用原配置的 ID;MVS 的序列号及内参必须填写真实标定值。
|
|
||||||
|
|
||||||
```text
|
|
||||||
camera {
|
|
||||||
cameras {
|
|
||||||
id: "camera_active"
|
|
||||||
auto_camera {
|
|
||||||
id: "camera_active"
|
|
||||||
realsense {
|
|
||||||
camera_mode: CAMERA_MODE_VIDEO
|
|
||||||
capture { width: 640 height: 480 fps: 30 stream_mode: STREAM_MODE_RGBD }
|
|
||||||
encoder { width: 640 height: 480 fps: 30 codec: "H264" buffer_size: 4 }
|
|
||||||
align_mode: ALIGN_MODE_COLOR
|
|
||||||
sync: true
|
|
||||||
}
|
|
||||||
mvs {
|
|
||||||
capture { width: 2448 height: 2048 fps: 15 stream_mode: STREAM_MODE_RGB }
|
|
||||||
encoder { width: 1224 height: 1024 fps: 15 codec: "H264" buffer_size: 4 }
|
|
||||||
// 在实机确认原始尺寸;本示例未提供内参,因此只允许预览。
|
|
||||||
// 填入 serial、fx/fy/cx/cy、5 个 coeffs 和 calibration_width/height。
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
MVS 驱动使用官方 `MvCameraControl`,与项目的 HCNetSDK 网络监控相机驱动不同。服务端需安装对应系统/架构的 MVS SDK,CMake 通过 `MVS_ROOT`、`MVS_INCLUDE_DIR` 和 `MVS_LIBRARY` 查找 SDK。例如已有正常构建目录中:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
MVS_ROOT=/opt/MVS cmake -S . -B build
|
|
||||||
cmake --build build --target cmvr_es
|
|
||||||
```
|
|
||||||
|
|
||||||
没有 SDK 时会编译明确报告不可用的适配器,不影响原有驱动。SDK 可用后使用 Mono8、软件触发、独立采集线程;SDK 缓冲区复制后释放。触发前与读到图像后的服务器 UTC 构成真实采集区间,再按请求/响应时刻转换到客户端时间区间。曝光超时结束本次采集,关闭旧会话后才允许重新触发。
|
|
||||||
|
|
||||||
二维内参必须绑定当前物理序列号、原始分辨率。ROI 偏移、binning 和 decimation 需读取验证为完整标定几何;无法验证时只预览。RealSense 纯 COLOR 配置缺少本实现需要的可靠采集时间,亦只预览。不要使用截图时间冒充曝光时间。
|
|
||||||
|
|
||||||
`CameraState.codec` 保留已分发协议的编号 10,`capabilities` 使用 11。上位机和新服务端协议已同步。此前尚未部署的相机能力实验版本使用过编号 10,不能与本版本混用。
|
|
||||||
|
|
||||||
AbstractCamera 和媒体帧结构发生兼容扩展,因此部署时需重编全部相关驱动和服务;不要只替换一个驱动库。此次只在隔离目录构建与测试,没有替换运行中的服务或配置。
|
|
||||||
|
|
||||||
## 二维相机的末端操作
|
|
||||||
|
|
||||||
MV-CS050-10UM 没有深度。选择对应手眼和 TCP 后,在任务配置导出平面模板,填入真实基座坐标系下的平面原点、朝向离开表面的单位法向和操作半径,再导入。模板默认数值只是占位,不能直接作为测量结果。
|
|
||||||
|
|
||||||
文件字段为 `schema_version=1`、`units="m"`、`frame="robot_base"`、`name`、`robot_id`、`camera_serial`、`handeye_name`、`handeye_fingerprint`、`intrinsics_fingerprint`、`origin[3]`、`normal[3]`、`operating_radius_m`。指纹由模板自动生成;改换标定或内参后重新导出匹配模板。平面保存沿用 QSettings,并按服务器、机械臂和相机序列号隔离。
|
|
||||||
|
|
||||||
像素经去畸变生成相机射线,再使用手眼关系和锁定时的机器人位姿变换到基座,与已知平面求交。界面显示相机与基座 XYZ;滑动沿用该平面法向与 TCP。目标像素不需要棋盘格,但必须位于已配置的真实平面和有效操作范围内。只靠二维像素和手眼矩阵不能确定任意空间深度。
|
|
||||||
|
|
||||||
RGBD 继续使用真实公制深度、同帧配准和原有时序校验;深度失败不会静默改用平面。旧手眼文件缺少物理序列号时需要显式确认归属,已知序列号不匹配的记录不显示、不使用。
|
|
||||||
|
|
||||||
## 三轴力传感器
|
|
||||||
|
|
||||||
界面只显示“未接入”,尚无真实力控。后续接口需要:传感器身份、绑定机器人、有效标记、采集时间、Fx/Fy/Fz(N)、测量坐标系、传感器到工具安装变换、量程及故障。三轴力不包含力矩。接触停止与闭环应在有明确时效保证的服务端/控制器实现;加装改变工具尺寸后需重新 TCP 标定。
|
|
||||||
|
|
||||||
## 已完成验证与边界
|
|
||||||
|
|
||||||
- Qt 5.12.4 / MinGW 7.3 / C++14 构建;手眼与末端 UI 回归、协议兼容、原始灰度取点与平面换算。
|
|
||||||
- 服务端隔离构建,单采集实例、替换相机、旧租约释放、故障退出、媒体 Hub、真实回环 gRPC 双向订阅结束测试通过。
|
|
||||||
- 上述服务端验证完成于 2026-10-12。2026-10-13 合并时调整了 codec/capabilities 字段编号;本地协议与 Qt 构建通过,但服务器连接超时,最后的编号调整尚未远端复编。
|
|
||||||
- 当前机器及服务器未安装 MVS SDK。启用 SDK 的分支、MV-CS050-10UM 实机采集和真实相机替换尚未验证。
|
|
||||||
- 未发送真实机械臂运动指令;之前“读数变化而机器人未实际运动”的问题仍需独立实机确认。
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
# 控制器活动 TCP 偏移读取
|
|
||||||
|
|
||||||
TCP 标定页面的“从控制器读取”使用当前连接和机械臂 ID,通过已有
|
|
||||||
`cmvr.api.ArmService/ExecuteJsonCommand` 发送:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{"command":"get_active_tcp_offset"}
|
|
||||||
```
|
|
||||||
|
|
||||||
服务端目前由 AuboArm 驱动调用 `getRobotConfig()->getTcpOffset()`。
|
|
||||||
其他未适配驱动返回不支持,不把失败转换成零偏移。
|
|
||||||
响应同时包含 `success`、`device_id`、`offset`(六个数)、
|
|
||||||
`transform: T_flange_tcp`、`units: m_rad` 和
|
|
||||||
`rotation_convention: RzRyRx`。这是相对法兰的活动工具偏移,不是机器人基座下的实时 TCP 位姿。
|
|
||||||
|
|
||||||
Qt 校验设备、单位、姿态约定和有限数值后,将平移转换为 mm,角度转换为度。
|
|
||||||
读取会清空本轮采样,成功后确认偏移;失败保持未确认。
|
|
||||||
切换连接或机械臂后,过期响应不会被应用。
|
|
||||||
这是按按钮实时读取,不是后台持续轮询;在示教器更换活动工具后需重新读取。
|
|
||||||
|
|
||||||
## 2026-10-10 验证
|
|
||||||
|
|
||||||
- TCP 页面测试 17 项通过。
|
|
||||||
- loopback 集成测试通过,覆盖错误单位、设备不匹配、无效值、合法零偏移及 UI 回填。
|
|
||||||
- Qt 调试程序编译通过,输出 `bin/debug/CmvrControlStation_touch_preview.exe`。
|
|
||||||
- 服务器驱动编译、链接通过,已按用户授权重启服务。
|
|
||||||
- `192.168.0.28:50052` 的 `aubo_arm` 实际读取成功,返回六项零偏移。
|
|
||||||
- 部署时原驱动备份:服务器
|
|
||||||
`/home/cmvr/Projects/cmvr-es/output/lib/libaubo_arm.so.before-tcp-20261010-162143`。
|
|
||||||
- 服务以原参数和环境后台启动,日志为服务器 `/tmp/cmvr-tcp-service.log`。
|
|
||||||
此次未更改设备配置或开机启动设置。
|
|
||||||
@ -1,154 +0,0 @@
|
|||||||
# Qt 手眼标定迁移说明
|
|
||||||
|
|
||||||
## 页面与使用流程
|
|
||||||
|
|
||||||
沿用侧栏「复杂控制 → 手眼标定」的第 14 号页面。原先该入口显示占位内容,`ui/handeyecalibrationwidget.ui/.h/.cpp` 是空 QWidget;现在入口实例化这个已有页面类。没有新增一级导航。
|
|
||||||
|
|
||||||
布局沿用机械臂页、相机页和 TCP 标定页的 `panel`、`sectionTitle`、`mutedLabel`、按钮和表格样式。`.ui` 管理滚动页面:左上为相机视频与检测,右上为相机选择及标定配置,下方并排放置采样数据与标定结果 / 保存。配置项按每行两组紧凑排列;板型参数和动态列表使用当前工程已有的 C++ 控件方式。
|
|
||||||
|
|
||||||
1. 在机械臂页面选择实际设备并连接服务。在工具坐标标定页确认控制器当前活动工具偏移,用于将反馈 TCP 位姿还原为法兰位姿。
|
|
||||||
2. 手眼页的相机来自现有相机配置列表。选择相机并开始视频,复用当前 RobotClient 相机流。已有相机流可以共享;页面只停止自己启动的流。
|
|
||||||
3. 选择安装方式、棋盘格 / ChArUco、实际板尺寸。棋盘格行列表示内角点数;ChArUco 表示方格数。尺寸界面使用 mm,算法使用 m。
|
|
||||||
4. 核对真实相机畸变模型、彩色对齐方式和服务器时钟后勾选确认。实时检测预览按算法完成速度刷新,角点、轴线始终绘制在它们所属的图像上。
|
|
||||||
5. 每次停稳后采集。联合标定至少 6 组(位姿法至少 5 组),建议 12–15 组,并覆盖至少两个独立旋转轴。表格显示两组位姿、重投影误差及帧时间。
|
|
||||||
6. 计算后查看 4×4 矩阵、方向、重投影 / AX=XB / 固定目标误差。异常点会标记为已剔除。质量不合格的结果可以查看但不能保存。
|
|
||||||
7. 输入名称保存。机械臂页速度控制区域「视觉坐标 → 手眼标定 · 仅坐标转换」的列表立即刷新。同名更新和删除都使用现有 QMessageBox 交互。
|
|
||||||
8. 在机械臂页选择记录,输入相机坐标点,点击转换。显示实际计算出的基座坐标。此操作不会发送运动。
|
|
||||||
|
|
||||||
## 真实调用链与线程
|
|
||||||
|
|
||||||
- 视频:已有 `CameraService.GetRGBImageStream` → RobotClient 流读取线程 → 已有 FFmpeg VideoDecoder → `videoFrameReceived(cameraId, VideoFrame, detail)` → 原有 VideoRenderWidget。
|
|
||||||
- 为 `VideoFrame` 增加原始解码 PTS、对应相机内参和帧时间。通过解码 PTS 与输入包匹配元数据,避免 B 帧 / 延迟解码时把最新包时间错误赋给旧图像。未知、重复或无法匹配的 PTS 不用于采点。
|
|
||||||
- 原始彩色尺寸与内参:新增的 RobotClient 请求包装复用同一 CameraService 通道上的真实 `GetRGBImage` RPC。校验 BGR / 灰度数据长度、维度、有限正焦距及畸变系数;QImage 持有独立数据。
|
|
||||||
- 算法:HandEyeBridge 的 QThread 内运行持久 QProcess,执行随应用部署的 Python worker。图像平面编码、检测和求解不阻塞 GUI。一次只允许一个算法请求,限制积压;页面退出停止算法,线程析构时释放资源。
|
|
||||||
- 机器人:复用 `requestTcpCalibrationPose` → 工作线程 `GetArmInfo` 与 `getRobotState` → `actual_tcp_pose`、关节速度和安全 / 运行状态校验。没有增加机器人通信实例。该接口仅接受现有代码已核对姿态约定的驱动;未知驱动返回明确错误,不猜测单位。
|
|
||||||
- 位姿回调、视频回调和算法结果最终都在 UI 线程更新控件。请求 token 和算法代次隔离过期响应;连接、机械臂、相机、参考工具及参数变化会失效当前采样过程。
|
|
||||||
|
|
||||||
## phone 算法来源与数学定义
|
|
||||||
|
|
||||||
源文件:`F:/phone/scripts/handeye_calibration_gui.py`。
|
|
||||||
|
|
||||||
迁移至 `scripts/handeye_math.py` / `scripts/handeye_worker.py`,保留主要函数和源代码行区间注释:
|
|
||||||
|
|
||||||
- `estimate_planar_pose`(174–247):平面 IPPE 候选与 PnP 精化。
|
|
||||||
- `estimate_charuco_pose`(250–266)及页面检测逻辑(1905–1952)。
|
|
||||||
- `solve_handeye_matrix`(289–311)。
|
|
||||||
- `fixed_target_consistency`(322–361)。
|
|
||||||
- `ax_xb_all_pair_metrics`(364–389)。
|
|
||||||
- `leave_one_out_handeye_metrics`(427–478)。
|
|
||||||
- `robust_handeye_calibration`(481–592):五种 OpenCV 求解器、自动比较、MAD 异常值剔除与交叉验证。
|
|
||||||
|
|
||||||
支持 Eye-in-Hand 和 Eye-to-Hand。沿用 phone 重投影筛选和质量阈值,并补充输入边界、SE(3)、正深度、独立旋转轴检查。至少保留 5 个有效样本;不会为了凑够样本数保留不合格的重投影点。
|
|
||||||
|
|
||||||
所有矩阵采用行优先存储、列向量左乘、平移单位 m。`T_parent_child` 表示将 child 坐标表达成 parent 坐标:
|
|
||||||
|
|
||||||
- 机器人输入:`T_base_flange`。反馈实际为活动 TCP;先按 `T_base_tcp × inverse(T_flange_tcp)` 还原。
|
|
||||||
- 相机输入:`T_camera_target`,由当前图像中的真实标定板检测取得。
|
|
||||||
- Eye-in-Hand 输出:`T_flange_camera`;使用时 `p_base = T_base_flange × T_flange_camera × p_camera`。
|
|
||||||
- Eye-to-Hand 输出:`T_base_camera`;使用时 `p_base = T_base_camera × p_camera`。
|
|
||||||
- 机器人姿态沿现有已验证接口使用 m、rad,旋转为 `Rz(rz) × Ry(ry) × Rx(rx)`。界面显示 mm / degree,未更改底层姿态定义。
|
|
||||||
|
|
||||||
## 联合标定与重投影非线性精修(2026-09-30)
|
|
||||||
|
|
||||||
页面默认选择“联合标定 + 重投影精修”,保留“原有手眼标定(对比)”。切换计算方式或初值算法只失效计算结果,保留原始采样;更改相机、安装方式、标定板参数仍重置采样。布局保持左上视频、右上配置、下方采样与结果。
|
|
||||||
|
|
||||||
新增 `scripts/handeye_refinement.py::refine_joint`。先沿用 phone 的求解器选择和异常样本剔除产生初值,再通过 Huber 损失、SE(3) 指数更新和解析雅可比的阻尼 LM,同时优化两个刚体变换(12 个自由度)。这是在迁移算法之上的新增实现,不声称 phone 原代码已经包含联合精修。没有新增 scipy 或 C++ OpenCV 依赖。
|
|
||||||
|
|
||||||
定义 `G = T_base_flange`、`C = T_camera_target`:
|
|
||||||
|
|
||||||
| 安装方式 | 优化 X | 优化 Y | 约束 | 用于投影的预测 C |
|
|
||||||
| --- | --- | --- | --- | --- |
|
|
||||||
| Eye-in-Hand | T_flange_camera | T_base_target | G X C = Y | inverse(X) inverse(G) Y |
|
|
||||||
| Eye-to-Hand | T_base_camera | T_flange_target | X C = G Y | inverse(X) G Y |
|
|
||||||
|
|
||||||
两种模式均对所有保留帧的真实角点进行联合优化。每帧保存 `image_points`、单位为 m 的 `object_points`、对应 `corner_ids`、该帧缩放后的 `K`、Brown 畸变 `D`、图像尺寸和两组测量位姿。支持 ChArUco 每帧可见角点不同;不能将局部列表下标代替板上 ID。内参、畸变、板尺寸及机器人位姿作为固定测量值,不在本阶段估计机器人运动学或相机内参。
|
|
||||||
|
|
||||||
质量检查及验证:
|
|
||||||
|
|
||||||
- 联合标定至少 6 个有效样本,原有算法仍至少 5 个;界面建议采集 12–15 个并覆盖多个旋转轴。
|
|
||||||
- Huber 点残差阈值 1.5 px,最多 80 次迭代。使用平移 0.2 m / 旋转 1 rad 的参数尺度检查雅可比秩及条件数(上限 1e6)。检查矩阵、坐标对应、正深度和有限值;不收敛不允许保存。
|
|
||||||
- RMS 定义为所有角点二维残差范数的均方根,不是单坐标 RMS,也不是原有 PnP 均值。精修后全点 RMS 上限 1.5 px;鲁棒目标不得增加;全点 RMS 上升不得超过 max(0.01 px, 初值 RMS 的 1%)。
|
|
||||||
- 6–8 组使用留一验证,9 组及以上使用确定性的三折验证。每折只用训练帧重新求手眼初值与两个变换,不复用全量拟合结果;在未参与该折拟合的帧上计算像素残差。所有保留帧必须完成验证,汇总 RMS 上限 3 px。此前 phone 的异常样本筛选是全量初始化步骤,因此此验证针对保留样本的拟合稳定性,不替代独立实机验收数据。
|
|
||||||
- 保留原有 AX=XB 与固定目标一致性 5 mm / 2° 检查。像素误差低不能覆盖物理位姿不一致。所有诊断及验证折索引映射回原始采样列表。
|
|
||||||
|
|
||||||
QSettings 仍使用原来的 v1 主键和机械臂隔离方式;新增可选字段 `refinement`、`observations`,兼容旧记录。保存初始及最终 X/Y、矩阵含义、两类像素误差、迭代及条件数、验证折、完整原始观测。旧记录没有角点,仍可选择使用,但不能直接进行像素精修。读取联合结果时校验质量标记、方向和主矩阵一致性。
|
|
||||||
|
|
||||||
Record.transform 保存最终 X,既有 `calibrationsChanged` 刷新与 `cameraPointToBase` 流程因此实际使用精修后的矩阵。Y 同时保存并展示,用于标定板固定关系;不将它误用为机械臂视觉运动的手眼矩阵。当前没有完整视觉运动接口的 TODO 保持不变。
|
|
||||||
|
|
||||||
本次增量文件:新增 `scripts/handeye_refinement.py`、`tests/test_handeye_refinement.py`、`tests/test_handeye_joint_worker.py`;修改 worker、原手眼页面 `.h/.cpp/.ui`、HandEyeStore `.h/.cpp`、存储与页面测试、qmake/CMake 脚本部署和本说明。其余先前迁移文件不因联合优化而重构。
|
|
||||||
|
|
||||||
相关数学资料:[Tabb / Ahmad Yousef 的联合标定迭代方法论文(含修订说明)](https://arxiv.org/abs/1907.12425);针孔/Brown 投影使用 [OpenCV projectPoints 文档](https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html)。这里固定内参的独立实现不等同于复现论文全部实验配置,真实定位精度仍需实机独立点位验证。
|
|
||||||
|
|
||||||
## 采样同步与已确认的相机限制
|
|
||||||
|
|
||||||
采样执行「静止位姿读前 → 新视频帧检测 → 静止位姿读后」。帧的服务器 UTC 时间必须位于读取时间窗内、PTS 匹配且未过期;前后法兰偏差不得超过 0.5 mm / 0.2°。整组保存两类变换、帧序号和读前读后时间。重复采样、运动、超时、检测失败都不追加记录。
|
|
||||||
|
|
||||||
这是静止条件下的软件配对,**不是传感器硬件曝光同步**。当前服务的部分时间戳是编码 / 处理时间,因此仍需保持机械臂及对应固定物静止,并确保两端时钟同步。上线前需要在实机上验证该时间模型。
|
|
||||||
|
|
||||||
从当前后端源码已确认以下限制,并在 Qt 侧拒绝不确定数据:
|
|
||||||
|
|
||||||
- unary `GetRGBImage` 不填拍摄时间戳,RealSense 还可能返回缓存图。因此单帧 RPC 只提供原生尺寸与内参,不直接用于成对采样。
|
|
||||||
- RealSense 编码流缩放后未缩放内参。Qt 根据原生图像尺寸换算焦距和主点,校验宽高比与流内参一致性;不支持任意裁剪。
|
|
||||||
- RealSense 深度对齐 RGB 的现有内参存在语义问题。使用者必须确认原生彩色或对齐到彩色,不能把深度对齐画面用于本实现。
|
|
||||||
- 当前 UVC 后端没有有效标定内参;Hikvision 原生单帧接口未实现。它们会收到明确提示,不能绕过有效内参检查采点。
|
|
||||||
- 协议没有畸变模型字段。当前检测适用普通针孔 / Brown 模型;鱼眼或未知模型不能直接套用。
|
|
||||||
|
|
||||||
## 持久化与机械臂页面使用
|
|
||||||
|
|
||||||
沿用应用默认 QSettings(正常运行组织 CMVR、应用 CMVR Control Station;Windows 通常位于 HKCU/Software/CMVR/CMVR Control Station)。主键 `handEyeCalibration/v1/<SHA256(endpoint + NUL + device)>`,记录当前连接和机械臂,其他机械臂不会混入列表。
|
|
||||||
|
|
||||||
每条记录包含名称、相机 ID、安装模式、求解器、创建时间、完整矩阵、方向、单位、有效样本数、误差、板参数和内参。允许同一机械臂的多个相机、多次标定;不静默覆盖同名结果。
|
|
||||||
|
|
||||||
保存 / 修改 / 删除成功后发出 `calibrationsChanged`,MainWindow 根据当前上下文转发给 HandEyeMotionWidget 重新加载。启动及切换机械臂也从同一个存储加载,并恢复当前选择。配置损坏、非有限数、非刚体矩阵、写入失败均返回错误。
|
|
||||||
|
|
||||||
HandEyeMotionWidget 读取选中记录的完整矩阵,实际调用 `HandEyeStore::cameraPointToBase`。Eye-in-Hand 在转换时重新读取当前真实位姿,并去掉控制器活动 TCP 偏移。转换结果通过 `basePointPrepared(cameraId, profileName, baseXYZmetres)` 提供;输入、选择、连接、参考偏移变化会清空旧结果。
|
|
||||||
|
|
||||||
保留一处业务 TODO:当前工程没有视觉目标运动流程及目标姿态语义,不能凭一个相机点推造完整 MoveL 目标。将来应由真实视觉运动流程消费已准备的基座点并定义方向、工具关系和运动约束,本次不虚构该接口。
|
|
||||||
|
|
||||||
## 文件与运行环境
|
|
||||||
|
|
||||||
本次修改:
|
|
||||||
|
|
||||||
- `ui/handeyecalibrationwidget.ui/.h/.cpp`:原页面完整实现。
|
|
||||||
- `src/mainwindow.cpp/.h`、`src/mainwindow_ui.cpp`:原入口实例化、信号槽、相机流共享和机械臂页嵌入。
|
|
||||||
- `src/robotclient.cpp/.h`:现有相机 RPC 包装和流元数据传递。
|
|
||||||
- `src/videoframe.h`、`src/videodecoder.cpp`:精确解码时间与帧元数据。
|
|
||||||
- `CmvrControlStation.pro`、`CMakeLists.txt`:新源码和 Python 算法脚本部署。
|
|
||||||
- `styles.qss`:速度控制三个页签的宽度及视觉坐标输入框留白,沿用已有配色和字体。
|
|
||||||
|
|
||||||
本次新增:
|
|
||||||
|
|
||||||
- `src/handeyebridge.h/.cpp`:异步算法桥接。
|
|
||||||
- `src/handeyestore.h/.cpp`:既有 QSettings 下的记录和坐标转换。
|
|
||||||
- `src/handeyemotionwidget.h/.cpp`:机械臂页内部的记录选择和转换区域。
|
|
||||||
- `scripts/handeye_math.py`、`scripts/handeye_worker.py`。
|
|
||||||
- `tests/test_handeye_worker.py`、`tests/handeyestore_test.cpp/.pro`、`tests/handeyemotion_test.cpp/.pro`、`tests/handeyeui_test.cpp/.pro`、`tests/handeyeintegration_test.cpp`、`tests/run_handeye_integration.py`。
|
|
||||||
- 本说明。
|
|
||||||
|
|
||||||
未升级 Qt 或 C++,未改造其他导航。算法现在使用随上位机部署的独立 Python 运行时、OpenCV(含 aruco)和 NumPy;进入页面自动检查,无需操作人员安装或选择环境。旧环境设置和 `CMVR_HANDEYE_PYTHON` 不再用于程序启动。三个脚本和运行时均随 qmake / CMake 部署,详见 [内置运行时说明](HANDEYE_RUNTIME.md)。
|
|
||||||
|
|
||||||
## 验证记录
|
|
||||||
|
|
||||||
### 2026-10-08:采样照片与 URDF 更新
|
|
||||||
|
|
||||||
- 采样表新增“采样照片 / 查看”。算法进程仅对成对采集请求,将用于检测的原始帧编码成 JPEG;通过时间与静止校验后,图像和该行观测一起入缓存。查看窗口可切换角点/坐标轴叠加;不会使用后续视频帧替换照片。
|
|
||||||
- 照片仅在本次采样会话缓存,每张最多 2 MiB、最多 100 组。删除行、重置和切换采样上下文同步释放;不写入 QSettings,重启后不能恢复照片。原始角点、内参及标定记录仍按原机制持久化。Windows 构建随程序部署 Qt JPEG 插件。
|
|
||||||
- 机械臂页“视觉坐标”中,“标定结果”下拉框仍按服务器和机械臂隔离,选中矩阵进入原有相机点到基座点转换;新增“URDF 标定更新”。可读取当前模型或选择 URDF,明确选择参考 Link、相机光学 Link,确认坐标关系后导出新文件并加载到现有模型查看器。
|
|
||||||
- Eye-in-Hand 使用 `Flange_T_Camera`,参考 Link 必须对应标定法兰;Eye-to-Hand 使用 `Base_T_Camera`,参考 Link 必须对应标定基座。相机 Link 必须是该标定的光学坐标系,不能直接将标定矩阵写到有额外旋转的相机外壳坐标系。
|
|
||||||
- `src/handeyeurdf.h/.cpp` 解析并验证模型;现有相机入口关节必须固定,参考到该关节父 Link 的链必须固定。写入 `T_parent_camera = inverse(T_reference_parent) * T_reference_camera`。不存在的相机 Link 创建为参考 Link 的固定子节点;m/rad 与 URDF XYZ/RPY 一致。
|
|
||||||
- 原 URDF 保留,禁止覆盖源文件或其他已有目标文件。输出经 QSaveFile 原子保存;相对 mesh/texture 路径转为绝对路径,`package://` 保留原语义,建议输出到原模型目录。模型加载失败时提示并尝试恢复旧模型;导出的文件仍保留。重启可通过已有 URDF 选择入口加载导出文件。
|
|
||||||
- 不修改运动关节,不发送机器人运动指令。无法表达为上述固定链时明确报错。模块测试 17 项、机械臂页面测试 23 项通过,覆盖两种模式、现有/新增光学 Link、完整矩阵重建、切换上下文失效、源文件保留和窄面板布局;区域高度不足时纵向滚动,不挤压输入框。
|
|
||||||
- 照片相关页面测试 18 项、Python 检测和数学测试 41 项通过。MainWindow 本机回环联调确认导出的模型通过既有 URDF 查看器加载;未连接真实设备。
|
|
||||||
|
|
||||||
- Qt 5.12.4 / MinGW 7.3 / C++14:完整 Debug 工程编译、链接通过。验证产物 `bin/debug/CmvrControlStation_handeye_preview.exe`,三个算法脚本已部署到同目录的 scripts 中。
|
|
||||||
- Python 检测 / 数学 / 联合精修测试:37 项通过,覆盖五种初值求解器、两种模式的两组变换、合成真值、噪声、异常点、退化姿态、雅可比数值核对、独立验证、棋盘格 / 部分 ChArUco、像素格式及错误输入。
|
|
||||||
- QSettings 与矩阵转换测试:90 项通过,包含旧记录兼容、完整原始观测与联合矩阵持久化、拒绝损坏数据。
|
|
||||||
- 机械臂页记录选择与坐标转换测试:12 项通过。
|
|
||||||
- Qt 页面与真实 Python 进程测试:14 项通过,覆盖启动失败重启、实际检测、原始角点配对、重复点、缺失时间戳、过期响应、相机替换及内参缩放;两种模式均实际经过计算、保存、重新加载和相机点转换,核对独立合成真值。
|
|
||||||
- MainWindow + RobotClient 本机回环 gRPC 联调通过:原始 BGR、内参、无效数据、断线 / 演示拒绝、保存 / 删除即时同步、机器人隔离、两种实际坐标转换、编码格式和相机流所有权。未产生机器人运动指令。
|
|
||||||
- 现有 TCP 全链路回归通过,包括真实回环 MoveL 目标计算、停止及参考偏移失效处理。
|
|
||||||
- 已渲染手眼页与机械臂页检查布局。离屏 OpenGL 环境不能作为实机视频画面验收。
|
|
||||||
|
|
||||||
编码视频的 PTS 匹配路径已完成编译和代码检查,但没有完成压缩流端到端自动测试:本机 FFmpeg 不含 H.264 编码器,phone OpenCV 的 H.264 写出也缺少 OpenH264;未为测试安装或下载额外依赖。需要在真实服务器视频流上补做解码时间戳对应检查。
|
|
||||||
|
|
||||||
以上自动测试使用合成板图、合成坐标真值及本机回环假服务,不等同于相机和机械臂实机精度验收。实机仍需独立点位验证及上述帧时间检查。
|
|
||||||
@ -1,63 +0,0 @@
|
|||||||
# 内置手眼标定运行时
|
|
||||||
|
|
||||||
上位机仅从自身目录加载 `runtime/handeye/python.exe` 和 `scripts/handeye_worker.py`,不再读取旧的 `handEyeCalibration/python` 设置、`CMVR_HANDEYE_PYTHON` 或系统 Python。进入手眼页面自动检查;关闭页面释放进程。算法仍在工作线程管理的独立进程中运行,保持界面响应。
|
|
||||||
|
|
||||||
页面已移除算法环境、路径、浏览与检查控件。组件缺失时提示重新部署完整程序,不要求操作人员安装依赖。
|
|
||||||
|
|
||||||
## 发布目录
|
|
||||||
|
|
||||||
```text
|
|
||||||
上位机目录/
|
|
||||||
CmvrControlStation_handeye_preview.exe # 当前 Debug 验证程序
|
|
||||||
...原有 Qt、通信 DLL、模型、证书等资源...
|
|
||||||
scripts/
|
|
||||||
handeye_worker.py
|
|
||||||
handeye_math.py
|
|
||||||
handeye_refinement.py
|
|
||||||
runtime/handeye/
|
|
||||||
python.exe
|
|
||||||
python312.dll
|
|
||||||
python312.zip
|
|
||||||
python312._pth
|
|
||||||
LICENSE.txt
|
|
||||||
manifest.json
|
|
||||||
...Python 扩展和运行库...
|
|
||||||
Lib/site-packages/
|
|
||||||
numpy/
|
|
||||||
numpy.libs/
|
|
||||||
cv2/
|
|
||||||
...对应 dist-info 元数据与许可证...
|
|
||||||
```
|
|
||||||
|
|
||||||
发布时复制完整程序目录,不能只复制 EXE。运行时约 178 MiB(未压缩),无需目标电脑安装 Python、Anaconda 或 pip;启动、检测和求解均无需联网。Windows x64 运行时使用官方 CPython 3.12.4 嵌入式包,配合本项目已验证的 NumPy 2.5.2 和 OpenCV-contrib 4.11.0.86。
|
|
||||||
|
|
||||||
采用 [Python 官方嵌入式分发方式](https://docs.python.org/3.12/using/windows.html#the-embeddable-package)。`python312._pth` 只包含包内标准库和依赖路径,不启用用户 site-packages;Qt 使用 `-I -B -u` 启动并清除继承的 `PYTHON*` 环境变量。worker 只显式加入自身脚本目录,用于加载同包的数学模块。
|
|
||||||
|
|
||||||
## 开发构建
|
|
||||||
|
|
||||||
生成器为 `scripts/package_handeye_runtime.py`。首次构建运行时需使用具备上述已验证依赖的 Windows x64 Python 3.12 环境:
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
& 'F:\phone\.handeye_venv\Scripts\python.exe' -B scripts/package_handeye_runtime.py
|
|
||||||
```
|
|
||||||
|
|
||||||
源虚拟环境只在**打包阶段**使用。生成器下载并校验固定 SHA256 的官方 Python ZIP,复制 NumPy、其依赖 DLL、OpenCV 和许可证,不复制虚拟环境、Anaconda、Jupyter 或其他设备 SDK。也可用 `--archive` 指定已下载的同一 ZIP 离线打包。成功后产生文件哈希清单及版本记录。
|
|
||||||
|
|
||||||
默认输出 `third_party/handeye-runtime`(二进制产物被 Git 忽略)。生成器拒绝覆盖已有目录;重新生成时指定新的 `--output`,审核后通过构建参数选择。现有运行时已生成,无需重复打包。
|
|
||||||
|
|
||||||
- qmake:默认读取上述目录,链接后复制至 `bin/debug/runtime/handeye` 或 Release 输出目录;可设置 `HAND_EYE_RUNTIME_DIR`。
|
|
||||||
- CMake:通过 `CMVR_HAND_EYE_RUNTIME_DIR` 指定运行时;构建后复制,`cmake --install` 也包含运行时及算法脚本。
|
|
||||||
- 缺少 `manifest.json` 时构建配置明确失败,避免产出缺失算法环境的安装目录。
|
|
||||||
- 运行时原件或版本有变化后需重新执行链接 / 部署,不能只拷贝新 EXE。
|
|
||||||
|
|
||||||
本机实际验证使用 qmake / Qt 5.12.4 / MinGW 7.3;CMake 部署规则已补齐但未另行完整构建。
|
|
||||||
|
|
||||||
## 验证
|
|
||||||
|
|
||||||
```powershell
|
|
||||||
& '.\third_party\handeye-runtime\python.exe' -I -B -m unittest discover -s tests -p 'test_handeye*.py' -v
|
|
||||||
```
|
|
||||||
|
|
||||||
40 项通过,包含将完整运行时与脚本迁移至中文 / 空格临时目录、PATH 仅保留 Windows System32、设置无效 PYTHONHOME / PYTHONPATH,再执行真实棋盘检测和 Eye-in-Hand / Eye-to-Hand 联合精修;核对模块和搜索路径均位于迁移后的目录,验证文件哈希与许可证。
|
|
||||||
|
|
||||||
Qt 页面测试使用测试 EXE 同目录的 `runtime/handeye` 和 `scripts`,15 项通过,涵盖自动启动、隐藏后重启、忽略无效旧路径、真实成对采点、计算、保存、重新加载与实际坐标转换。没有在另外一台全新 Windows 电脑上验收;实机发布仍需验证原有 Qt、相机及通信依赖和机器人精度。
|
|
||||||
@ -1,108 +0,0 @@
|
|||||||
# 新下载工程与原本地工程的差异及合并结果
|
|
||||||
|
|
||||||
日期:2026-10-13。
|
|
||||||
|
|
||||||
目标工程:`F:/QT/CmvrControlStation`。
|
|
||||||
新版本来源:`F:/QT/CmvrControlStation-main/cmvrcontrolstation`。来源为解压快照,没有 `.git`,因此不能确认对应的远端提交。三方比较使用原本地 `HEAD 1473cee` 作为共同参考,并逐项处理实际内容差异。
|
|
||||||
|
|
||||||
## 主要区别
|
|
||||||
|
|
||||||
| 内容 | 新下载目录 | 原本地目录 / 合并处理 |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| AGV | 地图控件、地图流、导航与手动速度控制更新 | 纳入更新 |
|
|
||||||
| 关节动作 | 点位记录、分组、单步与循环流程编辑器 | 纳入更新,并补停止及等待回调联锁 |
|
|
||||||
| 灵巧手 | 状态、指尖触觉数据及热图 | 纳入更新 |
|
|
||||||
| 相机 | 设备下拉、状态、深度截图及预览控制 | 与本地自动识别、标定页视频复用合并 |
|
|
||||||
| TCP | 两个标定/末端 `.cpp` 较旧,配套功能文件不完整 | 保留完整本地四点/六点法、控制器偏移读取、按机器人保存和实际点动 |
|
|
||||||
| 手眼 | 缺少完整算法桥、存储及使用模块 | 保留本地联合标定、重投影精修、内置算法环境、照片缓存、URDF及坐标换算 |
|
|
||||||
| 末端操作 | 缺少完整采点、路径和执行模块 | 保留任意像素、RGBD及二维平面定位、观察位和动作流程 |
|
|
||||||
| 相机自适应 | 没有能力/物理身份/采集代次链路 | 保留单相机自动识别及切换,详见 CAMERA_AUTO_MODE.md |
|
|
||||||
|
|
||||||
忽略换行方式后,共有 13 个双方修改文件、10 个仅新版本修改文件、7 个新版本新增文件、6 个仅本地修改文件,以及 72 个仅本地新增文件。`include`、`lib`、`tools`、`models`、`icons` 内容没有实质变化:头文件、部分文本模型和图标只有 LF/CRLF 差异;89 个库文件逐字节一致。这些依赖目录没有覆盖。
|
|
||||||
|
|
||||||
## 合并策略与冲突修复
|
|
||||||
|
|
||||||
- 三方合并 28 个来源文件;保留本地功能文件、脚本、内置算法运行时和测试。源目录保持未修改。
|
|
||||||
- CMake/qmake 纳入 AGV、JointFlowEditor、TactileHeatmapWidget,同时保留本地标定/末端模块和算法部署。保持 Qt 5.12.4、MinGW 7.3、C++14。
|
|
||||||
- 合并 MainWindow/RobotClient 的入口、信号、异步回调与资源生命周期,保留现有 16 个页面。标定页继续获得真实机械臂关节遥测。
|
|
||||||
- 新相机下拉代替旧输入框后继续同步当前标定上下文。标定与末端页只复用 RGB 会话;已有深度会话时结束旧模式并重建 RGB。
|
|
||||||
- 被替换视频会话的终止通知不再关闭新预览。视频控件保留本地动态比例;复查后恢复静态照片与取点标记共用画布的实现,避免照片子控件遮盖标记。
|
|
||||||
- 全局停止、机械臂停止、断开及同设备其他动作会取消关节流程;自身流程 MoveJ 不触发自我取消。等待回调校验执行代次,旧回调不能推进新的流程。
|
|
||||||
- 解决 protobuf 字段碰撞:保留 `CameraState.codec=10`,使用 `capabilities=11`;同步本地服务端协议。不能把字段号冲突当作普通文本拼接。
|
|
||||||
|
|
||||||
新增源文件:`src/agvmapviewwidget.*`、`src/jointfloweditor.*`、`src/tactileheatmapwidget.*`、`resources/joint_programs.json`。该 JSON 保留为来源资源,没有覆盖运行目录的现有用户点位文件。
|
|
||||||
|
|
||||||
## 验证
|
|
||||||
|
|
||||||
- 合并预览程序完整编译和链接成功:`bin/debug/CmvrControlStation_merged_preview.exe`。
|
|
||||||
- 末端操作:25 项通过;手眼 UI:22 项通过;手眼选择/变换/URDF:23 项通过;TCP 算法:16 项通过。
|
|
||||||
- 协议兼容:3 项通过,包括已分发的第 10 号 codec 字段。
|
|
||||||
- 关节流程:4 类停止/手动动作联锁及旧等待回调,共 5 个回归场景通过。修复前这些场景均失败。
|
|
||||||
- 真实 RobotClient 的本地回环测试通过:按机器人 TCP 列表、保存传播、实际 MoveL 目标换算、TCP 枢轴、取消及切换设备;原始灰度/RGBD数据校验、时钟换算、深度→RGB模式切换和终止通知。
|
|
||||||
- 单相机 Demo 视频启动、接收画面和停止自检通过;源码无残留合并标记,`git diff --check` 通过。
|
|
||||||
|
|
||||||
以上回环运动请求仅连接测试自己的 `127.0.0.1` 临时服务,GUI流程测试不连接服务端。没有发送真实机械臂运动指令。
|
|
||||||
|
|
||||||
## 备份与使用
|
|
||||||
|
|
||||||
比较清单:`build/incoming-main-merge/comparison.json`;依赖比较:`native-comparison.json`。
|
|
||||||
合并前备份:`local-sources-before.tar.gz` 和 `incoming-sources-before.tar.gz`,均在 `build/incoming-main-merge/`。它们保留双方存在差异的源文件,不包含构建目录和 SDK 库。
|
|
||||||
|
|
||||||
继续在原工程打开 `CmvrControlStation.pro`,执行 qmake 后编译即可。预览版使用单独名称,未覆盖之前的可执行文件。可使用 `bin/debug/run_merged_preview.cmd` 启动预览版;该入口补充本机 Qt DLL 搜索路径。
|
|
||||||
|
|
||||||
此次没有提交、推送或替换服务器服务。新增 AGV/灵巧手功能仍需匹配版本的服务端及实机验证。相机服务在 2026-10-12 完成隔离构建和生命周期测试;2026-10-13 最后同步的协议编号调整因服务器 `192.168.0.28` 连接超时,未在服务器重新编译。MVS SDK 及实机验证边界见 CAMERA_AUTO_MODE.md。
|
|
||||||
|
|
||||||
## 合并后本地功能保留复查(2026-10-13)
|
|
||||||
|
|
||||||
按用户要求再次对照 `local-sources-before.tar.gz`,检查了备份中的全部 101 个本地差异文件,而不是只检查 Git HEAD。没有文件丢失;修复后 78 个文件忽略换行方式后与备份一致,23 个有合并或本轮修复。原有 72 个本地独有文件全部存在,其中只有 1 个状态文档及 3 个补充回归测试发生变化,功能实现文件未被替换。原有 6 个仅本地修改文件全部保持一致。qmake/CMake 未删除本地源文件或内置算法部署项。
|
|
||||||
|
|
||||||
发现并修复了首次合并验证漏检的三类行为退化:
|
|
||||||
|
|
||||||
| 问题 | 原因和修复 | 验证 |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| 末端锁定照片遮住 A/B 目标标记 | 新版 `VideoRenderWidget::setImage` 新建的 QLabel 位于 GL 取点层之上。恢复本地 RGBA/QPainter 同画布路径,同时恢复已有 Qt 5.12 RGBA 颜色兼容处理与像素映射几何。 | Windows 软件 OpenGL 下,旧版用例因覆盖层失败;修复后实际 framebuffer 能看到标记,视频几何/锁帧/选择测试通过。 |
|
|
||||||
| 设备和相机列表不再周期刷新 | 新版删除了 `BackendWorker::pollGrpc` 中的状态查询,自动识别仅能依赖首次或手动刷新。恢复原 1 Hz 查询和 500 ms 超时。 | 真实 RobotClient 连接本地临时 SystemService,不启动机械臂遥测、不手动刷新,验证首次发现、设备替换和断开后停止轮询。修复前缺少周期发现。 |
|
|
||||||
| URDF 三维场景、关节绑定和限位丢失 | 新版 `loadUrdf` 无条件提前返回,只保留关节名称。恢复完整场景与限位构建;完成组件树后再接入场景,保留新版异步加载指针防护。 | 修复前场景/限位为空;修复后验证限位、遥测驱动变换、示教限幅、重新加载,并使用项目 `right_arm.urdf` 验证网格和连续遥测渲染。 |
|
|
||||||
|
|
||||||
再次沿入口和保存链路确认保留:TCP 四点/六点法、控制器工具偏移读取、按机器人保存/加载及实际点动;手眼联合标定、非线性精修、算法运行时、采样照片、文件导入、矩阵选择及 URDF 导出;末端观察位、任意像素目标、RGBD/二维平面定位、动作流程、停止联锁;单相机能力与物理身份过滤。TCP 与末端的真实 RobotClient 回环运动测试重新通过。
|
|
||||||
|
|
||||||
本轮生产修改仅为 `src/videorenderwidget.cpp/.h`、`src/robotclient.cpp`、`src/urdfviewerwidget.cpp`。新增 `tests/merge_retention_test.cpp`、`tests/urdf_retention_test.cpp`,扩充 `tests/touchvideo_test.cpp`;测试链接工具增加平台参数,以便在 Windows 上验证实际绘制。主程序重新编译链接成功,预览启动入口不变。
|
|
||||||
|
|
||||||
最终回归结果:视频绘制/锁帧/坐标映射 9 项通过,末端 UI 25 项通过,手眼 UI 22 项通过;自动设备发现、URDF 场景/限位/示教/重新加载、TCP 和末端 RobotClient 回环均通过。手眼测试需要运行目录旁的内置 Python 环境,已将测试程序放到现有 `bin/debug` 运行环境后完成验证。UI 业务测试使用 offscreen;实际标记绘制和 URDF 用 Windows 软件 OpenGL 单独验证。
|
|
||||||
|
|
||||||
本轮修复前备份、逐文件清单、失败复现及通过日志在 `build/incoming-main-merge/local-retention-audit/`。这些验证使用本地临时服务和软件 OpenGL,没有连接真实机械臂;不能代替服务端部署、相机硬件及目标机器显卡驱动联调。
|
|
||||||
|
|
||||||
## 关节速度面板恢复
|
|
||||||
|
|
||||||
对照合并前源码备份、`F:/QT/CmvrControlStation-upload` 和 Git 历史(`5c207d4`、`1473cee`),确认历史面板采用“关节名 / 实时弧度 / − / 限位指示 / +”的动态行。当前 `rebuildArmJogControls` 原布局仍在,但只由 `GetArmInfo.joint_names` 初始化;同时遥测读取只遍历名称数组。服务端缺少 GetArmInfo 或只返回位置数组时,真实关节位置无法生成控制行。该条件已通过本地旧版接口模拟服务复现,不代表已检查用户正在运行的服务端。
|
|
||||||
|
|
||||||
恢复和合并处理:
|
|
||||||
|
|
||||||
- 沿用历史关节行样式、速度倍率、按住 SpeedJ 和松开停止,保留新版“点位与流程”、笛卡尔和视觉标签页。
|
|
||||||
- 遥测按真实关节位置数组读取。缺少名称时显示 J1、J2…,数量及顺序来自当前设备反馈,不硬编码机器人或六轴。
|
|
||||||
- 设备信息不完整时,由当前设备有效遥测初始化关节行;其他设备的消息不会修改当前面板。
|
|
||||||
- 空信息不清除已恢复的关节行,相同信息不重复销毁按钮;确需重建时先结束当前点动。
|
|
||||||
- 无数据时显示等待状态,断开后禁用正反向按钮,避免空白面板和固定的“控制就绪”提示。
|
|
||||||
|
|
||||||
本次修改 `src/mainwindow.cpp/.h`、`src/mainwindow_ui.cpp`、`src/robotclient.cpp`;新增 `tests/jointjog_restore_test.cpp`。备份为 `local-retention-audit/before-jog-restore.tar.gz`。测试使用临时 127.0.0.1 服务模拟缺少名称和 GetArmInfo 的控制器,覆盖实时角度、倍率、关节方向、松开停止、重复刷新、机器人隔离和动态轴数。主程序预览版已重新编译。
|
|
||||||
|
|
||||||
|
|
||||||
## 2026-10-14 第二次增量合并
|
|
||||||
|
|
||||||
来源仍为 `F:/QT/CmvrControlStation-main/cmvrcontrolstation`,目标仍为原本地工程。本轮按昨天的来源备份做增量三方合并,生产代码只修改六个文件:`src/jointfloweditor.cpp/.h`、`src/mainwindow.cpp`、`src/mainwindow_ui.cpp`、`src/robotclient.cpp`、`protos/cmvr/api/arm_command.proto`。来源目录未修改;逐文件哈希检查确认其余本地生产源码没有覆盖或丢失。
|
|
||||||
|
|
||||||
合入更新:关节电流列(mA)及演示数据,协议 `JointState.current=6`;流程支持选中节点后插入、同级拖动排序及自动布局;流程窗口及操作提示同步更新。保留按真实 position 数组恢复关节行、按住点动/松开停止、动态轴数、机器人隔离、停止联锁、相机能力、TCP/手眼/末端功能接线。
|
|
||||||
|
|
||||||
修复来源版本中的问题:
|
|
||||||
|
|
||||||
- “切换到根流程末尾”同步清除场景和内部选择,避免继续插在旧选中节点之后。
|
|
||||||
- 重建画布后同步插入位置提示;进入循环时清除旧卡片选择。
|
|
||||||
- 析构前断开场景的选择回调,避免成员销毁后仍被场景析构访问;原版本已在独立测试中复现堆损坏退出。
|
|
||||||
- 自动排列按整棵子树的占用宽度避让,避免相邻循环展开后子节点重叠;拖动只调整同级顺序。
|
|
||||||
- 电流数组缺项显示“未提供”,NaN/Inf 显示“无效”,真实零值显示 `0`,负值保持原符号;数据随后缺失时清除旧读数。本地服务端尚未填充新字段,不能把此上位机更新视为电流实测接口已经部署。
|
|
||||||
|
|
||||||
新增 `tests/jointflow_update_test.cpp/.pro`,扩展 `tests/jointjog_restore_test.cpp`。流程测试覆盖根末尾、选中后插入、取消选择后追加、嵌套循环及保存加载、相邻循环不重叠、拖动事件排序和选中卡片析构。真实 RobotClient 的临时回环测试覆盖旧服务端无名称/无电流、新字段、零值、负值、NaN/Inf、短数组及撤销读数,继续验证原关节点动/停止/动态轴数。
|
|
||||||
|
|
||||||
验证:Qt 5.12.4 / MinGW 7.3 主程序完整编译链接成功;流程七个场景通过;电流/旧控制器关节回环通过;原流程停止/手动操作/旧定时回调联锁五个场景通过;设备自动发现、更换及断开停止轮询通过;相机协议兼容三个测试通过。测试只使用本地临时服务或 UI 事件,没有连接真实机械臂。没有改动服务端、提交或推送仓库。
|
|
||||||
|
|
||||||
本轮备份、精确增量、失败复现和通过日志位于 `build/incoming-main-merge/update-2026-10-14/`,修改前备份为 `before.tar.gz`。程序仍为 `bin/debug/CmvrControlStation_merged_preview.exe`,使用 `bin/debug/run_merged_preview.cmd` 启动。
|
|
||||||
@ -1,94 +0,0 @@
|
|||||||
# 末端操作:视觉取点与触控笔动作
|
|
||||||
|
|
||||||
## 入口与适用范围
|
|
||||||
|
|
||||||
入口为“复杂操作 → 末端操作”,位于手眼标定下方,页面索引 15。沿用现有面板、表格、按钮、日志和 QMessageBox。实时视频在左上,标定、观察位和双列动作参数在右上,目标坐标和执行路径在下方;执行和停止按钮固定在底部,不随内容滚动。页面视频与配置约为 7:3,视频按实际帧比例填充可用空间。进入页面后在连接和相机就绪时自动预览,没有手眼结果时可先从相机列表选择设备。离开页面仅停止本页面启动的视频会话。
|
|
||||||
|
|
||||||
无需棋盘格、角点或目标检测。可在锁定 RGB 画面上选择任意具有可靠深度的目标像素。单击、双击支持 1–2 个目标并依次完成;滑动必须选择 A/B 两点,按 A → B 执行。目标坐标直接由配准深度计算;直线滑动会检查中间深度,不支持沿未知曲面自动贴面运动。
|
|
||||||
|
|
||||||
## 操作流程
|
|
||||||
|
|
||||||
1. 在机械臂页选择服务器和设备;在 TCP 标定页核对控制器当前活动 TCP 偏移。
|
|
||||||
2. 进入末端操作,将机械臂放到便于观察且离开触控面的姿态,点击“录入当前观察位”。
|
|
||||||
3. 选择该机器人已保存的手眼标定与触控笔 TCP。相机由手眼记录确定;支持 Eye-in-Hand 和 Eye-to-Hand。
|
|
||||||
4. 三点示教已取消。触控姿态沿用观察位所选 TCP 的姿态,接近/抬笔沿相机 Z 轴反方向。观察位需保证笔姿适合目标,且有足够接近距离。
|
|
||||||
5. 点击“回观察位”,或通过现有机械臂页面手动返回观察位。回程是直线段,操作人员必须先确认路径净空;页面没有碰撞模型或全局绕障规划。
|
|
||||||
6. 开始视频,核对 RGB 内参、标准 Brown 畸变模型及相机/上位机时钟。点击“锁定观察画面”,系统请求同一组原始 RGBD,并使用前后静止位姿读数夹住彩色和深度的采集时间。
|
|
||||||
7. 在画面内点选 A/B,黑边不参与选点;选满两点后再点击将开始一组新选点。“目标点坐标换算结果”即时显示像素坐标及相机系、基座系 XYZ(mm)。这里显示深度测量得到的目标点,未叠加接触偏移。设置单击、双击或滑动及动作参数。
|
|
||||||
8. 点击“转换 / 预览”,检查控制器活动 TCP 的逐步运动路径,确认笔姿及净空后执行。换算结果与运动路径分开显示;重新锁图、切换机器人或标定后需重新取点。
|
|
||||||
9. 任务执行接近、接触、必要的双击短抬/第二次接触或滑动、回撤、返回观察位。两点单击/双击在每个目标后分别回到观察位。
|
|
||||||
|
|
||||||
执行前再次读取真实位姿,必须仍在观察位(0.5 mm / 0.2°内)。锁定图像最多用于 60 秒内的执行。完成、停止、离开页面或切换机器人后清除目标和路径,需要重新取图。
|
|
||||||
|
|
||||||
## 数据和真实接口
|
|
||||||
|
|
||||||
- 视频复用 `RobotClient::videoFrameReceived`、`VideoRenderWidget` 及现有解码线程。仅停止本页面创建的相机流;借用已运行流时不重复创建相机实例。
|
|
||||||
- 原始 RGBD 来自 `requestTouchRgbdImage` → 现有 `CameraService.GetRGBDImages`,请求启用 `require_metric_depth`。继续使用现有 RobotClient 工作线程;彩图深度、内参及时间戳作为一次结果排队送回 UI。
|
|
||||||
- 原始 BGR 转为拥有独立存储的 QImage;保留原始 U16/F32 小端深度数据,按服务提供的 metres_per_unit 转为 m。只接受与原始 RGB 尺寸一致、配准到 RGB 且表示 RGB 光轴 Z 的深度,绝不使用可视化灰度或默认深度比例。
|
|
||||||
- 锁图不再混用视频帧和单独深度帧。必须同时有两张图的真实采集时间戳,帧间时间差不超过 33 ms;过期快照会在原有超时内重试。两张图均须落在前后静止位姿读取之间。取消/退出后迟到结果作废。
|
|
||||||
- 位姿复用 `requestTcpCalibrationPose` → `getRobotState.actual_tcp_pose`,检查真实连接、静止、故障/保护停止/急停、数据来源和请求时间。该值为控制器活动 TCP,先去除已核对的活动偏移得到法兰位姿。
|
|
||||||
- 运动复用 `requestTcpJogMove` → 现有 `MoveL(base,tcp)`。路径把选定触控笔 TCP 的目标换算成控制器活动 TCP 目标;不把本机工具名称虚构成控制器坐标系。
|
|
||||||
- 控制器逐步等待 RPC 结束,并重新读取实际位姿核对目标后才进入停留或下一步。不会将命令返回成功等同于已到位。
|
|
||||||
- 手眼列表使用 `HandEyeStore`,TCP 列表使用 `TcpToolStore`,均按服务器和机械臂隔离。新增/修改/删除标定后即时刷新并废弃旧路径。
|
|
||||||
|
|
||||||
## 算法来源与坐标定义
|
|
||||||
|
|
||||||
phone 来源:`F:/phone/scripts/phone_workcell_motion.py` 的 `build_touch_action_plan` / `build_touch_queue_plan`,以及 `handeye_click_motion_gui.py` 的 `_localize_free_pixel`。迁移了观察位检查、单/双击和滑动顺序、法向短抬及返回观察位。Qt 版本补上接近与回撤、真实到位验证和取消状态机。
|
|
||||||
|
|
||||||
phone 的 `_localize_free_pixel` / `_depth_mm` 已迁移到 `TouchPlanner::resolveDepthPixels`:去畸变射线乘以光轴深度,再用手眼矩阵换算。局部取样收紧为 5×5 邻域、至少 5 个有效样本、深度极差不超过 5 mm,避免大范围填洞跨到其他表面;没有可靠深度就拒绝,不使用手动 Z 或三点平面补偿。
|
|
||||||
|
|
||||||
- 内部距离 m,姿态 rad,旋转约定 `Rz(rz) * Ry(ry) * Rx(rx)`,矩阵为行优先。
|
|
||||||
- Eye-in-Hand:`Base_T_Camera = Base_T_Flange_at_capture * Flange_T_Camera`。
|
|
||||||
- Eye-to-Hand:直接使用已保存的 `Base_T_Camera`。
|
|
||||||
- 接近/回撤方向为 `-R_base_camera[:,2]`,沿用 phone 自由取点流程;它不是估计的表面法线。正接触偏移沿相机 +Z 推进,是几何位移,**不是力控**。触控方向由观察位笔姿决定,不因选点自动转笔。
|
|
||||||
- `Base_T_ActiveTarget = Base_T_SelectedTarget * inverse(Flange_T_Selected) * Flange_T_Active`。
|
|
||||||
- 拒绝无效单位/配准、NaN/Inf、深度空洞、遮挡边缘、失效标定及越界路径。滑动每隔不超过 2 像素采样,深度点偏离端点三维连线超过 3 mm 则拒绝。范围限制不替代机器人 IK、碰撞检查或关节限位。
|
|
||||||
|
|
||||||
## 停止、时间及保存
|
|
||||||
|
|
||||||
停止、页面离开、断连、控制器偏移/机器人切换、外部手动命令介入都会取消后续步骤。失败后不自动回程。位姿请求超时 6 秒,每段运动超时 30 秒,整段序列超时 180 秒。
|
|
||||||
|
|
||||||
双击间隔是抬笔到位后的停留时间;实际触点间隔还包含机械臂运动与通信时间,需要在目标触摸设备上验证双击识别阈值。没有硬实时或触控成功识别保证,也没有增加未经证实的压力传感器接口。
|
|
||||||
|
|
||||||
观察位、所用活动偏移及所选标定名称沿用 QSettings,保存于 `touchOperation/v1/SHA256(endpoint + NUL + deviceId)`。启动后按机器人恢复;活动 TCP 偏移改变时观察位失效。选定工具切换后清除图像和路径,并按新 TCP 偏移重新计算笔尖位姿。旧版三点配置不再读取。图像、目标点、已核对状态和待执行路径不会跨会话恢复。
|
|
||||||
|
|
||||||
## 文件与验证
|
|
||||||
|
|
||||||
新增 `src/touchplanner.h/.cpp`、`touchsequencecontroller.h/.cpp`、`touchvideowidget.h/.cpp`、`touchoperationwidget.h/.cpp`。
|
|
||||||
|
|
||||||
修改 MainWindow 的入口、上下文/列表同步、视频归属和退出取消;RobotClient 增加手动命令入队前的同步通知;qmake/CMake 登记源文件。未升级 Qt/C++,未引入额外依赖或新通信通道。
|
|
||||||
|
|
||||||
测试位于 `tests/touchplanner_test.*`、`touchsequence_test.*`、`touchvideo_test.*`、`touchoperation_test.*`,真实 RobotClient 与本机假服务联调为 `tests/touchintegration_test.cpp` / `run_touch_integration.py`。覆盖几何、偏移补偿、时序/取消、双点选取、图像内参缩放、配置隔离、实际回程、停止和外部命令介入。
|
|
||||||
|
|
||||||
测试使用合成图像/位姿和 127.0.0.1 模拟服务,不等同于实机触控精度、双击时序或碰撞验收。离屏 OpenGL 不支持真实视频显示,实机视频仍需在正常图形环境验证。
|
|
||||||
|
|
||||||
## 深度服务更新
|
|
||||||
|
|
||||||
客户端和服务端必须同时具备公制 RGBD 契约。Qt 已实现并编译;服务端源码修改在 `F:/QT/cmvr-es-depth`,补丁为 `patches/cmvr-es-metric-rgbd.patch`,基于 `cmvr-es origin/dev` 的 `9b2f5773e692706e4c618e23889befc18cbbc579`。
|
|
||||||
|
|
||||||
- `GetRGBDImages` 新增可选请求位和 `DepthGeometry`;旧请求行为不变。未升级服务会缺少元数据,客户端明确提示更新,不继续生成坐标。
|
|
||||||
- RealSense 相机配置需要 `STREAM_MODE_RGBD`。服务复用现有采集线程保存原始帧组,用 SDK 的 `get_units()` 读取真实比例,用深度/彩色内外参反投影、变换、投影,按最近深度写入 RGB 尺寸的 F32 米制 Z 图。没有对应测量的像素保持 0。
|
|
||||||
- 时间戳来自 SDK global/system time;仅有 hardware time 时拒绝公制快照,不伪造曝光时间。尝试启用 global time 失败不影响原有视频流程。
|
|
||||||
- 当前补丁实现 RealSense 驱动,其他驱动需实现同一 metric RGBD 契约;普通彩色视频功能不受影响。没有按相机名称、IP 或机器人型号硬编码。
|
|
||||||
- 2026-10-10 已在 `192.168.0.28` 完整编译并部署 RGBD 补丁。真实 `real_cam1` 返回 640×480 彩色图及同尺寸 F32 公制深度,三组有效深度约 10 万像素;彩色/深度采集时间差约 0.018 ms。未执行机械臂触控动作或验证触控精度。
|
|
||||||
- Modified Brown / Inverse Brown 彩色模型通过 SDK 几何校正至针孔快照,深度同时投影到该快照;Inverse Brown 系数全零时直接使用等价的无畸变模型。无测量或无有效彩色映射的像素保留零深度。
|
|
||||||
- Qt 使用服务端响应时间计算 RGBD 年龄,并映射到客户端请求/响应时间区间。保留原始服务器采集时间和时间区间宽度,不假设两台主机 UTC 完全一致;区间必须落在前后静止位姿之间,通信或图像年龄超过 1.5 秒拒绝。
|
|
||||||
- 视频按钮下方显示取点前置条件;实时画面上的点击会提示先锁定同步 RGBD。“已核对相机内参与时钟”未勾选时,直接提示该项。
|
|
||||||
- 服务器部署备份位于 `output/backup-rgbd-20261010-165239`,日志位于 `/tmp/cmvr-rgbd-service.log`。补丁文件已同步包含畸变模型兼容处理。
|
|
||||||
|
|
||||||
在对应服务端源代码根目录先执行 `git apply --check cmvr-es-metric-rgbd.patch`,再 `git apply cmvr-es-metric-rgbd.patch`,按照该工程原有构建流程重新生成 protobuf、编译并部署。不要只替换上位机而继续使用旧服务协议。
|
|
||||||
|
|
||||||
## 本地标定与观察位(2026-10-10)
|
|
||||||
|
|
||||||
手眼与 TCP 各自提供“已有标定 / 本地文件”模式,导入 JSON 后直接用于当前会话的坐标转换和路径计算,不写入控制器、不覆盖已有列表。切换机器人清除导入结果;重启需重新导入。文件含 endpoint/device 时必须与当前设备一致。
|
|
||||||
|
|
||||||
- TCP 支持 phone `save_tcp()` 格式:convention 以 T_flange_tcp 开头,aubo_pose_convention 明确米、ZYX、弧度,tool_name、translation_m[3]、orientation_rxyz[3]。
|
|
||||||
- phone 手眼支持 primary_result、明确的 T_flange_camera 或 T_base_camera[4][4]、camera_matrix、solver、created_at、samples_used 及质量指标。不能将含义不明确的 T_eef_camera 直接作为法兰矩阵。缺少 cameraId 时绑定导入时选择的相机,需人工核对物理设备。
|
|
||||||
- phone 导入质量门限:至少 5 组,平均重投影不超过 1.5 px,AX=XB 平移 RMS 不超过 5 mm、旋转 RMS 不超过 5°;缺失或异常指标拒绝导入。
|
|
||||||
- Qt 单条手眼 JSON 支持 units=m_rad、name、cameraId、mode、matrixDirection、transformSI[16]、method、createdAt、sampleCount、metrics、intrinsics,以及可选 board/refinement/observations;沿用 HandEyeStore 校验。
|
|
||||||
|
|
||||||
观察位采用 phone TaughtPose 语义:同次真实状态的 joint_positions(rad)、所选触控笔 tcp1_pose(m、ZYX rad)、pose_frame=tcp1。内部同时保留控制器当前激活 TCP 位姿,用于现有 MoveL 接口;显示采用度与毫米。切换 TCP、机器人或控制器偏移后应重新示教;缺少关节角的旧记录不自动激活。
|
|
||||||
|
|
||||||
### 页面状态校验
|
|
||||||
|
|
||||||
实时预览采用与手眼页相同的自适应宽度和相机流;冻结画面仅用于同帧 RGBD 取点。锁定需手眼标定、当前 TCP 对应观察位及相机确认齐备。重新加载列表时,如 TCP 被删除或同名参数改变,观察位失效并要求重新录入。滑动需要 A/B 两点;底部提示按当前缺失条件显示下一步操作。
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
# USB 仿生头调试
|
|
||||||
|
|
||||||
在上位机连接 `192.168.0.234:50053`,打开 **仿生头 → 常用操作**,选择 `usb_head`。
|
|
||||||
该页面使用服务端已有的关节 gRPC 接口,不需要部署后端。
|
|
||||||
|
|
||||||
## 单路舵机
|
|
||||||
|
|
||||||
1. 点击 **刷新配置与目标**,读取当前设备的通道、弧度范围和已确认目标。
|
|
||||||
2. 点击 **启用拖动调试**,显式设置直接位置模式;此操作不发送位置目标。
|
|
||||||
3. 拖动对应滑块或输入弧度值。每条位置请求只包含该路舵机,不修改其他通道。
|
|
||||||
|
|
||||||
当前服务配置了 `eye_l_up`、`eye_l_lower`、`eye_l_v`、`eye_l_h`、`pwm8_local` 五路。
|
|
||||||
实际显示和限制以服务端配置为准。拖动请求以 100 ms 节流,每路仅保留最新待发送值;松开后保留最终目标。
|
|
||||||
|
|
||||||
## 预设表情
|
|
||||||
|
|
||||||
页面从服务读取预设,目前包含中立、微笑、疲倦、惊讶、生气、当前姿态。
|
|
||||||
选择表情只查看预设,点击 **执行所选表情** 才按其 ID 调用 gRPC;过渡时间支持 0.2~5 秒。
|
|
||||||
“当前姿态”是服务端固定预设的名称,不是实时姿态采集。
|
|
||||||
|
|
||||||
服务要求已确认的完整起点。页面提示起点未就绪时,可显式点击 **归位并准备预设**,
|
|
||||||
它会把所有配置通道移动到各自的初始目标,成功读回后才可执行预设。页面不会自动归位。
|
|
||||||
|
|
||||||
**取消表情** 会取消当前 RPC 并请求停止后续主机表情帧。设备没有硬件急停接口,
|
|
||||||
这个按钮不能保证舵机立即停止,也不能撤回已经发给设备的命令。
|
|
||||||
|
|
||||||
## 本地自定义表情
|
|
||||||
|
|
||||||
右侧切换到 **本地表情**。本地库保存在上位机 `data/biohead_expressions.json`,
|
|
||||||
按服务地址(区分演示和真实连接)及设备 ID 隔离,不会上传或覆盖设备预设。
|
|
||||||
|
|
||||||
1. 点击 **编辑输入(不发送)**,用左侧滑块和弧度输入编辑目标;此模式不向设备发送动作。
|
|
||||||
2. 输入名称和 0.2~5 秒过渡时长,点击 **保存当前目标为新表情**。保存的是完整输入目标,
|
|
||||||
不是实测姿态。名称重复会报错,不会悄悄覆盖已有记录。
|
|
||||||
3. 选择本地表情只预览。点击 **载入目标** 才会填入左侧输入,仍然不会移动设备;修改后可
|
|
||||||
点击 **更新所选**。**删除所选** 只删除本机记录,并需要确认。
|
|
||||||
4. 点击 **执行本地表情** 才将完整目标通过现有 `SetHeadExpression` gRPC 接口执行。
|
|
||||||
起点未就绪时需要显式归位准备;页面不会自动归位或重发失败动作。
|
|
||||||
|
|
||||||
若要从本地编辑恢复实际逐舵机调试,需重新点击 **启用拖动调试**,这一步只切换模式,
|
|
||||||
不会自动发送编辑后的输入。配置缺失、通道不一致或目标超出当前设备范围时,禁用保存或执行。
|
|
||||||
断线不会删除本地记录,重新连接同一服务及设备后可继续使用。文件损坏或写入失败会明确报错,
|
|
||||||
不会显示保存成功。
|
|
||||||
|
|
||||||
## 状态和边界
|
|
||||||
|
|
||||||
- 服务提供的是已确认目标缓存,没有实际位置测量;确认成功不代表机械已经到位。
|
|
||||||
- 打开页面、刷新状态、选择表情均不会发送位置命令。
|
|
||||||
- 切换设备、切换“常用操作/全部接口”、离开仿生头页面或断线时,清除待发目标并取消当前请求;再次调试需要重新启用。
|
|
||||||
- 切换“设备预设/本地表情”会清除待发目标并停用拖动调试;已经开始的表情需点击“取消表情”来取消。
|
|
||||||
- 操作失败或超时后不自动重发,不自动重连或归位。先刷新状态,再明确选择下一步操作。
|
|
||||||
- 只读状态查询使用独立的 6 秒预算。读取失败时暂停真实控制,保留同一设备的本地输入草稿和上次配置;可继续本地编辑或保存,手动刷新成功后再恢复控制。状态读取失败不会被描述为动作执行失败。
|
|
||||||
- 页面移除了说话类快捷动作。原有任务编排和“全部接口”中的旧接口仍保留兼容。
|
|
||||||
|
|
||||||
## 编译
|
|
||||||
|
|
||||||
在 CMD 中执行(已安装本机项目依赖的情况下):
|
|
||||||
|
|
||||||
```bat
|
|
||||||
cd /d C:\Users\LattePanda\Documents\CmvrControlStation-main
|
|
||||||
set "PATH=E:\qt\qt5.12.4\5.12.4\mingw73_64\bin;E:\qt\qt5.12.4\Tools\mingw730_64\bin;%PATH%"
|
|
||||||
qmake CmvrControlStation.pro
|
|
||||||
mingw32-make -f Makefile.Release -j4
|
|
||||||
```
|
|
||||||
|
|
||||||
关闭旧程序后重新编译,运行 `bin\release\CmvrControlStation.exe`。
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
# TCP calibration migration implementation plan
|
|
||||||
|
|
||||||
Goal: fill existing navigation slot 13 with phone-equivalent fixed-point TCP calibration, using verified robot feedback and local QSettings persistence explicitly approved by the user.
|
|
||||||
|
|
||||||
Initial migration scope: retain Qt 5.12.4 / MinGW 7.3 / C++14, existing .pro fixes and certificate. Reuse current checkout because the user builds this exact project in Qt Creator. No robot motion, controller writes, new navigation or dependency installation in that phase.
|
|
||||||
|
|
||||||
Verified design:
|
|
||||||
- Current TCP panel is createCalibrationEntryPage in mainwindow.cpp; no TCP .ui/class/CRUD exists. Keep its stack position. Dynamic internal widget follows panel/sectionTitle/mutedLabel/primaryButton and mechanical-arm tables; no global stylesheet changes.
|
|
||||||
- phone scripts/handeye_calibration_gui.py solve_tcp_offset: >=4 base-to-flange poses, metres and ZYX Euler radians, Rz Ry Rx; stacked [R,-I] least squares. RMS mm, save blocked above 2mm. Orientation is manual, never claimed calibrated.
|
|
||||||
- Existing getPose ignores requested flange on vendor backends; getPoseMatrix is unimplemented. Reuse RobotClient worker/channel and getRobotState, require verified AUBO vendor, validate stopped/connected/finite feedback. Derive flange with phone robot_backend.py transform chain from explicit user-confirmed active server TCP offset. Never use telemetry display cache or simulated samples.
|
|
||||||
- No TCP save RPC/config fields. User explicitly selected local QSettings, separate local tool names and controller frames. Persist per endpoint and device. Do not make local selection change motion/controller settings.
|
|
||||||
|
|
||||||
Tasks / verification:
|
|
||||||
- [x] Numerical module + tests: known pivot solution, rank/conditioning, invalid finite inputs, duplicate poses, noisy/high-error sets, Euler and flange/tool conversions. Compare Python phone solver.
|
|
||||||
- [x] Additive worker request/result with request token; false/demo/disconnected/vendor unsupported/state errors return explicit failure. UI ignores late results after reset/device/session changes.
|
|
||||||
- [x] Local tool store tests: namespace isolation, restart reload, bad data, duplicate name/update, current selection, sync failure reporting.
|
|
||||||
- [x] Populate existing TCP page: tool name/list, manual orientation, active server TCP offset confirmation, 4+ sample rows, capture/overwrite, solve/clear/save/reload, residuals and RMS, local tool preview; log via MainWindow and use QMessageBox.
|
|
||||||
- [x] UI tests with injected result signals (no hardware) for capture flow, source/tool changes, late responses, errors, invalid RMS, round-trip save/reload. Offscreen render inspect.
|
|
||||||
- [x] Build existing Debug target, review changes, report precise limitations (local persistence, manually confirmed active TCP, AUBO pose adapter, hardware not tested).
|
|
||||||
|
|
||||||
User-requested follow-up: remove vendor/connection banner; return saved TCPs to the current robot's speed-control selector and actually use offsets for movement. This supersedes the initial phase's no-motion UI scope (no hardware commands are run during development).
|
|
||||||
|
|
||||||
- [x] Preserve per-endpoint/per-device QSettings storage and connect save/update/delete to the same robot's tool selector.
|
|
||||||
- [x] Generic calibration UI with clear separation of the profile being edited and the profile selected for motion.
|
|
||||||
- [x] Bounded local-tool jogging via verified MoveL(base,tcp) with fresh feedback and rigid-transform compensation; cancellable on release/context/stop/timeout.
|
|
||||||
- [x] Invalidate active-TCP confirmation before ordinary named MoveL and mutable ArmService RPCs.
|
|
||||||
- [x] Numerical/state-machine tests, robot-isolated UI/store tests and real loopback gRPC integration using MainWindow/RobotClient. Document finite-step and vendor-adapter limits.
|
|
||||||
- [x] Build the complete app to an alternate filename because the user's original executable is running; preserve the process.
|
|
||||||
@ -1,160 +0,0 @@
|
|||||||
# 单相机自动切换 Implementation Plan
|
|
||||||
|
|
||||||
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. This task uses native execution in the existing session; no subagent dispatch.
|
|
||||||
|
|
||||||
**Goal:** 在同一服务端入口下替换 RealSense 与 MV-CS050-10UM,Qt 自动识别当前相机并切换 RGBD 或二维平面操作。
|
|
||||||
|
|
||||||
**Architecture:** 服务端增加一个自动相机适配器,保持逻辑设备 ID 稳定,实际型号、序列号和会话代次动态变化。适配器一次只拥有一个采集实例;Qt 通过 CameraService 查询真实能力,现有页面消费同一身份与图像。二维操作复用 TouchPlanner 的射线平面求交,配置仍使用 QSettings。
|
|
||||||
|
|
||||||
**Tech Stack:** Qt 5.12.4、现有 qmake/CMake、protobuf/gRPC、现有 OpenCV/FFmpeg/RealSense SDK;海康 MVS SDK 为服务端可选依赖。
|
|
||||||
|
|
||||||
**Spec:** `docs/superpowers/specs/2026-10-12-camera-capability-modes-design.md`
|
|
||||||
|
|
||||||
## Global Constraints
|
|
||||||
|
|
||||||
- 同一时间只使用一台相机,不实施双相机协同或并行采集。
|
|
||||||
- 不硬编码 IP、名称或序列号。
|
|
||||||
- 保留现有页面导航、视频获取通道、TCP 和手眼保存机制。
|
|
||||||
- Qt 5.12.4 和现有 C++ 标准保持不变。
|
|
||||||
- SDK 未安装时明确提示驱动不可用,不影响原有相机驱动构建。
|
|
||||||
- 自动化测试不发送机械臂运动指令。
|
|
||||||
- 力传感器尚无型号和协议,本次仅预留接入契约和状态;不提供真实力控。
|
|
||||||
|
|
||||||
## Review Focus
|
|
||||||
|
|
||||||
1. 同一逻辑设备 ID 换了硬件:必须检测序列号和会话变化,旧图像、标定与路径不得继续使用。
|
|
||||||
2. 采集帧跨越机器人读取窗口,或两台机器时钟不同:保留时间不确定区间并拒绝不能确定同步的数据。
|
|
||||||
3. 单台设备拔出或发现两台设备:清除活动相机,禁止静默选取设备或回退定位方式。
|
|
||||||
4. 内参被 ROI、分辨率或镜头变化影响:阻止定位,不能缩放旧内参冒充新标定。
|
|
||||||
5. MVS 缺失或传感器未接入:不伪造图像、深度、时间戳或零力反馈。
|
|
||||||
|
|
||||||
## Task 1: 服务端身份与能力协议
|
|
||||||
|
|
||||||
**Files:**
|
|
||||||
- Modify (both repositories): `protos/cmvr/api/camera_command.proto`
|
|
||||||
- Modify (server): `cmvr-es/devices/camera/abstract_camera.h`
|
|
||||||
- Modify (server): `cmvr-es/service/grpc/src/grpc_camera_service.cpp`
|
|
||||||
- Modify (server): RealSense header/source for actual device identity
|
|
||||||
- Test (server, new): `cmvr-es/service/grpc/tests/camera_capabilities_test.cpp`
|
|
||||||
|
|
||||||
**Interfaces (new definitions, not existing interfaces):**
|
|
||||||
- `CameraCapabilities` message: version, driver, model, serial, transport, raw_image, valid_intrinsics, capture_timestamp, metric_aligned_depth, distortion_model, session_generation, unavailable_reason.
|
|
||||||
- Append `CameraState.capabilities`; append `FrameData.camera_serial` and `FrameData.camera_session_generation` using unused field numbers. Preserve existing fields.
|
|
||||||
- `AbstractCamera::getCapabilities()` returns a value snapshot; default reports unsupported/unknown, never inferred capabilities.
|
|
||||||
|
|
||||||
- [ ] Write tests: empty capability fields remain unknown; non-depth driver cannot advertise metric depth; serialized legacy fields retain their values; raw and video frames carry the same hardware identity.
|
|
||||||
- [ ] Run those tests to establish failure before adding capability fields and producers.
|
|
||||||
- [ ] Extend both proto copies and regenerate using project build tooling. Use SDK-reported model/serial; RealSense metric capability additionally requires the supported depth output mode and geometry path.
|
|
||||||
- [ ] Include identity, distortion model and real capture timestamp in raw GetRGBImage response, not response receipt time. Return no usable image when capture identity is missing or stale in automatic mode.
|
|
||||||
- [ ] Run protocol/producer tests and existing camera stream policy tests; check that old clients ignore new fields.
|
|
||||||
|
|
||||||
## Task 2: MVS 灰度采集与单实例生命周期
|
|
||||||
|
|
||||||
**Files:**
|
|
||||||
- Create (server): `cmvr-es/devices/camera/mvs_camera/include/mvs_camera.h`
|
|
||||||
- Create (server): `cmvr-es/devices/camera/mvs_camera/src/mvs_camera.cpp`
|
|
||||||
- Create (server): `cmvr-es/devices/camera/mvs_camera/CMakeLists.txt`
|
|
||||||
- Create (server): `cmvr-es/devices/camera/mvs_camera/tests/mvs_camera_test.cpp`
|
|
||||||
- Modify (both repositories): `protos/cmvr/config/camera_config/camera_config.proto`
|
|
||||||
- Modify (server): `cmvr-es/devices/camera/CMakeLists.txt`
|
|
||||||
|
|
||||||
**Interfaces (new):**
|
|
||||||
- `MvsCamera final : AbstractCamera` implements existing init/start/stop, state, raw image and encoded frame interfaces.
|
|
||||||
- `MvsCameraConfig`: id, serial, capture, encoder, fx/fy/cx/cy, exactly five Brown distortion coefficients, calibration_width/height. Unspecified intrinsics do not prevent preview but disable calibration and positioning.
|
|
||||||
- An SDK discovery helper returns attached model/serial/transport descriptors without starting acquisition.
|
|
||||||
|
|
||||||
- [ ] Obtain and inspect official MVS headers/sample definitions on the server before implementing calls. If SDK is unavailable, build the explicit unsupported adapter branch and document the hardware-validation limitation; do not fabricate SDK declarations.
|
|
||||||
- [ ] Write fake-SDK tests: Mono8 ownership after buffer release, actual frame width/height, start/stop/restart, no duplicate producer, shutdown while awaiting frame, timeout, SDK missing.
|
|
||||||
- [ ] Run tests to establish failure, then implement optional SDK compilation using its actual headers/libraries.
|
|
||||||
- [ ] Acquire images on one worker, copy SDK-owned buffers before releasing them, and publish through the existing CameraStreamEncoder/stream interface. Preserve sensor frame number and distinguish SDK sensor timing from host receive timing; advertise timestamp capability only when bounded capture timing is actually established.
|
|
||||||
- [ ] Keep raw acquisition dimensions separate from preview encoding dimensions. A mismatched intrinsics configuration blocks raw calibration capture, not video preview.
|
|
||||||
- [ ] Run fake-SDK tests. With hardware/SDK present, verify real Mono8 snapshots and steady video without any robot moves.
|
|
||||||
|
|
||||||
## Task 3: 服务端自动相机适配器
|
|
||||||
|
|
||||||
**Files:**
|
|
||||||
- Create (server): `cmvr-es/devices/camera/auto_camera/include/auto_camera.h`
|
|
||||||
- Create (server): `cmvr-es/devices/camera/auto_camera/src/auto_camera.cpp`
|
|
||||||
- Create (server): `cmvr-es/devices/camera/auto_camera/CMakeLists.txt`
|
|
||||||
- Create (server): `cmvr-es/devices/camera/auto_camera/tests/auto_camera_test.cpp`
|
|
||||||
- Modify (server): `cmvr-es/devices/camera/camera_factory.h`, camera CMakeLists
|
|
||||||
- Modify (both repositories): camera_config.proto
|
|
||||||
- Create (Qt documentation): `docs/CAMERA_AUTO_MODE.md` with a standalone configuration example; do not overwrite live configuration.
|
|
||||||
|
|
||||||
**Interfaces (new):**
|
|
||||||
- `AutoCameraConfig`: id, RealSense capture/encoder profile, MVS profile, per-serial calibration entries.
|
|
||||||
- `AutoCamera final : AbstractCamera`, stable logical id; internal device and capabilities refer to the current real hardware.
|
|
||||||
- `discoverAttachedCamera()` uses RealSense SDK enumeration and Task 2 discovery; result is none, unique, ambiguous, or unavailable.
|
|
||||||
- `session_generation` increases before clearing/replacing the delegate; all frames carry that generation.
|
|
||||||
|
|
||||||
- [ ] Write fake-device tests: unique RealSense, unique MVS, none, ambiguous, unplug during raw capture, replaced serial under the same logical ID, and outstanding stream lease during replacement.
|
|
||||||
- [ ] Run tests to establish failure; implement delegation using existing camera methods, without changing DeviceManager global registration behavior.
|
|
||||||
- [ ] On refresh/start, retire the old delegate and its producer before creating a new one. On disappearance, fail current reads and terminate the old stream epoch. Never encode or read through a freed delegate; never combine producer indexes from different sessions.
|
|
||||||
- [ ] One logical auto-camera entry must replace the separate enabled camera entries in the deployment example. Preserve separate legacy configurations for users who do not enable auto mode.
|
|
||||||
- [ ] Run lifecycle tests and verify at most one acquisition instance starts at any point. Refresh/reconnect supports replacement; automatic hotplug monitoring is added only if its lifecycle can use existing events without a second capture instance.
|
|
||||||
|
|
||||||
## Task 4: Qt 自动能力同步与标定归属
|
|
||||||
|
|
||||||
**Files:**
|
|
||||||
- Modify: `src/robotclient.h`, `src/robotclient.cpp`
|
|
||||||
- Modify: `src/mainwindow.h`, `src/mainwindow.cpp`
|
|
||||||
- Modify: `ui/handeyecalibrationwidget.h/.cpp/.ui`
|
|
||||||
- Modify: `src/touchoperationwidget.h/.cpp`
|
|
||||||
- Modify: `src/handeyestore.h/.cpp`, `src/calibrationfile.h`
|
|
||||||
- Test: `tests/touchintegration_test.cpp`, `tests/touchoperation_test.cpp`, `tests/handeyeui_test.cpp`, `tests/handeyestore_test.cpp`
|
|
||||||
|
|
||||||
**Interfaces (new):**
|
|
||||||
- `RobotClient::requestCameraCapabilities(const QString &cameraId, quint64 token)` and matching `cameraCapabilitiesReceived(token, cameraId, capabilities, success, detail)`.
|
|
||||||
- Each calibration page accepts an active-camera snapshot through `setCameraCapabilities(const QString &cameraId, const QVariantMap &capabilities)`.
|
|
||||||
- Add optional cameraSerial and cameraModel fields to HandEyeStore::Record. Preserve legacy files but require explicit identity confirmation; known mismatched identity must be rejected.
|
|
||||||
|
|
||||||
- [ ] Add tests for unknown capabilities, server reconnect, delayed stale response, same ID/new serial, same serial/new acquisition generation, and legacy result identity confirmation. Run them red.
|
|
||||||
- [ ] Query asynchronously after connection and device discovery; match callbacks to session/token. MainWindow supplies the same unique active camera to the camera, handeye and touch pages. No new two-camera selector or navigation.
|
|
||||||
- [ ] Clear frame/target/path on identity, generation, calibration or intrinsics changes. Hide incompatible saved results; reject imports belonging to another known camera.
|
|
||||||
- [ ] Display current model and automatic mode compactly. Preview may start with unknown/missing intrinsics; sampling and coordinate conversion remain blocked with a precise reason.
|
|
||||||
- [ ] Run widget/store/loopback tests. Assert read/identity refresh requests issue zero robot motion RPCs.
|
|
||||||
|
|
||||||
## Task 5: 二维平面参数与定位流程
|
|
||||||
|
|
||||||
**Files:**
|
|
||||||
- Create: `src/touchplanestore.h/.cpp`
|
|
||||||
- Modify: `src/touchoperationwidget.h/.cpp`, `src/touchplanner.h/.cpp`
|
|
||||||
- Modify: `src/robotclient.h/.cpp`, `src/mainwindow.cpp`
|
|
||||||
- Modify: `CmvrControlStation.pro`, `CMakeLists.txt` and affected test .pro files
|
|
||||||
- Test: `tests/touchplanner_test.cpp`, `tests/touchoperation_test.cpp`, `tests/touchintegration_test.cpp`
|
|
||||||
- Document: `docs/CAMERA_AUTO_MODE.md` with a plane JSON example
|
|
||||||
|
|
||||||
**Interfaces (new):**
|
|
||||||
- `TouchPlaneStore::Record`: name, endpoint/device scope, cameraSerial, handEyeName, handEyeFingerprint, intrinsicsFingerprint, Plane, operatingRadiusM.
|
|
||||||
- `TouchPlaneStore::parse(const QVariantMap &, Record &, QString &error)`, `load(QSettings &, endpoint, device, serial, Record &, error)`, `save(...)`. Parsing failure leaves the previous value unchanged.
|
|
||||||
- Plane JSON contract: schema_version=1, units="m", frame="robot_base", name, robot_id, camera_serial, handeye_name/fingerprint, intrinsics_fingerprint, origin[3], normal[3], operating_radius_m. Normal must be finite and unit length within 1e-6; radius finite, >0 and <= configured maxTravelM.
|
|
||||||
- A separate `requestTouchImage(cameraId, token)` returns raw image, matched intrinsics and bounded local capture interval without pretending it is RGBD. Existing requestTouchRgbdImage retains its strict checks.
|
|
||||||
|
|
||||||
- [ ] Add parser/load tests for serial mismatch, missing plane, invalid units/frame/normal, NaN, handeye replacement, intrinsics replacement and QSettings failure. Add UI tests for switching RGBD → plane → RGBD and failure remaining in the selected mode. Run red.
|
|
||||||
- [ ] Add an import-plane button and short current-plane state to the existing task panel. Do not recreate the deleted mandatory three-contact teach controls.
|
|
||||||
- [ ] Reuse observation pose bracketing. In plane mode lock the raw grayscale frame only when its capture interval is wholly inside the robot-reading interval. Reuse the existing RGBD clock conversion logic as a shared helper, preserving uncertainty and validation.
|
|
||||||
- [ ] Call resolvePixels for plane mode, then invert Base_T_Camera for camera XYZ display. Use the imported plane normal for approach/retract and the current selected TCP orientation; call buildPlan with depthTargets=false. Keep depth mode's depth validation and depthTargets=true.
|
|
||||||
- [ ] Keep explicit path preview/confirmation and existing motion interfaces. Missing depth is an error in depth mode, never an automatic fallback to plane mode.
|
|
||||||
- [ ] Run geometry and widget tests, including parallel rays, behind-camera intersections, invalid plane bounds, old frames, and 1–2 arbitrary non-board target pixels. Verify existing RGBD tests still pass.
|
|
||||||
|
|
||||||
## Task 6: 力传感器预留与整体验证
|
|
||||||
|
|
||||||
**Files:**
|
|
||||||
- Modify: `src/touchoperationwidget.h/.cpp`
|
|
||||||
- Document: `docs/CAMERA_AUTO_MODE.md`
|
|
||||||
- Test: `tests/touchoperation_test.cpp`
|
|
||||||
|
|
||||||
**Interfaces:**
|
|
||||||
- This phase exposes no live sensor API. UI state is “力传感器:未接入”; no fabricated zero force, no enabled force-control buttons.
|
|
||||||
- Document future sensor contract: identity, robot binding, Fx/Fy/Fz in N, timestamp/validity, force coordinate frame, sensor-to-tool transform, range and fault. Torque is explicitly absent for a three-axis sensor.
|
|
||||||
|
|
||||||
- [ ] Add a UI assertion that unconnected force is represented as unavailable and cannot be selected as contact feedback.
|
|
||||||
- [ ] Implement the compact state row in the current action panel; document recalibration after mechanical installation changes and future server/controller-side contact control.
|
|
||||||
- [ ] Run affected QtTest suites and Python handeye tests only where affected; regenerate protobufs and build the Qt executable with existing Qt/MinGW versions.
|
|
||||||
- [ ] Build the server with MVS disabled to prove optional dependency compatibility; with SDK available, build the enabled adapter and verify a real camera stream and image/capability response.
|
|
||||||
- [ ] Review diff for stale callbacks, frame/SDK buffer lifetime, single producer ownership, unit/transform direction, and changes outside this feature.
|
|
||||||
- [ ] Report exact files and checks, and separately state any SDK/hardware limitation. Do not claim hardware switching or force control is validated without corresponding evidence. Do not send physical movement commands as an automatic check.
|
|
||||||
|
|
||||||
## Execution and deployment
|
|
||||||
|
|
||||||
Implement in the current session after plan review. Preserve existing local changes and do not commit or push unrelated files. Server changes are first built and packaged with the configuration example; a running service is not replaced as part of automated tests. The unresolved actual-motion issue remains a separate prerequisite for a physical touch trial.
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
# 新下载工程与本地功能合并
|
|
||||||
|
|
||||||
> 按 superpowers:executing-plans 在当前会话执行;原工作区包含用户尚未提交的功能,不创建遗漏这些功能的空白分支。
|
|
||||||
|
|
||||||
目标:把 F:/QT/CmvrControlStation-main/cmvrcontrolstation 的更新合并到 F:/QT/CmvrControlStation,保留本地 TCP、手眼、末端操作、内置算法和相机自适应。
|
|
||||||
|
|
||||||
共同参考:本地 HEAD 1473cee;新目录为无 Git 元数据的源码快照,不能断言它来自哪个提交。
|
|
||||||
|
|
||||||
- [x] 按共同参考比较源码:13 个双方修改、10 个新版本修改、7 个新版本新增、6 个仅本地修改、72 个仅本地新增。
|
|
||||||
- [x] 保存双方差异源码备份到 build/incoming-main-merge/*-sources-before.tar.gz,并在 staged 目录进行三方合并。
|
|
||||||
- [x] 解决重叠改动:主窗口页面和遥测生命周期、RobotClient 信号/回调、视频比例与静态图显示、构建列表。
|
|
||||||
- [x] 解决相机协议编号冲突:codec 保留上游编号 10,新增 capabilities 使用 11;同步本地服务端协议。服务器离线,末次远端复编未执行。
|
|
||||||
- [x] 保持当前 Qt 5.12.4、C++14 与内置算法部署;保留本地完整标定模块,拒绝用缺少配套头文件的两个孤立 .cpp 覆盖。
|
|
||||||
- [x] 重新生成 protobuf/UI,构建独立合并预览程序;回归 TCP/手眼/末端操作,检查新增页面。另修复并验证流程停止/旧定时器、深度→RGB切换/旧终止通知。
|
|
||||||
- [x] 输出 docs/INCOMING_MAIN_MERGE.md;不提交、不推送、不更换真实机器人服务、不发送运动指令。
|
|
||||||
@ -1,89 +0,0 @@
|
|||||||
# 相机能力自适应与末端操作模式
|
|
||||||
|
|
||||||
日期:2026-10-12。状态:用户已确认;已实施并完成可用环境验证,MVS SDK 与实机验证待对应环境就绪。
|
|
||||||
|
|
||||||
## 目标与范围
|
|
||||||
|
|
||||||
连接当前服务端后,按实际相机能力选择视频、手眼标定和末端定位流程。用户在 RealSense 和 MV-CS050-10UM 之间直接替换使用,同一时间只使用一台相机,不实施双相机协同或并行采集。保留现有页面导航、视频获取通道、TCP 和手眼保存机制。新增 MV-CS050-10UM 工业相机适配,以及二维平面定位模式;为后续末端三轴力传感器明确扩展边界。
|
|
||||||
|
|
||||||
当前使用的服务器、机械臂和相机均为动态设备,不硬编码 IP、名称或序列号。服务端识别当前实际连接的相机,向 Qt 返回唯一活动相机身份和能力。正常流程不要求用户在两台相机之间选择;发现结果不唯一或没有设备时,明确报告状态并停止自动接入,不能任意选取设备。
|
|
||||||
|
|
||||||
## 已核实的现有代码
|
|
||||||
|
|
||||||
- Qt `src/robotclient.cpp` 的 `deviceListFromStatus()` 读取系统设备列表的 `driverType`,但不足以判断具体相机型号或公制深度能力。
|
|
||||||
- 服务端 `CameraService.GetStatus` 返回 `CameraState`;当前字段只有运行状态、帧率和分辨率。
|
|
||||||
- 服务端 `devices/camera/hikvision_camera` 使用 HCNetSDK、`NET_DVR_Login_V40`,不能复用为 MV-CS050-10UM 的 MVS 工业相机驱动。
|
|
||||||
- Qt `getHandEyeImage()` 已接受原始灰度图;二维相机的手眼算法无需重写。
|
|
||||||
- Qt `getTouchRgbdImage()` 与 `TouchOperationWidget::acceptImage()` 当前强制要求同步、公制、配准 RGBD 数据。
|
|
||||||
- `TouchPlanner::resolvePixels()` 已支持去畸变、相机射线与机器人基座平面求交,可复用。
|
|
||||||
- `TouchPlanner::resolveDepthPixels()` 已支持深度定位,继续保留其数据有效性检查。
|
|
||||||
- `ArmRobotState.actual_tcp_wrench` 虽有协议字段,当前机械臂驱动未找到真实三轴力传感器填充链路。灵巧手触觉模块的数据不等于末端力传感器数据。
|
|
||||||
- 本机未找到 MVS SDK 头文件或运行库。海康适配需在服务端安装对应平台 SDK 后进行编译和实机验证。
|
|
||||||
|
|
||||||
## 接入方案
|
|
||||||
|
|
||||||
采用服务端统一适配,Qt 继续通过现有 RobotClient 和 CameraService 获取图像及状态。这能让三个现有页面共享设备身份、时间戳和资源管理。
|
|
||||||
|
|
||||||
备选方案是 Qt 直接接 USB 相机,但会形成两套设备与时间戳来源,也不能满足通过服务端识别相机的要求,因此不采用。
|
|
||||||
|
|
||||||
MVS 驱动独立于现有 HikvisionCamera。服务端使用相应 SDK 枚举真实连接设备,识别型号、序列号和连接方式,不能仅靠配置中的相机名称判断当前硬件。仅创建并启动当前活动相机的采集实例。SDK 未安装时明确提示驱动不可用,不影响原有相机驱动构建,不用 UVC 或监控 SDK 冒充接入成功。
|
|
||||||
|
|
||||||
切换时先停止旧相机的采集和视频生产,撤销旧设备的流租约并释放资源,再接入当前连接设备;不允许两台相机同时采集。界面在切换期间显示连接状态,旧帧、旧能力回包和旧图像请求不得进入新相机流程。设备更换可通过重新连接服务或刷新发现完成;服务端若支持热插拔通知,则复用该通知更新,不能以已配置但未连接的相机冒充活动设备。
|
|
||||||
|
|
||||||
## 能力信息与自动切换
|
|
||||||
|
|
||||||
兼容扩展 CameraState,包含版本、驱动、型号、序列号、连接类型、原始图像格式、有效内参状态、采集时间戳能力、公制配准深度能力和错误原因。新增字段必须按真实驱动结果填充,未知不能默认为支持。
|
|
||||||
|
|
||||||
连接成功、实际相机替换、设备发现结果更新和重新启动相机后查询能力。相机断开时清除能力缓存。回包须与服务器会话、相机身份和请求代次匹配,旧会话或旧相机回包不改变当前模式。
|
|
||||||
|
|
||||||
| 实际能力 | 自动模式 | 可用功能 |
|
|
||||||
| --- | --- | --- |
|
|
||||||
| 原始图像、有效内参、采集时间戳、公制配准深度 | RGBD 深度定位 | 视频、手眼标定、按深度定位任意有效像素 |
|
|
||||||
| 原始图像、有效内参、采集时间戳,无深度 | 二维平面定位 | 视频、手眼标定、按已知平面定位任意有效像素 |
|
|
||||||
| 只有视频或能力未知 | 视频预览 | 可显示视频;明确列出阻止标定或定位的缺失条件 |
|
|
||||||
|
|
||||||
不得仅凭 RealSense 品牌名称判定当前输出有有效深度。不得在 RGBD 深度失败时静默改用二维平面。
|
|
||||||
|
|
||||||
页面紧凑显示当前唯一活动相机、模式和必要条件,保持现有样式,不增加双相机选择或双画面。视频比例由帧尺寸决定,鼠标坐标始终映射到原始图像像素。
|
|
||||||
|
|
||||||
## 二维平面定位
|
|
||||||
|
|
||||||
MV-CS050-10UM 不提供深度。新增平面参数文件导入入口,不恢复用户已要求删除的强制三点接触示教 UI。
|
|
||||||
|
|
||||||
平面参数明确包括版本、名称、机器人身份、相机序列号、参考手眼标定、单位、坐标系、平面原点、单位法向、有效操作范围。内部使用米、机器人基座坐标系;导入时校验并保存到现有 QSettings 管理范围。页面展示当前平面和状态,缺少有效平面时允许视频,禁止生成运动路径。
|
|
||||||
|
|
||||||
计算链为原始像素 → 使用对应相机内参去畸变 → 相机射线 → 当前手眼变换与锁定时法兰位姿 → 基座射线与平面求交。输出相机 XYZ 和基座 XYZ,沿用现有 TCP 变换与动作序列。
|
|
||||||
|
|
||||||
平面定位需要一次性获得真实平面位置,但目标点不要求位于棋盘格或标定板上。仅手眼矩阵不能唯一恢复任意二维像素的三维位置。
|
|
||||||
|
|
||||||
拒绝无效内参、法向、相机后方交点、近平行射线、越界目标和过期图像。滑动路径须在平面有效范围内。
|
|
||||||
|
|
||||||
## 图像同步与标定归属
|
|
||||||
|
|
||||||
二维与 RGBD 都沿用现有采集前后读取真实机械臂位姿的流程。采集图像和内参必须同源、同帧,保留采集时刻及时间不确定区间;只使用处于位姿读取窗口内的帧。
|
|
||||||
|
|
||||||
更换相机身份、分辨率、ROI、内参、手眼结果、TCP 或平面参数后,清除当前锁定图像、目标点和待执行路径,并重新确认必要条件。标定结果按服务器、机器人和相机身份过滤;相同设备 ID 下换了硬件也不能静默沿用旧结果。
|
|
||||||
|
|
||||||
旧标定文件缺少相机序列号时显示为需确认匹配,不能自动绑定给新设备。改变镜头、焦距或成像模式后重新校验内参。程序重启可恢复配置选择,但不恢复旧图像和待执行动作。
|
|
||||||
|
|
||||||
## 三轴力传感器扩展边界
|
|
||||||
|
|
||||||
本阶段只预留状态区域和接口契约,默认“未接入”,不生成假力值,不启用力控运动。
|
|
||||||
|
|
||||||
后续设备适配必须提供传感器身份、绑定机械臂、Fx/Fy/Fz(N)、有效标志、采集时间、坐标系、传感器到工具的安装变换、量程和故障。三轴力不包含 Tx/Ty/Tz,缺失力矩不能显示成已测得的零值。
|
|
||||||
|
|
||||||
接入后可扩展接触确认、按压阈值与侧向力限制。传感器只能提供接触反馈,不能替代二维相机缺失的目标空间位置。加装传感器改变工具安装尺寸时需重新 TCP 标定;若同时改变相机与法兰的相对安装,则还需重新手眼标定。
|
|
||||||
|
|
||||||
接触停止及闭环控制应在能够保证时效的服务端或控制器实现,Qt 负责参数与状态显示。传感器型号、通讯协议、更新频率尚未给出,真实驱动与力控不纳入本次交付。
|
|
||||||
|
|
||||||
## 涉及文件与验证
|
|
||||||
|
|
||||||
协议:Qt 和服务端的 camera_command.proto、camera_config.proto 同步兼容扩展。
|
|
||||||
|
|
||||||
服务端:AbstractCamera、GetStatus、CameraFactory、独立 MVS 驱动及可选 SDK 构建配置。保留现有驱动和流资源管理行为。
|
|
||||||
|
|
||||||
Qt:RobotClient 能力查询与会话校验、MainWindow 页面同步、现有手眼和末端页面、平面配置与 TouchPlanner 调用。Qt 5.12.4 和现有 C++ 标准保持不变。
|
|
||||||
|
|
||||||
验证:能力缺失及旧服务兼容、单相机替换与自动模式切换、旧采集资源释放、没有相机或发现不唯一、断线和旧回包、身份与内参不匹配、二维射线求交、深度模式回归、配置重载、点击像素比例,以及 UI 与主程序编译。实机检查分别验证 MVS 采集和 RealSense 回归;自动化测试不发送机械臂运动指令。
|
|
||||||
|
|
||||||
尚未解决的“读数变化但机械臂未实际运动”问题不能被新模式掩盖;在真实触控验证前需独立确认运动反馈来自真实控制器。
|
|
||||||
@ -1,118 +0,0 @@
|
|||||||
{
|
|
||||||
"executionPolicy": {
|
|
||||||
"automaticRetry": false,
|
|
||||||
"onError": "stop",
|
|
||||||
"order": "sequential",
|
|
||||||
"stopBehavior": "stop_scheduling_and_cancel_active_unary",
|
|
||||||
"waitStartsAfter": "operation_success"
|
|
||||||
},
|
|
||||||
"format": "cmvr.task-flow",
|
|
||||||
"groups": [
|
|
||||||
{
|
|
||||||
"id": "example-group",
|
|
||||||
"name": "offline example",
|
|
||||||
"nodes": [
|
|
||||||
{
|
|
||||||
"action": "接口 · ApplyUserCoordinateSystem",
|
|
||||||
"deviceId": "aubo_arm",
|
|
||||||
"deviceType": "机械臂",
|
|
||||||
"execution": {
|
|
||||||
"completion": "rpc_response",
|
|
||||||
"kind": "grpc_unary",
|
|
||||||
"method": "ApplyUserCoordinateSystem",
|
|
||||||
"request": {
|
|
||||||
"expected_revision": "0",
|
|
||||||
"header": {
|
|
||||||
"device_id": "aubo_arm"
|
|
||||||
},
|
|
||||||
"name": "测试坐标系"
|
|
||||||
},
|
|
||||||
"service": "cmvr.api.ArmService",
|
|
||||||
"timeoutMs": 180000
|
|
||||||
},
|
|
||||||
"id": "example-apply",
|
|
||||||
"kind": "task",
|
|
||||||
"name": "接口 · ApplyUserCoordinateSystem",
|
|
||||||
"operationId": "cmvr.api.ArmService.ApplyUserCoordinateSystem",
|
|
||||||
"parameters": {
|
|
||||||
"method": "ApplyUserCoordinateSystem",
|
|
||||||
"request": {
|
|
||||||
"expected_revision": "0",
|
|
||||||
"name": "测试坐标系"
|
|
||||||
},
|
|
||||||
"service": "cmvr.api.ArmService",
|
|
||||||
"timeoutMs": 180000
|
|
||||||
},
|
|
||||||
"waitMs": 3000,
|
|
||||||
"waitUnit": "s"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"action": "接口 · moveL",
|
|
||||||
"deviceId": "aubo_arm",
|
|
||||||
"deviceType": "机械臂",
|
|
||||||
"execution": {
|
|
||||||
"completion": "rpc_response",
|
|
||||||
"kind": "grpc_unary",
|
|
||||||
"method": "moveL",
|
|
||||||
"request": {
|
|
||||||
"header": {
|
|
||||||
"device_id": "aubo_arm"
|
|
||||||
},
|
|
||||||
"options": {
|
|
||||||
"acceleration": 0.5,
|
|
||||||
"velocity": 0.1
|
|
||||||
},
|
|
||||||
"target": {
|
|
||||||
"rx": 0,
|
|
||||||
"ry": 0,
|
|
||||||
"rz": 0,
|
|
||||||
"x": 0.1,
|
|
||||||
"y": 0.2,
|
|
||||||
"z": 0.3
|
|
||||||
},
|
|
||||||
"user_coordinate_name": "测试坐标系",
|
|
||||||
"user_coordinate_revision": "0"
|
|
||||||
},
|
|
||||||
"service": "cmvr.api.ArmService",
|
|
||||||
"timeoutMs": 180000
|
|
||||||
},
|
|
||||||
"id": "example-movej-pose",
|
|
||||||
"kind": "task",
|
|
||||||
"name": "接口 · moveL",
|
|
||||||
"operationId": "cmvr.api.ArmService.moveL",
|
|
||||||
"parameters": {
|
|
||||||
"method": "moveL",
|
|
||||||
"request": {
|
|
||||||
"options": {
|
|
||||||
"acceleration": 0.5,
|
|
||||||
"velocity": 0.1
|
|
||||||
},
|
|
||||||
"target": {
|
|
||||||
"rx": 0,
|
|
||||||
"ry": 0,
|
|
||||||
"rz": 0,
|
|
||||||
"x": 0.1,
|
|
||||||
"y": 0.2,
|
|
||||||
"z": 0.3
|
|
||||||
},
|
|
||||||
"user_coordinate_name": "测试坐标系",
|
|
||||||
"user_coordinate_revision": "0"
|
|
||||||
},
|
|
||||||
"service": "cmvr.api.ArmService",
|
|
||||||
"timeoutMs": 180000
|
|
||||||
},
|
|
||||||
"waitMs": 3000,
|
|
||||||
"waitUnit": "s"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"count": 2,
|
|
||||||
"id": "example-loop",
|
|
||||||
"kind": "loop",
|
|
||||||
"name": "repeat"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -1,142 +0,0 @@
|
|||||||
// Transport-independent reference. No connection or device command is made on import.
|
|
||||||
export const executionPolicy = Object.freeze({order:'sequential',onError:'stop',automaticRetry:false,
|
|
||||||
waitStartsAfter:'operation_success',stopBehavior:'stop_scheduling_and_cancel_active_unary'});
|
|
||||||
const equal=(a,b)=>canonical(a)===canonical(b);
|
|
||||||
function canonical(v){return JSON.stringify(Array.isArray(v)?v.map(sort):sort(v));}
|
|
||||||
function sort(v){if(Array.isArray(v))return v.map(sort);if(v&&typeof v==='object')return Object.fromEntries(Object.keys(v).sort().map(k=>[k,sort(v[k])]));return v;}
|
|
||||||
const object=v=>v!==null&&typeof v==='object'&&!Array.isArray(v);
|
|
||||||
function check(ok,message){if(!ok)throw new Error(message);}
|
|
||||||
function integer(v,min,max){return Number.isInteger(v)&&v>=min&&v<=max;}
|
|
||||||
|
|
||||||
export function validateMessage(value,type,catalog,depth=0){
|
|
||||||
check(depth<=32,'Message nesting exceeds 32');
|
|
||||||
if(type==='google.protobuf.Timestamp'){check(typeof value==='string'&&!Number.isNaN(Date.parse(value)),'Invalid Timestamp');return;}
|
|
||||||
if(type==='google.protobuf.Duration'){check(typeof value==='string'&&/^-?\d+(\.\d{1,9})?s$/.test(value),'Invalid Duration');return;}
|
|
||||||
check(object(value),`Expected message ${type}`);const message=catalog.messages[type];check(message,`Unknown message ${type}`);
|
|
||||||
const seen=new Set(),oneofs=new Set();
|
|
||||||
function scalar(v,f){
|
|
||||||
if(f.messageType){validateMessage(v,f.messageType,catalog,depth+1);return;}
|
|
||||||
if(f.enumType){check((catalog.enums[f.enumType]||[]).some(e=>e.name===v||e.number===v),`Invalid enum ${f.name}`);return;}
|
|
||||||
if(f.type==='string'){check(typeof v==='string',`Invalid string ${f.name}`);return;}
|
|
||||||
if(f.type==='bytes'){check(typeof v==='string'&&/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(v),`Invalid Base64 ${f.name}`);return;}
|
|
||||||
if(f.type==='bool'){check(typeof v==='boolean',`Invalid boolean ${f.name}`);return;}
|
|
||||||
if(['int64','sint64','sfixed64','uint64','fixed64'].includes(f.type)){
|
|
||||||
check(typeof v==='string'&&/^-?\d+$/.test(v),`Use a decimal string for ${f.name}`);
|
|
||||||
const number=BigInt(v),unsigned=f.type==='uint64'||f.type==='fixed64';
|
|
||||||
check(number>=(unsigned?0n:-(1n<<63n))&&number<=(unsigned?(1n<<64n)-1n:(1n<<63n)-1n),`64-bit overflow ${f.name}`);return;
|
|
||||||
}
|
|
||||||
check(typeof v==='number'&&Number.isFinite(v),`Invalid number ${f.name}`);
|
|
||||||
if(!['float','double'].includes(f.type)){const unsigned=f.type==='uint32'||f.type==='fixed32';check(integer(v,unsigned?0:-2147483648,unsigned?4294967295:2147483647),`32-bit overflow ${f.name}`);}
|
|
||||||
}
|
|
||||||
for(const [key,v] of Object.entries(value)){
|
|
||||||
const f=message.fields.find(f=>f.name===key||f.jsonName===key);check(f,`Unknown field ${type}.${key}`);
|
|
||||||
check(!seen.has(f.name),`Duplicate field alias ${key}`);seen.add(f.name);
|
|
||||||
if(f.oneof){check(!oneofs.has(f.oneof),`Mutually exclusive fields in ${f.oneof}`);oneofs.add(f.oneof);}
|
|
||||||
if(f.map){
|
|
||||||
check(object(v),`Map must be an object: ${key}`);const fields=catalog.messages[f.messageType].fields,keyField=fields.find(f=>f.name==='key'),entry=fields.find(f=>f.name==='value');
|
|
||||||
for(const [k,item] of Object.entries(v)){
|
|
||||||
const mapKey=keyField.type==='bool'?(k==='true'?true:k==='false'?false:k):keyField.type==='string'||keyField.type.includes('64')?k:Number(k);
|
|
||||||
scalar(mapKey,keyField);scalar(item,entry);
|
|
||||||
}
|
|
||||||
}else if(f.repeated){check(Array.isArray(v),`List required ${key}`);for(const item of v)scalar(item,f);}
|
|
||||||
else scalar(v,f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Validate the entire plan before executing the first node. Returned order is authoritative.
|
|
||||||
export function flatten(document,catalog,groupId){
|
|
||||||
check(document.format==='cmvr.task-flow'&&!Object.hasOwn(document,'version'),'Expected cmvr.task-flow without version; normalize legacy files using Qt');
|
|
||||||
check(equal(document.executionPolicy,executionPolicy),'Unsupported execution policy');
|
|
||||||
check(Array.isArray(document.groups),'groups must be an array');const ids=new Set(),result=new Map();
|
|
||||||
const methods=new Map(catalog.services.flatMap(s=>s.methods.map(m=>[m.id,{...m,deviceType:s.deviceType}])));
|
|
||||||
const adapters=new Map(catalog.clientAdapters.map(a=>[a.id,a]));
|
|
||||||
const identify=n=>{check(typeof n.id==='string'&&n.id&&!ids.has(n.id),'Missing or duplicate id');ids.add(n.id);};
|
|
||||||
function visit(nodes,depth){
|
|
||||||
check(depth<=32&&Array.isArray(nodes),'Invalid children or excessive nesting');const steps=[];
|
|
||||||
for(const node of nodes){
|
|
||||||
check(object(node),'Node must be an object');identify(node);
|
|
||||||
if(node.kind==='loop'){
|
|
||||||
check(integer(node.count,1,100000)&&Array.isArray(node.children)&&node.children.length>0,'Invalid repeat count or empty loop');const children=visit(node.children,depth+1);
|
|
||||||
check(steps.length+children.length*node.count<=100000,'Expanded plan exceeds 100000 steps');
|
|
||||||
for(let iteration=0;iteration<node.count;iteration++)for(const entry of children)steps.push({node:entry.node,iterationPath:[{loopId:node.id,iteration},...entry.iterationPath]});
|
|
||||||
check(integer(node.waitMs??0,0,2147483647),'Invalid loop post-completion delay');
|
|
||||||
if(node.waitMs){const last=steps.at(-1);const waitMs=last.node.waitMs+node.waitMs;check(integer(waitMs,0,2147483647),'Accumulated delay exceeds limit');last.node={...last.node,waitMs};}
|
|
||||||
}else{
|
|
||||||
check(node.kind==='task'&&typeof node.deviceId==='string'&&node.deviceId,'Invalid task or deviceId');
|
|
||||||
check(integer(node.waitMs,0,2147483647)&&['ms','s'].includes(node.waitUnit),'Invalid post-completion delay');
|
|
||||||
const ex=node.execution,p=node.parameters;check(object(ex)&&object(p),'Missing execution or parameters');
|
|
||||||
if(ex.kind==='grpc_unary'){
|
|
||||||
const m=methods.get(node.operationId);check(m&&!m.clientStreaming&&!m.serverStreaming,'Unknown or streaming operation');
|
|
||||||
check(m.service===ex.service&&m.method===ex.method&&p.service===m.service&&p.method===m.method,'Conflicting RPC identity');
|
|
||||||
check(node.deviceType==='通用RPC'||(node.deviceType===m.deviceType&&node.action===`接口 · ${m.method}`),'Conflicting display action/device type');
|
|
||||||
check(integer(ex.timeoutMs,100,1800000)&&ex.timeoutMs===(p.timeoutMs??180000),'Invalid RPC timeout');
|
|
||||||
const expected=structuredClone(p.request||{}),fields=catalog.messages[m.requestType].fields;
|
|
||||||
if(fields.some(f=>f.name==='header')){expected.header={...expected.header,device_id:node.deviceId};delete expected.header.deviceId;}
|
|
||||||
else if(fields.some(f=>f.name==='device_id')){delete expected.deviceId;expected.device_id=node.deviceId;}
|
|
||||||
check(ex.completion==='rpc_response'&&equal(expected,ex.request),'Conflicting RPC payload');validateMessage(ex.request,m.requestType,catalog);
|
|
||||||
}else{
|
|
||||||
const a=adapters.get(node.operationId);check(ex.kind==='client_adapter'&&a&&ex.adapter===a.id,'Unknown client adapter');
|
|
||||||
check(a.deviceType===node.deviceType&&a.action===node.action&&ex.deviceId===node.deviceId&&equal(p,ex.parameters)&&ex.completion==='adapter_callback','Conflicting adapter payload');
|
|
||||||
}
|
|
||||||
steps.push({node,iterationPath:[]});check(steps.length<=100000,'Expanded plan exceeds 100000 steps');
|
|
||||||
}
|
|
||||||
}return steps;
|
|
||||||
}
|
|
||||||
for(const group of document.groups){identify(group);result.set(group.id,visit(group.nodes,0));}
|
|
||||||
check(result.has(groupId),'Group not found');check(result.get(groupId).length>0,'No executable tasks');return result.get(groupId);
|
|
||||||
}
|
|
||||||
function succeeded(response){
|
|
||||||
const header=response?.header??response;
|
|
||||||
check(header?.success===true,header?.error_message||header?.errorMessage||'Missing/false business success');
|
|
||||||
return response;
|
|
||||||
}
|
|
||||||
function delay(ms,signal){return new Promise((resolve,reject)=>{
|
|
||||||
if(signal?.aborted){reject(new Error('Canceled'));return;}
|
|
||||||
const abort=()=>{clearTimeout(timer);reject(new Error('Canceled'));};
|
|
||||||
const timer=setTimeout(()=>{signal?.removeEventListener('abort',abort);resolve();},ms);
|
|
||||||
signal?.addEventListener('abort',abort,{once:true});
|
|
||||||
});}
|
|
||||||
|
|
||||||
// Inject transport/adapters. The reference has no built-in gRPC-Web connection.
|
|
||||||
// rpc(service,method,request,{signal,timeoutMs}) => Promise<decoded Protobuf-JSON response>
|
|
||||||
// adapters[id](parameters,{deviceId,signal}) => Promise<{success:true,...}>
|
|
||||||
export async function execute(document,catalog,groupId,{rpc,adapters={},signal,onEvent=()=>{}}){
|
|
||||||
const steps=flatten(document,catalog,groupId);
|
|
||||||
for(const {node} of steps)if(node.execution.kind==='client_adapter')check(typeof adapters[node.execution.adapter]==='function',`Missing adapter ${node.execution.adapter}`);
|
|
||||||
for(let index=0;index<steps.length;index++){
|
|
||||||
const {node,iterationPath}=steps[index],context={nodeId:node.id,index,iterationPath};let timer,detach=()=>{};
|
|
||||||
try{
|
|
||||||
check(!signal?.aborted,'Canceled');onEvent({...context,state:'running'});const ex=node.execution;let response;
|
|
||||||
if(ex.kind==='grpc_unary'){
|
|
||||||
check(typeof rpc==='function','RPC transport required');const controller=new AbortController();
|
|
||||||
const canceled=()=>controller.abort();signal?.addEventListener('abort',canceled,{once:true});detach=()=>signal?.removeEventListener('abort',canceled);
|
|
||||||
const request=structuredClone(ex.request),m=catalog.services.flatMap(s=>s.methods).find(m=>m.id===node.operationId);
|
|
||||||
const nested=catalog.messages[m.requestType].fields.some(f=>f.name==='header');const h=nested?(request.header??={}):request;
|
|
||||||
delete h.commandId;h.command_id=globalThis.crypto.randomUUID();h.timestamp=new Date().toISOString();
|
|
||||||
const interrupted=new Promise((_,reject)=>controller.signal.addEventListener('abort',()=>reject(new Error('Canceled or deadline exceeded; physical stop not confirmed')),{once:true}));
|
|
||||||
timer=setTimeout(()=>controller.abort(),ex.timeoutMs);
|
|
||||||
if(ex.service==='cmvr.api.ArmService'&&ex.method==='moveL'&&
|
|
||||||
(request.user_coordinate_name||request.userCoordinateName||'user_frame_pose' in request||'userFramePose' in request||'tcp_offset' in request||'tcpOffset' in request)){
|
|
||||||
let probeTimer;
|
|
||||||
try{
|
|
||||||
const probe=await Promise.race([rpc(ex.service,'ExecuteJsonCommand',{header:{device_id:node.deviceId},request_json:'{"command":"get_active_tcp_offset"}'},{signal:controller.signal,timeoutMs:3000}),interrupted,
|
|
||||||
new Promise((_,reject)=>{probeTimer=setTimeout(()=>reject(new Error('Coordinate capability probe timed out; no motion sent')),3000);})]);
|
|
||||||
succeeded(probe);const capability=JSON.parse(probe.response_json??probe.responseJson??'{}');
|
|
||||||
check(capability.coordinate_api_version>=4&&capability.movel_target_mode==='absolute_selected_frame','Absolute selected-frame MoveL unsupported; no motion sent');
|
|
||||||
}finally{clearTimeout(probeTimer);}
|
|
||||||
}
|
|
||||||
response=await Promise.race([Promise.resolve().then(()=>rpc(ex.service,ex.method,request,{signal:controller.signal,timeoutMs:ex.timeoutMs})),interrupted]);
|
|
||||||
}else {
|
|
||||||
const interrupted=new Promise((_,reject)=>{
|
|
||||||
const abort=()=>reject(new Error('Canceled; adapter/device stop not confirmed'));
|
|
||||||
signal?.addEventListener('abort',abort,{once:true});detach=()=>signal?.removeEventListener('abort',abort);
|
|
||||||
});
|
|
||||||
response=await Promise.race([Promise.resolve().then(()=>adapters[ex.adapter](structuredClone(ex.parameters),{deviceId:node.deviceId,signal})),interrupted]);
|
|
||||||
}
|
|
||||||
clearTimeout(timer);detach();succeeded(response);check(!signal?.aborted,'Canceled');
|
|
||||||
onEvent({...context,state:'succeeded',response});
|
|
||||||
if(node.waitMs){onEvent({...context,state:'waiting',waitMs:node.waitMs});await delay(node.waitMs,signal);}
|
|
||||||
}catch(error){clearTimeout(timer);detach();onEvent({...context,state:signal?.aborted?'canceled':'failed',error:String(error)});throw error;}
|
|
||||||
}
|
|
||||||
onEvent({state:'completed',completedSteps:steps.length});return {success:true,completedSteps:steps.length};
|
|
||||||
}
|
|
||||||
@ -1,158 +0,0 @@
|
|||||||
CMVR 任务编排 JSON —— 外部解析与执行协议
|
|
||||||
2026-11-10
|
|
||||||
|
|
||||||
一、交付范围
|
|
||||||
本包定义一份可由Qt上位机和外部程序共同理解的任务文件。它不是网页项目,不包含云端同步服务或gRPC-Web网关。外部可导入同一文件,绘制节点、生成参数表单、按本协议实现执行器。
|
|
||||||
当前界面入口:任务编排 -> 添加任务 -> 选择已连接设备 -> 选择操作。
|
|
||||||
保留原有友好操作,额外提供“接口 · 方法名”。本次构建按Proto覆盖8类设备服务的120个Unary接口,完整清单见task_operations.json。
|
|
||||||
原有接口是否真正支持某型号、是否需要上电/使能及相关参数限制,以服务端驱动和反馈为准。目录列出接口不代表每台设备都支持全部功能,不自动启用设备,也不自动使能。
|
|
||||||
|
|
||||||
文件说明:
|
|
||||||
- example.task.json:Qt核心格式代码生成的完整示例,含坐标系应用和循环内末端位姿MoveJ。目标只是示例值,不能作为现场运动目标。
|
|
||||||
- task-flow.schema.json:JSON Schema Draft 2020-12;涵盖节点、执行字段及120个Unary接口的请求消息类型。
|
|
||||||
- task_operations.json:操作目录、请求/反馈消息、枚举及38个客户端适配节点的参数规则与实现说明。
|
|
||||||
- verify-example.mjs:用Node运行的离线自检:node verify-example.mjs;仅模拟传输,不连接设备。
|
|
||||||
- task-flow.mjs:无连接代码的JavaScript参考解析/执行器,运行时由外部注入rpc和媒体等适配函数。
|
|
||||||
- protos/:原始Proto及递归依赖,字段含义和单位以对应注释为准。相同数值字段在不同接口中可能单位不同。
|
|
||||||
- rpc_catalog.txt:按设备划分的清单,区分Unary/流式。
|
|
||||||
|
|
||||||
二、上位机现已实现的行为
|
|
||||||
新增的Unary操作使用按Proto生成的参数表单:支持数字、字符串、Base64二进制、布尔、枚举、嵌套消息、列表、Map和oneof互斥字段。
|
|
||||||
部分接口共用同一Request类型,editorFields标明当前方法实际使用的输入字段。电机设置模式、六种运动模式及限位设置分别只显示对应字段;Apply/Get/Delete坐标系不显示无关的完整coordinate记录。外部可使用editorFields渲染相同表单,完整消息字段仍在messages中保留。
|
|
||||||
消息参数通过复选框控制是否发送;列表逐项增删;oneof只能选一个分支;可选标量可控制是否发送。64位整数按十进制字符串保存,避免JS精度损失。表单最多展开12层参数嵌套。
|
|
||||||
通用请求头由上位机填写:device_id来自节点设备,command_id为每次调用的新UUID,timestamp为当前UTC时间;不用用户重复输入。
|
|
||||||
新增接口在未连接或演示模式下不会发送。新增接口在独立线程执行,每节点可设置100~1800000ms的RPC超时,默认180000ms,不阻塞界面线程。
|
|
||||||
反馈检查传输状态和业务success;失败终止后续节点,不自动重试。执行历史可双击查看/复制反馈。历史保留最近200条,单条详细反馈超过1MiB会明确截断;原始图像展示应使用专用抓图/预览节点。
|
|
||||||
|
|
||||||
同时修正了旧AGV停止/暂停/继续的命令映射;导航站点通过独立RPC线程等待结果。任务中的AGV新调用复用手动控制与地图操作的检查,并等待已排队控制命令结束,避免先前的停止速度命令晚于导航请求到达。外部若也有手动控制通道,应实现同样的协调。
|
|
||||||
原有方案、循环、拖动排序、节点间插入、执行后等待、图像结果窗口和音频播放等保留。录制、媒体流启动与停止依然由专用状态回调推进。
|
|
||||||
相机专用深度抓图以及新增GetDepthImage/GetRGBDImages操作会按已获取的深度能力过滤;未获取能力时按不支持处理。外部客户端应同样检查能力,并处理服务端“不支持”反馈。
|
|
||||||
|
|
||||||
三、根对象
|
|
||||||
format 固定为 cmvr.task-flow;任务文件不包含 version。Qt 兼容读取旧版 version=1/2 文件,规范化后移除 version。
|
|
||||||
groups 是方案数组。每个方案包含:id(稳定标识)、name(显示名)、nodes(根节点有序数组)。
|
|
||||||
executionPolicy 固定为:
|
|
||||||
order: sequential
|
|
||||||
onError: stop
|
|
||||||
automaticRetry: false
|
|
||||||
waitStartsAfter: operation_success
|
|
||||||
stopBehavior: stop_scheduling_and_cancel_active_unary
|
|
||||||
未知版本和不支持的策略必须拒绝,不能猜测后执行。
|
|
||||||
|
|
||||||
文件不保存服务器IP、凭据、robot_id和真实运行状态。外部必须单独绑定目标机器人/连接,确认deviceId属于该连接;不能仅凭同名deviceId跨机器人发送指令。
|
|
||||||
同一任务文件中的方案和节点id必须唯一。绘图和运行日志用id关联,不能用中文名称作为主键。
|
|
||||||
|
|
||||||
四、节点与顺序
|
|
||||||
kind=task:普通任务;kind=loop:循环。
|
|
||||||
普通节点包含 id、name、deviceType、deviceId、action、operationId、parameters、execution、waitMs、waitUnit。
|
|
||||||
deviceType/action保留上位机显示和兼容用途;operationId为稳定、机器可读的操作标识,不能只根据中文标题猜接口。
|
|
||||||
相邻节点的执行顺序由所在nodes/children数组顺序决定;无需另存edges。上一个完整子树执行完成后再执行下一个同级节点。
|
|
||||||
循环包含count与children:将整个children序列按count次数重复,允许嵌套。collapsed只是显示状态,折叠不跳过执行。
|
|
||||||
最多32层嵌套、每方案展开最多100000个任务。count为1~100000整数。空循环可作为编辑草稿保存,但执行时必须拒绝;空方案不可执行。
|
|
||||||
节点id在循环每次迭代中不改变。日志需要另外记录迭代路径和执行序号,例:[{loopId:"example-loop",iteration:0}],iteration从0开始。
|
|
||||||
|
|
||||||
waitMs为实际等待毫秒数,0~2147483647整数。waitUnit只影响显示,可为ms或s;例如waitMs=3000且waitUnit=s显示3s。执行器绝不能再把3000乘1000。
|
|
||||||
等待从本节点成功条件成立后开始;等待结束才进入下一任务。不能把“完成后等待”当作接口超时或动画时长。
|
|
||||||
|
|
||||||
五、直接gRPC节点(新增接口)
|
|
||||||
operationId示例:cmvr.api.ArmService.moveJPose。
|
|
||||||
action为“接口 · moveJPose”,deviceType对应目录服务的设备类型。
|
|
||||||
parameters包含service、method、request、timeoutMs。request为Proto-JSON;允许Proto原字段名或jsonName别名,但不能重复提供同一字段的两种写法。
|
|
||||||
execution包含:
|
|
||||||
kind: grpc_unary
|
|
||||||
service: 完整服务名,如cmvr.api.ArmService
|
|
||||||
method: 原方法名,大小写敏感
|
|
||||||
request: 根据parameters.request生成并绑定节点deviceId的请求
|
|
||||||
timeoutMs: RPC截止时间,默认180000ms
|
|
||||||
completion: rpc_response
|
|
||||||
|
|
||||||
对普通Request消息,目标设备写入request.header.device_id;对直接使用CommandHeader.Request的接口(如torqueOn),目标设备写在request.device_id,不能再包一层header。
|
|
||||||
request中的device_id以节点deviceId为准。发送前每次重新生成command_id和timestamp,不能将之前已执行的command_id作为自动重试标识。
|
|
||||||
parameters与execution是同一意图的编辑视图和执行视图。修改request时必须同步重建execution;action/operationId、service/method和request若互相矛盾,必须拒绝,不允许任选其一执行。
|
|
||||||
上位机导入会校验Proto字段、类型、互斥关系、有限数值和上述一致性;不能用NaN或Infinity,也不接受未知字段。
|
|
||||||
JSON Schema做结构验证,跨字段一致性、id全局唯一、循环展开数量以及64位范围等仍需语义校验;task-flow.mjs提供此部分参考。
|
|
||||||
|
|
||||||
消息字段规则:
|
|
||||||
- int32/uint32等为JSON整数,遵守32位范围;int64/uint64等用十进制字符串并校验64位范围。
|
|
||||||
- double/float为有限JSON数字;bool是true/false;string为字符串;bytes是Base64。
|
|
||||||
- enum使用目录中的枚举名称或已知整数值。
|
|
||||||
- repeated为数组,Map为JSON对象。
|
|
||||||
- 嵌套消息为对象。缺省消息字段可以不发送;不要把缺省和全部字段填0混为一谈。
|
|
||||||
- google.protobuf.Timestamp使用RFC3339 UTC时间字符串。
|
|
||||||
|
|
||||||
六、机械臂坐标系和运动示例的准确含义
|
|
||||||
先添加“接口 · ApplyUserCoordinateSystem”:填已保存name、expected_revision,不能把完整coordinate当应用请求;应用不运动。
|
|
||||||
再添加“接口 · moveL”或“接口 · moveJPose”,目标均为所选坐标系下的完整绝对TCP位姿,XYZ为m,RX/RY/RZ为rad,约定RzRyRx,不是增量。
|
|
||||||
MoveL:速度m/s,加速度m/s²;先应用坐标系,user_coordinate_name/revision校验对应当前应用,不混用base_frame/tcp_frame、显式坐标位姿或增量模式。
|
|
||||||
末端位姿MoveJ:速度rad/s,加速度rad/s²,name必填,blend_radius=0;服务端坐标变换、SDK逆解后调用moveJoint,路径不保证直线。逆解失败不运动。
|
|
||||||
user_coordinate_revision、expected_revision可填字符串"0"表示使用最新记录,但当前已应用版本也必须匹配。需要防止中途记录变更时,应填写查到的具体版本。
|
|
||||||
普通关节角MoveJ传target.position,不受工件坐标系改变影响。
|
|
||||||
|
|
||||||
新接口路径的自定义坐标系MoveL在运动前调用ArmService.ExecuteJsonCommand做能力确认,请求request_json为 {"command":"get_active_tcp_offset"};响应response_json解析后要求coordinate_api_version>=4且movel_target_mode=absolute_selected_frame。否则拒绝运动,不能依赖旧服务端忽略未知字段后的行为。task-flow.mjs也演示此检查。
|
|
||||||
Qt任务编排依次调用各个接口,不会将这些节点自动转换成SystemService.ExecuteActionQueue请求;“动作队列测试”仍是另一个页面和另一条服务端执行路径。
|
|
||||||
当前205服务端运动完成等待上限是120秒。任务节点的RPC超时调大不会延长这个驱动内部上限。
|
|
||||||
|
|
||||||
七、旧友好节点/媒体节点
|
|
||||||
旧节点operationId以client.开头,例如client.camera.preview_start、client.arm.move_j。
|
|
||||||
execution.kind=client_adapter,包含adapter、deviceId、parameters,completion=adapter_callback。
|
|
||||||
不能把adapter名字当RPC方法名调用。完整参数schema、所用RPC及成功含义在task_operations.json的clientAdapters中。
|
|
||||||
其中部分只是已有Unary接口的友好包装;图像预览、声音采集和播放需要客户端会话、编解码及结果展示逻辑。
|
|
||||||
预览/音频流启动节点确认流建立后就完成该节点,后续waitMs开始计时;流继续存在,直到专门的停止节点或显式关闭。不会一直等到整段流结束才执行下一节点。
|
|
||||||
相机预览需GetStatus查询编码器再建RGB视频流。开始录像/录音不意味着录制已经结束。播放服务端文件的path是服务端路径,不是自动上传本地文件。
|
|
||||||
本机麦克风流播放需先建立扬声器流,再采集本机PCM音频发送;浏览器端必须申请麦克风权限并提供对应媒体适配,Qt设备名不能直接当浏览器设备ID使用。
|
|
||||||
成功回调格式为{success:true,...};失败应reject或返回success:false。适配器必须保证反馈对应当前节点和设备,而不是复用别的会话事件。
|
|
||||||
|
|
||||||
目录还列出8个原始流式RPC。当前专用节点覆盖RGB预览、麦克风和扬声器流;深度/RGBD视频流、AGV地图流、灵巧手传感器流、仿生头表情流目前未作为新通用节点直接开放。它们不应被当作一次性Unary调用,也不能承诺都已适配。
|
|
||||||
|
|
||||||
八、成功、失败、取消和结果
|
|
||||||
直接RPC节点:传输成功且反馈header.success(或直接反馈对象success)为true才成功。缺少业务成功标志、gRPC错误或false均停止后续节点,不自动重试。
|
|
||||||
completion=rpc_response只代表这个服务接口的返回条件。某些接口等待运动完成,某些仅表示驱动接受;重定位可能未收敛,灵巧手可能未到位,不能从Unary一词推导物理完成。
|
|
||||||
目录中MotorRequest.mode的suggestedChoices给出轮廓位置/速度/力矩、周期位置/速度/力矩的常用数值,外部可据此渲染下拉框;支持范围仍由电机驱动决定。
|
|
||||||
导出的目录响应消息说明返回数据结构。结果、错误和运行进度单独保存,不写回计划参数,不用结果修改已定义节点目标。当前没有跨节点变量绑定、条件分支、并发节点或失败自动恢复。
|
|
||||||
|
|
||||||
点击停止或连接断开时,停止安排后续节点。新通用Unary的ClientContext会被取消;旧客户端适配节点只停止流程调度,不保证主动停止所有设备/媒体会话。需要结束流、录制或设备运动,应使用相应停止节点或专门的设备停止/急停操作。
|
|
||||||
RPC取消、客户端超时、网络断开不等于物理停止已经确认;服务端可能已经接受动作。结果不明时不能自动重发运动。
|
|
||||||
独立执行器应预检所有节点与适配器后再发第一个动作。执行中遇到错误即结束,已经完成的动作和坐标系应用不回滚;不要因重载网页自动重跑任务。
|
|
||||||
|
|
||||||
九、外部实现建议流程
|
|
||||||
1. 读取文件,检查format及JSON Schema。
|
|
||||||
2. 加载相同版本task_operations.json,按id解析接口及请求/反馈类型;用Proto或目录构造参数表单。
|
|
||||||
3. 做语义校验:id、循环限制、operationId与参数一致、设备归属、服务能力、适配器是否全部可用。
|
|
||||||
4. 将目标方案深度优先展开;每次迭代保持完整子序列顺序。
|
|
||||||
5. 新建运行上下文,按节点execution调用。rpc由外部注入连接/鉴权/gRPC-Web适配,client_adapter由外部注入媒体等逻辑。
|
|
||||||
6. 等待对应成功条件,记录返回结果,等待waitMs,再进入下一节点。
|
|
||||||
7. 失败/取消/超时停止,不重试、不自动恢复后续节点;由用户确认后决定下一步。
|
|
||||||
|
|
||||||
参考JavaScript(ES2022,浏览器或较新Node,需crypto.randomUUID/structuredClone/AbortController):
|
|
||||||
import {execute} from './task-flow.mjs';
|
|
||||||
const abort = new AbortController();
|
|
||||||
await execute(plan, catalog, plan.groups[0].id, {
|
|
||||||
rpc: async (service, method, request, {signal, timeoutMs}) => {
|
|
||||||
// 通过你自己的gRPC/gRPC-Web客户端调用,返回解码后的Proto-JSON对象。
|
|
||||||
// 传递取消和deadline;若使用SDK消息对象,先转成JSON,保留false的success。
|
|
||||||
return yourTransport(service, method, request, {signal, timeoutMs});
|
|
||||||
},
|
|
||||||
adapters: yourClientAdapters,
|
|
||||||
signal: abort.signal,
|
|
||||||
onEvent: event => console.log(event)
|
|
||||||
});
|
|
||||||
// abort.abort()停止执行器等待/后续调度;不代表现场机械臂已停稳。
|
|
||||||
不要将包中的示例rpc替换成真正网络传输后直接运行示例目标,先在离线/模拟环境验证解析和结果判断。
|
|
||||||
|
|
||||||
十、文件保存、导入导出与兼容
|
|
||||||
Qt仍保存到程序目录data/task_orchestration.json,使用原子写入,不使用注册表。
|
|
||||||
导出按钮生成选定文件名的整份任务文件,以及同目录task_operations.json。请将操作目录与任务文件一起交给外部开发者。
|
|
||||||
导入会追加方案,重新生成导入方案/节点id以避免与本地冲突,不删除已有方案,不执行任何节点。
|
|
||||||
v1旧文件会迁移到当前无 version 格式,迁移前先生成task_orchestration.json.v1.bak;同名备份已存在时生成独立UUID备份,不覆盖旧备份。
|
|
||||||
解析失败、未知版本、无效接口参数或执行描述冲突时保留原文件、禁用自动覆盖。重新导入有效文件前会先备份原文件。
|
|
||||||
当前协议只约定上述字段。外部自己的机器人连接绑定、云端版本、用户权限等放在外部系统中管理;不要依赖Qt保留额外的未知根字段。
|
|
||||||
|
|
||||||
十一、验证范围
|
|
||||||
已完成Release编译及纯离线校验:旧格式迁移、稳定id、请求头放置、参数类型、NaN拒绝、循环数量、歧义拒绝、业务错误和外部参考执行器。
|
|
||||||
测试仅使用本机回环模拟gRPC服务和模拟传输,没有发送任何现场设备控制指令。当前无头Qt初始化环境存在限制,未完成自动化真实窗口操作测试,也未逐个实机验证120个接口。
|
|
||||||
|
|
||||||
十二、网页服务端直接调用 cmvr-es 的导出约定(2026-11-16)
|
|
||||||
导出时将普通友好动作转换为真实 Unary RPC 节点;本地编辑方案不变。operationId 使用完整服务名.方法名,parameters 保留 service、method、request、timeoutMs,execution.request 为绑定设备后的 Proto-JSON 请求。MoveJ 的 positions 转为 target.position,AGV 的 stationId/maxSpeed 转为 station_id/options.max_speed,灵巧手 values 转为 [{id:0,value:...},...],录像 path 转为 video_path,录音 path 转为 file_path,播放 path 转为 audio_path。
|
|
||||||
预览、音频流仍保留编辑所需 client_adapter 字段,但每个节点额外导出 serverCalls。网页服务端按 serverCalls 顺序实现真实服务调用及会话控制,无需调用 Qt。每项含 service、method、rpcPath、requestType、responseType、clientStreaming、serverStreaming、mode、request。mode=unary 为一次调用,open_stream 为建立流,close_stream 为关闭 sessionKey 指定的既有流,关闭流不是再发一次同名 RPC。相机预览开始依次 GetStatus、StartCamera、GetRGBImageStream,状态响应 codec 用于解码。
|
|
||||||
runtimeRequestFields 列出运行时才有的请求字段,如扬声器流每帧 audio;具体 AudioData 类型参见 task_operations.json/protos。客户端采集设备、sampleRate、channels 等原始配置保留在 parameters,网页端需要自己的采集源绑定。request 是请求模板,发送时重新生成 command_id 和 timestamp,不把缺少音频帧的模板当成完整播放请求。
|
|
||||||
example.server-export.json 展示全部38个友好节点转换结果,仅用于离线解析,不可直接执行示例设备与路径。普通节点与循环的顺序、waitMs、失败停止策略不变。已有通用 RPC 节点的预检(如自定义坐标系 MoveL 能力确认)仍按本说明执行,不能只看到 service/method 就跳过预检。
|
|
||||||
@ -1,160 +0,0 @@
|
|||||||
# 工具坐标系 TCP 标定迁移说明
|
|
||||||
|
|
||||||
## 页面和使用流程
|
|
||||||
|
|
||||||
实现位于 `F:\QT\CmvrControlStation`,仍使用 MainWindow 原来的工具坐标标定入口和堆栈索引 13。
|
|
||||||
原页面是 `createCalibrationEntryPage` 创建的占位内容,没有专属 `.ui`、TCP 页面类或工具参数 CRUD。
|
|
||||||
现在在原入口嵌入 `TcpCalibrationWidget`,遵循原工程动态创建控件的方式。
|
|
||||||
|
|
||||||
界面参考机械臂页面、配置编辑页和原标定占位页,复用 `styles.qss` 的 `panel`、`sectionTitle`、`mutedLabel`、`primaryButton`,以及既有表格、输入框和 QMessageBox。
|
|
||||||
包含标定工具、活动 TCP 偏移核对、固定点采样表、结果与操作四个区域。日志通过信号接入 MainWindow::appendLog。
|
|
||||||
页面不显示厂家名称或服务器/设备/演示状态摘要;上下文自动跟随机械臂页面当前选择。
|
|
||||||
“标定工具”只负责新建或重新标定;实际点动使用哪个工具,由机械臂页面的工具坐标下拉框选择。
|
|
||||||
|
|
||||||
1. 连接真实机械臂,在机械臂页面选择设备,再进入原工具坐标标定入口。
|
|
||||||
2. 从示教器核对服务端活动 TCP 的法兰到 TCP 偏移,在页面输入 XYZ(mm)和 RX/RY/RZ(度),勾选已核对。只有实际零偏移才可填全零。
|
|
||||||
3. 输入本机工具名称,选择四点法、六点法 · XZ 或六点法 · XY。四点法在同一固定参考点改变姿态采集四次;六点法按下文的三个接近点和三个方向点采集。
|
|
||||||
4. 点击 TCP 标定,检查 XYZ、每点残差和固定点 RMS。RMS 大于 2 mm 禁止保存,应重新采样。
|
|
||||||
5. 四点法只计算平移,方向 RX/RY/RZ 手动输入。六点法计算完整平移和方向,方向字段只读,保存保留未舍入的结果。
|
|
||||||
6. 点击保存工具。机械臂速度控制的工具坐标下拉框立即刷新并选择该工具,显示为“工具名(标定)”。同名记录需确认覆盖;清除或重新标定仅清空临时过程。
|
|
||||||
7. 返回机械臂页面,选择“笛卡尔速度”页签,按住所选工具轴的方向按钮进行小步点动,松开即停止。
|
|
||||||
|
|
||||||
工具记录仍通过 QSettings 保存在本机,但按服务器地址和机械臂设备 ID 分别存储;不是所有机器人共用的列表。
|
|
||||||
保存、覆盖、删除同步刷新速度控制下拉框。切换机器人或服务器后只加载该身份下的工具,可存在同名但不同偏移的工具。
|
|
||||||
本机标定工具不会注册成控制器命名坐标系,而是由上位机将选中工具的目标位姿换算后发送给现有运动接口。
|
|
||||||
|
|
||||||
### 六点法 · XZ / XY
|
|
||||||
|
|
||||||
前三点保持工具尖端在同一固定点,改变法兰姿态,由 `solvePosition` 的最小二乘方程求 TCP 平移。后三点依次为方向原点、+X 方向点及 +Z(XZ)或 +Y(XY)方向点,保持法兰姿态一致。这与六次固定点采样不同;后三点不参与固定点残差计算。
|
|
||||||
|
|
||||||
`TcpCalibration::solveSixPoint` 先用已解出的偏移将后三个法兰位置换成 TCP 在基座下的位置,构造方向向量,保留 X 轴并对第二方向正交化,以右手定则补齐第三轴。最终 `R_flange_tool = transpose(R_base_flange_origin) * R_base_tool`,与原有 m/rad、ZYX 姿态格式一致。
|
|
||||||
|
|
||||||
拒绝秩不足、NaN/Inf、方向基线小于 10 mm、夹角不在 5°~175°、后三点相对方向原点姿态漂移超过 0.2°等情况。10 mm 是退化检查下限,不是精度推荐距离;实际距离依据工具、工作空间及示教条件确定,程序不自动移动机器人。固定点 RMS 大于 2 mm 仍禁止保存。
|
|
||||||
|
|
||||||
切换方法清空当前采样和结果,不删除已保存工具。记录增加方法字段,兼容没有该字段的历史固定点记录;加载和保存保留历史样本数量。四点法和两种六点法均使用原有按机器人隔离的存储与工具轴点动链路,计算与保存保持独立。
|
|
||||||
|
|
||||||
2026-10-08 更新验证:数值测试 16 项、页面/保存流程 16 项通过,覆盖 XZ/XY 合成真值、非零方向原点旋转、退化、重复方向原点、六点保存重载和旧记录兼容。
|
|
||||||
|
|
||||||
## 标定工具的实际点动链路
|
|
||||||
|
|
||||||
MainWindow::startCartesianJog → TcpJogController → RobotClient::requestTcpCalibrationPose → 新鲜真实反馈 → jogTarget → RobotClient::requestTcpJogMove → 原通道的 MoveL。
|
|
||||||
|
|
||||||
平移沿选中工具自身 XYZ 轴;旋转按所选工具自身轴生成目标,并保持所选 TCP 的目标位置不变:
|
|
||||||
|
|
||||||
```
|
|
||||||
T_base_flange = T_base_activeTCP * inverse(T_flange_activeTCP)
|
|
||||||
T_base_selectedTCP = T_base_flange * T_flange_selectedTCP
|
|
||||||
T_target_selectedTCP = T_base_selectedTCP * delta_in_selected_axes
|
|
||||||
T_target_activeTCP = T_target_selectedTCP * inverse(T_flange_selectedTCP) * T_flange_activeTCP
|
|
||||||
```
|
|
||||||
|
|
||||||
发送的 frame 始终为 BASE,base_frame 为 `base`,tcp_frame 为 `tcp`;本机工具名称从不冒充控制器坐标名。
|
|
||||||
已沿服务源码核实:当前适配驱动的 MoveL 对 `tcp` 读取并沿用当前 TCP 偏移,并等待到位后返回。
|
|
||||||
界面姿态显示也使用原始活动 TCP 反馈换算为所选工具的位姿,禁止将命名 getPose 的结果重复换算。
|
|
||||||
|
|
||||||
SpeedL 只有 Base/Tool 枚举,不能携带任意标定偏移,且驱动禁止已有运动时叠加速度请求。因此标定工具采用有限 MoveL 小步循环,不宣称实现连续速度伺服。
|
|
||||||
每步至多 2 mm 或 0.005 rad(约 0.29°),长工具进一步限制步长,使活动 TCP 的位移也不超过 2 mm。
|
|
||||||
指令速度上限为平移 0.02 m/s、旋转输入 0.05 rad/s;每步重新读取反馈,连续按住最长 30 秒。实际平均速度还受 RPC 和到位等待影响。
|
|
||||||
每段内部仍由控制器对活动 TCP 插补,旋转时所选尖端在段间有小量弦线近似误差;上述转换保证每个目标端点,而非承诺整条旋转轨迹绝对无偏差。
|
|
||||||
|
|
||||||
松开、切换工具/机械臂/服务器、离开机械臂页面、窗口失去激活、断连、停止按钮和超时均取消后续步进并请求 stopMotion。
|
|
||||||
请求序号区分采点和点动,并丢弃旧反馈及重复完成消息。控制器已有坐标项保留原速度控制行为;选择“(标定)”项才进入这个新流程。
|
|
||||||
每次重连必须核对活动 TCP 偏移;不要在点动过程中通过示教器切换它。当前协议没有自动读取该偏移的接口。
|
|
||||||
程序内普通“末端位姿移动”会按指定控制器帧切换活动 TCP,因此在派发该 MoveL 前主动取消偏移确认、清空临时采样并停止本机 TCP 点动。
|
|
||||||
通用 RPC 页的机械臂写命令同样使确认失效,之后需重新核对;这不会删除已保存的工具记录。
|
|
||||||
|
|
||||||
## phone 算法与坐标定义
|
|
||||||
|
|
||||||
直接参考的源码:
|
|
||||||
|
|
||||||
- `F:\phone\scripts\handeye_calibration_gui.py`:`aubo_pose_to_matrix`、`solve_tcp_offset`、`capture_tcp_sample`、`confirm_tcp`、`save_tcp` / `load_tcp`。
|
|
||||||
- `F:\phone\scripts\robot_backend.py`:`flange_pose` 和 `tool_pose` 的刚体变换关系。
|
|
||||||
|
|
||||||
输入至少 4 个基座到法兰位姿,格式 `[x,y,z,rx,ry,rz]`,内部使用 m/rad。
|
|
||||||
角度为 ZYX 欧拉角,旋转矩阵 `Rz(rz) * Ry(ry) * Rx(rx)`;不是旋转向量。
|
|
||||||
齐次矩阵使用列向量约定,C++ 数组按行存储。
|
|
||||||
|
|
||||||
固定点方程为 `R_i * t_flange_tcp + p_i = p_fixed`。
|
|
||||||
与 phone 一样构造 `[R_i, -I] * [t_flange_tcp; p_fixed] = -p_i`,求六个未知量的最小二乘解。
|
|
||||||
用轻量一侧 Jacobi SVD 实现对应求解,避免引入 NumPy/Eigen 或使用正规方程放大病态误差。
|
|
||||||
检查秩、非有限值和病态条件数;保留 phone 的毫米 RMS 和 2 mm 合格上限。
|
|
||||||
RMS 为所有重建固定点到拟合固定点的欧氏距离的均方根,并显示每点误差。
|
|
||||||
phone 的重复采点阈值为位移小于 1 mm 且姿态差小于 3°;Qt 对其他所有已采点进行该检查。
|
|
||||||
|
|
||||||
数值模块集中提供 `poseMatrix`、`matrixPose`、`flangePose`、`toolPose`;显示转换集中为 m↔mm、rad↔degree。
|
|
||||||
对带旋转的活动偏移严格使用:
|
|
||||||
|
|
||||||
```
|
|
||||||
T_base_flange = T_base_activeTCP * inverse(T_flange_activeTCP)
|
|
||||||
T_base_localTCP = T_base_flange * T_flange_localTCP
|
|
||||||
```
|
|
||||||
|
|
||||||
## 真实反馈调用链及限制
|
|
||||||
|
|
||||||
页面 captureRequested → RobotClient::requestTcpCalibrationPose → 既有工作线程 getTcpCalibrationPose → 既有 gRPC 通道的 GetArmInfo 和 getRobotState → state.actual_tcp_pose。
|
|
||||||
没有创建新连接,没有使用遥测显示缓存,也不接受演示模式数据。
|
|
||||||
|
|
||||||
先核对返回的设备 ID 和 AUBO 驱动,再检查连接、运动、故障、停止标志、安全模式、机器人模式、反馈字段、DOF、关节位置/速度和所有数值。
|
|
||||||
每次 RPC 有截止时间,页面另有 6 秒超时和请求序号。断连、换设备、换服务器、清除及重采均使旧响应失效。
|
|
||||||
|
|
||||||
已检查服务源码:命名 getPose 的驱动实现忽略帧参数,不能把它当作法兰反馈;getPoseMatrix 未实现。
|
|
||||||
当前没有读取活动 TCP 偏移的 RPC,因此按 phone 的 gRPC 方式换算,要求用户手动确认当前偏移。采点过程中不得在示教器切换活动 TCP。
|
|
||||||
仅对已核实的 AUBO 姿态定义开放采点,其他厂家明确报错,未猜测 Huayan 姿态约定。
|
|
||||||
|
|
||||||
服务端可能用全零位姿/关节数组掩盖 SDK 读取异常,客户端拒绝这些反馈;真实全零关节姿态也会被保守拒绝,可换姿态重试。
|
|
||||||
服务端默认时间戳可能为零,因此客户端记录本次请求时间,不声称验证了硬件时间戳的新鲜度。
|
|
||||||
没有服务端独立的 SDK 有效性标志,客户端无法完全排除服务器返回表面合法但过时的数据;实际机器人联调尚未完成。
|
|
||||||
|
|
||||||
## 保存和重新加载
|
|
||||||
|
|
||||||
工程和服务只有 TCP 名称列表,没有可调用的 TCP 偏移创建/编辑/删除/保存 RPC,也没有对应工具参数配置结构。
|
|
||||||
按用户明确确认的方案,沿用工程默认 QSettings 增加独立的本机工具记录;没有新增文件型配置系统或控制器 Tool ID。
|
|
||||||
名称作为当前服务器和设备下的唯一标识,记录偏移六元组(m/rad)、RMS(mm)、采样数量和当前本机工具名称。
|
|
||||||
|
|
||||||
Windows 默认位置:
|
|
||||||
|
|
||||||
```
|
|
||||||
HKEY_CURRENT_USER\Software\CMVR\CMVR Control Station
|
|
||||||
tcpCalibration/v1/<SHA256(endpoint + NUL + deviceId)>
|
|
||||||
```
|
|
||||||
|
|
||||||
记录内同时存储服务器和设备身份,避免跨设备混用。应用启动后恢复相同连接参数和设备 ID,即加载该身份下的工具列表及当前工具;也可点击重新加载。
|
|
||||||
保存调用 sync 并检查状态;配置损坏、同名冲突、数值异常和写入失败均报告,不静默覆盖坏配置。
|
|
||||||
保留一个明确 TODO:待服务提供真实持久化 TCP RPC 后再接入控制器,当前不虚构接口。
|
|
||||||
|
|
||||||
## 文件范围
|
|
||||||
|
|
||||||
修改:
|
|
||||||
|
|
||||||
- `src/mainwindow.cpp/.h`、`src/mainwindow_ui.cpp`:原页面内容、信号槽、上下文、工具列表及点动接入。
|
|
||||||
- `src/robotclient.h`、`src/robotclient.cpp`:通过原工作线程增加真实采点请求和校验。
|
|
||||||
- `CmvrControlStation.pro`、`CMakeLists.txt`:登记新增模块。
|
|
||||||
|
|
||||||
新增:
|
|
||||||
|
|
||||||
- `src/tcpcalibration.h/.cpp`:数值求解和刚体转换。
|
|
||||||
- `src/tcpcalibrationwidget.h/.cpp`:原入口内的界面与采样状态管理。
|
|
||||||
- `src/tcptoolstore.h/.cpp`:QSettings 本机工具保存、加载、选择、删除。
|
|
||||||
- `src/tcpjogcontroller.h/.cpp`:可取消的真实反馈读取与有限运动状态机。
|
|
||||||
- `tests/tcpcalibration_test.cpp/.pro`、`tests/tcpworkflow_test.cpp/.pro`:算法和页面/保存流程测试。
|
|
||||||
- `tests/tcpjog_test.cpp/.pro`:工具轴、旋转端点、停止/切换和响应隔离测试。
|
|
||||||
- `tests/tcpintegration_test.cpp`、`tests/run_tcp_integration.py`:实际 MainWindow + RobotClient 与回环 gRPC 模拟服务联调。
|
|
||||||
- 本说明及 `docs/superpowers/plans/2026-09-30-tcp-calibration.md`。
|
|
||||||
|
|
||||||
原有 protoc 路径修复、证书以及 Qt Creator 本机设置保留,属于此前环境修复,不是 TCP 算法改动。
|
|
||||||
|
|
||||||
## 验证
|
|
||||||
|
|
||||||
Qt 5.12.4、MinGW 7.3 64 位、C++14;未升级工程标准或引入数学依赖。
|
|
||||||
算法测试 12 项通过(含初始化/清理),覆盖已知真值、phone NumPy 参考结果、退化、病态、NaN/Inf、旋转和法兰转换。
|
|
||||||
页面/持久化测试 13 项通过(含初始化/清理),覆盖采集计算保存重开、隔离、重复/非法反馈、失败重采、旧响应、切换设备、断连、误差超限及设置写入失败。
|
|
||||||
点动测试 7 项通过(含初始化/清理),覆盖工具轴、带旋转源偏移的 TCP 端点保持、松开后旧响应、切换及失败停止。
|
|
||||||
回环 gRPC 联调通过:保存结果进入真实主界面下拉框;不同机器人/服务器工具隔离;真实 MoveL 请求的设备、帧和目标位姿正确;松开和切换后不继续派发运动;普通 MoveL/机械臂 RPC 派发前取消旧活动 TCP 确认。
|
|
||||||
页面截图来自合成测试数据,不是真实机械臂测量。
|
|
||||||
|
|
||||||
Windows Qt 5.12.4 离屏插件不能处理 QMessageBox 的原生系统菜单;仅测试代码跳过该 Show 钩子,保留标准弹窗按钮和返回值。产品代码仍使用正常 QMessageBox。
|
|
||||||
完整应用 qmake Debug 目标编译成功,启用 gRPC 和 MsQuic。当前旧程序正在运行,默认 exe 无法覆盖,故用同一组完整对象链接为 `bin/debug/CmvrControlStation_tcp_preview.exe`,未结束用户进程。
|
|
||||||
构建日志为 `build/Desktop_Qt_5_12_4_MinGW_64_bit_Debug/tcp-integration-build.log`;回环联调日志为 `build/tcp-integration-test.log`。
|
|
||||||
关闭旧程序后,Qt Creator 正常构建即可生成默认名称的新版程序。
|
|
||||||
CMake 仅同步源文件清单,未单独执行 CMake 构建。
|
|
||||||
真实设备采点精度、示教器偏移一致性和最终运动使用需现场验证。
|
|
||||||
398
feature/CMakeLists.txt
Normal file
@ -0,0 +1,398 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
project(CmvrControlStation VERSION 1.0.0 LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 14)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
set(CMAKE_AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/ui")
|
||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
set(CMVR_MSQUIC_DEFAULT ON)
|
||||||
|
else()
|
||||||
|
set(CMVR_MSQUIC_DEFAULT OFF)
|
||||||
|
endif()
|
||||||
|
option(CMVR_WITH_MSQUIC "Build the embedded MsQuic test server" ${CMVR_MSQUIC_DEFAULT})
|
||||||
|
set(CMVR_MSQUIC_ROOT "" CACHE PATH "Optional MsQuic installation prefix on Linux")
|
||||||
|
set(CMVR_CXX_RUNTIME "" CACHE FILEPATH
|
||||||
|
"Optional libstdc++.so.6 matching a non-system Linux dependency prefix")
|
||||||
|
set(CMVR_ASSIMP_SCENE_PARSER "" CACHE FILEPATH
|
||||||
|
"Qt3D Assimp scene parser plugin used for URDF mesh files")
|
||||||
|
|
||||||
|
set(CMVR_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/include")
|
||||||
|
set(CMVR_LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib")
|
||||||
|
set(CMVR_TOOLS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tools")
|
||||||
|
set(CMVR_CERT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/certs")
|
||||||
|
set(PROTO_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/protos")
|
||||||
|
set(GENERATED_ROOT "${CMAKE_CURRENT_BINARY_DIR}/generated_cpp")
|
||||||
|
|
||||||
|
find_package(Qt5 5.12 REQUIRED COMPONENTS
|
||||||
|
Core Gui Widgets Multimedia 3DCore 3DRender 3DExtras 3DInput 3DAnimation)
|
||||||
|
|
||||||
|
get_target_property(CMVR_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
|
||||||
|
if(CMVR_QMAKE_EXECUTABLE)
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${CMVR_QMAKE_EXECUTABLE}" -query QT_INSTALL_PLUGINS
|
||||||
|
OUTPUT_VARIABLE CMVR_QT_PLUGIN_ROOT
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
endif()
|
||||||
|
if(NOT CMVR_ASSIMP_SCENE_PARSER)
|
||||||
|
find_file(CMVR_ASSIMP_SCENE_PARSER
|
||||||
|
NAMES assimpsceneimport.dll assimpsceneimportd.dll libassimpsceneimport.so
|
||||||
|
HINTS
|
||||||
|
"${CMVR_QT_PLUGIN_ROOT}/sceneparsers"
|
||||||
|
"/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/qt5/plugins/sceneparsers")
|
||||||
|
endif()
|
||||||
|
if(NOT CMVR_ASSIMP_SCENE_PARSER OR NOT EXISTS "${CMVR_ASSIMP_SCENE_PARSER}")
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"Qt3D's Assimp scene parser was not found. It is required to display "
|
||||||
|
"STL, DAE, and 3DS meshes from bundled URDF models. On Ubuntu install "
|
||||||
|
"qt3d-assimpsceneimport-plugin, or set CMVR_ASSIMP_SCENE_PARSER to the "
|
||||||
|
"plugin file supplied by the selected Qt installation.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
# The checked-in native libraries use the Qt 5.12.4 MinGW 7.3 64-bit ABI.
|
||||||
|
set(PROTOC "${CMVR_TOOLS_DIR}/run_protoc.cmd")
|
||||||
|
set(GRPC_CPP_PLUGIN "${CMVR_TOOLS_DIR}/grpc_cpp_plugin.exe")
|
||||||
|
foreach(REQUIRED_FILE IN ITEMS
|
||||||
|
"${PROTOC}"
|
||||||
|
"${GRPC_CPP_PLUGIN}"
|
||||||
|
"${CMVR_LIB_DIR}/libgrpc++.a"
|
||||||
|
"${CMVR_LIB_DIR}/libprotobuf.a"
|
||||||
|
"${CMVR_LIB_DIR}/libavcodec.dll.a"
|
||||||
|
"${CMVR_LIB_DIR}/liburdfdom_model.dll.a")
|
||||||
|
if(NOT EXISTS "${REQUIRED_FILE}")
|
||||||
|
message(FATAL_ERROR "Required Windows dependency not found: ${REQUIRED_FILE}")
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
else()
|
||||||
|
find_package(Protobuf CONFIG QUIET)
|
||||||
|
if(NOT Protobuf_FOUND)
|
||||||
|
find_package(Protobuf REQUIRED)
|
||||||
|
endif()
|
||||||
|
find_package(gRPC CONFIG REQUIRED)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
pkg_check_modules(FFMPEG REQUIRED IMPORTED_TARGET
|
||||||
|
libavcodec libavutil libswscale)
|
||||||
|
find_path(CMVR_URDFDOM_INCLUDE_DIR urdf_parser/urdf_parser.h
|
||||||
|
PATH_SUFFIXES include include/urdfdom)
|
||||||
|
find_path(CMVR_TINYXML_INCLUDE_DIR tinyxml.h PATH_SUFFIXES include)
|
||||||
|
find_library(CMVR_URDFDOM_MODEL_LIBRARY NAMES urdfdom_model)
|
||||||
|
if(NOT CMVR_URDFDOM_INCLUDE_DIR OR NOT CMVR_TINYXML_INCLUDE_DIR OR
|
||||||
|
NOT CMVR_URDFDOM_MODEL_LIBRARY)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"urdfdom/tinyxml was not found. Install liburdfdom-dev or add its prefix "
|
||||||
|
"to CMAKE_PREFIX_PATH.")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT TARGET protobuf::protoc)
|
||||||
|
message(FATAL_ERROR "The Protobuf package does not provide protobuf::protoc")
|
||||||
|
endif()
|
||||||
|
if(NOT TARGET gRPC::grpc_cpp_plugin)
|
||||||
|
message(FATAL_ERROR "The gRPC package does not provide gRPC::grpc_cpp_plugin")
|
||||||
|
endif()
|
||||||
|
set(PROTOC "$<TARGET_FILE:protobuf::protoc>")
|
||||||
|
set(GRPC_CPP_PLUGIN "$<TARGET_FILE:gRPC::grpc_cpp_plugin>")
|
||||||
|
|
||||||
|
# A Conda-provided Qt/gRPC stack may carry an older libstdc++ than the
|
||||||
|
# host compiler. Link against the runtime next to the imported dependency
|
||||||
|
# so symbol versions selected at link time match the library loaded from
|
||||||
|
# the generated RUNPATH. System packages resolve to the system runtime.
|
||||||
|
if(NOT CMVR_CXX_RUNTIME)
|
||||||
|
foreach(DEPENDENCY_TARGET IN ITEMS gRPC::grpc++ Qt5::Core)
|
||||||
|
get_target_property(DEPENDENCY_LOCATION
|
||||||
|
${DEPENDENCY_TARGET} IMPORTED_LOCATION_RELEASE)
|
||||||
|
if(NOT DEPENDENCY_LOCATION)
|
||||||
|
get_target_property(DEPENDENCY_LOCATION
|
||||||
|
${DEPENDENCY_TARGET} IMPORTED_LOCATION)
|
||||||
|
endif()
|
||||||
|
if(DEPENDENCY_LOCATION)
|
||||||
|
get_filename_component(DEPENDENCY_LIB_DIR
|
||||||
|
"${DEPENDENCY_LOCATION}" DIRECTORY)
|
||||||
|
if(EXISTS "${DEPENDENCY_LIB_DIR}/libstdc++.so.6")
|
||||||
|
set(CMVR_CXX_RUNTIME
|
||||||
|
"${DEPENDENCY_LIB_DIR}/libstdc++.so.6")
|
||||||
|
message(STATUS
|
||||||
|
"Using dependency-prefix C++ runtime: ${CMVR_CXX_RUNTIME}")
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(CMVR_WITH_MSQUIC)
|
||||||
|
if(WIN32)
|
||||||
|
if(NOT EXISTS "${CMVR_INCLUDE_DIR}/msquic.h" OR
|
||||||
|
NOT EXISTS "${CMVR_LIB_DIR}/msquic.dll")
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"CMVR_WITH_MSQUIC is enabled, but include/msquic.h or lib/msquic.dll is missing")
|
||||||
|
endif()
|
||||||
|
set(CMVR_MSQUIC_INCLUDE_DIR "${CMVR_INCLUDE_DIR}")
|
||||||
|
else()
|
||||||
|
find_path(CMVR_MSQUIC_INCLUDE_DIR msquic.h
|
||||||
|
HINTS "${CMVR_MSQUIC_ROOT}"
|
||||||
|
PATH_SUFFIXES include)
|
||||||
|
find_library(CMVR_MSQUIC_LIBRARY NAMES msquic
|
||||||
|
HINTS "${CMVR_MSQUIC_ROOT}"
|
||||||
|
PATH_SUFFIXES lib lib64)
|
||||||
|
if(NOT CMVR_MSQUIC_INCLUDE_DIR OR NOT CMVR_MSQUIC_LIBRARY)
|
||||||
|
message(FATAL_ERROR
|
||||||
|
"CMVR_WITH_MSQUIC=ON requires a Linux MsQuic installation. "
|
||||||
|
"Set CMVR_MSQUIC_ROOT or configure with -DCMVR_WITH_MSQUIC=OFF.")
|
||||||
|
endif()
|
||||||
|
get_filename_component(CMVR_MSQUIC_LIBRARY_DIR
|
||||||
|
"${CMVR_MSQUIC_LIBRARY}" DIRECTORY)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMVR_SOURCES
|
||||||
|
src/audiostreammanager.cpp
|
||||||
|
src/audiostreammanager.h
|
||||||
|
src/configeditorwidget.cpp
|
||||||
|
src/configeditorwidget.h
|
||||||
|
src/main.cpp
|
||||||
|
src/mainwindow.cpp
|
||||||
|
src/mainwindow_ui.cpp
|
||||||
|
src/mainwindow.h
|
||||||
|
src/quictestserver.cpp
|
||||||
|
src/quictestserver.h
|
||||||
|
src/rpcservicewidget.cpp
|
||||||
|
src/rpcservicewidget.h
|
||||||
|
src/robotclient.cpp
|
||||||
|
src/robotclient.h
|
||||||
|
src/trendwidget.cpp
|
||||||
|
src/trendwidget.h
|
||||||
|
src/uiicons.h
|
||||||
|
src/urdfviewerwidget.cpp
|
||||||
|
src/urdfviewerwidget.h
|
||||||
|
src/videodecoder.cpp
|
||||||
|
src/videodecoder.h
|
||||||
|
src/videoframe.h
|
||||||
|
src/videorenderwidget.cpp
|
||||||
|
src/videorenderwidget.h
|
||||||
|
ui/handeyecalibrationwidget.cpp
|
||||||
|
ui/handeyecalibrationwidget.h
|
||||||
|
ui/handeyecalibrationwidget.ui
|
||||||
|
ui/mainwindow.ui
|
||||||
|
ui/systemservicepage.ui
|
||||||
|
ui/armservicepage.ui
|
||||||
|
ui/cameraservicepage.ui
|
||||||
|
ui/agvservicepage.ui
|
||||||
|
ui/agvstatusdialog.ui
|
||||||
|
ui/audioservicepage.ui
|
||||||
|
ui/quicserverpage.ui
|
||||||
|
ui/diagnosticspage.ui
|
||||||
|
ui/rpcservicewidget.ui
|
||||||
|
resources.qrc)
|
||||||
|
|
||||||
|
list(APPEND CMVR_SOURCES
|
||||||
|
src/handeyebridge.cpp src/handeyebridge.h
|
||||||
|
src/handeyestore.cpp src/handeyestore.h
|
||||||
|
src/handeyeurdf.cpp src/handeyeurdf.h
|
||||||
|
src/touchplanner.cpp src/touchplanner.h
|
||||||
|
src/touchsequencecontroller.cpp src/touchsequencecontroller.h
|
||||||
|
src/touchvideowidget.cpp src/touchvideowidget.h
|
||||||
|
src/touchoperationwidget.cpp src/touchoperationwidget.h
|
||||||
|
src/handeyemotionwidget.cpp src/handeyemotionwidget.h
|
||||||
|
src/tcpcalibration.cpp src/tcpcalibration.h
|
||||||
|
src/tcpjogcontroller.cpp src/tcpjogcontroller.h
|
||||||
|
src/tcptoolstore.cpp src/tcptoolstore.h
|
||||||
|
src/tcpcalibrationwidget.cpp src/tcpcalibrationwidget.h)
|
||||||
|
add_executable(CmvrControlStation ${CMVR_SOURCES})
|
||||||
|
if(WIN32)
|
||||||
|
set_target_properties(CmvrControlStation PROPERTIES WIN32_EXECUTABLE TRUE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set_target_properties(CmvrControlStation PROPERTIES
|
||||||
|
DEBUG_POSTFIX "_d"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin/$<LOWER_CASE:$<CONFIG>>")
|
||||||
|
|
||||||
|
target_compile_definitions(CmvrControlStation PRIVATE
|
||||||
|
CMVR_WITH_GRPC=1
|
||||||
|
CMVR_WITH_MSQUIC=$<BOOL:${CMVR_WITH_MSQUIC}>)
|
||||||
|
if(WIN32)
|
||||||
|
target_compile_definitions(CmvrControlStation PRIVATE _WIN32_WINNT=0x0600)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_include_directories(CmvrControlStation PRIVATE "${GENERATED_ROOT}")
|
||||||
|
if(WIN32)
|
||||||
|
target_include_directories(CmvrControlStation PRIVATE
|
||||||
|
"${CMVR_INCLUDE_DIR}"
|
||||||
|
"${CMVR_INCLUDE_DIR}/urdfdom_headers")
|
||||||
|
else()
|
||||||
|
target_include_directories(CmvrControlStation PRIVATE
|
||||||
|
"${CMVR_URDFDOM_INCLUDE_DIR}"
|
||||||
|
"${CMVR_TINYXML_INCLUDE_DIR}"
|
||||||
|
"${CMVR_INCLUDE_DIR}/urdfdom_headers")
|
||||||
|
endif()
|
||||||
|
if(CMVR_WITH_MSQUIC)
|
||||||
|
target_include_directories(CmvrControlStation PRIVATE "${CMVR_MSQUIC_INCLUDE_DIR}")
|
||||||
|
if(UNIX AND CMVR_MSQUIC_LIBRARY_DIR)
|
||||||
|
set_property(TARGET CmvrControlStation APPEND PROPERTY
|
||||||
|
BUILD_RPATH "${CMVR_MSQUIC_LIBRARY_DIR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(CmvrControlStation PRIVATE
|
||||||
|
Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Multimedia
|
||||||
|
Qt5::3DCore Qt5::3DRender Qt5::3DExtras Qt5::3DInput Qt5::3DAnimation)
|
||||||
|
|
||||||
|
# Generate every project-local CMVR message. This avoids source-tree generated
|
||||||
|
# files and automatically picks up newly added configuration messages.
|
||||||
|
file(GLOB_RECURSE PROTO_FILES CONFIGURE_DEPENDS
|
||||||
|
"${PROTO_ROOT}/cmvr/api/*.proto"
|
||||||
|
"${PROTO_ROOT}/cmvr/common/*.proto"
|
||||||
|
"${PROTO_ROOT}/cmvr/config/*.proto"
|
||||||
|
"${PROTO_ROOT}/cmvr/msgs/agv.proto"
|
||||||
|
"${PROTO_ROOT}/cmvr/quic_edge/v1/*.proto")
|
||||||
|
|
||||||
|
set(SERVICE_NAMES
|
||||||
|
cmvr/api/agv_service
|
||||||
|
cmvr/api/arm_service
|
||||||
|
cmvr/api/biohead_service
|
||||||
|
cmvr/api/camera_service
|
||||||
|
cmvr/api/configuration_service
|
||||||
|
cmvr/api/dexhand_service
|
||||||
|
cmvr/api/hlc_service
|
||||||
|
cmvr/api/microphone_service
|
||||||
|
cmvr/api/speaker_service
|
||||||
|
cmvr/api/system_service
|
||||||
|
cmvr/api/test_service)
|
||||||
|
|
||||||
|
set(GENERATED_FILES)
|
||||||
|
foreach(PROTO_FILE IN LISTS PROTO_FILES)
|
||||||
|
file(RELATIVE_PATH PROTO_RELATIVE "${PROTO_ROOT}" "${PROTO_FILE}")
|
||||||
|
string(REGEX REPLACE "\\.proto$" "" PROTO_NAME "${PROTO_RELATIVE}")
|
||||||
|
set(PB_CC "${GENERATED_ROOT}/${PROTO_NAME}.pb.cc")
|
||||||
|
set(PB_H "${GENERATED_ROOT}/${PROTO_NAME}.pb.h")
|
||||||
|
get_filename_component(PROTO_OUTPUT_DIR "${PB_CC}" DIRECTORY)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${PB_CC}" "${PB_H}"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${PROTO_OUTPUT_DIR}"
|
||||||
|
COMMAND "${PROTOC}"
|
||||||
|
"--proto_path=${PROTO_ROOT}"
|
||||||
|
"--cpp_out=${GENERATED_ROOT}"
|
||||||
|
"${PROTO_FILE}"
|
||||||
|
DEPENDS "${PROTO_FILE}" ${PROTO_FILES}
|
||||||
|
VERBATIM)
|
||||||
|
list(APPEND GENERATED_FILES "${PB_CC}" "${PB_H}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
foreach(SERVICE_NAME IN LISTS SERVICE_NAMES)
|
||||||
|
set(PROTO_FILE "${PROTO_ROOT}/${SERVICE_NAME}.proto")
|
||||||
|
set(GRPC_CC "${GENERATED_ROOT}/${SERVICE_NAME}.grpc.pb.cc")
|
||||||
|
set(GRPC_H "${GENERATED_ROOT}/${SERVICE_NAME}.grpc.pb.h")
|
||||||
|
get_filename_component(PROTO_OUTPUT_DIR "${GRPC_CC}" DIRECTORY)
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT "${GRPC_CC}" "${GRPC_H}"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory "${PROTO_OUTPUT_DIR}"
|
||||||
|
COMMAND "${PROTOC}"
|
||||||
|
"--proto_path=${PROTO_ROOT}"
|
||||||
|
"--grpc_out=${GENERATED_ROOT}"
|
||||||
|
"--plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN}"
|
||||||
|
"${PROTO_FILE}"
|
||||||
|
DEPENDS "${PROTO_FILE}" ${PROTO_FILES}
|
||||||
|
VERBATIM)
|
||||||
|
list(APPEND GENERATED_FILES "${GRPC_CC}" "${GRPC_H}")
|
||||||
|
endforeach()
|
||||||
|
target_sources(CmvrControlStation PRIVATE ${GENERATED_FILES})
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
file(GLOB ABSL_STATIC_LIBS "${CMVR_LIB_DIR}/libabsl_*.a")
|
||||||
|
target_link_libraries(CmvrControlStation PRIVATE
|
||||||
|
"-Wl,--start-group"
|
||||||
|
"${CMVR_LIB_DIR}/libgrpc++.a"
|
||||||
|
"${CMVR_LIB_DIR}/libgrpc.a"
|
||||||
|
"${CMVR_LIB_DIR}/libgpr.a"
|
||||||
|
"${CMVR_LIB_DIR}/libaddress_sorting.a"
|
||||||
|
"${CMVR_LIB_DIR}/libre2.a"
|
||||||
|
"${CMVR_LIB_DIR}/libupb.a"
|
||||||
|
"${CMVR_LIB_DIR}/libcares.a"
|
||||||
|
"${CMVR_LIB_DIR}/libssl.a"
|
||||||
|
"${CMVR_LIB_DIR}/libcrypto.a"
|
||||||
|
"${CMVR_LIB_DIR}/libzlibstatic.a"
|
||||||
|
"${CMVR_LIB_DIR}/libprotobuf.a"
|
||||||
|
${ABSL_STATIC_LIBS}
|
||||||
|
"-Wl,--end-group"
|
||||||
|
"${CMVR_LIB_DIR}/libavcodec.dll.a"
|
||||||
|
"${CMVR_LIB_DIR}/libavutil.dll.a"
|
||||||
|
"${CMVR_LIB_DIR}/libswscale.dll.a"
|
||||||
|
"${CMVR_LIB_DIR}/liburdfdom_model.dll.a"
|
||||||
|
ws2_32 crypt32 advapi32 bcrypt dbghelp iphlpapi secur32 ntdll)
|
||||||
|
else()
|
||||||
|
if(CMVR_CXX_RUNTIME)
|
||||||
|
target_link_libraries(CmvrControlStation PRIVATE "${CMVR_CXX_RUNTIME}")
|
||||||
|
endif()
|
||||||
|
target_link_libraries(CmvrControlStation PRIVATE
|
||||||
|
protobuf::libprotobuf
|
||||||
|
gRPC::grpc++
|
||||||
|
PkgConfig::FFMPEG
|
||||||
|
Threads::Threads
|
||||||
|
"${CMVR_URDFDOM_MODEL_LIBRARY}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
file(GLOB CMVR_RUNTIME_DLLS "${CMVR_LIB_DIR}/*.dll")
|
||||||
|
foreach(RUNTIME_DLL IN LISTS CMVR_RUNTIME_DLLS)
|
||||||
|
add_custom_command(TARGET CmvrControlStation POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
"${RUNTIME_DLL}" "$<TARGET_FILE_DIR:CmvrControlStation>")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
foreach(CERTIFICATE IN ITEMS quic-test-server.pfx quic-test-ca.crt)
|
||||||
|
if(EXISTS "${CMVR_CERT_DIR}/${CERTIFICATE}")
|
||||||
|
add_custom_command(TARGET CmvrControlStation POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
"${CMVR_CERT_DIR}/${CERTIFICATE}"
|
||||||
|
"$<TARGET_FILE_DIR:CmvrControlStation>/${CERTIFICATE}")
|
||||||
|
install(FILES "${CMVR_CERT_DIR}/${CERTIFICATE}" DESTINATION bin)
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
add_custom_command(TARGET CmvrControlStation POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory
|
||||||
|
"$<TARGET_FILE_DIR:CmvrControlStation>/sceneparsers"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
"${CMVR_ASSIMP_SCENE_PARSER}"
|
||||||
|
"$<TARGET_FILE_DIR:CmvrControlStation>/sceneparsers/"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/models"
|
||||||
|
"$<TARGET_FILE_DIR:CmvrControlStation>/models")
|
||||||
|
|
||||||
|
install(TARGETS CmvrControlStation RUNTIME DESTINATION bin)
|
||||||
|
add_custom_command(TARGET CmvrControlStation POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:CmvrControlStation>/scripts"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/handeye_worker.py"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/handeye_math.py"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/scripts/handeye_refinement.py"
|
||||||
|
"$<TARGET_FILE_DIR:CmvrControlStation>/scripts")
|
||||||
|
install(FILES scripts/handeye_worker.py scripts/handeye_math.py scripts/handeye_refinement.py DESTINATION bin/scripts)
|
||||||
|
if(WIN32)
|
||||||
|
set(CMVR_HAND_EYE_JPEG_PLUGIN "${CMVR_QT_PLUGIN_ROOT}/imageformats/qjpeg$<$<CONFIG:Debug>:d>.dll")
|
||||||
|
add_custom_command(TARGET CmvrControlStation POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:CmvrControlStation>/imageformats"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMVR_HAND_EYE_JPEG_PLUGIN}"
|
||||||
|
"$<TARGET_FILE_DIR:CmvrControlStation>/imageformats/")
|
||||||
|
install(FILES "${CMVR_HAND_EYE_JPEG_PLUGIN}" DESTINATION bin/imageformats)
|
||||||
|
set(CMVR_HAND_EYE_RUNTIME_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/handeye-runtime" CACHE PATH "Bundled Windows x64 hand-eye runtime")
|
||||||
|
if(NOT EXISTS "${CMVR_HAND_EYE_RUNTIME_DIR}/manifest.json")
|
||||||
|
message(FATAL_ERROR "Build the bundled runtime with scripts/package_handeye_runtime.py first")
|
||||||
|
endif()
|
||||||
|
add_custom_command(TARGET CmvrControlStation POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:CmvrControlStation>/runtime/handeye"
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMVR_HAND_EYE_RUNTIME_DIR}"
|
||||||
|
"$<TARGET_FILE_DIR:CmvrControlStation>/runtime/handeye")
|
||||||
|
install(DIRECTORY "${CMVR_HAND_EYE_RUNTIME_DIR}/" DESTINATION bin/runtime/handeye)
|
||||||
|
endif()
|
||||||
|
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/models/"
|
||||||
|
DESTINATION bin/models)
|
||||||
|
install(PROGRAMS "${CMVR_ASSIMP_SCENE_PARSER}"
|
||||||
|
DESTINATION bin/sceneparsers)
|
||||||
341
feature/CmvrControlStation.pro
Normal file
@ -0,0 +1,341 @@
|
|||||||
|
QT += core gui widgets multimedia 3dcore 3drender 3dextras 3dinput 3danimation
|
||||||
|
|
||||||
|
CONFIG += c++14 warn_on debug_and_release
|
||||||
|
TEMPLATE = app
|
||||||
|
|
||||||
|
DEFINES += QT_DEPRECATED_WARNINGS _WIN32_WINNT=0x0600
|
||||||
|
|
||||||
|
INCLUDE_DIR = $$clean_path($$PWD/include)
|
||||||
|
LIB_DIR = $$clean_path($$PWD/lib)
|
||||||
|
TOOLS_DIR = $$clean_path($$PWD/tools)
|
||||||
|
CERT_DIR = $$clean_path($$PWD/certs)
|
||||||
|
PROTO_ROOT = $$clean_path($$PWD/protos)
|
||||||
|
PROTO_GEN_DIR = $$clean_path($$PWD/generated_cpp)
|
||||||
|
PROTOC = $$TOOLS_DIR/run_protoc.cmd
|
||||||
|
GRPC_CPP_PLUGIN = $$TOOLS_DIR/grpc_cpp_plugin.exe
|
||||||
|
MSQUIC_DLL = $$LIB_DIR/msquic.dll
|
||||||
|
MSQUIC_TEST_CERT = $$CERT_DIR/quic-test-server.pfx
|
||||||
|
MSQUIC_TEST_CA = $$CERT_DIR/quic-test-ca.crt
|
||||||
|
RUNTIME_DLLS = $$files($$LIB_DIR/*.dll)
|
||||||
|
MODEL_DIR = $$clean_path($$PWD/models)
|
||||||
|
QT_SCENEPARSER_DIR = $$clean_path($$[QT_INSTALL_PLUGINS]/sceneparsers)
|
||||||
|
|
||||||
|
!exists($$PROTOC): error("protoc launcher not found. Run scripts/build_native_deps.ps1 first.")
|
||||||
|
!exists($$GRPC_CPP_PLUGIN): error("grpc_cpp_plugin.exe not found. Run scripts/build_native_deps.ps1 first.")
|
||||||
|
!exists($$MSQUIC_DLL): error("msquic.dll not found. Run scripts/install_msquic.ps1 first.")
|
||||||
|
!exists($$MSQUIC_TEST_CERT): error("QUIC test certificate not found. Run scripts/install_msquic.ps1 first.")
|
||||||
|
!exists($$MSQUIC_TEST_CA): error("QUIC test CA not found. Run scripts/install_msquic.ps1 first.")
|
||||||
|
!exists($$INCLUDE_DIR/libavcodec/avcodec.h): error("FFmpeg headers not found in include.")
|
||||||
|
!exists($$LIB_DIR/avcodec-58.dll): error("FFmpeg runtime DLLs not found in lib.")
|
||||||
|
!exists($$INCLUDE_DIR/urdf_parser/urdf_parser.h): error("urdfdom headers not found in include.")
|
||||||
|
!exists($$LIB_DIR/liburdfdom_model.dll.a): error("urdfdom link library not found in lib.")
|
||||||
|
!exists($$LIB_DIR/liburdfdom_model.dll): error("urdfdom runtime DLL not found in lib.")
|
||||||
|
|
||||||
|
PROTO_FILES = \
|
||||||
|
$$PROTO_ROOT/cmvr/api/common.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/agv_command.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/agv_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/arm_command.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/arm_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/biohead_command.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/biohead_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/camera_command.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/camera_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/configuration_command.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/configuration_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/dexhand_command.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/dexhand_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/hlc_command.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/hlc_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/microphone_command.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/microphone_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/speaker_command.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/speaker_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/system_command.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/system_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/test_service.proto
|
||||||
|
|
||||||
|
GRPC_PROTO_FILES = \
|
||||||
|
$$PROTO_ROOT/cmvr/api/agv_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/arm_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/biohead_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/camera_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/configuration_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/dexhand_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/hlc_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/microphone_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/speaker_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/system_service.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/api/test_service.proto
|
||||||
|
|
||||||
|
MSG_PROTO_FILES = \
|
||||||
|
$$PROTO_ROOT/cmvr/msgs/agv.proto
|
||||||
|
|
||||||
|
CONFIG_PROTO_FILES = \
|
||||||
|
$$PROTO_ROOT/cmvr/config/agv_config/agv_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/arm_config/arm_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/aubo_robot_config/aubo_robot_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/biohead_config/biohead_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/camera_config/camera_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/cmvr_es_config/cmvr_es_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/device_manager_config/device_manager_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/dexhand_config/dexhand_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/grpc_server_config/grpc_server_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/logger_config/logger_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/microphone_config/microphone_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/motor_config/motor_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/quic_edge_config/quic_edge_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/self_collision_task_config/self_collision_task_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/speaker_config/speaker_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/task_manager_config/task_manager_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/touch_screen_task_config/touch_screen_task_config.proto
|
||||||
|
|
||||||
|
CONFIG_ROOT_PROTO_FILES = \
|
||||||
|
$$PROTO_ROOT/cmvr/config/cartesian_motion_validation_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/joint_limits_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/lawba_ik_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/pinocchio_dls_ik_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/pinocchio_qp_ik_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/srs_ik_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/touch_screen_algorithm_config.proto \
|
||||||
|
$$PROTO_ROOT/cmvr/config/touch_screen_common_config.proto
|
||||||
|
|
||||||
|
COMMON_PROTO_FILES = \
|
||||||
|
$$PROTO_ROOT/cmvr/common/geometry.proto
|
||||||
|
|
||||||
|
MUJOCO_PROTO_FILES = \
|
||||||
|
$$PROTO_ROOT/cmvr/config/mujoco_config/mujoco_world_config.proto
|
||||||
|
|
||||||
|
QUIC_PROTO_FILES = \
|
||||||
|
$$PROTO_ROOT/cmvr/quic_edge/v1/quic_edge.proto
|
||||||
|
|
||||||
|
# Show the complete local proto tree in Qt Creator without compiling unused APIs.
|
||||||
|
OTHER_FILES += $$files($$PROTO_ROOT/*.proto, true) $$files($$MODEL_DIR/*.urdf, true)
|
||||||
|
|
||||||
|
INCLUDEPATH += \
|
||||||
|
$$PROTO_GEN_DIR \
|
||||||
|
$$INCLUDE_DIR \
|
||||||
|
$$INCLUDE_DIR/urdfdom_headers
|
||||||
|
|
||||||
|
protobuf_compiler.name = Protobuf ${QMAKE_FILE_IN}
|
||||||
|
protobuf_compiler.input = PROTO_FILES
|
||||||
|
protobuf_compiler.output = $$PROTO_GEN_DIR/cmvr/api/${QMAKE_FILE_BASE}.pb.cc
|
||||||
|
protobuf_compiler.commands = $$quote($$PROTOC) --proto_path=$$quote($$PROTO_ROOT) --cpp_out=$$quote($$PROTO_GEN_DIR) $$quote($$PROTO_ROOT/cmvr/api/${QMAKE_FILE_BASE}.proto)
|
||||||
|
protobuf_compiler.depends = $$PROTO_FILES $$MSG_PROTO_FILES
|
||||||
|
protobuf_compiler.variable_out = SOURCES
|
||||||
|
protobuf_compiler.CONFIG += target_predeps
|
||||||
|
|
||||||
|
msg_protobuf_compiler.name = Protobuf ${QMAKE_FILE_IN}
|
||||||
|
msg_protobuf_compiler.input = MSG_PROTO_FILES
|
||||||
|
msg_protobuf_compiler.output = $$PROTO_GEN_DIR/cmvr/msgs/${QMAKE_FILE_BASE}.pb.cc
|
||||||
|
msg_protobuf_compiler.commands = $$quote($$PROTOC) --proto_path=$$quote($$PROTO_ROOT) --cpp_out=$$quote($$PROTO_GEN_DIR) $$quote($$PROTO_ROOT/cmvr/msgs/${QMAKE_FILE_BASE}.proto)
|
||||||
|
msg_protobuf_compiler.depends = $$MSG_PROTO_FILES
|
||||||
|
msg_protobuf_compiler.variable_out = SOURCES
|
||||||
|
msg_protobuf_compiler.CONFIG += target_predeps
|
||||||
|
|
||||||
|
config_protobuf_compiler.name = Protobuf ${QMAKE_FILE_IN}
|
||||||
|
config_protobuf_compiler.input = CONFIG_PROTO_FILES
|
||||||
|
config_protobuf_compiler.output = $$PROTO_GEN_DIR/cmvr/config/${QMAKE_FILE_BASE}/${QMAKE_FILE_BASE}.pb.cc
|
||||||
|
config_protobuf_compiler.commands = $$quote($$PROTOC) --proto_path=$$quote($$PROTO_ROOT) --cpp_out=$$quote($$PROTO_GEN_DIR) $$quote($$PROTO_ROOT/cmvr/config/${QMAKE_FILE_BASE}/${QMAKE_FILE_BASE}.proto)
|
||||||
|
config_protobuf_compiler.depends = $$CONFIG_PROTO_FILES
|
||||||
|
config_protobuf_compiler.variable_out = SOURCES
|
||||||
|
config_protobuf_compiler.CONFIG += target_predeps
|
||||||
|
|
||||||
|
config_root_protobuf_compiler.name = Protobuf ${QMAKE_FILE_IN}
|
||||||
|
config_root_protobuf_compiler.input = CONFIG_ROOT_PROTO_FILES
|
||||||
|
config_root_protobuf_compiler.output = $$PROTO_GEN_DIR/cmvr/config/${QMAKE_FILE_BASE}.pb.cc
|
||||||
|
config_root_protobuf_compiler.commands = $$quote($$PROTOC) --proto_path=$$quote($$PROTO_ROOT) --cpp_out=$$quote($$PROTO_GEN_DIR) $$quote($$PROTO_ROOT/cmvr/config/${QMAKE_FILE_BASE}.proto)
|
||||||
|
config_root_protobuf_compiler.depends = $$CONFIG_ROOT_PROTO_FILES $$COMMON_PROTO_FILES
|
||||||
|
config_root_protobuf_compiler.variable_out = SOURCES
|
||||||
|
config_root_protobuf_compiler.CONFIG += target_predeps
|
||||||
|
|
||||||
|
common_protobuf_compiler.name = Protobuf ${QMAKE_FILE_IN}
|
||||||
|
common_protobuf_compiler.input = COMMON_PROTO_FILES
|
||||||
|
common_protobuf_compiler.output = $$PROTO_GEN_DIR/cmvr/common/${QMAKE_FILE_BASE}.pb.cc
|
||||||
|
common_protobuf_compiler.commands = $$quote($$PROTOC) --proto_path=$$quote($$PROTO_ROOT) --cpp_out=$$quote($$PROTO_GEN_DIR) $$quote($$PROTO_ROOT/cmvr/common/${QMAKE_FILE_BASE}.proto)
|
||||||
|
common_protobuf_compiler.depends = $$COMMON_PROTO_FILES
|
||||||
|
common_protobuf_compiler.variable_out = SOURCES
|
||||||
|
common_protobuf_compiler.CONFIG += target_predeps
|
||||||
|
|
||||||
|
mujoco_protobuf_compiler.name = Protobuf ${QMAKE_FILE_IN}
|
||||||
|
mujoco_protobuf_compiler.input = MUJOCO_PROTO_FILES
|
||||||
|
mujoco_protobuf_compiler.output = $$PROTO_GEN_DIR/cmvr/config/mujoco_config/${QMAKE_FILE_BASE}.pb.cc
|
||||||
|
mujoco_protobuf_compiler.commands = $$quote($$PROTOC) --proto_path=$$quote($$PROTO_ROOT) --cpp_out=$$quote($$PROTO_GEN_DIR) $$quote($$PROTO_ROOT/cmvr/config/mujoco_config/${QMAKE_FILE_BASE}.proto)
|
||||||
|
mujoco_protobuf_compiler.depends = $$MUJOCO_PROTO_FILES
|
||||||
|
mujoco_protobuf_compiler.variable_out = SOURCES
|
||||||
|
mujoco_protobuf_compiler.CONFIG += target_predeps
|
||||||
|
|
||||||
|
grpc_compiler.name = gRPC ${QMAKE_FILE_IN}
|
||||||
|
grpc_compiler.input = GRPC_PROTO_FILES
|
||||||
|
grpc_compiler.output = $$PROTO_GEN_DIR/cmvr/api/${QMAKE_FILE_BASE}.grpc.pb.cc
|
||||||
|
grpc_compiler.commands = $$quote($$PROTOC) --proto_path=$$quote($$PROTO_ROOT) --grpc_out=$$quote($$PROTO_GEN_DIR) --plugin=protoc-gen-grpc=$$quote($$GRPC_CPP_PLUGIN) $$quote($$PROTO_ROOT/cmvr/api/${QMAKE_FILE_BASE}.proto)
|
||||||
|
grpc_compiler.depends = $$PROTO_FILES $$MSG_PROTO_FILES
|
||||||
|
grpc_compiler.variable_out = SOURCES
|
||||||
|
grpc_compiler.CONFIG += target_predeps
|
||||||
|
|
||||||
|
quic_protobuf_compiler.name = Protobuf ${QMAKE_FILE_IN}
|
||||||
|
quic_protobuf_compiler.input = QUIC_PROTO_FILES
|
||||||
|
quic_protobuf_compiler.output = $$PROTO_GEN_DIR/cmvr/quic_edge/v1/${QMAKE_FILE_BASE}.pb.cc
|
||||||
|
quic_protobuf_compiler.commands = $$quote($$PROTOC) --proto_path=$$quote($$PROTO_ROOT) --cpp_out=$$quote($$PROTO_GEN_DIR) $$quote($$PROTO_ROOT/cmvr/quic_edge/v1/${QMAKE_FILE_BASE}.proto)
|
||||||
|
quic_protobuf_compiler.depends = $$QUIC_PROTO_FILES
|
||||||
|
quic_protobuf_compiler.variable_out = SOURCES
|
||||||
|
quic_protobuf_compiler.CONFIG += target_predeps
|
||||||
|
|
||||||
|
QMAKE_EXTRA_COMPILERS += protobuf_compiler msg_protobuf_compiler config_protobuf_compiler config_root_protobuf_compiler common_protobuf_compiler mujoco_protobuf_compiler grpc_compiler quic_protobuf_compiler
|
||||||
|
|
||||||
|
ABSL_STATIC_LIBS = $$files($$LIB_DIR/libabsl_*.a)
|
||||||
|
LIBS += \
|
||||||
|
-Wl,--start-group \
|
||||||
|
$$LIB_DIR/libgrpc++.a \
|
||||||
|
$$LIB_DIR/libgrpc.a \
|
||||||
|
$$LIB_DIR/libgpr.a \
|
||||||
|
$$LIB_DIR/libaddress_sorting.a \
|
||||||
|
$$LIB_DIR/libre2.a \
|
||||||
|
$$LIB_DIR/libupb.a \
|
||||||
|
$$LIB_DIR/libcares.a \
|
||||||
|
$$LIB_DIR/libssl.a \
|
||||||
|
$$LIB_DIR/libcrypto.a \
|
||||||
|
$$LIB_DIR/libzlibstatic.a \
|
||||||
|
$$LIB_DIR/libprotobuf.a \
|
||||||
|
$$ABSL_STATIC_LIBS \
|
||||||
|
-Wl,--end-group \
|
||||||
|
$$LIB_DIR/libavcodec.dll.a \
|
||||||
|
$$LIB_DIR/libavutil.dll.a \
|
||||||
|
$$LIB_DIR/libswscale.dll.a \
|
||||||
|
$$LIB_DIR/liburdfdom_model.dll.a \
|
||||||
|
-lws2_32 \
|
||||||
|
-lcrypt32 \
|
||||||
|
-ladvapi32 \
|
||||||
|
-lbcrypt \
|
||||||
|
-ldbghelp \
|
||||||
|
-liphlpapi \
|
||||||
|
-lsecur32 \
|
||||||
|
-lntdll
|
||||||
|
|
||||||
|
DEFINES += CMVR_WITH_GRPC=1 CMVR_WITH_MSQUIC=1
|
||||||
|
|
||||||
|
CONFIG(debug, debug|release) {
|
||||||
|
TARGET = CmvrControlStation_d
|
||||||
|
DESTDIR = $$clean_path($$PWD/bin/debug)
|
||||||
|
OBJECTS_DIR = build/debug/obj
|
||||||
|
MOC_DIR = build/debug/moc
|
||||||
|
RCC_DIR = build/debug/rcc
|
||||||
|
UI_DIR = build/debug/ui
|
||||||
|
DEFINES += CMVR_DEBUG_BUILD
|
||||||
|
ASSIMP_SCENE_PARSER = $$QT_SCENEPARSER_DIR/assimpsceneimportd.dll
|
||||||
|
} else {
|
||||||
|
TARGET = CmvrControlStation
|
||||||
|
DESTDIR = $$clean_path($$PWD/bin/release)
|
||||||
|
OBJECTS_DIR = build/release/obj
|
||||||
|
MOC_DIR = build/release/moc
|
||||||
|
RCC_DIR = build/release/rcc
|
||||||
|
UI_DIR = build/release/ui
|
||||||
|
DEFINES += NDEBUG
|
||||||
|
ASSIMP_SCENE_PARSER = $$QT_SCENEPARSER_DIR/assimpsceneimport.dll
|
||||||
|
}
|
||||||
|
|
||||||
|
!exists($$ASSIMP_SCENE_PARSER): error("Qt3D Assimp scene parser not found in the selected Qt Kit.")
|
||||||
|
|
||||||
|
SOURCES += \
|
||||||
|
src/handeyebridge.cpp \
|
||||||
|
src/handeyestore.cpp \
|
||||||
|
src/handeyeurdf.cpp \
|
||||||
|
src/touchplanner.cpp \
|
||||||
|
src/touchsequencecontroller.cpp \
|
||||||
|
src/touchvideowidget.cpp \
|
||||||
|
src/touchoperationwidget.cpp \
|
||||||
|
src/handeyemotionwidget.cpp \
|
||||||
|
src/tcpcalibration.cpp \
|
||||||
|
src/tcpjogcontroller.cpp \
|
||||||
|
src/tcptoolstore.cpp \
|
||||||
|
src/tcpcalibrationwidget.cpp \
|
||||||
|
src/audiostreammanager.cpp \
|
||||||
|
src/configeditorwidget.cpp \
|
||||||
|
src/main.cpp \
|
||||||
|
src/mainwindow.cpp \
|
||||||
|
src/mainwindow_ui.cpp \
|
||||||
|
src/quictestserver.cpp \
|
||||||
|
src/rpcservicewidget.cpp \
|
||||||
|
src/robotclient.cpp \
|
||||||
|
src/trendwidget.cpp \
|
||||||
|
src/urdfviewerwidget.cpp \
|
||||||
|
src/videodecoder.cpp \
|
||||||
|
src/videorenderwidget.cpp \
|
||||||
|
ui/handeyecalibrationwidget.cpp
|
||||||
|
|
||||||
|
HEADERS += \
|
||||||
|
src/handeyebridge.h \
|
||||||
|
src/handeyestore.h \
|
||||||
|
src/handeyeurdf.h \
|
||||||
|
src/touchplanner.h \
|
||||||
|
src/touchsequencecontroller.h \
|
||||||
|
src/touchvideowidget.h \
|
||||||
|
src/touchoperationwidget.h \
|
||||||
|
src/handeyemotionwidget.h \
|
||||||
|
src/tcpcalibration.h \
|
||||||
|
src/tcpjogcontroller.h \
|
||||||
|
src/tcptoolstore.h \
|
||||||
|
src/tcpcalibrationwidget.h \
|
||||||
|
src/audiostreammanager.h \
|
||||||
|
src/configeditorwidget.h \
|
||||||
|
src/mainwindow.h \
|
||||||
|
src/quictestserver.h \
|
||||||
|
src/rpcservicewidget.h \
|
||||||
|
src/robotclient.h \
|
||||||
|
src/trendwidget.h \
|
||||||
|
src/uiicons.h \
|
||||||
|
src/urdfviewerwidget.h \
|
||||||
|
src/videodecoder.h \
|
||||||
|
src/videoframe.h \
|
||||||
|
src/videorenderwidget.h \
|
||||||
|
ui/handeyecalibrationwidget.h
|
||||||
|
|
||||||
|
FORMS += \
|
||||||
|
ui/handeyecalibrationwidget.ui \
|
||||||
|
ui/mainwindow.ui \
|
||||||
|
ui/systemservicepage.ui \
|
||||||
|
ui/armservicepage.ui \
|
||||||
|
ui/cameraservicepage.ui \
|
||||||
|
ui/agvservicepage.ui \
|
||||||
|
ui/agvstatusdialog.ui \
|
||||||
|
ui/audioservicepage.ui \
|
||||||
|
ui/quicserverpage.ui \
|
||||||
|
ui/diagnosticspage.ui \
|
||||||
|
ui/rpcservicewidget.ui
|
||||||
|
|
||||||
|
RESOURCES += resources.qrc
|
||||||
|
|
||||||
|
runtime_library_deployment.files = $$RUNTIME_DLLS
|
||||||
|
runtime_library_deployment.path = $$DESTDIR
|
||||||
|
quic_certificate_deployment.files = $$MSQUIC_TEST_CERT
|
||||||
|
quic_certificate_deployment.path = $$DESTDIR
|
||||||
|
quic_ca_deployment.files = $$MSQUIC_TEST_CA
|
||||||
|
quic_ca_deployment.path = $$DESTDIR
|
||||||
|
assimp_scene_parser_deployment.files = $$ASSIMP_SCENE_PARSER
|
||||||
|
assimp_scene_parser_deployment.path = $$DESTDIR/sceneparsers
|
||||||
|
COPIES += runtime_library_deployment quic_certificate_deployment quic_ca_deployment assimp_scene_parser_deployment
|
||||||
|
handeye_algorithm_deployment.files = $$PWD/scripts/handeye_worker.py $$PWD/scripts/handeye_math.py $$PWD/scripts/handeye_refinement.py
|
||||||
|
handeye_algorithm_deployment.path = $$DESTDIR/scripts
|
||||||
|
COPIES += handeye_algorithm_deployment
|
||||||
|
win32 {
|
||||||
|
CONFIG(debug, debug|release): HAND_EYE_JPEG_PLUGIN = $$[QT_INSTALL_PLUGINS]/imageformats/qjpegd.dll
|
||||||
|
else: HAND_EYE_JPEG_PLUGIN = $$[QT_INSTALL_PLUGINS]/imageformats/qjpeg.dll
|
||||||
|
handeye_image_plugin.files = $$HAND_EYE_JPEG_PLUGIN
|
||||||
|
handeye_image_plugin.path = $$DESTDIR/imageformats
|
||||||
|
COPIES += handeye_image_plugin
|
||||||
|
}
|
||||||
|
DISTFILES += scripts/handeye_worker.py scripts/handeye_math.py scripts/handeye_refinement.py
|
||||||
|
DISTFILES += scripts/package_handeye_runtime.py
|
||||||
|
|
||||||
|
QMAKE_POST_LINK += $$QMAKE_COPY_DIR $$shell_quote($$shell_path($$MODEL_DIR)) $$shell_quote($$shell_path($$DESTDIR/models))
|
||||||
|
|
||||||
|
win32 {
|
||||||
|
isEmpty(HAND_EYE_RUNTIME_DIR): HAND_EYE_RUNTIME_DIR = $$PWD/third_party/handeye-runtime
|
||||||
|
!exists($$HAND_EYE_RUNTIME_DIR/manifest.json): error(Build the bundled runtime with scripts/package_handeye_runtime.py first)
|
||||||
|
QMAKE_POST_LINK += $$escape_expand(\n\t) if not exist $$shell_quote($$shell_path($$DESTDIR/runtime)) $$QMAKE_MKDIR $$shell_quote($$shell_path($$DESTDIR/runtime))
|
||||||
|
QMAKE_POST_LINK += $$escape_expand(\n\t) $$QMAKE_COPY_DIR $$shell_quote($$shell_path($$HAND_EYE_RUNTIME_DIR)) $$shell_quote($$shell_path($$DESTDIR/runtime/handeye))
|
||||||
|
QMAKE_POST_LINK += $$escape_expand(\n\t) $$QMAKE_COPY_FILE $$shell_quote($$shell_path($$MSQUIC_TEST_CERT)) $$shell_quote($$shell_path($$DESTDIR/quic-test-server.pfx))
|
||||||
|
QMAKE_POST_LINK += $$escape_expand(\n\t) $$QMAKE_COPY_FILE $$shell_quote($$shell_path($$MSQUIC_TEST_CA)) $$shell_quote($$shell_path($$DESTDIR/quic-test-ca.crt))
|
||||||
|
}
|
||||||
|
|
||||||
|
win32:RC_ICONS =
|
||||||
1606
feature/styles.qss
Normal file
|
Before Width: | Height: | Size: 6.9 KiB |
@ -1,5 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64">
|
|
||||||
<rect x="2" y="2" width="60" height="60" rx="15" fill="#1b6ef3"/>
|
|
||||||
<path d="M44 21a17 17 0 1 0 0 22" fill="none" stroke="#ffffff" stroke-width="7" stroke-linecap="round"/>
|
|
||||||
<rect x="43" y="28" width="9" height="9" rx="3" fill="#8fddff"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 310 B |
@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="m9 3-1 3-3 1-2 3 2 2-1 3 3 2 3-1 2 2 3-1 1-3 3-1 1-3-2-2V5l-3-1-2 1-2-2Z"/><circle cx="11.5" cy="10.5" r="3"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 309 B |
@ -1,278 +0,0 @@
|
|||||||
diff --git a/cmvr-es/devices/camera/abstract_camera.h b/cmvr-es/devices/camera/abstract_camera.h
|
|
||||||
index d807b658..a0e1f224 100644
|
|
||||||
--- a/cmvr-es/devices/camera/abstract_camera.h
|
|
||||||
+++ b/cmvr-es/devices/camera/abstract_camera.h
|
|
||||||
@@ -26,6 +26,14 @@ namespace cmvr::device {
|
|
||||||
float coeffs[5]{};
|
|
||||||
|
|
||||||
};
|
|
||||||
+ struct RgbdGeometry {
|
|
||||||
+ double metres_per_unit = 0;
|
|
||||||
+ bool aligned_to_color = false;
|
|
||||||
+ bool color_axial_z = false;
|
|
||||||
+ std::string distortion_model;
|
|
||||||
+ int64_t color_capture_utc_ns = 0;
|
|
||||||
+ int64_t depth_capture_utc_ns = 0;
|
|
||||||
+ };
|
|
||||||
struct StreamFrameData
|
|
||||||
{
|
|
||||||
//原始图像数据
|
|
||||||
@@ -102,6 +110,9 @@ namespace cmvr::device {
|
|
||||||
virtual void getRGBImage(cv::Mat &color, Rs2Intrinsics& intrinsics) {}
|
|
||||||
virtual void getDepthImage(cv::Mat &depth, Rs2Intrinsics& intrinsics) {}
|
|
||||||
virtual void getRGBDImages(cv::Mat &color, cv::Mat &depth, Rs2Intrinsics& intrinsics) {}
|
|
||||||
+ // Unsupported drivers deliberately return no metric geometry.
|
|
||||||
+ virtual void getMetricRGBDImages(cv::Mat &color, cv::Mat &depth,
|
|
||||||
+ Rs2Intrinsics& intrinsics, RgbdGeometry& geometry) {}
|
|
||||||
virtual void startRecording(const std::string &video_path) {}
|
|
||||||
virtual void stopRecording() {}
|
|
||||||
virtual void pauseRecording() {}
|
|
||||||
diff --git a/cmvr-es/devices/camera/realsense_camera/include/realsense_camera.h b/cmvr-es/devices/camera/realsense_camera/include/realsense_camera.h
|
|
||||||
index ec700d96..597b9814 100644
|
|
||||||
--- a/cmvr-es/devices/camera/realsense_camera/include/realsense_camera.h
|
|
||||||
+++ b/cmvr-es/devices/camera/realsense_camera/include/realsense_camera.h
|
|
||||||
@@ -28,6 +28,8 @@ namespace cmvr::device{
|
|
||||||
void getRGBImage(cv::Mat& color, Rs2Intrinsics& intrinsics) override;
|
|
||||||
void getDepthImage(cv::Mat& depth, Rs2Intrinsics& intrinsics) override;
|
|
||||||
void getRGBDImages(cv::Mat &color, cv::Mat &depth, Rs2Intrinsics& intrinsics) override;
|
|
||||||
+ void getMetricRGBDImages(cv::Mat &color, cv::Mat &depth,
|
|
||||||
+ Rs2Intrinsics& intrinsics, RgbdGeometry& geometry) override;
|
|
||||||
void startRecording(const std::string &video_path) override;
|
|
||||||
void stopRecording() override;
|
|
||||||
void pauseRecording() override;
|
|
||||||
@@ -71,6 +73,7 @@ namespace cmvr::device{
|
|
||||||
rs2_intrinsics intrinsics_;
|
|
||||||
|
|
||||||
std::mutex frame_mtx_;
|
|
||||||
+ rs2::frameset latest_metric_frames_; // Owned SDK frames before display alignment.
|
|
||||||
|
|
||||||
cv::Mat dist_coeffs_;
|
|
||||||
cv::Mat latest_rgb_;
|
|
||||||
diff --git a/cmvr-es/devices/camera/realsense_camera/src/realsense_camera.cpp b/cmvr-es/devices/camera/realsense_camera/src/realsense_camera.cpp
|
|
||||||
index a22918c1..4733b7f4 100644
|
|
||||||
--- a/cmvr-es/devices/camera/realsense_camera/src/realsense_camera.cpp
|
|
||||||
+++ b/cmvr-es/devices/camera/realsense_camera/src/realsense_camera.cpp
|
|
||||||
@@ -6,6 +6,9 @@
|
|
||||||
#include "../include/realsense_camera.h"
|
|
||||||
|
|
||||||
#include <cstring>
|
|
||||||
+#include <cmath>
|
|
||||||
+#include <stdexcept>
|
|
||||||
+#include <librealsense2/rsutil.h>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
using namespace cmvr::device;
|
|
||||||
@@ -232,6 +235,14 @@ bool RealsenseCamera::start() {
|
|
||||||
|
|
||||||
// 使用相同的同步策略启动
|
|
||||||
profile_ = pipe_.start(rs_cfg_);
|
|
||||||
+ for (auto sensor : profile_.get_device().query_sensors()) {
|
|
||||||
+ try {
|
|
||||||
+ if (sensor.supports(RS2_OPTION_GLOBAL_TIME_ENABLED))
|
|
||||||
+ sensor.set_option(RS2_OPTION_GLOBAL_TIME_ENABLED, 1.f);
|
|
||||||
+ } catch (const rs2::error& e) {
|
|
||||||
+ CMVR_LOG(WARNING) << "Metric RGBD global time unavailable: " << e.what();
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (stream_mode_ == RGBD_MODE){
|
|
||||||
auto sp_depth = profile_.get_stream(RS2_STREAM_DEPTH).as<rs2::video_stream_profile>();
|
|
||||||
@@ -350,6 +361,126 @@ bool RealsenseCamera::stop() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
+void RealsenseCamera::getMetricRGBDImages(cv::Mat& color, cv::Mat& depth,
|
|
||||||
+ Rs2Intrinsics& intrinsics, RgbdGeometry& geometry) {
|
|
||||||
+ rs2::frameset frames;
|
|
||||||
+ {
|
|
||||||
+ std::lock_guard lock(ctrl_mtx_);
|
|
||||||
+ if (!state_.is_opened || stream_mode_ != RGBD_MODE)
|
|
||||||
+ throw std::runtime_error("Metric RGBD requires an opened RGBD camera");
|
|
||||||
+ if (state_.is_streaming) {
|
|
||||||
+ std::lock_guard<std::mutex> frame_lock(frame_mtx_);
|
|
||||||
+ frames = latest_metric_frames_;
|
|
||||||
+ } else {
|
|
||||||
+ frames = get_frameset(false);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ if (!frames) throw std::runtime_error("Waiting for a complete RGBD frameset");
|
|
||||||
+ const auto rgb = frames.get_color_frame();
|
|
||||||
+ const auto raw = frames.get_depth_frame();
|
|
||||||
+ if (!rgb || !raw) throw std::runtime_error("RGBD frameset is incomplete");
|
|
||||||
+ const auto capture = [](const rs2::frame& frame) -> int64_t {
|
|
||||||
+ const auto domain = frame.get_frame_timestamp_domain();
|
|
||||||
+ const double ms = frame.get_timestamp();
|
|
||||||
+ if ((domain != RS2_TIMESTAMP_DOMAIN_GLOBAL_TIME && domain != RS2_TIMESTAMP_DOMAIN_SYSTEM_TIME)
|
|
||||||
+ || !std::isfinite(ms) || ms <= 0 || ms > 9e12)
|
|
||||||
+ throw std::runtime_error("RGBD requires SDK global/system capture timestamps");
|
|
||||||
+ return static_cast<int64_t>(ms * 1000000.0);
|
|
||||||
+ };
|
|
||||||
+ geometry.color_capture_utc_ns = capture(rgb);
|
|
||||||
+ geometry.depth_capture_utc_ns = capture(raw);
|
|
||||||
+ if (std::abs(geometry.color_capture_utc_ns - geometry.depth_capture_utc_ns) > 33000000)
|
|
||||||
+ throw std::runtime_error("RGB and depth captures differ by more than 33 ms");
|
|
||||||
+ const auto color_profile = rgb.get_profile().as<rs2::video_stream_profile>();
|
|
||||||
+ const auto depth_profile = raw.get_profile().as<rs2::video_stream_profile>();
|
|
||||||
+ auto kc = color_profile.get_intrinsics();
|
|
||||||
+ const auto kd = depth_profile.get_intrinsics();
|
|
||||||
+ if (kc.model != RS2_DISTORTION_NONE && kc.model != RS2_DISTORTION_BROWN_CONRADY
|
|
||||||
+ && kc.model != RS2_DISTORTION_MODIFIED_BROWN_CONRADY
|
|
||||||
+ && kc.model != RS2_DISTORTION_INVERSE_BROWN_CONRADY)
|
|
||||||
+ throw std::runtime_error("Unsupported RGB distortion model: " + std::to_string(kc.model));
|
|
||||||
+ if (kd.model != RS2_DISTORTION_NONE && kd.model != RS2_DISTORTION_BROWN_CONRADY
|
|
||||||
+ && kd.model != RS2_DISTORTION_INVERSE_BROWN_CONRADY)
|
|
||||||
+ throw std::runtime_error("Unsupported depth deprojection model");
|
|
||||||
+ const auto extrinsics = depth_profile.get_extrinsics_to(color_profile);
|
|
||||||
+ const double scale = raw.get_units(); // Real sensor units, never assume millimetres.
|
|
||||||
+ if (!std::isfinite(scale) || scale <= 0 || scale > .1)
|
|
||||||
+ throw std::runtime_error("Invalid sensor depth units");
|
|
||||||
+ if (rgb.get_profile().format() != RS2_FORMAT_BGR8 || raw.get_profile().format() != RS2_FORMAT_Z16)
|
|
||||||
+ throw std::runtime_error("Metric RGBD requires BGR8 and Z16 sensor frames");
|
|
||||||
+ color = cv::Mat(rgb.get_height(), rgb.get_width(), CV_8UC3,
|
|
||||||
+ const_cast<void*>(rgb.get_data()), rgb.get_stride_in_bytes()).clone();
|
|
||||||
+ cv::Mat valid_color;
|
|
||||||
+ if (kc.model == RS2_DISTORTION_INVERSE_BROWN_CONRADY
|
|
||||||
+ && std::all_of(std::begin(kc.coeffs),std::end(kc.coeffs),[](float v) { return v==0.f; }))
|
|
||||||
+ kc.model = RS2_DISTORTION_NONE;
|
|
||||||
+ if (kc.model == RS2_DISTORTION_MODIFIED_BROWN_CONRADY
|
|
||||||
+ || kc.model == RS2_DISTORTION_INVERSE_BROWN_CONRADY) {
|
|
||||||
+ // These models differ from OpenCV's standard Brown. Rectify with SDK
|
|
||||||
+ // geometry, then project depth into the same pinhole image.
|
|
||||||
+ const auto original = kc;
|
|
||||||
+ cv::Mat map_x(color.size(), CV_32FC1), map_y(color.size(), CV_32FC1);
|
|
||||||
+ valid_color = cv::Mat::zeros(color.size(), CV_8UC1);
|
|
||||||
+ for (int y = 0; y < color.rows; ++y) for (int x = 0; x < color.cols; ++x) {
|
|
||||||
+ const float ray[3] = {(x-kc.ppx)/kc.fx, (y-kc.ppy)/kc.fy, 1.f};
|
|
||||||
+ float uv[2];
|
|
||||||
+ bool converged = true;
|
|
||||||
+ if (original.model == RS2_DISTORTION_INVERSE_BROWN_CONRADY) {
|
|
||||||
+ // Inverse Brown supports SDK deprojection. Find the source
|
|
||||||
+ // pixel whose SDK ray matches this rectified pinhole ray.
|
|
||||||
+ uv[0]=float(x); uv[1]=float(y); converged=false;
|
|
||||||
+ for (int iteration=0; iteration<12; ++iteration) {
|
|
||||||
+ float actual[3]; rs2_deproject_pixel_to_point(actual,&original,uv,1.f);
|
|
||||||
+ const float dx=(ray[0]-actual[0])*original.fx;
|
|
||||||
+ const float dy=(ray[1]-actual[1])*original.fy;
|
|
||||||
+ if (!std::isfinite(dx)||!std::isfinite(dy)) break;
|
|
||||||
+ if (std::abs(dx)<.001f && std::abs(dy)<.001f) { converged=true; break; }
|
|
||||||
+ uv[0]+=dx; uv[1]+=dy;
|
|
||||||
+ }
|
|
||||||
+ } else rs2_project_point_to_pixel(uv, &original, ray);
|
|
||||||
+ if (!converged) { uv[0]=-1.f; uv[1]=-1.f; }
|
|
||||||
+ map_x.at<float>(y,x) = uv[0]; map_y.at<float>(y,x) = uv[1];
|
|
||||||
+ if (std::isfinite(uv[0]) && std::isfinite(uv[1]) && uv[0]>=0 && uv[1]>=0
|
|
||||||
+ && uv[0]<color.cols-1 && uv[1]<color.rows-1)
|
|
||||||
+ valid_color.at<uint8_t>(y,x) = 1;
|
|
||||||
+ }
|
|
||||||
+ cv::Mat rectified;
|
|
||||||
+ cv::remap(color, rectified, map_x, map_y, cv::INTER_LINEAR, cv::BORDER_CONSTANT);
|
|
||||||
+ color = rectified;
|
|
||||||
+ kc.model = RS2_DISTORTION_NONE;
|
|
||||||
+ std::fill(std::begin(kc.coeffs), std::end(kc.coeffs), 0.f);
|
|
||||||
+ }
|
|
||||||
+ depth = cv::Mat::zeros(color.rows, color.cols, CV_32FC1);
|
|
||||||
+ // Reproject raw depth into RGB, including the baseline translation. Store
|
|
||||||
+ // RGB-camera Z, not the original depth-camera Z. Nearest-depth z-buffer;
|
|
||||||
+ // unobserved/occluded pixels stay zero instead of inventing a surface.
|
|
||||||
+ const auto* bytes = static_cast<const uint8_t*>(raw.get_data());
|
|
||||||
+ for (int y = 0; y < raw.get_height(); ++y) for (int x = 0; x < raw.get_width(); ++x) {
|
|
||||||
+ uint16_t sample = 0;
|
|
||||||
+ std::memcpy(&sample, bytes + y * raw.get_stride_in_bytes() + x * 2, 2);
|
|
||||||
+ if (!sample) continue;
|
|
||||||
+ const float z = static_cast<float>(sample * scale);
|
|
||||||
+ if (z < .05f || z > 5.f) continue;
|
|
||||||
+ const float pixel[2] = {static_cast<float>(x), static_cast<float>(y)};
|
|
||||||
+ float pd[3], pc[3], uv[2];
|
|
||||||
+ rs2_deproject_pixel_to_point(pd, &kd, pixel, z);
|
|
||||||
+ rs2_transform_point_to_point(pc, &extrinsics, pd);
|
|
||||||
+ if (!std::isfinite(pc[0]) || !std::isfinite(pc[1]) || !std::isfinite(pc[2]) || pc[2] <= 0) continue;
|
|
||||||
+ rs2_project_point_to_pixel(uv, &kc, pc);
|
|
||||||
+ if (!std::isfinite(uv[0]) || !std::isfinite(uv[1]) || uv[0] < 0 || uv[1] < 0
|
|
||||||
+ || uv[0] > color.cols - 1 || uv[1] > color.rows - 1) continue;
|
|
||||||
+ const int target_y=static_cast<int>(std::lround(uv[1])), target_x=static_cast<int>(std::lround(uv[0]));
|
|
||||||
+ if (!valid_color.empty() && !valid_color.at<uint8_t>(target_y,target_x)) continue;
|
|
||||||
+ float& stored = depth.at<float>(target_y,target_x);
|
|
||||||
+ if (stored == 0 || pc[2] < stored) stored = pc[2];
|
|
||||||
+ }
|
|
||||||
+ intrinsics.fx = kc.fx; intrinsics.fy = kc.fy; intrinsics.cx = kc.ppx; intrinsics.cy = kc.ppy;
|
|
||||||
+ for (int i = 0; i < 5; ++i) intrinsics.coeffs[i] = kc.model == RS2_DISTORTION_NONE ? 0.f : kc.coeffs[i];
|
|
||||||
+ geometry.metres_per_unit = 1.;
|
|
||||||
+ geometry.aligned_to_color = true; geometry.color_axial_z = true;
|
|
||||||
+ geometry.distortion_model = kc.model == RS2_DISTORTION_NONE ? "none" : "brown_conrady";
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void RealsenseCamera::getRGBImage(cv::Mat& color, Rs2Intrinsics& intrinsics) {
|
|
||||||
intrinsics.cx = intrinsics_.ppx;
|
|
||||||
intrinsics.cy = intrinsics_.ppy;
|
|
||||||
@@ -727,6 +858,7 @@ rs2::frameset RealsenseCamera::get_frameset(bool align) {
|
|
||||||
std::lock_guard<std::mutex> lock(frame_mtx_);
|
|
||||||
constexpr unsigned int kWaitTimeoutMs = 300;
|
|
||||||
rs2::frameset frames = pipe_.wait_for_frames(kWaitTimeoutMs);
|
|
||||||
+ latest_metric_frames_ = frames;
|
|
||||||
// 如果需要对齐,添加对齐逻辑
|
|
||||||
if (align_ && align && stream_mode_ == RGBD_MODE) {
|
|
||||||
frames = align_->process(frames);
|
|
||||||
diff --git a/cmvr-es/service/grpc/src/grpc_camera_service.cpp b/cmvr-es/service/grpc/src/grpc_camera_service.cpp
|
|
||||||
index d209fe13..1857fc1c 100644
|
|
||||||
--- a/cmvr-es/service/grpc/src/grpc_camera_service.cpp
|
|
||||||
+++ b/cmvr-es/service/grpc/src/grpc_camera_service.cpp
|
|
||||||
@@ -320,7 +320,24 @@ grpc::Status gRPCCameraServiceImpl::GetRGBDImages(grpc::ServerContext* context,
|
|
||||||
return failResponse(response, "Camera device not found: " + dev_id);
|
|
||||||
}
|
|
||||||
Rs2Intrinsics intrinsics = {0};
|
|
||||||
- dev->getRGBDImages(color_image,depth_image, intrinsics);
|
|
||||||
+ RgbdGeometry geometry;
|
|
||||||
+ if (request->require_metric_depth())
|
|
||||||
+ dev->getMetricRGBDImages(color_image, depth_image, intrinsics, geometry);
|
|
||||||
+ else
|
|
||||||
+ dev->getRGBDImages(color_image,depth_image, intrinsics);
|
|
||||||
+ if (request->require_metric_depth()) {
|
|
||||||
+ if (!geometry.aligned_to_color || !geometry.color_axial_z || geometry.metres_per_unit <= 0)
|
|
||||||
+ return failResponse(response, "Camera driver does not provide metric RGB-aligned depth");
|
|
||||||
+ response->mutable_depth_geometry()->set_metres_per_unit(geometry.metres_per_unit);
|
|
||||||
+ response->mutable_depth_geometry()->set_aligned_to_color(geometry.aligned_to_color);
|
|
||||||
+ response->mutable_depth_geometry()->set_color_axial_z(geometry.color_axial_z);
|
|
||||||
+ const uint16_t endian_probe = 1;
|
|
||||||
+ response->mutable_depth_geometry()->set_byte_order(
|
|
||||||
+ *reinterpret_cast<const uint8_t*>(&endian_probe) == 1 ? "little" : "big");
|
|
||||||
+ response->mutable_depth_geometry()->set_distortion_model(geometry.distortion_model);
|
|
||||||
+ response->mutable_color_frame()->set_capture_utc_ns(geometry.color_capture_utc_ns);
|
|
||||||
+ response->mutable_depth_frame()->set_capture_utc_ns(geometry.depth_capture_utc_ns);
|
|
||||||
+ }
|
|
||||||
if (color_image.empty()) {
|
|
||||||
return failResponse(response, "Camera returned an empty RGB image: " + dev_id);
|
|
||||||
}
|
|
||||||
diff --git a/protos/cmvr/api/camera_command.proto b/protos/cmvr/api/camera_command.proto
|
|
||||||
index 7305955a..276994ce 100644
|
|
||||||
--- a/protos/cmvr/api/camera_command.proto
|
|
||||||
+++ b/protos/cmvr/api/camera_command.proto
|
|
||||||
@@ -107,6 +107,8 @@ message GetDepthImageCommand {
|
|
||||||
message GetRGBDImagesCommand {
|
|
||||||
message Request {
|
|
||||||
CommandHeader.Request header = 1;
|
|
||||||
+ // Opt-in metric snapshot; legacy requests retain their existing format.
|
|
||||||
+ bool require_metric_depth = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Feedback {
|
|
||||||
@@ -114,9 +116,20 @@ message GetRGBDImagesCommand {
|
|
||||||
FrameData color_frame = 2;
|
|
||||||
FrameData depth_frame = 3;
|
|
||||||
CameraIntrinsics intrinsics = 4;
|
|
||||||
+ DepthGeometry depth_geometry = 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
+// Raw little-endian depth samples, aligned to the accompanying native RGB.
|
|
||||||
+// sample * metres_per_unit is RGB optical-axis Z (not range along the ray).
|
|
||||||
+message DepthGeometry {
|
|
||||||
+ double metres_per_unit = 1;
|
|
||||||
+ bool aligned_to_color = 2;
|
|
||||||
+ bool color_axial_z = 3;
|
|
||||||
+ string byte_order = 4;
|
|
||||||
+ string distortion_model = 5;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
message StartCameraRecordingCommand {
|
|
||||||
message Request {
|
|
||||||
CommandHeader.Request header = 1;
|
|
||||||
@ -4,15 +4,10 @@ package cmvr.api;
|
|||||||
|
|
||||||
import "cmvr/api/common.proto";
|
import "cmvr/api/common.proto";
|
||||||
|
|
||||||
// 机械臂笛卡尔命令使用的参考坐标系。
|
|
||||||
enum ArmFrameType {
|
enum ArmFrameType {
|
||||||
// 机械臂基座坐标系,无单位。
|
|
||||||
ARM_FRAME_BASE = 0;
|
ARM_FRAME_BASE = 0;
|
||||||
// 当前工具/TCP 坐标系,无单位。
|
|
||||||
ARM_FRAME_TOOL = 1;
|
ARM_FRAME_TOOL = 1;
|
||||||
// 世界坐标系,无单位。
|
|
||||||
ARM_FRAME_WORLD = 2;
|
ARM_FRAME_WORLD = 2;
|
||||||
// 用户自定义坐标系,无单位。
|
|
||||||
ARM_FRAME_USER = 3;
|
ARM_FRAME_USER = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,63 +43,38 @@ enum ArmControlMode {
|
|||||||
ARM_CONTROL_MODE_FREEDRIVE = 6;
|
ARM_CONTROL_MODE_FREEDRIVE = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关节位置命令;数组顺序必须与机械臂关节顺序一致。
|
|
||||||
message JointPositionCommand {
|
message JointPositionCommand {
|
||||||
// 各关节目标角度,单位:rad。
|
|
||||||
repeated double position = 1;
|
repeated double position = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关节速度命令;数组顺序必须与机械臂关节顺序一致。
|
|
||||||
message JointVelocityCommand {
|
message JointVelocityCommand {
|
||||||
// 各关节目标角速度,单位:rad/s。
|
|
||||||
repeated double velocity = 1;
|
repeated double velocity = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MoveJ 和 MoveL 共用的运动参数。
|
|
||||||
message MotionOptions {
|
message MotionOptions {
|
||||||
// 目标速度;MoveJ 单位为 rad/s,MoveL 单位为 m/s。
|
|
||||||
double velocity = 1;
|
double velocity = 1;
|
||||||
// 目标加速度;MoveJ 单位为 rad/s^2,MoveL 单位为 m/s^2。
|
|
||||||
double acceleration = 2;
|
double acceleration = 2;
|
||||||
// 路径交融半径,单位:m;0 表示不交融。
|
|
||||||
double blend_radius = 3;
|
double blend_radius = 3;
|
||||||
// 目标加加速度;MoveJ 单位为 rad/s^3,MoveL 单位为 m/s^3。
|
|
||||||
double jerk = 4;
|
double jerk = 4;
|
||||||
// MoveL 规划时各关节的最大角速度限制,单位:rad/s。
|
|
||||||
repeated double joint_velocity_limits = 5;
|
repeated double joint_velocity_limits = 5;
|
||||||
// 是否异步执行;true 表示命令提交后立即返回,无单位。
|
|
||||||
bool asynchronous = 6;
|
bool asynchronous = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TCP 的笛卡尔位姿。
|
|
||||||
message CartesianPose {
|
message CartesianPose {
|
||||||
// X 方向位置,单位:m。
|
|
||||||
double x = 1;
|
double x = 1;
|
||||||
// Y 方向位置,单位:m。
|
|
||||||
double y = 2;
|
double y = 2;
|
||||||
// Z 方向位置,单位:m。
|
|
||||||
double z = 3;
|
double z = 3;
|
||||||
// 绕 X 轴的姿态分量,单位:rad。
|
|
||||||
double rx = 4;
|
double rx = 4;
|
||||||
// 绕 Y 轴的姿态分量,单位:rad。
|
|
||||||
double ry = 5;
|
double ry = 5;
|
||||||
// 绕 Z 轴的姿态分量,单位:rad。
|
|
||||||
double rz = 6;
|
double rz = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TCP 的笛卡尔速度。
|
|
||||||
message CartesianVelocity {
|
message CartesianVelocity {
|
||||||
// X 方向线速度,单位:m/s。
|
|
||||||
double vx = 1;
|
double vx = 1;
|
||||||
// Y 方向线速度,单位:m/s。
|
|
||||||
double vy = 2;
|
double vy = 2;
|
||||||
// Z 方向线速度,单位:m/s。
|
|
||||||
double vz = 3;
|
double vz = 3;
|
||||||
// 绕 X 轴角速度,单位:rad/s。
|
|
||||||
double wx = 4;
|
double wx = 4;
|
||||||
// 绕 Y 轴角速度,单位:rad/s。
|
|
||||||
double wy = 5;
|
double wy = 5;
|
||||||
// 绕 Z 轴角速度,单位:rad/s。
|
|
||||||
double wz = 6;
|
double wz = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,296 +87,106 @@ message CartesianWrench {
|
|||||||
double tz = 6;
|
double tz = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4x4 齐次变换矩阵;前三列为无量纲旋转矩阵,第四列前三项为平移量(m)。
|
|
||||||
message TransformMatrix4x4 {
|
message TransformMatrix4x4 {
|
||||||
// 第一行:m00~m02 无单位,m03 单位为 m。
|
|
||||||
double m00 = 1; double m01 = 2; double m02 = 3; double m03 = 4;
|
double m00 = 1; double m01 = 2; double m02 = 3; double m03 = 4;
|
||||||
// 第二行:m10~m12 无单位,m13 单位为 m。
|
|
||||||
double m10 = 5; double m11 = 6; double m12 = 7; double m13 = 8;
|
double m10 = 5; double m11 = 6; double m12 = 7; double m13 = 8;
|
||||||
// 第三行:m20~m22 无单位,m23 单位为 m。
|
|
||||||
double m20 = 9; double m21 = 10; double m22 = 11; double m23 = 12;
|
double m20 = 9; double m21 = 10; double m22 = 11; double m23 = 12;
|
||||||
// 齐次矩阵最后一行,均无单位,通常为 [0, 0, 0, 1]。
|
|
||||||
double m30 = 13; double m31 = 14; double m32 = 15; double m33 = 16;
|
double m30 = 13; double m31 = 14; double m32 = 15; double m33 = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关节空间点到点运动命令。
|
|
||||||
message MoveJ {
|
message MoveJ {
|
||||||
// MoveJ 请求。
|
|
||||||
message Request {
|
message Request {
|
||||||
// 通用请求头,包含目标设备 ID 和请求时间戳。
|
|
||||||
CommandHeader.Request header = 1;
|
CommandHeader.Request header = 1;
|
||||||
// 关节目标位置,单位:rad。
|
|
||||||
JointPositionCommand target = 2;
|
JointPositionCommand target = 2;
|
||||||
// 运动参数;速度/加速度/加加速度单位分别为 rad/s、rad/s^2、rad/s^3。
|
|
||||||
MotionOptions options = 3;
|
MotionOptions options = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MoveJ 执行结果。
|
|
||||||
message Response {
|
message Response {
|
||||||
// 通用响应头,包含成功标志、错误信息和响应时间戳。
|
|
||||||
CommandHeader.Feedback header = 1;
|
CommandHeader.Feedback header = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TCP 笛卡尔直线运动命令。
|
|
||||||
// 服务端持久化记录。名称仅用于服务端查找,不是示教器命名坐标系。
|
|
||||||
message CoordinateCalibrationPoint {
|
|
||||||
// Actual TCP pose in Base, m/rad. Three points: origin, +X, XY plane (+Y).
|
|
||||||
CartesianPose base_tcp_pose = 1;
|
|
||||||
}
|
|
||||||
message UserCoordinateSystem {
|
|
||||||
// 内置记录标识:__builtin_base__(基座)、__builtin_tool__(工具)。
|
|
||||||
// List/Get 默认提供,revision 固定为 1;禁止 Create/Update/Delete。
|
|
||||||
// 内置记录的 user_pose/tcp_offset 全零仅作协议占位,不是实际 TCP 回读。
|
|
||||||
// Apply 保留当前 TCP 偏移。基座模式使用Base绝对目标;工具模式固定
|
|
||||||
// Apply时的实际TCP为参考,后续MoveL使用相对该固定参考的绝对目标,不累加。
|
|
||||||
string name = 1;
|
|
||||||
// 服务端 SDK 三点标定结果 T_base_user,[x,y,z,rx,ry,rz],m/rad,RzRyRx。
|
|
||||||
// Create/Update 不采用客户端提供的该字段,只采用 calibration_points 重新计算。
|
|
||||||
repeated double user_pose = 2;
|
|
||||||
// T_flange_tcp,维度、单位及姿态约定同上。
|
|
||||||
repeated double tcp_offset = 3;
|
|
||||||
// 由服务端分配,创建后单调递增;客户端不能自行设置版本。
|
|
||||||
uint64 revision = 4;
|
|
||||||
// Required for custom Create/Update; user_pose is computed by server, never trusted as input.
|
|
||||||
repeated CoordinateCalibrationPoint calibration_points = 5;
|
|
||||||
uint32 calibration_version = 6;
|
|
||||||
}
|
|
||||||
message UserCoordinateSystemCommand {
|
|
||||||
message Request {
|
|
||||||
CommandHeader.Request header = 1;
|
|
||||||
// Create/Update 使用 coordinate;名称不变,修改名称请新建后删除原记录。
|
|
||||||
UserCoordinateSystem coordinate = 2;
|
|
||||||
// Get/Delete/Apply 使用 name;List 不需要名称。
|
|
||||||
string name = 3;
|
|
||||||
// Update/Delete 必须等于当前版本;Apply 为 0 时使用最新版本。
|
|
||||||
uint64 expected_revision = 4;
|
|
||||||
}
|
|
||||||
message Response {
|
|
||||||
CommandHeader.Feedback header = 1;
|
|
||||||
// Create/Get/Update/Delete/Apply 返回处理的记录。
|
|
||||||
UserCoordinateSystem coordinate = 2;
|
|
||||||
// List 返回所有记录;查询和 CRUD 不设置控制器、不运动。
|
|
||||||
repeated UserCoordinateSystem coordinates = 3;
|
|
||||||
// Apply 成功后实际回读的 TCP。工件坐标没有完整回读接口,SDK成功码并非持久化证明。
|
|
||||||
repeated double actual_tcp_offset = 4;
|
|
||||||
bool work_object_acknowledged = 5;
|
|
||||||
// 本服务本次运行中最后成功应用的记录;不是 SDK 工件坐标实时回读。
|
|
||||||
string last_applied_name = 6;
|
|
||||||
uint64 last_applied_revision = 7;
|
|
||||||
bool application_known = 8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
message MoveL {
|
message MoveL {
|
||||||
// MoveL 请求。
|
|
||||||
message Request {
|
message Request {
|
||||||
// 通用请求头,包含目标设备 ID 和请求时间戳。
|
|
||||||
CommandHeader.Request header = 1;
|
CommandHeader.Request header = 1;
|
||||||
// 所选坐标系下的完整绝对TCP目标位姿:位置m、姿态rad(RzRyRx)。
|
|
||||||
// XYZ/RX/RY/RZ均为目标值,不是增量。重复同一目标不会累加移动。
|
|
||||||
CartesianPose target = 2;
|
CartesianPose target = 2;
|
||||||
// 运动参数;速度/加速度/加加速度单位分别为 m/s、m/s^2、m/s^3。
|
|
||||||
MotionOptions options = 3;
|
MotionOptions options = 3;
|
||||||
// 未指定命名坐标系时使用的参考坐标系,无单位。
|
|
||||||
ArmFrameType frame = 4;
|
ArmFrameType frame = 4;
|
||||||
// 可选基准坐标系名称,无单位;不传或为空时使用驱动配置的默认基准坐标系。
|
|
||||||
optional string base_frame = 5;
|
optional string base_frame = 5;
|
||||||
// 可选 TCP 坐标系名称,无单位;不传或为空时使用驱动配置的默认 TCP 坐标系。
|
|
||||||
optional string tcp_frame = 6;
|
optional string tcp_frame = 6;
|
||||||
// AUBO explicit host-managed user frame T_base_user, [x,y,z,rx,ry,rz], m/rad.
|
|
||||||
// Both vectors must contain six finite values; cannot combine with named frames.
|
|
||||||
// Compatibility path: configures SDK setWorkObjectData, not pendant persistence.
|
|
||||||
// Prefer server CRUD + ApplyUserCoordinateSystem for named managed records.
|
|
||||||
repeated double user_frame_pose = 7;
|
|
||||||
// T_flange_tcp, [x,y,z,rx,ry,rz], m/rad. Required together with user_frame_pose.
|
|
||||||
repeated double tcp_offset = 8;
|
|
||||||
// 校验当前已应用的服务端坐标系名称,不自动切换;请先调用 ApplyUserCoordinateSystem。
|
|
||||||
// 不传时沿用服务端当前已应用记录;不能与显式位姿或命名世界坐标系同时传入。
|
|
||||||
string user_coordinate_name = 9;
|
|
||||||
// 所选记录的版本号,非零时拒绝执行已被修改的记录。
|
|
||||||
uint64 user_coordinate_revision = 10;
|
|
||||||
// Deprecated increment mode. Must be false or omitted; true returns UNIMPLEMENTED.
|
|
||||||
// Check get_active_tcp_offset.coordinate_api_version >= 4 and
|
|
||||||
// movel_target_mode == "absolute_selected_frame" before using this contract.
|
|
||||||
bool coordinate_relative_translation = 11 [deprecated = true];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MoveL 执行结果。
|
|
||||||
message Response {
|
message Response {
|
||||||
// 通用响应头,包含成功标志、错误信息和响应时间戳。
|
|
||||||
CommandHeader.Feedback header = 1;
|
CommandHeader.Feedback header = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询机械臂可用坐标系名称。
|
|
||||||
message ListFrame {
|
message ListFrame {
|
||||||
// 坐标系列表查询请求。
|
|
||||||
message Request {
|
message Request {
|
||||||
// 通用请求头,包含目标设备 ID 和请求时间戳。
|
|
||||||
CommandHeader.Request header = 1;
|
CommandHeader.Request header = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 坐标系列表查询结果。
|
|
||||||
message Response {
|
message Response {
|
||||||
// 通用响应头,包含成功标志、错误信息和响应时间戳。
|
|
||||||
CommandHeader.Feedback header = 1;
|
CommandHeader.Feedback header = 1;
|
||||||
// 可选坐标系名称列表,无单位。
|
|
||||||
repeated string frame_names = 2;
|
repeated string frame_names = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关节速度运动命令。
|
|
||||||
message SpeedJ {
|
message SpeedJ {
|
||||||
// SpeedJ 请求。
|
|
||||||
message Request {
|
message Request {
|
||||||
// 通用请求头,包含目标设备 ID 和请求时间戳。
|
|
||||||
CommandHeader.Request header = 1;
|
CommandHeader.Request header = 1;
|
||||||
// 各关节目标角速度,单位:rad/s。
|
|
||||||
JointVelocityCommand velocity = 2;
|
JointVelocityCommand velocity = 2;
|
||||||
// 关节角加速度,单位:rad/s^2。
|
|
||||||
double acceleration = 3;
|
double acceleration = 3;
|
||||||
// 速度命令持续时间,单位:s;具体停止语义由机械臂驱动实现。
|
|
||||||
double duration = 4;
|
double duration = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SpeedJ 执行结果。
|
|
||||||
message Response {
|
message Response {
|
||||||
// 通用响应头,包含成功标志、错误信息和响应时间戳。
|
|
||||||
CommandHeader.Feedback header = 1;
|
CommandHeader.Feedback header = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TCP 笛卡尔速度运动命令。
|
|
||||||
message SpeedL {
|
message SpeedL {
|
||||||
// SpeedL 请求。
|
|
||||||
message Request {
|
message Request {
|
||||||
// 通用请求头,包含目标设备 ID 和请求时间戳。
|
|
||||||
CommandHeader.Request header = 1;
|
CommandHeader.Request header = 1;
|
||||||
// TCP 目标速度;线速度单位为 m/s,角速度单位为 rad/s。
|
|
||||||
CartesianVelocity velocity = 2;
|
CartesianVelocity velocity = 2;
|
||||||
// TCP 线加速度,单位:m/s^2。
|
|
||||||
double acceleration = 3;
|
double acceleration = 3;
|
||||||
// 速度命令持续时间,单位:s;具体停止语义由机械臂驱动实现。
|
|
||||||
double duration = 4;
|
double duration = 4;
|
||||||
// 速度向量所在的参考坐标系,无单位。
|
|
||||||
ArmFrameType frame = 5;
|
ArmFrameType frame = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SpeedL 执行结果。
|
|
||||||
message Response {
|
message Response {
|
||||||
// 通用响应头,包含成功标志、错误信息和响应时间戳。
|
|
||||||
CommandHeader.Feedback header = 1;
|
CommandHeader.Feedback header = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 关节位置实时伺服命令。
|
|
||||||
message ServoJ {
|
message ServoJ {
|
||||||
// ServoJ 请求。
|
|
||||||
message Request {
|
message Request {
|
||||||
// 通用请求头,包含目标设备 ID 和请求时间戳。
|
|
||||||
CommandHeader.Request header = 1;
|
CommandHeader.Request header = 1;
|
||||||
// 本周期各关节目标角度,单位:rad。
|
|
||||||
JointPositionCommand target = 2;
|
JointPositionCommand target = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ServoJ 执行结果。
|
|
||||||
message Response {
|
|
||||||
// 通用响应头,包含成功标志、错误信息和响应时间戳。
|
|
||||||
CommandHeader.Feedback header = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 开始记录实际关节轨迹,CSV 保存在服务端程序目录 data/trajectories/<device_id>。
|
|
||||||
message StartTrajectoryRecording {
|
|
||||||
message Request {
|
|
||||||
// 通用请求头,包含目标设备 ID 和请求时间戳。
|
|
||||||
CommandHeader.Request header = 1;
|
|
||||||
// 不含目录的文件名;不覆盖已有文件,自动补充 .csv。
|
|
||||||
string file_name = 2;
|
|
||||||
// 实际关节采样频率 Hz;0 使用 100,支持 1~100。
|
|
||||||
double sampling_frequency_hz = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Response {
|
|
||||||
// 通用响应头,包含成功标志、错误信息和响应时间戳。
|
|
||||||
CommandHeader.Feedback header = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 已完成且通过校验的 CSV;不包含录制中的 .partial 文件。
|
|
||||||
message RecordedTrajectory {
|
|
||||||
string file_name = 1;
|
|
||||||
uint64 samples = 2;
|
|
||||||
double duration_s = 3;
|
|
||||||
double sampling_frequency_hz = 4;
|
|
||||||
}
|
|
||||||
message ListRecordedTrajectories {
|
|
||||||
message Request { CommandHeader.Request header = 1; }
|
|
||||||
message Response {
|
message Response {
|
||||||
CommandHeader.Feedback header = 1;
|
CommandHeader.Feedback header = 1;
|
||||||
repeated RecordedTrajectory trajectories = 2;
|
|
||||||
string directory = 3;
|
|
||||||
bool recording = 4;
|
|
||||||
string recording_file = 5;
|
|
||||||
uint64 recorded_samples = 6;
|
|
||||||
string recording_error = 7;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
message ReplayRecordedTrajectory {
|
|
||||||
message Request {
|
|
||||||
CommandHeader.Request header = 1;
|
|
||||||
string file_name = 2;
|
|
||||||
// 0 使用原速;支持 0.1~1,只允许降速。
|
|
||||||
double speed_ratio = 3;
|
|
||||||
// 平滑限值;0 使用默认值 0.3 rad/s、0.5 rad/s²、2 rad/s³。
|
|
||||||
// 回放经 BSplineSmoother 重新定时,可能偏离原始中间点;首尾保持不变。
|
|
||||||
double max_velocity = 4;
|
|
||||||
double max_acceleration = 5;
|
|
||||||
double max_jerk = 6;
|
|
||||||
}
|
|
||||||
message Response { CommandHeader.Feedback header = 1; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// 机械臂关节状态。
|
|
||||||
message JointState {
|
message JointState {
|
||||||
// 关节名称列表,无单位;与 position、velocity、effort 按索引对应。
|
|
||||||
repeated string name = 1;
|
repeated string name = 1;
|
||||||
// 关节实际角度,单位:rad。
|
|
||||||
repeated double position = 2;
|
repeated double position = 2;
|
||||||
// 关节实际角速度,单位:rad/s。
|
|
||||||
repeated double velocity = 3;
|
repeated double velocity = 3;
|
||||||
// 关节实际力矩,单位:N·m。
|
|
||||||
repeated double effort = 4;
|
repeated double effort = 4;
|
||||||
// 状态采样的 Unix 时间戳,单位:s。
|
|
||||||
double timestamp = 5;
|
double timestamp = 5;
|
||||||
// 电机实际电流,单位:mA。
|
|
||||||
repeated double current = 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询关节状态的请求。
|
|
||||||
message JointRequest {
|
message JointRequest {
|
||||||
// 通用请求头,包含目标设备 ID 和请求时间戳。
|
|
||||||
CommandHeader.Request header = 1;
|
CommandHeader.Request header = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询关节状态的响应。
|
|
||||||
message JointResponse {
|
message JointResponse {
|
||||||
// 通用响应头,包含成功标志、错误信息和响应时间戳。
|
|
||||||
CommandHeader.Feedback header = 1;
|
CommandHeader.Feedback header = 1;
|
||||||
// 当前关节状态。
|
|
||||||
JointState state = 2;
|
JointState state = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 机械臂静态能力与 SDK 自动识别信息。
|
|
||||||
// Per-joint position limits, matched by name; radians. Missing/invalid limits are not zero limits.
|
|
||||||
message ArmJointLimit {
|
|
||||||
string joint_name = 1;
|
|
||||||
bool position_limits_available = 2;
|
|
||||||
double lower = 3;
|
|
||||||
double upper = 4;
|
|
||||||
// aubo_sdk: controller readback; driver_model: driver model/configuration/URDF, not hardware readback.
|
|
||||||
string source = 5;
|
|
||||||
}
|
|
||||||
message GetArmInfo {
|
message GetArmInfo {
|
||||||
message Request {
|
message Request {
|
||||||
CommandHeader.Request header = 1;
|
CommandHeader.Request header = 1;
|
||||||
@ -425,7 +205,6 @@ message GetArmInfo {
|
|||||||
string description_id = 10;
|
string description_id = 10;
|
||||||
bool detected_from_sdk = 11;
|
bool detected_from_sdk = 11;
|
||||||
string driver_type = 12;
|
string driver_type = 12;
|
||||||
repeated ArmJointLimit joint_limits = 13;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -461,91 +240,53 @@ message GetRobotState {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询 TCP 位姿。
|
|
||||||
message GetPose {
|
message GetPose {
|
||||||
// 位姿查询请求。
|
|
||||||
message Request {
|
message Request {
|
||||||
// 通用请求头,包含目标设备 ID 和请求时间戳。
|
|
||||||
CommandHeader.Request header = 1;
|
CommandHeader.Request header = 1;
|
||||||
// 参考坐标系名称。遨博支持空/base/__builtin_base__(基座)、已保存的自定义坐标系名称,
|
|
||||||
// 以及 __builtin_tool__(必须先 Apply,使用 Apply 时冻结的工具参考系)。
|
|
||||||
// 自定义系按服务端当前保存的定义转换实际反馈;查询不切换当前应用,不触发运动。
|
|
||||||
string base_link = 2;
|
string base_link = 2;
|
||||||
// 末端坐标系名称,无单位;为空时使用驱动默认 TCP 坐标系。
|
|
||||||
string ee_link = 3;
|
string ee_link = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 位姿查询结果。
|
|
||||||
message Response {
|
message Response {
|
||||||
// 通用响应头,包含成功标志、错误信息和响应时间戳。
|
|
||||||
CommandHeader.Feedback header = 1;
|
CommandHeader.Feedback header = 1;
|
||||||
// TCP 位姿;位置单位为 m,姿态单位为 rad。
|
|
||||||
CartesianPose pose = 2;
|
CartesianPose pose = 2;
|
||||||
// 实际返回位姿的参考坐标系:base 或请求的已保存坐标系名称。
|
|
||||||
// SDK 原生反馈始终在 Base 下;请求自定义系时由服务端使用 SDK Math 转换。
|
|
||||||
string reference_frame = 3;
|
|
||||||
// 实际返回的末端:tcp 为当前工具中心点,flange 为法兰。
|
|
||||||
string end_frame = 4;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 指定关节的零位标定命令。
|
|
||||||
message CalibrateZeroQ {
|
message CalibrateZeroQ {
|
||||||
// 零位标定请求。
|
|
||||||
message Request {
|
message Request {
|
||||||
// 通用请求头,包含目标设备 ID 和请求时间戳。
|
|
||||||
CommandHeader.Request header = 1;
|
CommandHeader.Request header = 1;
|
||||||
// 待标定关节名称,无单位。
|
|
||||||
string joint_name = 2;
|
string joint_name = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 零位标定结果。
|
|
||||||
message Response {
|
message Response {
|
||||||
// 通用响应头,包含成功标志、错误信息和响应时间戳。
|
|
||||||
CommandHeader.Feedback header = 1;
|
CommandHeader.Feedback header = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询两个坐标系之间的齐次变换矩阵。
|
|
||||||
message GetPoseMatrix {
|
message GetPoseMatrix {
|
||||||
// 变换矩阵查询请求。
|
|
||||||
message Request {
|
message Request {
|
||||||
// 通用请求头,包含目标设备 ID 和请求时间戳。
|
|
||||||
CommandHeader.Request header = 1;
|
CommandHeader.Request header = 1;
|
||||||
// 参考坐标系名称,无单位。
|
|
||||||
string base_link = 2;
|
string base_link = 2;
|
||||||
// 目标末端坐标系名称,无单位。
|
|
||||||
string ee_link = 3;
|
string ee_link = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 变换矩阵查询结果。
|
|
||||||
message Response {
|
message Response {
|
||||||
// 通用响应头,包含成功标志、错误信息和响应时间戳。
|
|
||||||
CommandHeader.Feedback header = 1;
|
CommandHeader.Feedback header = 1;
|
||||||
// 齐次变换矩阵;旋转元素无单位,平移元素单位为 m。
|
|
||||||
TransformMatrix4x4 matrix = 2;
|
TransformMatrix4x4 matrix = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 根据关节角计算正运动学变换矩阵。
|
|
||||||
message ComputeForwardKinematics {
|
message ComputeForwardKinematics {
|
||||||
// 正运动学计算请求。
|
|
||||||
message Request {
|
message Request {
|
||||||
// 通用请求头,包含目标设备 ID 和请求时间戳。
|
|
||||||
CommandHeader.Request header = 1;
|
CommandHeader.Request header = 1;
|
||||||
// 参考坐标系名称,无单位。
|
|
||||||
string base_link = 2;
|
string base_link = 2;
|
||||||
// 目标末端坐标系名称,无单位。
|
|
||||||
string ee_link = 3;
|
string ee_link = 3;
|
||||||
// 用于计算的关节角,单位:rad。
|
|
||||||
JointPositionCommand joints = 4;
|
JointPositionCommand joints = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 正运动学计算结果。
|
|
||||||
message Response {
|
message Response {
|
||||||
// 通用响应头,包含成功标志、错误信息和响应时间戳。
|
|
||||||
CommandHeader.Feedback header = 1;
|
CommandHeader.Feedback header = 1;
|
||||||
// 齐次变换矩阵;旋转元素无单位,平移元素单位为 m。
|
|
||||||
TransformMatrix4x4 matrix = 2;
|
TransformMatrix4x4 matrix = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,72 +5,26 @@ package cmvr.api;
|
|||||||
import "cmvr/api/common.proto";
|
import "cmvr/api/common.proto";
|
||||||
import "cmvr/api/arm_command.proto";
|
import "cmvr/api/arm_command.proto";
|
||||||
|
|
||||||
// 机械臂控制服务。除特别说明外,所有接口通过请求头中的 device_id 选择机械臂。
|
|
||||||
service ArmService {
|
service ArmService {
|
||||||
// 机械臂下电/去使能;不包含数值参数,无单位。
|
|
||||||
rpc torqueOff(CommandHeader.Request) returns (CommandHeader.Feedback);
|
rpc torqueOff(CommandHeader.Request) returns (CommandHeader.Feedback);
|
||||||
// 机械臂上电并使能;不包含数值参数,无单位。
|
|
||||||
rpc torqueOn(CommandHeader.Request) returns (CommandHeader.Feedback);
|
rpc torqueOn(CommandHeader.Request) returns (CommandHeader.Feedback);
|
||||||
// 清除机械臂可恢复故障;不包含数值参数,无单位。
|
|
||||||
rpc clearFault(CommandHeader.Request) returns (CommandHeader.Feedback);
|
rpc clearFault(CommandHeader.Request) returns (CommandHeader.Feedback);
|
||||||
// 执行关节空间点到点运动;目标角度单位为 rad。
|
|
||||||
rpc moveJ(MoveJ.Request) returns (MoveJ.Response);
|
rpc moveJ(MoveJ.Request) returns (MoveJ.Response);
|
||||||
// 执行所选坐标系下的绝对TCP目标直线运动,位置m、姿态rad;不接受增量目标。
|
|
||||||
rpc moveL(MoveL.Request) returns (MoveL.Response);
|
rpc moveL(MoveL.Request) returns (MoveL.Response);
|
||||||
// 查询可用基准坐标系名称;返回名称列表,无单位。
|
|
||||||
rpc ListBaseFrame(ListFrame.Request) returns (ListFrame.Response);
|
rpc ListBaseFrame(ListFrame.Request) returns (ListFrame.Response);
|
||||||
// 查询可用 TCP 坐标系名称;返回名称列表,无单位。
|
|
||||||
rpc ListTCPFrame(ListFrame.Request) returns (ListFrame.Response);
|
rpc ListTCPFrame(ListFrame.Request) returns (ListFrame.Response);
|
||||||
// 执行关节速度运动;角速度单位为 rad/s,加速度单位为 rad/s^2。
|
|
||||||
rpc speedJ(SpeedJ.Request) returns (SpeedJ.Response);
|
rpc speedJ(SpeedJ.Request) returns (SpeedJ.Response);
|
||||||
// 执行 TCP 速度运动;线速度单位为 m/s,角速度单位为 rad/s。
|
|
||||||
rpc speedL(SpeedL.Request) returns (SpeedL.Response);
|
rpc speedL(SpeedL.Request) returns (SpeedL.Response);
|
||||||
// 下发单周期关节位置伺服目标;目标角度单位为 rad。
|
|
||||||
rpc servoJ(ServoJ.Request) returns (ServoJ.Response);
|
rpc servoJ(ServoJ.Request) returns (ServoJ.Response);
|
||||||
// 停止当前机械臂运动;不包含数值参数,无单位。
|
|
||||||
rpc stopMotion(CommandHeader.Request) returns (CommandHeader.Feedback);
|
rpc stopMotion(CommandHeader.Request) returns (CommandHeader.Feedback);
|
||||||
// 查询机械臂 SDK 自动识别的型号、自由度、关节名及默认坐标系。
|
|
||||||
rpc GetArmInfo(GetArmInfo.Request) returns (GetArmInfo.Response);
|
rpc GetArmInfo(GetArmInfo.Request) returns (GetArmInfo.Response);
|
||||||
// 读取关节状态;角度 rad、角速度 rad/s、力矩 N·m。
|
|
||||||
rpc getJointState(JointRequest) returns (JointResponse);
|
rpc getJointState(JointRequest) returns (JointResponse);
|
||||||
// 一次性读取完整机械臂运行状态、关节状态及 TCP 位姿。
|
|
||||||
rpc getRobotState(GetRobotState.Request) returns (GetRobotState.Response);
|
rpc getRobotState(GetRobotState.Request) returns (GetRobotState.Response);
|
||||||
// 读取 TCP 位姿;位置单位为 m,姿态单位为 rad。
|
|
||||||
rpc getPose(GetPose.Request) returns (GetPose.Response);
|
rpc getPose(GetPose.Request) returns (GetPose.Response);
|
||||||
// 对指定关节执行零位标定;关节名称无单位。
|
|
||||||
rpc calibrateZeroQ(CalibrateZeroQ.Request) returns (CalibrateZeroQ.Response);
|
rpc calibrateZeroQ(CalibrateZeroQ.Request) returns (CalibrateZeroQ.Response);
|
||||||
// 查询两个坐标系之间的齐次变换矩阵;平移元素单位为 m。
|
|
||||||
rpc getPoseMatrix(GetPoseMatrix.Request) returns (GetPoseMatrix.Response);
|
rpc getPoseMatrix(GetPoseMatrix.Request) returns (GetPoseMatrix.Response);
|
||||||
// 根据关节角计算正运动学矩阵;输入角度 rad,输出平移元素 m。
|
|
||||||
rpc computeForwardKinematics(ComputeForwardKinematics.Request) returns (ComputeForwardKinematics.Response);
|
rpc computeForwardKinematics(ComputeForwardKinematics.Request) returns (ComputeForwardKinematics.Response);
|
||||||
// 执行机械臂厂商扩展 JSON 命令;当前用于 AUBO 控制柜 Standard DI/DO。
|
|
||||||
|
// Vendor-specific arm extension currently used for AUBO cabinet IO.
|
||||||
rpc ExecuteJsonCommand(JsonDeviceCommand.Request) returns (JsonDeviceCommand.Feedback);
|
rpc ExecuteJsonCommand(JsonDeviceCommand.Request) returns (JsonDeviceCommand.Feedback);
|
||||||
// 进入拖动示教模式;仅支持具备该能力的机械臂。
|
|
||||||
rpc EnterTeachingMode(CommandHeader.Request) returns (CommandHeader.Feedback);
|
|
||||||
// 开始记录实际关节轨迹到服务端 CSV。
|
|
||||||
rpc StartTrajectoryRecording(StartTrajectoryRecording.Request) returns (StartTrajectoryRecording.Response);
|
|
||||||
// 完成示教:停止轨迹记录并退出拖动示教模式。
|
|
||||||
rpc CompleteTeaching(CommandHeader.Request) returns (CommandHeader.Feedback);
|
|
||||||
// 单独停止轨迹记录,不退出拖动示教模式。
|
|
||||||
rpc StopTrajectoryRecording(CommandHeader.Request) returns (CommandHeader.Feedback);
|
|
||||||
// 单独退出拖动示教模式,不停止轨迹记录。
|
|
||||||
rpc ExitTeachingMode(CommandHeader.Request) returns (CommandHeader.Feedback);
|
|
||||||
// 查询 CSV 轨迹及当前录制状态,不启动采样或运动。
|
|
||||||
rpc ListRecordedTrajectories(ListRecordedTrajectories.Request) returns (ListRecordedTrajectories.Response);
|
|
||||||
// 按请求的速度、加速度、加加速度限值平滑运动到轨迹起点;必须退出示教且已使能。
|
|
||||||
rpc MoveToTrajectoryStart(ReplayRecordedTrajectory.Request) returns (ReplayRecordedTrajectory.Response);
|
|
||||||
// 同步回放;必须先到达起点,结束后返回。取消请求会停止运动。
|
|
||||||
rpc ReplayRecordedTrajectory(ReplayRecordedTrajectory.Request) returns (ReplayRecordedTrajectory.Response);
|
|
||||||
// 以下记录保存在服务端程序目录 data/user_coordinates/<device_id>/coordinates.json。
|
|
||||||
// Three-point SDK calibration only; no persistence, TCP write or movement.
|
|
||||||
rpc CalibrateUserCoordinateSystem(UserCoordinateSystemCommand.Request) returns (UserCoordinateSystemCommand.Response);
|
|
||||||
rpc CreateUserCoordinateSystem(UserCoordinateSystemCommand.Request) returns (UserCoordinateSystemCommand.Response);
|
|
||||||
rpc GetUserCoordinateSystem(UserCoordinateSystemCommand.Request) returns (UserCoordinateSystemCommand.Response);
|
|
||||||
rpc ListUserCoordinateSystems(UserCoordinateSystemCommand.Request) returns (UserCoordinateSystemCommand.Response);
|
|
||||||
rpc UpdateUserCoordinateSystem(UserCoordinateSystemCommand.Request) returns (UserCoordinateSystemCommand.Response);
|
|
||||||
rpc DeleteUserCoordinateSystem(UserCoordinateSystemCommand.Request) returns (UserCoordinateSystemCommand.Response);
|
|
||||||
// 实际调用 setWorkObjectData + setTcpOffset,并在服务端记住当前选择。
|
|
||||||
// MoveL 通过 SDK Math 将所选工件系目标转换至 Base;提交前中和原生 WorkObject,避免重复变换。
|
|
||||||
// 不运动、不写示教器命名配置库;SDK 工件系无完整回读,重连/服务重启后应重新应用。
|
|
||||||
rpc ApplyUserCoordinateSystem(UserCoordinateSystemCommand.Request) returns (UserCoordinateSystemCommand.Response);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,29 +2,9 @@ syntax = "proto3";
|
|||||||
|
|
||||||
package cmvr.api;
|
package cmvr.api;
|
||||||
import "cmvr/api/biohead_command.proto";
|
import "cmvr/api/biohead_command.proto";
|
||||||
import "cmvr/api/head_joint_command.proto";
|
|
||||||
|
|
||||||
// 生物头部机器人服务接口
|
// 生物头部机器人服务接口
|
||||||
service BioHeadService {
|
service BioHeadService {
|
||||||
|
|
||||||
// USB 头部关节控制。
|
|
||||||
rpc ControlHeadJoints(HeadJointCommand.Request)
|
|
||||||
returns (HeadJointCommand.Feedback);
|
|
||||||
|
|
||||||
// 查询 USB 头部的配置、连接和命令目标缓存。
|
|
||||||
rpc GetHeadJointState(GetHeadJointStateCommand.Request)
|
|
||||||
returns (GetHeadJointStateCommand.Feedback);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Complete five-joint expression transition, with per-frame cancellation.
|
|
||||||
rpc SetHeadExpression(SetHeadExpressionCommand.Request)
|
|
||||||
returns (SetHeadExpressionCommand.Feedback);
|
|
||||||
|
|
||||||
// Play one configured preset by exact ID or exact name.
|
|
||||||
rpc PlayHeadExpression(PlayHeadExpressionCommand.Request)
|
|
||||||
returns (PlayHeadExpressionCommand.Feedback);
|
|
||||||
|
|
||||||
// 设置面部表情
|
// 设置面部表情
|
||||||
rpc SetExpression(SetFacialExpression.Request) returns (SetFacialExpression.Feedback){};
|
rpc SetExpression(SetFacialExpression.Request) returns (SetFacialExpression.Feedback){};
|
||||||
|
|
||||||
@ -57,4 +37,11 @@ service BioHeadService {
|
|||||||
|
|
||||||
rpc ExpressionYawn(ExpressionYawn.Request) returns (ExpressionYawn.Feedback){};
|
rpc ExpressionYawn(ExpressionYawn.Request) returns (ExpressionYawn.Feedback){};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -38,24 +38,6 @@ message CameraIntrinsics {
|
|||||||
repeated float coeffs = 5 [packed = true]; // 畸变系数(固定5个元素)
|
repeated float coeffs = 5 [packed = true]; // 畸变系数(固定5个元素)
|
||||||
}
|
}
|
||||||
|
|
||||||
message CameraCapabilities {
|
|
||||||
uint32 version = 1;
|
|
||||||
string driver = 2;
|
|
||||||
string model = 3;
|
|
||||||
string serial = 4;
|
|
||||||
string transport = 5;
|
|
||||||
bool raw_image = 6;
|
|
||||||
bool valid_intrinsics = 7;
|
|
||||||
bool capture_timestamp = 8;
|
|
||||||
bool metric_aligned_depth = 9;
|
|
||||||
string distortion_model = 10;
|
|
||||||
uint64 session_generation = 11;
|
|
||||||
string unavailable_reason = 12;
|
|
||||||
string intrinsics_signature = 13;
|
|
||||||
bool depth_image = 14;
|
|
||||||
bool depth_stream = 15;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CameraState {
|
message CameraState {
|
||||||
bool is_initialized = 1;
|
bool is_initialized = 1;
|
||||||
bool is_opened = 2;
|
bool is_opened = 2;
|
||||||
@ -66,8 +48,6 @@ message CameraState {
|
|||||||
int32 fps = 7;
|
int32 fps = 7;
|
||||||
int32 width = 8;
|
int32 width = 8;
|
||||||
int32 height = 9;
|
int32 height = 9;
|
||||||
string codec = 10;
|
|
||||||
CameraCapabilities capabilities = 11;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetCameraStateCommand {
|
message GetCameraStateCommand {
|
||||||
|
|||||||
@ -4,6 +4,59 @@ package cmvr.api;
|
|||||||
|
|
||||||
import "google/protobuf/timestamp.proto";
|
import "google/protobuf/timestamp.proto";
|
||||||
|
|
||||||
|
enum CommandReasonCode {
|
||||||
|
COMMAND_REASON_CODE_UNSPECIFIED = 0;
|
||||||
|
COMMAND_REASON_CODE_NONE = 1;
|
||||||
|
COMMAND_REASON_CODE_INVALID_ARGUMENT = 2;
|
||||||
|
COMMAND_REASON_CODE_UNAUTHENTICATED = 3;
|
||||||
|
COMMAND_REASON_CODE_PERMISSION_DENIED = 4;
|
||||||
|
COMMAND_REASON_CODE_RECOVERY_RPC_DISABLED = 5;
|
||||||
|
COMMAND_REASON_CODE_DEVICE_NOT_FOUND = 6;
|
||||||
|
COMMAND_REASON_CODE_DEVICE_UNAVAILABLE = 7;
|
||||||
|
COMMAND_REASON_CODE_UNSUPPORTED_COMMAND = 8;
|
||||||
|
COMMAND_REASON_CODE_SYSTEM_STARTING = 9;
|
||||||
|
COMMAND_REASON_CODE_SYSTEM_STOPPING = 10;
|
||||||
|
COMMAND_REASON_CODE_SAFETY_LATCHED = 11;
|
||||||
|
COMMAND_REASON_CODE_SAFETY_STATE_MISSING = 12;
|
||||||
|
COMMAND_REASON_CODE_SAFETY_STATE_STALE = 13;
|
||||||
|
COMMAND_REASON_CODE_HARDWARE_UNSAFE = 14;
|
||||||
|
COMMAND_REASON_CODE_EMERGENCY_STOP_ACTIVE = 15;
|
||||||
|
COMMAND_REASON_CODE_PROTECTIVE_STOP_ACTIVE = 16;
|
||||||
|
COMMAND_REASON_CODE_DEVICE_DISCONNECTED = 17;
|
||||||
|
COMMAND_REASON_CODE_DEVICE_FAULT = 18;
|
||||||
|
COMMAND_REASON_CODE_DEVICE_NOT_READY = 19;
|
||||||
|
COMMAND_REASON_CODE_DEVICE_STILL_MOVING = 20;
|
||||||
|
COMMAND_REASON_CODE_CONTROL_BUSY = 21;
|
||||||
|
COMMAND_REASON_CODE_GENERATION_MISMATCH = 22;
|
||||||
|
COMMAND_REASON_CODE_COMMAND_ID_REQUIRED = 23;
|
||||||
|
COMMAND_REASON_CODE_COMMAND_ID_CONFLICT = 24;
|
||||||
|
COMMAND_REASON_CODE_RESULT_EVICTED = 25;
|
||||||
|
COMMAND_REASON_CODE_LEDGER_EXHAUSTED = 26;
|
||||||
|
COMMAND_REASON_CODE_BACKPRESSURE = 27;
|
||||||
|
COMMAND_REASON_CODE_DEADLINE_EXCEEDED_BEFORE_DISPATCH = 28;
|
||||||
|
COMMAND_REASON_CODE_OUTCOME_UNKNOWN = 29;
|
||||||
|
COMMAND_REASON_CODE_PARTICIPANT_TIMEOUT = 30;
|
||||||
|
COMMAND_REASON_CODE_STOP_UNCONFIRMED = 31;
|
||||||
|
COMMAND_REASON_CODE_RECOVERY_EPOCH_MISMATCH = 32;
|
||||||
|
COMMAND_REASON_CODE_RECOVERY_REASON_REQUIRED = 33;
|
||||||
|
COMMAND_REASON_CODE_RECOVERY_AUDIT_FAILED = 34;
|
||||||
|
COMMAND_REASON_CODE_INTERNAL_ERROR = 35;
|
||||||
|
}
|
||||||
|
|
||||||
|
enum CommandExecutionState {
|
||||||
|
COMMAND_EXECUTION_STATE_UNSPECIFIED = 0;
|
||||||
|
COMMAND_EXECUTION_STATE_RECEIVED = 1;
|
||||||
|
COMMAND_EXECUTION_STATE_RESERVED = 2;
|
||||||
|
COMMAND_EXECUTION_STATE_REJECTED_BEFORE_DISPATCH = 3;
|
||||||
|
COMMAND_EXECUTION_STATE_ADMITTED = 4;
|
||||||
|
COMMAND_EXECUTION_STATE_DISPATCHING = 5;
|
||||||
|
COMMAND_EXECUTION_STATE_ACCEPTED_BY_HARDWARE = 6;
|
||||||
|
COMMAND_EXECUTION_STATE_COMPLETED = 7;
|
||||||
|
COMMAND_EXECUTION_STATE_FAILED = 8;
|
||||||
|
COMMAND_EXECUTION_STATE_CANCELED_BEFORE_DISPATCH = 9;
|
||||||
|
COMMAND_EXECUTION_STATE_OUTCOME_UNKNOWN = 10;
|
||||||
|
}
|
||||||
|
|
||||||
message DeviceLifecycle {
|
message DeviceLifecycle {
|
||||||
enum Lifecycle {
|
enum Lifecycle {
|
||||||
STATE_INIT = 0;
|
STATE_INIT = 0;
|
||||||
@ -20,12 +73,22 @@ message CommandHeader {
|
|||||||
message Request {
|
message Request {
|
||||||
string device_id = 1; // 目标设备名称
|
string device_id = 1; // 目标设备名称
|
||||||
google.protobuf.Timestamp timestamp = 2; // 请求时间
|
google.protobuf.Timestamp timestamp = 2; // 请求时间
|
||||||
|
string command_id = 3;
|
||||||
|
string expected_service_instance_id = 4;
|
||||||
|
optional uint64 expected_device_generation = 5;
|
||||||
|
uint32 valid_for_ms = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message Feedback {
|
message Feedback {
|
||||||
bool success = 1; // 是否成功
|
bool success = 1; // 是否成功
|
||||||
string error_message = 2; // 错误信息(成功时为空)
|
string error_message = 2; // 错误信息(成功时为空)
|
||||||
google.protobuf.Timestamp timestamp = 3; // 回复时间
|
google.protobuf.Timestamp timestamp = 3; // 回复时间
|
||||||
|
CommandReasonCode reason_code = 4;
|
||||||
|
string command_id = 5;
|
||||||
|
string service_instance_id = 6;
|
||||||
|
uint64 safety_epoch = 7;
|
||||||
|
uint64 device_generation = 8;
|
||||||
|
CommandExecutionState execution_state = 9;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,21 +122,14 @@ message ConfigParam {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设备厂商扩展 JSON 命令;JSON 内容及字段单位由具体设备命令定义。
|
|
||||||
message JsonDeviceCommand {
|
message JsonDeviceCommand {
|
||||||
// JSON 命令请求。
|
|
||||||
message Request {
|
message Request {
|
||||||
// 通用请求头,包含目标设备 ID 和请求时间戳。
|
|
||||||
CommandHeader.Request header = 1;
|
CommandHeader.Request header = 1;
|
||||||
// JSON 格式的设备命令字符串,无单位。
|
|
||||||
string request_json = 2;
|
string request_json = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// JSON 命令响应。
|
|
||||||
message Feedback {
|
message Feedback {
|
||||||
// 通用响应头,包含成功标志、错误信息和响应时间戳。
|
|
||||||
CommandHeader.Feedback header = 1;
|
CommandHeader.Feedback header = 1;
|
||||||
// JSON 格式的设备响应字符串,无单位。
|
|
||||||
string response_json = 2;
|
string response_json = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
57
protos/cmvr/api/configuration_command.proto
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
import "cmvr/api/common.proto";
|
||||||
|
|
||||||
|
package cmvr.api;
|
||||||
|
|
||||||
|
message ConfigFileInfo {
|
||||||
|
string relative_path = 1;
|
||||||
|
uint64 size_bytes = 2;
|
||||||
|
int64 modified_unix_ms = 3;
|
||||||
|
string message_type = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ListConfigFilesCommand {
|
||||||
|
message Request {}
|
||||||
|
message Feedback {
|
||||||
|
CommandHeader.Feedback header = 1;
|
||||||
|
string config_root = 2;
|
||||||
|
repeated ConfigFileInfo files = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message ReadConfigFileCommand {
|
||||||
|
message Request {
|
||||||
|
string relative_path = 1;
|
||||||
|
}
|
||||||
|
message Feedback {
|
||||||
|
CommandHeader.Feedback header = 1;
|
||||||
|
ConfigFileInfo file = 2;
|
||||||
|
string content = 3;
|
||||||
|
string revision = 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message ValidateConfigFileCommand {
|
||||||
|
message Request {
|
||||||
|
string relative_path = 1;
|
||||||
|
string content = 2;
|
||||||
|
}
|
||||||
|
message Feedback {
|
||||||
|
CommandHeader.Feedback header = 1;
|
||||||
|
string message_type = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
message SaveConfigFileCommand {
|
||||||
|
message Request {
|
||||||
|
string relative_path = 1;
|
||||||
|
string content = 2;
|
||||||
|
string expected_revision = 3;
|
||||||
|
}
|
||||||
|
message Feedback {
|
||||||
|
CommandHeader.Feedback header = 1;
|
||||||
|
string revision = 2;
|
||||||
|
int64 modified_unix_ms = 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
12
protos/cmvr/api/configuration_service.proto
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
import "cmvr/api/configuration_command.proto";
|
||||||
|
|
||||||
|
package cmvr.api;
|
||||||
|
|
||||||
|
service ConfigurationService {
|
||||||
|
rpc ListConfigFiles(ListConfigFilesCommand.Request) returns (ListConfigFilesCommand.Feedback);
|
||||||
|
rpc ReadConfigFile(ReadConfigFileCommand.Request) returns (ReadConfigFileCommand.Feedback);
|
||||||
|
rpc ValidateConfigFile(ValidateConfigFileCommand.Request) returns (ValidateConfigFileCommand.Feedback);
|
||||||
|
rpc SaveConfigFile(SaveConfigFileCommand.Request) returns (SaveConfigFileCommand.Feedback);
|
||||||
|
}
|
||||||
@ -31,7 +31,6 @@ message SensorData {
|
|||||||
INDEX = 3; // 食指
|
INDEX = 3; // 食指
|
||||||
THUMB = 4; // 大拇指
|
THUMB = 4; // 大拇指
|
||||||
PALM = 5; // 掌心
|
PALM = 5; // 掌心
|
||||||
FINGER_UNSPECIFIED = 6; // 独立触觉传感器,不关联手指
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 部位类型(指中改为THUMB_MIDDLE以避免冲突)
|
// 部位类型(指中改为THUMB_MIDDLE以避免冲突)
|
||||||
@ -41,7 +40,6 @@ message SensorData {
|
|||||||
PAD = 2; // 指腹
|
PAD = 2; // 指腹
|
||||||
THUMB_MIDDLE = 3; // 大拇指指中(仅大拇指有)
|
THUMB_MIDDLE = 3; // 大拇指指中(仅大拇指有)
|
||||||
PALM_PAD = 4; // 掌心部位(对应PalmTactileData)
|
PALM_PAD = 4; // 掌心部位(对应PalmTactileData)
|
||||||
PART_UNSPECIFIED = 5; // 独立触觉传感器,不关联手指部位
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FingerType finger_type = 4; // 手指类型(掌心使用PALM)
|
FingerType finger_type = 4; // 手指类型(掌心使用PALM)
|
||||||
@ -60,8 +58,6 @@ message SensorData {
|
|||||||
message DexHandState {
|
message DexHandState {
|
||||||
bool is_initialized = 1; // 是否初始化
|
bool is_initialized = 1; // 是否初始化
|
||||||
repeated FreedomState hands = 2; // 包含多个自由度状态
|
repeated FreedomState hands = 2; // 包含多个自由度状态
|
||||||
bool has_tactile_feedback = 3; // 是否具备真实触觉传感器反馈能力
|
|
||||||
string model = 4; // 设备型号,仅作为描述信息
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetDexHandStateCommand {
|
message GetDexHandStateCommand {
|
||||||
|
|||||||
@ -1,198 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package cmvr.api;
|
|
||||||
|
|
||||||
import "cmvr/api/common.proto";
|
|
||||||
|
|
||||||
// 头部关节运动模式。
|
|
||||||
enum HeadJointMotionMode {
|
|
||||||
HEAD_JOINT_MOTION_IMMEDIATE = 0;
|
|
||||||
HEAD_JOINT_MOTION_S_CURVE = 1;
|
|
||||||
HEAD_JOINT_MOTION_FOLLOW = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 最近一次设备命令的处理结果。
|
|
||||||
enum HeadJointCommandOutcome {
|
|
||||||
HEAD_JOINT_COMMAND_NONE = 0;
|
|
||||||
HEAD_JOINT_COMMAND_ACKNOWLEDGED = 1;
|
|
||||||
HEAD_JOINT_COMMAND_REJECTED = 2;
|
|
||||||
HEAD_JOINT_COMMAND_UNKNOWN = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 一个关节的目标位置。
|
|
||||||
message HeadJointTarget {
|
|
||||||
string id = 1;
|
|
||||||
|
|
||||||
// 单位:rad。
|
|
||||||
// 区分“没有填写目标”和“明确要求移动到 0 rad”。
|
|
||||||
oneof target {
|
|
||||||
double position_rad = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 从设备配置中取得的关节信息。
|
|
||||||
message HeadJointInfo {
|
|
||||||
string id = 1;
|
|
||||||
double min_position_rad = 2;
|
|
||||||
double max_position_rad = 3;
|
|
||||||
double home_position_rad = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 最近一次获得固件 ACK 的目标缓存。
|
|
||||||
// 这里保存的是命令目标,不是机械位置测量值。
|
|
||||||
message HeadJointTargetState {
|
|
||||||
string id = 1;
|
|
||||||
double target_position_rad = 2;
|
|
||||||
bool target_valid = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 头部关节控制命令。
|
|
||||||
message HeadJointCommand {
|
|
||||||
// 单路或多路目标控制。
|
|
||||||
message Move {
|
|
||||||
// 本次未列出的通道不参与目标下发。
|
|
||||||
// 驱动会拒绝重复的通道 ID。
|
|
||||||
repeated HeadJointTarget targets = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 显式移动到配置中的 home 位置。
|
|
||||||
message Home {}
|
|
||||||
|
|
||||||
// Reopen and probe service 1 without sending any position target.
|
|
||||||
message Reconnect {}
|
|
||||||
|
|
||||||
// Cancel later host-side expression frames; this is not a hardware stop.
|
|
||||||
message CancelExpression {}
|
|
||||||
|
|
||||||
// 设置设备运动模式。
|
|
||||||
message Mode {
|
|
||||||
// 区分未填写和明确选择 IMMEDIATE。
|
|
||||||
oneof value {
|
|
||||||
HeadJointMotionMode mode = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置指定关节的运动约束。
|
|
||||||
message Constraints {
|
|
||||||
string id = 1;
|
|
||||||
double max_velocity_rad_s = 2;
|
|
||||||
double max_acceleration_rad_s2 = 3;
|
|
||||||
double max_jerk_rad_s3 = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置指定关节的位置增益。
|
|
||||||
message PositionGain {
|
|
||||||
string id = 1;
|
|
||||||
|
|
||||||
// 0 是合法增益,需要与未填写区分。
|
|
||||||
oneof value {
|
|
||||||
double gain = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置设备更新周期,单位:ms。
|
|
||||||
message UpdatePeriod {
|
|
||||||
uint32 period_ms = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Request {
|
|
||||||
CommandHeader.Request header = 1;
|
|
||||||
|
|
||||||
// 一条请求明确执行一项操作。
|
|
||||||
oneof operation {
|
|
||||||
Move move = 2;
|
|
||||||
Home home = 3;
|
|
||||||
Mode mode = 4;
|
|
||||||
Constraints constraints = 5;
|
|
||||||
PositionGain position_gain = 6;
|
|
||||||
UpdatePeriod update_period = 7;
|
|
||||||
Reconnect reconnect = 8;
|
|
||||||
CancelExpression cancel_expression = 9;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message Feedback {
|
|
||||||
// Move/configuration: success means firmware ACK, not mechanical arrival.
|
|
||||||
// Reconnect: success means open + service-1 probe, without automatic motion.
|
|
||||||
// CancelExpression: success means cancellation was requested for later host
|
|
||||||
// frames, not that firmware trajectory/PWM or the mechanism was stopped.
|
|
||||||
// A timed-out write may already have taken effect; do not blindly retry.
|
|
||||||
CommandHeader.Feedback header = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 查询头部驱动的配置和缓存状态。
|
|
||||||
message GetHeadJointStateCommand {
|
|
||||||
message Request {
|
|
||||||
CommandHeader.Request header = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Feedback {
|
|
||||||
// success=true 表示成功取得驱动状态。
|
|
||||||
// 设备连接和命令结果仍需检查下面的对应字段。
|
|
||||||
CommandHeader.Feedback header = 1;
|
|
||||||
|
|
||||||
// 表示串口传输连接状态,不是持续的硬件健康检测。
|
|
||||||
bool connected = 2;
|
|
||||||
|
|
||||||
// 配置中的关节信息,不是从控制板读取的标定。
|
|
||||||
repeated HeadJointInfo joint_info = 3;
|
|
||||||
|
|
||||||
// 最近一次获得 ACK 的目标及其有效性。
|
|
||||||
repeated HeadJointTargetState targets = 4;
|
|
||||||
|
|
||||||
HeadJointCommandOutcome last_command_outcome = 5;
|
|
||||||
string last_error = 6;
|
|
||||||
|
|
||||||
// 当前 eRPC 服务 1 不提供真实关节位置测量反馈。
|
|
||||||
bool position_feedback_available = 7;
|
|
||||||
|
|
||||||
// Presets come from configuration, not measured hardware poses.
|
|
||||||
repeated HeadExpressionInfo expressions = 8;
|
|
||||||
bool expression_baseline_ready = 9;
|
|
||||||
bool hardware_emergency_stop_available = 10;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// One configured expression, with a stable ID and an exact display name.
|
|
||||||
message HeadExpressionInfo {
|
|
||||||
string expression_id = 1;
|
|
||||||
string expression_name = 2;
|
|
||||||
repeated HeadJointTarget targets = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Synchronously send a complete five-joint expression through a bounded host
|
|
||||||
// transition. Omitted joints and partial expressions are rejected.
|
|
||||||
message SetHeadExpressionCommand {
|
|
||||||
message Request {
|
|
||||||
CommandHeader.Request header = 1;
|
|
||||||
repeated HeadJointTarget targets = 2;
|
|
||||||
// Finite duration in [0.2, 5.0] seconds; 0 or omission is rejected.
|
|
||||||
double transition_duration_s = 3;
|
|
||||||
}
|
|
||||||
message Feedback {
|
|
||||||
// Every transmitted frame, including the final target, was acknowledged.
|
|
||||||
// This is not proof of mechanical arrival; late intermediate frames may be skipped.
|
|
||||||
CommandHeader.Feedback header = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Select one configured expression by exact stable ID or exact name.
|
|
||||||
// Unknown selectors and ambiguous names are rejected without fallback.
|
|
||||||
message PlayHeadExpressionCommand {
|
|
||||||
message Request {
|
|
||||||
CommandHeader.Request header = 1;
|
|
||||||
oneof expression {
|
|
||||||
string expression_id = 2;
|
|
||||||
string expression_name = 3;
|
|
||||||
}
|
|
||||||
// Finite duration in [0.2, 5.0] seconds; 0 or omission is rejected.
|
|
||||||
double transition_duration_s = 4;
|
|
||||||
}
|
|
||||||
message Feedback {
|
|
||||||
// Every transmitted frame, including the final target, was acknowledged.
|
|
||||||
// This is not proof of mechanical arrival; late intermediate frames may be skipped.
|
|
||||||
CommandHeader.Feedback header = 1;
|
|
||||||
string expression_id = 2;
|
|
||||||
string expression_name = 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,88 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
package cmvr.api;
|
|
||||||
import "cmvr/api/common.proto";
|
|
||||||
|
|
||||||
// header.device_id identifies a MotorManager, NOT an individual motor.
|
|
||||||
// A nonempty joint_name selects by name; otherwise node_id (including 0) is used.
|
|
||||||
message MotorRequest {
|
|
||||||
CommandHeader.Request header = 1;
|
|
||||||
uint32 node_id = 2;
|
|
||||||
string joint_name = 3;
|
|
||||||
reserved 4; // Retired UI confirmation flag.
|
|
||||||
int32 mode = 5; // cmvr.msgs.RunMode numeric values.
|
|
||||||
double q = 6; // rad
|
|
||||||
double qd = 7; // rad/s: profile speed or cyclic velocity/feedforward, per driver API.
|
|
||||||
double qdd = 8; // rad/s^2: profile acceleration parameter.
|
|
||||||
double tau = 9; // Per mille of rated torque: 1000 = rated torque.
|
|
||||||
double upper = 10;
|
|
||||||
double lower = 11;
|
|
||||||
uint32 torque_slope = 12; // Per mille/s, > 0 for profile torque.
|
|
||||||
reserved 13 to 16; // Retired gRPC planning parameters.
|
|
||||||
}
|
|
||||||
message MotorInfo {
|
|
||||||
string manager_id = 1;
|
|
||||||
uint32 node_id = 2;
|
|
||||||
string joint_name = 3;
|
|
||||||
string driver = 4;
|
|
||||||
// Software/configured limits; these are NOT an SDO dictionary readback.
|
|
||||||
double limit_q_lb = 5;
|
|
||||||
double limit_q_ub = 6;
|
|
||||||
double limit_qd = 7;
|
|
||||||
double limit_qdd = 8;
|
|
||||||
reserved 9; // Retired planning capability.
|
|
||||||
}
|
|
||||||
message MotorDebugState {
|
|
||||||
double position = 1; // rad
|
|
||||||
double velocity = 2; // rad/s
|
|
||||||
bool feedback_valid = 3;
|
|
||||||
double torque = 4;
|
|
||||||
bool torque_valid = 5;
|
|
||||||
string torque_unit = 6; // "per_mille_rated" (not N*m).
|
|
||||||
int32 mode = 7;
|
|
||||||
uint32 status_word = 8;
|
|
||||||
uint32 error_code = 9;
|
|
||||||
bool enabled = 10;
|
|
||||||
bool fault = 11;
|
|
||||||
bool status_valid = 12;
|
|
||||||
reserved 13, 14; // No current getter in this branch's AbstractMotor contract.
|
|
||||||
double sampled_at_s = 15;
|
|
||||||
}
|
|
||||||
message MotorResponse {
|
|
||||||
CommandHeader.Feedback header = 1;
|
|
||||||
MotorInfo info = 2;
|
|
||||||
MotorDebugState state = 3;
|
|
||||||
bool reached_target = 4;
|
|
||||||
// False for void setters; true only means the driver's bool result was true.
|
|
||||||
bool driver_acknowledged = 5;
|
|
||||||
string detail = 6;
|
|
||||||
reserved 7; // Retired background trajectory status.
|
|
||||||
}
|
|
||||||
message MotorListResponse {
|
|
||||||
CommandHeader.Feedback header = 1;
|
|
||||||
repeated MotorInfo motors = 2;
|
|
||||||
}
|
|
||||||
service MotorService {
|
|
||||||
rpc ListMotors(MotorRequest) returns (MotorListResponse);
|
|
||||||
rpc GetInfo(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc GetState(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc getMode(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc getQ(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc getQd(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc getTau(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc reachedTargetQ(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc setMode(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc torqueOn(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc torqueOff(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc brakeRelease(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc quickStop(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc calibrateZeroQ(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc commandProfilePosition(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc commandProfileVelocity(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc commandProfileTorque(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc commandCyclicPosition(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc commandCyclicVelocity(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc commandCyclicTorque(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc setLimitQ(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc setLimitQd(MotorRequest) returns (MotorResponse);
|
|
||||||
rpc setLimitQdd(MotorRequest) returns (MotorResponse);
|
|
||||||
}
|
|
||||||
@ -1,6 +1,5 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
import "cmvr/api/arm_command.proto";
|
|
||||||
import "cmvr/api/common.proto";
|
import "cmvr/api/common.proto";
|
||||||
|
|
||||||
package cmvr.api;
|
package cmvr.api;
|
||||||
@ -14,13 +13,12 @@ enum DeviceType {
|
|||||||
Microphone = 5;
|
Microphone = 5;
|
||||||
Robot = 6;
|
Robot = 6;
|
||||||
Speaker = 7;
|
Speaker = 7;
|
||||||
Touch = 8;
|
BioHead = 8;
|
||||||
BioHead = 9;
|
Motor = 9;
|
||||||
Motor = 10;
|
MotorSystem = 10;
|
||||||
MotorSystem = 11;
|
MujocoWorld = 11;
|
||||||
MujocoWorld = 12;
|
MujocoViewer = 12;
|
||||||
MujocoViewer = 13;
|
CanBus = 13;
|
||||||
CanBus = 14;
|
|
||||||
Unknown = 20;
|
Unknown = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,52 +101,3 @@ message StopAllCommand {
|
|||||||
CommandHeader.Feedback header = 1;
|
CommandHeader.Feedback header = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ActionResultCode {
|
|
||||||
ACTION_RESULT_CODE_UNSPECIFIED = 0;
|
|
||||||
ACTION_RESULT_CODE_COMPLETED = 1;
|
|
||||||
ACTION_RESULT_CODE_FAILED = 2;
|
|
||||||
ACTION_RESULT_CODE_CANCELED = 3;
|
|
||||||
ACTION_RESULT_CODE_TIMED_OUT = 4;
|
|
||||||
ACTION_RESULT_CODE_REJECTED = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
message ActionStep {
|
|
||||||
reserved 1;
|
|
||||||
reserved "step_id";
|
|
||||||
|
|
||||||
// Zero inherits the remaining ActionQueue timeout.
|
|
||||||
uint32 timeout_ms = 2;
|
|
||||||
|
|
||||||
oneof command {
|
|
||||||
MoveJ.Request arm_move_j = 10;
|
|
||||||
MoveL.Request arm_move_l = 11;
|
|
||||||
// Apply a saved coordinate before subsequent arm steps. Uses header.device_id,
|
|
||||||
// name and expected_revision (0 = latest); coordinate payload is not accepted.
|
|
||||||
// AUBO MoveL without legacy frame overrides follows this selection until switched.
|
|
||||||
// Switching does not move the arm. A failure aborts the remaining queue.
|
|
||||||
UserCoordinateSystemCommand.Request arm_apply_user_coordinate = 12;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message ActionQueueCommand {
|
|
||||||
message Request {
|
|
||||||
reserved 1;
|
|
||||||
reserved "action_id";
|
|
||||||
|
|
||||||
repeated ActionStep steps = 2;
|
|
||||||
// Zero uses the server default.
|
|
||||||
uint32 total_timeout_ms = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Feedback {
|
|
||||||
CommandHeader.Feedback header = 1;
|
|
||||||
|
|
||||||
reserved 2;
|
|
||||||
reserved "action_id";
|
|
||||||
|
|
||||||
uint32 completed_steps = 3;
|
|
||||||
optional uint32 failed_step_index = 4;
|
|
||||||
ActionResultCode result = 5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
|
import "cmvr/api/common.proto";
|
||||||
import "cmvr/api/system_command.proto";
|
import "cmvr/api/system_command.proto";
|
||||||
|
|
||||||
package cmvr.api;
|
package cmvr.api;
|
||||||
@ -8,7 +9,9 @@ package cmvr.api;
|
|||||||
service SystemService {
|
service SystemService {
|
||||||
rpc GetSystemInfo(GetSystemInfoCommand.Request) returns (GetSystemInfoCommand.Feedback) {}
|
rpc GetSystemInfo(GetSystemInfoCommand.Request) returns (GetSystemInfoCommand.Feedback) {}
|
||||||
rpc GetSystemStatus(GetSystemStatusCommand.Request) returns (GetSystemStatusCommand.Feedback) {}
|
rpc GetSystemStatus(GetSystemStatusCommand.Request) returns (GetSystemStatusCommand.Feedback) {}
|
||||||
|
|
||||||
rpc UpdateParams(UpdateParamsCommand.Request) returns (UpdateParamsCommand.Feedback) {}
|
rpc UpdateParams(UpdateParamsCommand.Request) returns (UpdateParamsCommand.Feedback) {}
|
||||||
|
rpc ExecuteJsonCommand(JsonDeviceCommand.Request) returns (JsonDeviceCommand.Feedback) {}
|
||||||
|
|
||||||
rpc StopAll(StopAllCommand.Request) returns (StopAllCommand.Feedback) {}
|
rpc StopAll(StopAllCommand.Request) returns (StopAllCommand.Feedback) {}
|
||||||
rpc ExecuteActionQueue(ActionQueueCommand.Request) returns (ActionQueueCommand.Feedback) {}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,11 +11,11 @@ message MyAgvConfig {
|
|||||||
int32 port = 3;
|
int32 port = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 仙工 SEER Robokit AGV 后端配置。
|
// 仙工 Robokit 系列 AGV 后端配置(包括 SRC1100)。
|
||||||
message SeerRobokitAgvConfig {
|
message SeerRobokitAgvConfig {
|
||||||
// 设备 id。为空时通常由外层 AGVDeviceConfig.id 补齐。
|
// 设备 id。为空时通常由外层 AGVDeviceConfig.id 补齐。
|
||||||
string id = 1;
|
string id = 1;
|
||||||
// SEER Robokit 控制器 IP 地址。
|
// SRC1100 控制器 IP 地址。
|
||||||
string ip = 2;
|
string ip = 2;
|
||||||
// 是否启用该后端配置。当前设备是否创建仍以设备管理器配置为准。
|
// 是否启用该后端配置。当前设备是否创建仍以设备管理器配置为准。
|
||||||
bool enable = 3;
|
bool enable = 3;
|
||||||
@ -49,7 +49,7 @@ message SeerRobokitAgvConfig {
|
|||||||
int32 map_update_interval_ms = 17;
|
int32 map_update_interval_ms = 17;
|
||||||
// 统一地图更新缓存条数。0 表示使用适配器默认值;缓存满后会丢弃最旧更新。
|
// 统一地图更新缓存条数。0 表示使用适配器默认值;缓存满后会丢弃最旧更新。
|
||||||
uint32 map_update_history_size = 18;
|
uint32 map_update_history_size = 18;
|
||||||
// 抢占 SEER Robokit 控制权时上报的稳定昵称。为空时适配器使用 "cmvr-es:<device-id>"。
|
// 控制器昵称。为空时使用设备 id。
|
||||||
string control_nick_name = 19;
|
string control_nick_name = 19;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ message AGVDeviceConfig {
|
|||||||
oneof backend {
|
oneof backend {
|
||||||
// 示例/测试 AGV 后端。
|
// 示例/测试 AGV 后端。
|
||||||
MyAgvConfig my_agv = 10;
|
MyAgvConfig my_agv = 10;
|
||||||
// 仙工 SEER Robokit AGV 后端。
|
// 仙工 SRC1100 AGV 后端。
|
||||||
SeerRobokitAgvConfig seer_robokit_agv = 11;
|
SeerRobokitAgvConfig seer_robokit_agv = 11;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,9 +6,7 @@ import "cmvr/config/pinocchio_dls_ik_config.proto";
|
|||||||
import "cmvr/config/pinocchio_qp_ik_config.proto";
|
import "cmvr/config/pinocchio_qp_ik_config.proto";
|
||||||
import "cmvr/config/srs_ik_config.proto";
|
import "cmvr/config/srs_ik_config.proto";
|
||||||
import "cmvr/config/cartesian_motion_validation_config.proto";
|
import "cmvr/config/cartesian_motion_validation_config.proto";
|
||||||
import "cmvr/config/joint_motion_config.proto";
|
|
||||||
|
|
||||||
// Keep legacy TOPPRA configurations readable for existing linbo_dev devices.
|
|
||||||
enum ToppraPathType {
|
enum ToppraPathType {
|
||||||
TOPPRA_PATH_TYPE_UNKNOWN = 0;
|
TOPPRA_PATH_TYPE_UNKNOWN = 0;
|
||||||
TOPPRA_PATH_TYPE_LINEAR = 1;
|
TOPPRA_PATH_TYPE_LINEAR = 1;
|
||||||
@ -16,12 +14,6 @@ enum ToppraPathType {
|
|||||||
TOPPRA_PATH_TYPE_QUINTIC = 3;
|
TOPPRA_PATH_TYPE_QUINTIC = 3;
|
||||||
TOPPRA_PATH_TYPE_NATURAL = 4;
|
TOPPRA_PATH_TYPE_NATURAL = 4;
|
||||||
}
|
}
|
||||||
message ToppraJointMotionPlannerConfig {
|
|
||||||
ToppraPathType path_type = 1;
|
|
||||||
double sample_period_s = 2;
|
|
||||||
int32 grid_size = 3;
|
|
||||||
int32 high_grid_size = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
message MotorRobotArmBackendConfig {
|
message MotorRobotArmBackendConfig {
|
||||||
string motor_system_id = 2;
|
string motor_system_id = 2;
|
||||||
@ -51,28 +43,11 @@ message VendorRobotArmBackendConfig {
|
|||||||
string tool_frame = 8;
|
string tool_frame = 8;
|
||||||
string username = 9;
|
string username = 9;
|
||||||
string password = 10;
|
string password = 10;
|
||||||
// 仅在检测到一次真实硬件急停并确认急停输入已释放后,自动上电并使能。
|
|
||||||
// 默认 false;普通启动、普通掉电和软件急停不会触发自动使能。
|
|
||||||
bool auto_enable = 11;
|
bool auto_enable = 11;
|
||||||
}
|
}
|
||||||
|
|
||||||
message SpeedLAdaptiveSpeedConfig {
|
|
||||||
// 主动降低 speedL 目标速度以保留限位制动余量,默认关闭。
|
|
||||||
// 仅控制正常运动的提前降速;QP 失解后的制动始终生效。
|
|
||||||
bool enable = 1;
|
|
||||||
// 可行性预测时间,单位秒;未设置/0 使用 0.15,负值或非有限值无效。
|
|
||||||
double lookahead_s = 2;
|
|
||||||
// 自动降速后的目标比例低于此值时平滑停止并报告限速错误,不是速度下限。
|
|
||||||
// 有效范围 [0, 1];未设置/0 关闭该停止阈值。
|
|
||||||
double min_speed_ratio = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SpeedLPlannerConfig {
|
message SpeedLPlannerConfig {
|
||||||
// Default true: preserve acceleration through same-axis velocity reversal.
|
|
||||||
optional bool continuous_linear_reversal = 21;
|
optional bool continuous_linear_reversal = 21;
|
||||||
// Arm-level speedL limits. Command requests may lower, but not raise them.
|
|
||||||
// Linear units: m/s, m/s^2, m/s^3. Angular units: rad/s, rad/s^2, rad/s^3.
|
|
||||||
// Unset/zero values use the planner defaults; negative/non-finite values are rejected.
|
|
||||||
double linear_velocity_max = 1;
|
double linear_velocity_max = 1;
|
||||||
double linear_acceleration_max = 2;
|
double linear_acceleration_max = 2;
|
||||||
double linear_jerk_max = 3;
|
double linear_jerk_max = 3;
|
||||||
@ -81,13 +56,12 @@ message SpeedLPlannerConfig {
|
|||||||
double angular_jerk_max = 6;
|
double angular_jerk_max = 6;
|
||||||
double linear_target_replan_threshold = 8;
|
double linear_target_replan_threshold = 8;
|
||||||
double angular_target_replan_threshold = 9;
|
double angular_target_replan_threshold = 9;
|
||||||
reserved 10, 11;
|
double linear_reverse_cos_threshold = 10;
|
||||||
reserved "linear_reverse_cos_threshold", "linear_reverse_switch_speed_threshold";
|
double linear_reverse_switch_speed_threshold = 11;
|
||||||
optional bool enforce_joint_acceleration_limits = 17;
|
optional bool enforce_joint_acceleration_limits = 17;
|
||||||
CartesianLineDeviationCheckConfig line_deviation_check = 18;
|
CartesianLineDeviationCheckConfig line_deviation_check = 18;
|
||||||
JointVelocityCheckConfig joint_velocity_check = 19;
|
JointVelocityCheckConfig joint_velocity_check = 19;
|
||||||
CartesianVelocityFeasibilityCheckConfig cartesian_velocity_feasibility_check = 20;
|
CartesianVelocityFeasibilityCheckConfig cartesian_velocity_feasibility_check = 20;
|
||||||
SpeedLAdaptiveSpeedConfig adaptive_speed = 22;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message CartesianVelocityControllerConfig {
|
message CartesianVelocityControllerConfig {
|
||||||
@ -96,25 +70,24 @@ message CartesianVelocityControllerConfig {
|
|||||||
double stop_command_velocity_norm = 3;
|
double stop_command_velocity_norm = 3;
|
||||||
double stop_measured_velocity_norm = 4;
|
double stop_measured_velocity_norm = 4;
|
||||||
double stop_acceleration = 5;
|
double stop_acceleration = 5;
|
||||||
// 等待 Cartesian 速度运动停止的最长时间,单位为秒。
|
|
||||||
optional double stop_timeout_s = 6;
|
optional double stop_timeout_s = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message MoveJConfig {
|
message ToppraJointMotionPlannerConfig {
|
||||||
ToppraJointMotionPlannerConfig toppra_joint_motion_planner = 1;
|
ToppraPathType path_type = 1;
|
||||||
reserved 7;
|
double sample_period_s = 2;
|
||||||
reserved "quintic_bspline_joint_motion_planner";
|
int32 grid_size = 3;
|
||||||
|
int32 high_grid_size = 4;
|
||||||
|
}
|
||||||
|
|
||||||
// MoveJ 轨迹发送完成后,等待关节实际状态稳定的最长时间,单位为秒。
|
message MoveJConfig {
|
||||||
|
oneof algorithm {
|
||||||
|
ToppraJointMotionPlannerConfig toppra_joint_motion_planner = 1;
|
||||||
|
}
|
||||||
optional double settle_timeout_s = 2;
|
optional double settle_timeout_s = 2;
|
||||||
// MoveJ 完成时允许的最大关节位置误差,单位为弧度。
|
|
||||||
optional double settle_position_tolerance_rad = 3;
|
optional double settle_position_tolerance_rad = 3;
|
||||||
// MoveJ 完成时允许的最大关节速度,单位为弧度/秒。
|
|
||||||
optional double settle_velocity_tolerance_rad_s = 4;
|
optional double settle_velocity_tolerance_rad_s = 4;
|
||||||
// 位置和速度连续满足条件的采样次数。
|
|
||||||
optional int32 settle_stable_sample_count = 5;
|
optional int32 settle_stable_sample_count = 5;
|
||||||
// MoveJ 轨迹位置限位检查的数值容差,单位 rad;默认 1e-5,0 表示严格检查。
|
|
||||||
optional double joint_limit_tolerance_rad = 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message MoveLPlannerConfig {
|
message MoveLPlannerConfig {
|
||||||
@ -159,8 +132,6 @@ message ArmMotionConfig {
|
|||||||
MoveJConfig move_j = 1;
|
MoveJConfig move_j = 1;
|
||||||
MoveLConfig move_l = 2;
|
MoveLConfig move_l = 2;
|
||||||
SpeedLConfig speed_l = 4;
|
SpeedLConfig speed_l = 4;
|
||||||
JointPathConfig joint_path = 5;
|
|
||||||
JointTrajectorySmootherConfig joint_trajectory_smoother = 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message RobotArmConfig {
|
message RobotArmConfig {
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package cmvr.config;
|
package cmvr.config;
|
||||||
|
|
||||||
// 原 ESP32 头部的舵机分组配置。
|
|
||||||
message BioHeadServoGroupConfig {
|
message BioHeadServoGroupConfig {
|
||||||
string name = 1;
|
string name = 1;
|
||||||
int32 address = 2;
|
int32 address = 2;
|
||||||
@ -13,47 +11,13 @@ message BioHeadServoGroupConfig {
|
|||||||
repeated double max_angles = 7;
|
repeated double max_angles = 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
// USB eRPC 服务 1 的单个舵机关节配置。
|
|
||||||
// 所有位置参数的单位均为弧度 rad。
|
|
||||||
message UsbHeadJointConfig {
|
|
||||||
// 与控制板固件中的舵机 ID 对应。
|
|
||||||
string id = 1;
|
|
||||||
|
|
||||||
// 允许下发的最小位置。
|
|
||||||
double min_position_rad = 2;
|
|
||||||
|
|
||||||
// 允许下发的最大位置。
|
|
||||||
double max_position_rad = 3;
|
|
||||||
|
|
||||||
// 显式调用 home 时使用的目标位置。
|
|
||||||
double home_position_rad = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// USB eRPC 服务 1 的设备配置。
|
|
||||||
message UsbHeadErpcConfig {
|
|
||||||
// 应答超时,单位 ms。
|
|
||||||
// 后续驱动中:0 表示使用默认 2000 ms,最大允许 30000 ms。
|
|
||||||
uint32 response_timeout_ms = 1;
|
|
||||||
|
|
||||||
// 该设备允许控制的关节及其标定参数。
|
|
||||||
repeated UsbHeadJointConfig joints = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 头部设备配置。
|
|
||||||
message BioHeadRobotConfig {
|
message BioHeadRobotConfig {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
string serial_port = 2;
|
string serial_port = 2;
|
||||||
int32 baud_rate = 3;
|
int32 baud_rate = 3;
|
||||||
|
|
||||||
// 原 ESP32 后端使用的配置,保留原字段编号。
|
|
||||||
repeated BioHeadServoGroupConfig servo_groups = 4;
|
repeated BioHeadServoGroupConfig servo_groups = 4;
|
||||||
|
|
||||||
// 配置此字段时,选择新增的 USB eRPC 后端。
|
|
||||||
// 未配置时,继续使用原 ESP32 后端。
|
|
||||||
UsbHeadErpcConfig usb_erpc = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 配置文件的根结构。
|
|
||||||
message BioHeadRobotRootConfig {
|
message BioHeadRobotRootConfig {
|
||||||
BioHeadRobotConfig bio_head = 1;
|
BioHeadRobotConfig bio_head = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,40 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package cmvr.config;
|
|
||||||
|
|
||||||
message CollisionPairConfig {
|
|
||||||
string first = 1;
|
|
||||||
string second = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CollisionCheckerConfig {
|
|
||||||
reserved 3;
|
|
||||||
string urdf_path = 1;
|
|
||||||
repeated CollisionPairConfig ignored_pairs = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DistanceSamplingConfig {
|
|
||||||
double max_geometry_displacement_m = 1;
|
|
||||||
double max_check_period_s = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message CollisionSafetyConfig {
|
|
||||||
double warning_distance_m = 1;
|
|
||||||
double stop_distance_m = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message ProtectiveRecoveryConfig {
|
|
||||||
double clear_distance_m = 1;
|
|
||||||
double stable_period_s = 2;
|
|
||||||
double max_joint_velocity_rad_s = 3;
|
|
||||||
double max_joint_acceleration_rad_s2 = 4;
|
|
||||||
double history_duration_s = 5;
|
|
||||||
double max_distance_regression_m = 6;
|
|
||||||
}
|
|
||||||
|
|
||||||
message SelfCollisionMonitorConfig {
|
|
||||||
CollisionCheckerConfig checker = 10;
|
|
||||||
DistanceSamplingConfig sampling = 11;
|
|
||||||
CollisionSafetyConfig safety = 12;
|
|
||||||
ProtectiveRecoveryConfig recovery = 13;
|
|
||||||
}
|
|
||||||
@ -21,10 +21,8 @@ message DeviceConfigEntry {
|
|||||||
DEVICE_TYPE_AGV = 17;
|
DEVICE_TYPE_AGV = 17;
|
||||||
DEVICE_TYPE_MUJOCO_WORLD = 18;
|
DEVICE_TYPE_MUJOCO_WORLD = 18;
|
||||||
DEVICE_TYPE_MUJOCO_VIEWER = 19;
|
DEVICE_TYPE_MUJOCO_VIEWER = 19;
|
||||||
DEVICE_TYPE_TOUCH = 20;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// For DEVICE_TYPE_MOTOR_SYSTEM, this is the motor_group id selected from config_file.
|
|
||||||
string id = 1;
|
string id = 1;
|
||||||
DeviceType type = 2;
|
DeviceType type = 2;
|
||||||
string config_file = 3;
|
string config_file = 3;
|
||||||
@ -32,12 +30,11 @@ message DeviceConfigEntry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message DeviceManagerConfig {
|
message DeviceManagerConfig {
|
||||||
reserved 20;
|
|
||||||
|
|
||||||
string name = 1;
|
string name = 1;
|
||||||
string version = 2;
|
string version = 2;
|
||||||
string description = 3;
|
string description = 3;
|
||||||
repeated DeviceConfigEntry devices = 4;
|
repeated DeviceConfigEntry devices = 4;
|
||||||
|
reserved 20;
|
||||||
}
|
}
|
||||||
message DeviceManagerRootConfig {
|
message DeviceManagerRootConfig {
|
||||||
DeviceManagerConfig device_manager = 1;
|
DeviceManagerConfig device_manager = 1;
|
||||||
|
|||||||
@ -10,13 +10,13 @@ message RH56DFTPDexHandConfig{
|
|||||||
int32 poll_interval_ms = 5;
|
int32 poll_interval_ms = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum LegacyPX6AXGen3PollingReadMode {
|
enum PX6AXGen3PollingReadMode {
|
||||||
LEGACY_PX_6AX_GEN3_POLLING_READ_MODE_DISTRIBUTED_AND_RESULTANT_FORCE = 0;
|
PX_6AX_GEN3_POLLING_READ_MODE_DISTRIBUTED_AND_RESULTANT_FORCE = 0;
|
||||||
LEGACY_PX_6AX_GEN3_POLLING_READ_MODE_DISTRIBUTED_FORCE = 1;
|
PX_6AX_GEN3_POLLING_READ_MODE_DISTRIBUTED_FORCE = 1;
|
||||||
LEGACY_PX_6AX_GEN3_POLLING_READ_MODE_RESULTANT_FORCE = 2;
|
PX_6AX_GEN3_POLLING_READ_MODE_RESULTANT_FORCE = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message LegacyPX6AXGen3{
|
message PX6AXGen3{
|
||||||
reserved 10;
|
reserved 10;
|
||||||
|
|
||||||
string id = 1;
|
string id = 1;
|
||||||
@ -35,9 +35,7 @@ message LegacyPX6AXGen3{
|
|||||||
string tactile_finger = 15;
|
string tactile_finger = 15;
|
||||||
string tactile_region = 16;
|
string tactile_region = 16;
|
||||||
string sensor_name = 17;
|
string sensor_name = 17;
|
||||||
LegacyPX6AXGen3PollingReadMode polling_read_mode = 18;
|
PX6AXGen3PollingReadMode polling_read_mode = 18;
|
||||||
// Maximum age since the sample's request was sent. 0 uses 50 ms.
|
|
||||||
// Independent of response_timeout_ms: stale cached data must fail promptly.
|
|
||||||
int32 max_sample_age_ms = 19;
|
int32 max_sample_age_ms = 19;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,29 +43,14 @@ message ZeroSimTouchDexHand {
|
|||||||
string id = 1;
|
string id = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message OYMotionAP001Config {
|
|
||||||
string id = 1;
|
|
||||||
string can_interface = 2;
|
|
||||||
uint32 hand_id = 3;
|
|
||||||
uint32 master_id = 4;
|
|
||||||
uint32 command_timeout_ms = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
message DexHandDeviceConfig {
|
message DexHandDeviceConfig {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
// Human-readable hardware model. This is metadata only and must not drive
|
reserved 2;
|
||||||
// device behavior.
|
|
||||||
string model = 2;
|
|
||||||
// Whether this device provides real tactile sensor feedback. Motor-current
|
|
||||||
// estimates do not count as tactile feedback.
|
|
||||||
optional bool has_tactile_feedback = 3;
|
|
||||||
|
|
||||||
oneof backend {
|
oneof backend {
|
||||||
RH56DFTPDexHandConfig rh56dftp = 10;
|
RH56DFTPDexHandConfig rh56dftp = 10;
|
||||||
LegacyPX6AXGen3 px_6ax_gen3 = 11;
|
PX6AXGen3 px_6ax_gen3 = 11;
|
||||||
ZeroSimTouchDexHand zero_sim_touch = 12;
|
ZeroSimTouchDexHand zero_sim_touch = 12;
|
||||||
// Shared OYMotion backend for AP001, LiteS001 and compatible hands.
|
|
||||||
OYMotionAP001Config oymotion_ap001 = 13;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -6,6 +6,12 @@ message GRPCServerConfig {
|
|||||||
string port = 2;
|
string port = 2;
|
||||||
bool enable_reflection = 3;
|
bool enable_reflection = 3;
|
||||||
string id = 4;
|
string id = 4;
|
||||||
|
// Bounds the continuity-oriented media queue before the gRPC stream skips
|
||||||
|
// ahead and waits for a new key frame. Zero uses the service default.
|
||||||
|
uint32 camera_stream_max_pending_frames = 5;
|
||||||
|
// Frames older than this monotonic age are not sent. Zero uses the service
|
||||||
|
// default so configurations written before these fields remain low-latency.
|
||||||
|
uint32 camera_stream_max_frame_age_ms = 6;
|
||||||
}
|
}
|
||||||
message GRPCServerRootConfig {
|
message GRPCServerRootConfig {
|
||||||
GRPCServerConfig grpc_server = 1;
|
GRPCServerConfig grpc_server = 1;
|
||||||
|
|||||||
@ -33,6 +33,7 @@ message JointLimitAvoidanceConfig {
|
|||||||
double gain = 2;
|
double gain = 2;
|
||||||
double margin_ratio = 3;
|
double margin_ratio = 3;
|
||||||
double max_push = 4;
|
double max_push = 4;
|
||||||
|
double weight = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message JointLimitPolicyConfig {
|
message JointLimitPolicyConfig {
|
||||||
|
|||||||
@ -1,41 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
package cmvr.config;
|
|
||||||
|
|
||||||
import "cmvr/config/collision_config.proto";
|
|
||||||
|
|
||||||
message RrtConnectConfig {
|
|
||||||
// Omitted fields use planner defaults. Explicit values must be finite and positive.
|
|
||||||
optional double timeout_s = 1; // Default: 1.0 s.
|
|
||||||
optional double range_rad = 2; // Default: 0.2, Euclidean joint-space distance.
|
|
||||||
optional double collision_check_step_rad = 3; // Default: 0.02 rad per joint.
|
|
||||||
}
|
|
||||||
|
|
||||||
message QuinticBSplineConfig {
|
|
||||||
// Reference control-point spacing in Euclidean joint space; default 0.05 rad.
|
|
||||||
// Must be finite and positive. Actual control points are not equally spaced.
|
|
||||||
optional double control_point_spacing_rad = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message JointTrajectorySmootherConfig {
|
|
||||||
// Sampling period in seconds; default 0.001, must be finite and positive.
|
|
||||||
optional double sample_period_s = 1;
|
|
||||||
oneof algorithm {
|
|
||||||
QuinticBSplineConfig quintic_bspline = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
enum JointPathAlgorithm {
|
|
||||||
JOINT_PATH_ALGORITHM_UNKNOWN = 0;
|
|
||||||
RRT_CONNECT = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message JointPathConfig {
|
|
||||||
reserved 5, 6;
|
|
||||||
reserved "quintic_bspline";
|
|
||||||
|
|
||||||
JointPathAlgorithm algorithm = 2;
|
|
||||||
RrtConnectConfig rrt_connect = 1;
|
|
||||||
// Required by MotorRobotArm::moveP; each arm owns its checker.
|
|
||||||
CollisionCheckerConfig collision_checker = 3;
|
|
||||||
optional double minimum_distance_m = 4; // Default: 0.01 m.
|
|
||||||
}
|
|
||||||
@ -12,21 +12,6 @@ message MotorConfigItem {
|
|||||||
double limit_qdd = 6;
|
double limit_qdd = 6;
|
||||||
double encoder_counts_per_rev = 7;
|
double encoder_counts_per_rev = 7;
|
||||||
double gear_ratio = 8;
|
double gear_ratio = 8;
|
||||||
LingkongMotorConfig lingkong = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Vendor CAN protocol, not CiA301 CANopen. Zero conversion values mean unknown.
|
|
||||||
message LingkongMotorConfig {
|
|
||||||
// MG: 66/4096 A/LSB; MF: 33/4096 A/LSB. Do not use for MS power data.
|
|
||||||
double current_amp_per_lsb = 1;
|
|
||||||
// Required to convert current to the common API's per-mille rated torque.
|
|
||||||
double rated_torque_current_a = 2;
|
|
||||||
// B1 indices 12/14: the supplied protocol manual does not define their units.
|
|
||||||
// Populate only after confirming the drive firmware's parameter units.
|
|
||||||
double acceleration_deg_s2_per_lsb = 3;
|
|
||||||
double speed_limit_deg_s_per_lsb = 4;
|
|
||||||
uint32 response_timeout_ms = 5;
|
|
||||||
double reached_position_tolerance_rad = 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message MotorList {
|
message MotorList {
|
||||||
@ -96,8 +81,6 @@ enum MotorVendor {
|
|||||||
MOTOR_VENDOR_TI5 = 1;
|
MOTOR_VENDOR_TI5 = 1;
|
||||||
MOTOR_VENDOR_MUJOCO = 2;
|
MOTOR_VENDOR_MUJOCO = 2;
|
||||||
MOTOR_VENDOR_EYOU = 3;
|
MOTOR_VENDOR_EYOU = 3;
|
||||||
MOTOR_VENDOR_TCHL = 4;
|
|
||||||
MOTOR_VENDOR_LINGKONG = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum MotorProtocol {
|
enum MotorProtocol {
|
||||||
@ -105,8 +88,6 @@ enum MotorProtocol {
|
|||||||
MOTOR_PROTOCOL_CANOPEN = 1;
|
MOTOR_PROTOCOL_CANOPEN = 1;
|
||||||
MOTOR_PROTOCOL_ETHERCAT_CIA402 = 2;
|
MOTOR_PROTOCOL_ETHERCAT_CIA402 = 2;
|
||||||
MOTOR_PROTOCOL_MUJOCO = 3;
|
MOTOR_PROTOCOL_MUJOCO = 3;
|
||||||
MOTOR_PROTOCOL_LINGKONG_CAN = 4;
|
|
||||||
MOTOR_PROTOCOL_LINGKONG_CAN_V2_38 = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message MotorGroupConfig {
|
message MotorGroupConfig {
|
||||||
|
|||||||
@ -36,34 +36,16 @@ message QuicEdgeTrackConfig {
|
|||||||
// Zero uses QuicEdgeConfig.maximum_frame_bytes.
|
// Zero uses QuicEdgeConfig.maximum_frame_bytes.
|
||||||
uint32 max_frame_bytes = 5;
|
uint32 max_frame_bytes = 5;
|
||||||
|
|
||||||
// Protocol-neutral MediaSourceManager track ID. When empty, the service derives
|
// Protocol-neutral MediaSourceHub track ID. When empty, the service derives
|
||||||
// the default ID from source_kind and device_id (for example
|
// the default ID from source_kind and device_id (for example
|
||||||
// "right_hand_cam/video/color"). The Hub's descriptor is the authority for
|
// "right_hand_cam/video/color"). The Hub's descriptor is the authority for
|
||||||
// codec metadata and descriptor generation.
|
// codec metadata and descriptor generation.
|
||||||
string source_track_id = 6;
|
string source_track_id = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
message QuicEdgePlatformConfig {
|
|
||||||
// Stable operator-facing identifier used in logs and task status. It must be
|
|
||||||
// unique within the task and differ from QuicEdgeConfig.id when the
|
|
||||||
// backward-compatible primary endpoint is also configured.
|
|
||||||
string id = 1;
|
|
||||||
string server_host = 2;
|
|
||||||
uint32 server_port = 3;
|
|
||||||
QuicEdgeTlsConfig tls = 4;
|
|
||||||
|
|
||||||
// False keeps registration, heartbeat, IP and device-state reporting while
|
|
||||||
// preventing accidental duplication of configured media tracks.
|
|
||||||
bool enable_media = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
message QuicEdgeConfig {
|
message QuicEdgeConfig {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
reserved 2;
|
reserved 2;
|
||||||
|
|
||||||
// Backward-compatible primary platform endpoint. When configured, it runs
|
|
||||||
// alongside every endpoint in platforms. New configurations may leave these
|
|
||||||
// fields empty and declare every destination in platforms instead.
|
|
||||||
string server_host = 3;
|
string server_host = 3;
|
||||||
uint32 server_port = 4;
|
uint32 server_port = 4;
|
||||||
string alpn = 5;
|
string alpn = 5;
|
||||||
@ -105,10 +87,6 @@ message QuicEdgeConfig {
|
|||||||
// Immutable robot product identity, for example:
|
// Immutable robot product identity, for example:
|
||||||
// CN-CMVR-MBLRV1-CHAGAN-20260731-001.
|
// CN-CMVR-MBLRV1-CHAGAN-20260731-001.
|
||||||
string robot_id = 22;
|
string robot_id = 22;
|
||||||
|
|
||||||
// Every platform owns an independent QUIC connection, registration,
|
|
||||||
// heartbeat/ACK sequence and reconnect loop.
|
|
||||||
repeated QuicEdgePlatformConfig platforms = 23;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message QuicEdgeRootConfig {
|
message QuicEdgeRootConfig {
|
||||||
|
|||||||
@ -2,20 +2,32 @@ syntax = "proto3";
|
|||||||
|
|
||||||
package cmvr.config;
|
package cmvr.config;
|
||||||
|
|
||||||
import "cmvr/config/collision_config.proto";
|
message CollisionPairConfig {
|
||||||
|
string first = 1;
|
||||||
|
string second = 2;
|
||||||
|
}
|
||||||
|
|
||||||
message SelfCollisionCheckerConfig {
|
message SelfCollisionCheckerConfig {
|
||||||
string urdf_path = 1;
|
string urdf_path = 1;
|
||||||
repeated CollisionPairConfig ignored_pairs = 2;
|
repeated CollisionPairConfig ignored_pairs = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message DistanceSamplingConfig {
|
||||||
|
double max_geometry_displacement_m = 1;
|
||||||
|
double max_check_period_s = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message CollisionSafetyConfig {
|
||||||
|
double warning_distance_m = 1;
|
||||||
|
double stop_distance_m = 2;
|
||||||
|
}
|
||||||
|
|
||||||
message SelfCollisionTaskConfig {
|
message SelfCollisionTaskConfig {
|
||||||
string id = 1;
|
string id = 1;
|
||||||
string arm_id = 2;
|
string arm_id = 2;
|
||||||
CollisionCheckerConfig checker = 10;
|
SelfCollisionCheckerConfig checker = 10;
|
||||||
DistanceSamplingConfig sampling = 11;
|
DistanceSamplingConfig sampling = 11;
|
||||||
CollisionSafetyConfig safety = 12;
|
CollisionSafetyConfig safety = 12;
|
||||||
ProtectiveRecoveryConfig recovery = 13;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message SelfCollisionTaskRootConfig {
|
message SelfCollisionTaskRootConfig {
|
||||||
|
|||||||
@ -8,8 +8,6 @@ message TaskConfigEntry {
|
|||||||
TASK_TYPE_GRPC_SERVER = 3;
|
TASK_TYPE_GRPC_SERVER = 3;
|
||||||
TASK_TYPE_SELF_COLLISION = 4;
|
TASK_TYPE_SELF_COLLISION = 4;
|
||||||
TASK_TYPE_QUIC_EDGE = 5;
|
TASK_TYPE_QUIC_EDGE = 5;
|
||||||
reserved 2;
|
|
||||||
reserved "TASK_TYPE_ARM_CONTROL";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TaskRunMode {
|
enum TaskRunMode {
|
||||||
|
|||||||
@ -1,63 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
package cmvr.config;
|
|
||||||
|
|
||||||
enum PX6AXGen3PollingReadMode {
|
|
||||||
PX_6AX_GEN3_POLLING_READ_MODE_DISTRIBUTED_AND_RESULTANT_FORCE = 0;
|
|
||||||
PX_6AX_GEN3_POLLING_READ_MODE_DISTRIBUTED_FORCE = 1;
|
|
||||||
PX_6AX_GEN3_POLLING_READ_MODE_RESULTANT_FORCE = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message PX6AXGen3{
|
|
||||||
reserved 10, 15, 16;
|
|
||||||
reserved "tactile_finger", "tactile_region";
|
|
||||||
|
|
||||||
string id = 1;
|
|
||||||
string serial_port = 2;
|
|
||||||
string sensor_model = 3;
|
|
||||||
int32 module_id = 4;
|
|
||||||
int32 baud_rate = 5;
|
|
||||||
int32 distributed_length = 6;
|
|
||||||
int32 resultant_length = 7;
|
|
||||||
int32 poll_interval_ms = 8;
|
|
||||||
bool auto_calibrate = 9;
|
|
||||||
int32 response_timeout_ms = 11;
|
|
||||||
int32 tactile_rows = 12;
|
|
||||||
int32 tactile_cols = 13;
|
|
||||||
int32 response_header_bytes = 14;
|
|
||||||
string sensor_name = 17;
|
|
||||||
PX6AXGen3PollingReadMode polling_read_mode = 18;
|
|
||||||
// Maximum age since the sample's request was sent. 0 uses 50 ms.
|
|
||||||
// Independent of response_timeout_ms: stale cached data must fail promptly.
|
|
||||||
int32 max_sample_age_ms = 19;
|
|
||||||
}
|
|
||||||
|
|
||||||
message ZeroSimTouch {
|
|
||||||
string id = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message PX6AXGenXCan {
|
|
||||||
string id = 1;
|
|
||||||
int32 channel_id = 2;
|
|
||||||
// Unset uses the default standard CAN force frame ID, 0x600.
|
|
||||||
optional uint32 force_can_id = 3;
|
|
||||||
// Maximum age of the latest received sample. 0 uses 300 ms.
|
|
||||||
int32 max_sample_age_ms = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
message TouchDeviceConfig {
|
|
||||||
string id = 1;
|
|
||||||
|
|
||||||
oneof backend {
|
|
||||||
PX6AXGen3 px_6ax_gen3 = 10;
|
|
||||||
ZeroSimTouch zero_sim = 11;
|
|
||||||
PX6AXGenXCan px_6ax_genx_can = 12;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
message TouchConfig {
|
|
||||||
repeated TouchDeviceConfig touches = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
message TouchRootConfig {
|
|
||||||
TouchConfig touch = 1;
|
|
||||||
}
|
|
||||||
@ -11,10 +11,17 @@ message TouchScreenApriltagConfig {
|
|||||||
optional TouchScreenTargetPointMethod target_point_method = 3;
|
optional TouchScreenTargetPointMethod target_point_method = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message TouchScreenTaskPbvsConfig {
|
message TouchScreenIbvsConfig {
|
||||||
.cmvr.common.Vec3 position_gain = 1;
|
optional string camera_link = 1;
|
||||||
.cmvr.common.Vec3 rotation_gain = 2;
|
optional double lambda = 2;
|
||||||
.cmvr.common.Vec6 vmax6 = 3;
|
optional double mu = 3;
|
||||||
.cmvr.common.Vec6 amax6 = 4;
|
optional double qdot_max = 4;
|
||||||
optional double twist_filter_alpha = 5;
|
.cmvr.common.Vec6 vmax6 = 5;
|
||||||
|
.cmvr.common.Vec6 amax6 = 6;
|
||||||
|
optional double twist_filter_alpha = 7;
|
||||||
|
|
||||||
|
.cmvr.common.Mat3 r_camera_to_visp = 12;
|
||||||
|
.cmvr.common.Mat3 r_camera_to_urdf = 13;
|
||||||
|
|
||||||
|
repeated string control_joint_names = 14;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,131 +12,47 @@ message TouchScreenInitJointPoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message TouchScreenTaskDevicesConfig {
|
message TouchScreenTaskDevicesConfig {
|
||||||
reserved 1, 2;
|
reserved 1;
|
||||||
reserved "robot_id", "dexhand_id";
|
reserved "robot_id";
|
||||||
|
|
||||||
optional string camera_id = 3;
|
|
||||||
optional string arm_id = 4;
|
optional string arm_id = 4;
|
||||||
optional string external_camera_id = 5;
|
optional string dexhand_id = 2;
|
||||||
optional string touch_id = 6;
|
optional string camera_id = 3;
|
||||||
// Joint-controlled head/neck, exposed through the RobotArm interface.
|
|
||||||
optional string head_id = 7;
|
|
||||||
}
|
|
||||||
|
|
||||||
message TouchScreenTaskHeadInitializationConfig {
|
|
||||||
// Move the head once during task init(), before the task becomes ready.
|
|
||||||
// Unset/false preserves startup behavior for configurations without a head.
|
|
||||||
optional bool enable = 1;
|
|
||||||
repeated TouchScreenInitJointPoint joint_positions = 2;
|
|
||||||
optional double velocity = 3; // rad/s
|
|
||||||
optional double acceleration = 4; // rad/s^2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message TouchScreenTaskInitializationConfig {
|
message TouchScreenTaskInitializationConfig {
|
||||||
enum MotionMethod {
|
|
||||||
USE_MOVEJ = 0;
|
|
||||||
USE_MOVEP = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 开始触控前回到配置的初始关节位置。
|
|
||||||
optional bool before_start = 1;
|
optional bool before_start = 1;
|
||||||
// 正常完成后回到配置的初始关节位置。
|
|
||||||
optional bool after_finish = 2;
|
optional bool after_finish = 2;
|
||||||
repeated TouchScreenInitJointPoint joint_positions = 3;
|
repeated TouchScreenInitJointPoint joint_positions = 3;
|
||||||
optional double velocity = 4;
|
optional double velocity = 4;
|
||||||
optional double acceleration = 5;
|
optional double acceleration = 5;
|
||||||
// 当前关节位置误差小于该值时可跳过初始位置回位,单位为弧度。
|
|
||||||
optional double skip_position_tolerance_rad = 6;
|
|
||||||
// 当前关节速度小于该值时才允许跳过初始位置回位,单位为弧度/秒。
|
|
||||||
optional double skip_velocity_tolerance_rad_s = 7;
|
|
||||||
// 失败后停止当前运动,再尝试回初始位置;未配置时关闭。
|
|
||||||
// 不解除急停/保护停止,回位结果不覆盖任务的原始失败原因。
|
|
||||||
optional bool after_failure = 8;
|
|
||||||
// 三个开关启用的回位动作统一使用此方式。省略时沿用旧配置行为:
|
|
||||||
// 开始前使用 MoveJ,正常完成和失败后使用 MoveP。
|
|
||||||
optional MotionMethod motion_method = 9;
|
|
||||||
// MoveJ 和 MoveP 回初始位时共用的关节加加速度上限(rad/s^3)。省略时使用 MotionOptions 默认值。
|
|
||||||
optional double jerk = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
message TouchScreenTaskTagConfig {
|
|
||||||
optional int32 id = 1;
|
|
||||||
optional double size_m = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message TouchScreenTaskTagsConfig {
|
|
||||||
TouchScreenTaskTagConfig screen = 1;
|
|
||||||
TouchScreenTaskTagConfig hand = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message TouchScreenTaskHandCameraConfig {
|
|
||||||
reserved 1;
|
|
||||||
reserved "camera_id";
|
|
||||||
optional TouchScreenDepthPolicy depth_policy = 2;
|
|
||||||
optional TouchScreenTargetPointMethod target_point_method = 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message TouchScreenTaskPerceptionConfig {
|
message TouchScreenTaskPerceptionConfig {
|
||||||
reserved 1, 2, 6;
|
TouchScreenApriltagConfig apriltag = 1;
|
||||||
reserved "apriltag", "external_apriltag", "external_camera";
|
|
||||||
|
|
||||||
TouchScreenTaskTagsConfig tags = 4;
|
|
||||||
TouchScreenTaskHandCameraConfig hand_camera = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message TouchScreenAlignmentTargetConfig {
|
message TouchScreenAlignmentTargetConfig {
|
||||||
reserved 2;
|
.cmvr.common.Vec3 position_in_camera = 1;
|
||||||
reserved "rotation_vector";
|
.cmvr.common.Vec3 rotation_vector = 2;
|
||||||
|
|
||||||
// Target orientation of Hand Tag H relative to Screen Tag G.
|
|
||||||
// rx, ry and rz are fixed-axis (extrinsic) rotations about G.X, G.Y and G.Z,
|
|
||||||
// applied in that order, in radians.
|
|
||||||
.cmvr.common.Euler hand_orientation_G = 6;
|
|
||||||
optional TouchScreenAlignMode mode = 3;
|
optional TouchScreenAlignMode mode = 3;
|
||||||
.cmvr.common.Vec3 position_offset_G = 4;
|
|
||||||
.cmvr.common.Vec3 rotation_offset_G = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
message TouchScreenTaskAlignmentCalibrationConfig {
|
|
||||||
.cmvr.common.Mat4 hand_tag_to_tcp = 1;
|
|
||||||
reserved 2;
|
|
||||||
reserved "external_camera_to_base";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message TouchScreenTaskAlignmentConfig {
|
message TouchScreenTaskAlignmentConfig {
|
||||||
reserved 1;
|
reserved 1;
|
||||||
reserved "kinematics";
|
reserved "kinematics";
|
||||||
|
TouchScreenIbvsConfig ibvs = 2;
|
||||||
TouchScreenAlignmentTargetConfig target = 3;
|
TouchScreenAlignmentTargetConfig target = 3;
|
||||||
.cmvr.common.Vec6 error_threshold = 4;
|
.cmvr.common.Vec6 error_threshold = 4;
|
||||||
optional int32 stable_frames = 5;
|
optional int32 stable_frames = 5;
|
||||||
// Separate time limit for alignment and, when enabled, the pause after reaching.
|
|
||||||
// The pause timer starts on entering ALIGN_REACHED. Either timeout fails the
|
|
||||||
// task and attempts to return to initialization when after_failure is enabled.
|
|
||||||
optional double timeout_s = 6;
|
optional double timeout_s = 6;
|
||||||
// Pause after alignment instead of starting touch, until timeout_s expires.
|
|
||||||
optional bool pause_when_reached = 7;
|
optional bool pause_when_reached = 7;
|
||||||
TouchScreenTaskPbvsConfig pbvs = 8;
|
|
||||||
TouchScreenTaskAlignmentCalibrationConfig calibration = 9;
|
|
||||||
}
|
|
||||||
|
|
||||||
message TouchScreenTaskApproachConfig {
|
|
||||||
// MoveP to alignment.target before PBVS; position_offset_G is in Screen G.
|
|
||||||
optional bool enable = 1;
|
|
||||||
optional double velocity = 2; // Joint velocity, rad/s.
|
|
||||||
optional double acceleration = 3; // Joint acceleration, rad/s^2.
|
|
||||||
optional double jerk = 4; // Joint jerk, rad/s^3.
|
|
||||||
optional double timeout_s = 5;
|
|
||||||
// Signed outward clearance from the screen plane, meters; TCP only, not the arm.
|
|
||||||
optional double minimum_clearance_m = 6;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message TouchScreenTouchSpeedLConfig {
|
message TouchScreenTouchSpeedLConfig {
|
||||||
.cmvr.common.Vec6 twist_tool = 1;
|
.cmvr.common.Vec6 twist_tool = 1;
|
||||||
optional double acceleration = 2;
|
optional double acceleration = 2;
|
||||||
optional double max_distance_m = 3;
|
optional double max_distance_m = 3;
|
||||||
// Requested linear jerk during approach, m/s^3, capped by the arm's
|
|
||||||
// linear_jerk_max. Unset uses that arm limit.
|
|
||||||
optional double linear_jerk = 4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message TouchScreenTouchMoveLConfig {
|
message TouchScreenTouchMoveLConfig {
|
||||||
@ -149,11 +65,9 @@ message TouchScreenTouchMoveLConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
message TouchScreenTactileTriggerConfig {
|
message TouchScreenTactileTriggerConfig {
|
||||||
reserved 1, 2;
|
optional TouchScreenFingerType finger = 1;
|
||||||
reserved "finger", "region";
|
optional TouchScreenTactileRegion region = 2;
|
||||||
optional TouchScreenTactileCriterion criterion = 3;
|
optional TouchScreenTactileCriterion criterion = 3;
|
||||||
// Threshold in newtons (N), applied to the selected sensor's force criterion.
|
|
||||||
// Equality also triggers contact.
|
|
||||||
optional double force_threshold = 4;
|
optional double force_threshold = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,15 +83,8 @@ message TouchScreenTaskTouchConfig {
|
|||||||
|
|
||||||
message TouchScreenTaskRetractConfig {
|
message TouchScreenTaskRetractConfig {
|
||||||
.cmvr.common.Vec6 twist_tool = 1;
|
.cmvr.common.Vec6 twist_tool = 1;
|
||||||
// Requested acceleration, capped by the arm's speedL acceleration limits.
|
|
||||||
optional double acceleration = 2;
|
optional double acceleration = 2;
|
||||||
reserved 3;
|
optional double duration_s = 3;
|
||||||
reserved "duration_s";
|
|
||||||
// Signed displacement along the retract direction before stopping, in meters.
|
|
||||||
optional double distance_m = 4;
|
|
||||||
// Requested linear jerk for braking and reversal, m/s^3, capped by the arm's
|
|
||||||
// linear_jerk_max. Unset uses that arm limit.
|
|
||||||
optional double linear_jerk = 5;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message TouchScreenTaskConfig {
|
message TouchScreenTaskConfig {
|
||||||
@ -188,12 +95,6 @@ message TouchScreenTaskConfig {
|
|||||||
TouchScreenTaskTouchConfig touch = 5;
|
TouchScreenTaskTouchConfig touch = 5;
|
||||||
TouchScreenTaskRetractConfig retract = 6;
|
TouchScreenTaskRetractConfig retract = 6;
|
||||||
optional string id = 7;
|
optional string id = 7;
|
||||||
// 是否在外部相机编码后的 gRPC 视频流中绘制坐标系,仅影响显示帧;未配置时默认开启。
|
|
||||||
optional bool debug_draw_coordinate_frames = 8;
|
|
||||||
// G/H 坐标轴长度,单位为米。
|
|
||||||
optional double debug_coordinate_axis_length_m = 9;
|
|
||||||
TouchScreenTaskApproachConfig approach = 10;
|
|
||||||
TouchScreenTaskHeadInitializationConfig head_initialization = 11;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message TouchScreenTaskRootConfig {
|
message TouchScreenTaskRootConfig {
|
||||||
|
|||||||
@ -63,7 +63,6 @@ enum DeviceKind {
|
|||||||
DEVICE_KIND_MOTOR_SYSTEM = 11;
|
DEVICE_KIND_MOTOR_SYSTEM = 11;
|
||||||
DEVICE_KIND_ROBOT = 12;
|
DEVICE_KIND_ROBOT = 12;
|
||||||
DEVICE_KIND_SPEAKER = 13;
|
DEVICE_KIND_SPEAKER = 13;
|
||||||
DEVICE_KIND_TOUCH = 14;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeviceManager's view of a configured entry. REGISTERED means that the
|
// DeviceManager's view of a configured entry. REGISTERED means that the
|
||||||
@ -198,7 +197,7 @@ message MediaTrackDescriptor {
|
|||||||
string codec = 4;
|
string codec = 4;
|
||||||
uint64 codec_generation = 5;
|
uint64 codec_generation = 5;
|
||||||
|
|
||||||
// The exact MediaSourceManager track and the 32-bit token repeated in every
|
// The exact MediaSourceHub track and the 32-bit token repeated in every
|
||||||
// DATAGRAM header. The full generation remains on the reliable stream.
|
// DATAGRAM header. The full generation remains on the reliable stream.
|
||||||
string source_track_id = 6;
|
string source_track_id = 6;
|
||||||
uint32 codec_generation_token = 7;
|
uint32 codec_generation_token = 7;
|
||||||
|
|||||||
@ -1,125 +0,0 @@
|
|||||||
syntax = "proto3";
|
|
||||||
|
|
||||||
package rbk.protocol;
|
|
||||||
|
|
||||||
// 仙工 SEER Robokit 3D 地图文件 0.3dsmap 的最小解析结构。
|
|
||||||
// 这里只保留转换统一地图所需字段,未声明字段由 protobuf 作为未知字段跳过。
|
|
||||||
|
|
||||||
// 地图坐标系下的三维位置,单位:米。
|
|
||||||
message Message_MapPos {
|
|
||||||
// X 坐标,单位:米。
|
|
||||||
double x = 1;
|
|
||||||
// Y 坐标,单位:米。
|
|
||||||
double y = 2;
|
|
||||||
// Z 坐标,单位:米。
|
|
||||||
double z = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 仙工地图头信息。
|
|
||||||
message Message_MapHeader {
|
|
||||||
// 地图类型,例如 2D-Map 或 3D-Map。
|
|
||||||
string map_type = 1;
|
|
||||||
// 地图名称,通常对应地图文件名。
|
|
||||||
string map_name = 2;
|
|
||||||
// 地图最小边界点,单位:米。
|
|
||||||
Message_MapPos min_pos = 3;
|
|
||||||
// 地图最大边界点,单位:米。
|
|
||||||
Message_MapPos max_pos = 4;
|
|
||||||
// 地图分辨率,单位:米。
|
|
||||||
double resolution = 5;
|
|
||||||
// 地图格式版本号。
|
|
||||||
string version = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 三维浮点向量。
|
|
||||||
message Vec3f {
|
|
||||||
// X 分量。
|
|
||||||
float x = 1;
|
|
||||||
// Y 分量。
|
|
||||||
float y = 2;
|
|
||||||
// Z 分量。
|
|
||||||
float z = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 三维整数向量。
|
|
||||||
message Vec3i {
|
|
||||||
// X 分量。
|
|
||||||
int32 x = 1;
|
|
||||||
// Y 分量。
|
|
||||||
int32 y = 2;
|
|
||||||
// Z 分量。
|
|
||||||
int32 z = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 仙工 3D 特征地图参数。
|
|
||||||
message FeatureMapParams {
|
|
||||||
// 激光测距标准差,单位:米。
|
|
||||||
float ranging_sigma = 1;
|
|
||||||
// 激光测角标准差,单位:度。
|
|
||||||
float angle_sigma = 2;
|
|
||||||
// 最大体素边长,单位:米。
|
|
||||||
float max_voxel_size = 3;
|
|
||||||
// 八叉树最大层数。
|
|
||||||
uint32 max_layer = 4;
|
|
||||||
// 平面协方差停止更新的点数阈值。
|
|
||||||
uint32 cov_fixed_pts_num = 5;
|
|
||||||
// 平面停止更新的点数阈值。
|
|
||||||
uint32 plane_fixed_pts_num = 6;
|
|
||||||
// 有效平面协方差最小特征值阈值。
|
|
||||||
float plane_min_eigen_value = 7;
|
|
||||||
// 每层评估平面所需的最少点数。
|
|
||||||
repeated int32 each_layer_least_pts_num = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 仙工 3D 平面特征。
|
|
||||||
message FeatureMapPlane {
|
|
||||||
// 平面中心点,单位:米。
|
|
||||||
Vec3f center = 1;
|
|
||||||
// 平面法向量。
|
|
||||||
Vec3f normal = 2;
|
|
||||||
// 平面方程 Ax + By + Cz + D = 0 中的 D。
|
|
||||||
float d = 3;
|
|
||||||
// 平面特征近似半径,单位:米。
|
|
||||||
float radius = 4;
|
|
||||||
// 平面协方差矩阵,按 6x6 展平。
|
|
||||||
repeated float plane_cov = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 仙工特征地图中的八叉树节点。
|
|
||||||
message OctoTree {
|
|
||||||
// 对应的平面 ID。
|
|
||||||
uint32 plane_id = 1;
|
|
||||||
// 子节点序列,-1 表示当前层无其他子节点。
|
|
||||||
repeated int32 child_id_list = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 同一外层体素位置下的八叉树节点集合。
|
|
||||||
message OctoTrees {
|
|
||||||
// 八叉树节点列表。
|
|
||||||
repeated OctoTree octo_tree = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 仙工 3D 特征地图。
|
|
||||||
message FeatureMap3D {
|
|
||||||
// 特征地图参数。
|
|
||||||
FeatureMapParams params = 1;
|
|
||||||
// 平面特征列表。
|
|
||||||
repeated FeatureMapPlane planes = 2;
|
|
||||||
// 每个外层体素对应的八叉树节点集合。
|
|
||||||
repeated OctoTrees octo_trees = 3;
|
|
||||||
// 最外层八叉树体素坐标。
|
|
||||||
repeated Vec3i voxel_locs = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 0.3dsmap 顶层消息。
|
|
||||||
message Message_Map3D {
|
|
||||||
// 地图目录或地图包内部目录名。
|
|
||||||
string map_directory = 1;
|
|
||||||
// 地图头信息。
|
|
||||||
Message_MapHeader header = 2;
|
|
||||||
// 普通 3D 点云点。
|
|
||||||
repeated Message_MapPos normal_pos3d_list = 3;
|
|
||||||
// 3D 特征地图。
|
|
||||||
FeatureMap3D feature_map_3d = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,12 +1,6 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>styles.qss</file>
|
<file>styles.qss</file>
|
||||||
<file>resources/task_adapters.json</file>
|
|
||||||
<file>resources/task_ui.json</file>
|
|
||||||
<file>assets/agv/demo_scan.smap</file>
|
|
||||||
<file>icons/cmvr-app.ico</file>
|
|
||||||
<file>icons/cmvr-app.svg</file>
|
|
||||||
<file>icons/settings.svg</file>
|
|
||||||
<file>icons/activity.svg</file>
|
<file>icons/activity.svg</file>
|
||||||
<file>icons/bot.svg</file>
|
<file>icons/bot.svg</file>
|
||||||
<file>icons/camera.svg</file>
|
<file>icons/camera.svg</file>
|
||||||
@ -42,21 +36,4 @@
|
|||||||
<file>icons/trash-2.svg</file>
|
<file>icons/trash-2.svg</file>
|
||||||
<file>icons/plus.svg</file>
|
<file>icons/plus.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/workflow-icons">
|
|
||||||
<file alias="arm.svg">resources/workflow-icons/arm.svg</file>
|
|
||||||
<file alias="agv.svg">resources/workflow-icons/agv.svg</file>
|
|
||||||
<file alias="hand.svg">resources/workflow-icons/hand.svg</file>
|
|
||||||
<file alias="camera.svg">resources/workflow-icons/camera.svg</file>
|
|
||||||
<file alias="video.svg">resources/workflow-icons/video.svg</file>
|
|
||||||
<file alias="microphone.svg">resources/workflow-icons/microphone.svg</file>
|
|
||||||
<file alias="audio.svg">resources/workflow-icons/audio.svg</file>
|
|
||||||
<file alias="expression.svg">resources/workflow-icons/expression.svg</file>
|
|
||||||
<file alias="motor.svg">resources/workflow-icons/motor.svg</file>
|
|
||||||
<file alias="start.svg">resources/workflow-icons/start.svg</file>
|
|
||||||
<file alias="end.svg">resources/workflow-icons/end.svg</file>
|
|
||||||
<file alias="sleep.svg">resources/workflow-icons/sleep.svg</file>
|
|
||||||
<file alias="loop.svg">resources/workflow-icons/loop.svg</file>
|
|
||||||
<file alias="plan.svg">resources/workflow-icons/plan.svg</file>
|
|
||||||
<file alias="touch.svg">resources/workflow-icons/touch.svg</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
IDI_ICON1 ICON "../icons/cmvr-app.ico"
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 1,
|
|
||||||
"appearance": {
|
|
||||||
"fontFamily": "Microsoft YaHei UI",
|
|
||||||
"fontPixels": 13
|
|
||||||
},
|
|
||||||
"arm": {
|
|
||||||
"modelPreview": false
|
|
||||||
},
|
|
||||||
"window": {
|
|
||||||
"rememberGeometry": true,
|
|
||||||
"startMaximized": true,
|
|
||||||
"startupPage": 0,
|
|
||||||
"geometry": "AdnQywADAAAAAAAAAAAAAAAAB38AAASHAAAAAAAAABQAAAd/AAAESwAAAAACAAAAB4AAAAAAAAAAAAAAB38AAASH"
|
|
||||||
},
|
|
||||||
"log": {
|
|
||||||
"maximumLines": 3000,
|
|
||||||
"autoScroll": true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,181 +0,0 @@
|
|||||||
{
|
|
||||||
"activeGroup": "挥手",
|
|
||||||
"groups": [
|
|
||||||
{
|
|
||||||
"flow": [
|
|
||||||
],
|
|
||||||
"moveJAcceleration": 0.1,
|
|
||||||
"moveJVelocity": 0.1,
|
|
||||||
"name": "默认组",
|
|
||||||
"points": [
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"flow": [
|
|
||||||
{
|
|
||||||
"collapsed": false,
|
|
||||||
"id": "860308d9-f0fb-46f6-a0d3-30013b46827a",
|
|
||||||
"intervalSeconds": 0.5,
|
|
||||||
"loopCount": 1,
|
|
||||||
"nodeName": "初始位置",
|
|
||||||
"order": 0,
|
|
||||||
"parentId": "",
|
|
||||||
"pointName": "初始位置",
|
|
||||||
"type": "single",
|
|
||||||
"x": 40,
|
|
||||||
"y": 40
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"collapsed": false,
|
|
||||||
"id": "0ddff873-9e76-4635-917d-1d7357dddcc1",
|
|
||||||
"intervalSeconds": 0.5,
|
|
||||||
"loopCount": 3,
|
|
||||||
"nodeName": "循环左右",
|
|
||||||
"order": 1,
|
|
||||||
"parentId": "",
|
|
||||||
"pointName": "",
|
|
||||||
"type": "loop",
|
|
||||||
"x": 260,
|
|
||||||
"y": 40
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"collapsed": false,
|
|
||||||
"id": "c1a33717-b636-4eb4-80f4-91305edc64ff",
|
|
||||||
"intervalSeconds": 0.5,
|
|
||||||
"loopCount": 1,
|
|
||||||
"nodeName": "挥手-右",
|
|
||||||
"order": 0,
|
|
||||||
"parentId": "0ddff873-9e76-4635-917d-1d7357dddcc1",
|
|
||||||
"pointName": "挥手-右",
|
|
||||||
"type": "single",
|
|
||||||
"x": 40,
|
|
||||||
"y": 140
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"collapsed": false,
|
|
||||||
"id": "9851e4a8-91bd-4182-a5f5-cdd19180d0a3",
|
|
||||||
"intervalSeconds": 0.5,
|
|
||||||
"loopCount": 1,
|
|
||||||
"nodeName": "挥手-左",
|
|
||||||
"order": 1,
|
|
||||||
"parentId": "0ddff873-9e76-4635-917d-1d7357dddcc1",
|
|
||||||
"pointName": "挥手-左",
|
|
||||||
"type": "single",
|
|
||||||
"x": 260,
|
|
||||||
"y": 140
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"collapsed": false,
|
|
||||||
"id": "3b89feb6-c457-4a93-b81f-28e5b1423046",
|
|
||||||
"intervalSeconds": 0.5,
|
|
||||||
"loopCount": 1,
|
|
||||||
"nodeName": "初始位置",
|
|
||||||
"order": 2,
|
|
||||||
"parentId": "",
|
|
||||||
"pointName": "初始位置",
|
|
||||||
"type": "single",
|
|
||||||
"x": 480,
|
|
||||||
"y": 40
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"moveJAcceleration": 1,
|
|
||||||
"moveJVelocity": 1,
|
|
||||||
"name": "挥手",
|
|
||||||
"points": [
|
|
||||||
{
|
|
||||||
"deviceId": "right_ethercat_arm",
|
|
||||||
"jointNames": [
|
|
||||||
"right_arm_J1",
|
|
||||||
"right_arm_J2",
|
|
||||||
"right_arm_J3",
|
|
||||||
"right_arm_J4",
|
|
||||||
"right_arm_J5",
|
|
||||||
"right_arm_J6",
|
|
||||||
"right_arm_J7"
|
|
||||||
],
|
|
||||||
"name": "零位",
|
|
||||||
"positions": [
|
|
||||||
-9.492455370579462e-07,
|
|
||||||
0,
|
|
||||||
-9.492455370579462e-07,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
-9.492455370579462e-07,
|
|
||||||
-9.492455370579462e-07
|
|
||||||
],
|
|
||||||
"side": "right"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"deviceId": "right_ethercat_arm",
|
|
||||||
"jointNames": [
|
|
||||||
"right_arm_J1",
|
|
||||||
"right_arm_J2",
|
|
||||||
"right_arm_J3",
|
|
||||||
"right_arm_J4",
|
|
||||||
"right_arm_J5",
|
|
||||||
"right_arm_J6",
|
|
||||||
"right_arm_J7"
|
|
||||||
],
|
|
||||||
"name": "初始位置",
|
|
||||||
"positions": [
|
|
||||||
0.014501624069634246,
|
|
||||||
-1.4912457538072925,
|
|
||||||
-1.2003475604848106,
|
|
||||||
-0.02585080371069905,
|
|
||||||
-0.07927434253632026,
|
|
||||||
-0.06444807649301221,
|
|
||||||
-0.11000426830749717
|
|
||||||
],
|
|
||||||
"side": "right"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"deviceId": "right_ethercat_arm",
|
|
||||||
"jointNames": [
|
|
||||||
"right_arm_J1",
|
|
||||||
"right_arm_J2",
|
|
||||||
"right_arm_J3",
|
|
||||||
"right_arm_J4",
|
|
||||||
"right_arm_J5",
|
|
||||||
"right_arm_J6",
|
|
||||||
"right_arm_J7"
|
|
||||||
],
|
|
||||||
"name": "挥手-右",
|
|
||||||
"positions": [
|
|
||||||
0.742245461282794,
|
|
||||||
-1.490991356003361,
|
|
||||||
-1.3799808874265822,
|
|
||||||
1.543379267948052,
|
|
||||||
0.14546428458983382,
|
|
||||||
-0.06442149761797458,
|
|
||||||
-0.4555106588858484
|
|
||||||
],
|
|
||||||
"side": "right"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"deviceId": "right_ethercat_arm",
|
|
||||||
"jointNames": [
|
|
||||||
"right_arm_J1",
|
|
||||||
"right_arm_J2",
|
|
||||||
"right_arm_J3",
|
|
||||||
"right_arm_J4",
|
|
||||||
"right_arm_J5",
|
|
||||||
"right_arm_J6",
|
|
||||||
"right_arm_J7"
|
|
||||||
],
|
|
||||||
"name": "挥手-左",
|
|
||||||
"positions": [
|
|
||||||
0.9055916332997255,
|
|
||||||
-1.4894905988092724,
|
|
||||||
-1.8256241389547136,
|
|
||||||
1.5302806287821893,
|
|
||||||
0.019423462179279694,
|
|
||||||
-0.06441770063582634,
|
|
||||||
-0.4553255560061222
|
|
||||||
],
|
|
||||||
"side": "right"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"version": 1
|
|
||||||
}
|
|
||||||
@ -1,652 +0,0 @@
|
|||||||
{
|
|
||||||
"client.arm.move_j": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.ArmService",
|
|
||||||
"method": "moveJ"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"positions": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"description": "关节角数组 rad,长度为设备DOF"
|
|
||||||
},
|
|
||||||
"velocity": {
|
|
||||||
"type": "number",
|
|
||||||
"exclusiveMinimum": 0,
|
|
||||||
"description": "rad/s"
|
|
||||||
},
|
|
||||||
"acceleration": {
|
|
||||||
"type": "number",
|
|
||||||
"exclusiveMinimum": 0,
|
|
||||||
"description": "rad/s²"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"positions",
|
|
||||||
"velocity",
|
|
||||||
"acceleration"
|
|
||||||
],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "driver_motion_result",
|
|
||||||
"implementation": "positions -> target.position;速度/加速度 -> options;当前遨博等待运动完成,其他驱动以其返回语义为准。"
|
|
||||||
},
|
|
||||||
"client.arm.enable": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.ArmService",
|
|
||||||
"method": "torqueOn"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "选中deviceId写入通用请求头,不传运动目标。"
|
|
||||||
},
|
|
||||||
"client.arm.disable": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.ArmService",
|
|
||||||
"method": "torqueOff"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "选中deviceId写入通用请求头,不传运动目标。"
|
|
||||||
},
|
|
||||||
"client.arm.stop": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.ArmService",
|
|
||||||
"method": "stopMotion"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "选中deviceId写入通用请求头,不传运动目标。"
|
|
||||||
},
|
|
||||||
"client.arm.clear_fault": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.ArmService",
|
|
||||||
"method": "clearFault"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "选中deviceId写入通用请求头,不传运动目标。"
|
|
||||||
},
|
|
||||||
"client.camera.snapshot_rgb": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.CameraService",
|
|
||||||
"method": "GetRGBImage"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "image_callback",
|
|
||||||
"implementation": "获取图像并在客户端解码、展示;深度抓图需先查询设备能力,不支持时失败。"
|
|
||||||
},
|
|
||||||
"client.camera.snapshot_depth": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.CameraService",
|
|
||||||
"method": "GetDepthImage"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "image_callback",
|
|
||||||
"implementation": "获取图像并在客户端解码、展示;深度抓图需先查询设备能力,不支持时失败。"
|
|
||||||
},
|
|
||||||
"client.camera.preview_start": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.CameraService",
|
|
||||||
"method": "GetRGBImageStream"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "stream_started",
|
|
||||||
"implementation": "先GetStatus获取设备编码器,建立RGB视频流并展示结果;确认流已启动后本节点完成,流继续存在。"
|
|
||||||
},
|
|
||||||
"client.camera.preview_stop": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.CameraService",
|
|
||||||
"method": "GetRGBImageStream"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "stream_stopped",
|
|
||||||
"implementation": "取消/关闭该设备预览会话,确认流停止;不是重复提交Unary RPC。"
|
|
||||||
},
|
|
||||||
"client.camera.record_start": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.CameraService",
|
|
||||||
"method": "StartRecording"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"path": {
|
|
||||||
"type": "string",
|
|
||||||
"minLength": 1,
|
|
||||||
"description": "服务端录像路径"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"path"
|
|
||||||
],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "recording_started",
|
|
||||||
"implementation": "path由客户端映射到录制请求,记录状态确认启动后完成,不等待整段录像结束。"
|
|
||||||
},
|
|
||||||
"client.camera.record_stop": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.CameraService",
|
|
||||||
"method": "StopRecording"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "recording_stopped",
|
|
||||||
"implementation": "确认录制结束后继续。"
|
|
||||||
},
|
|
||||||
"client.agv.navigate_station": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.AgvService",
|
|
||||||
"method": "navigateToStation"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"stationId": {
|
|
||||||
"type": "string",
|
|
||||||
"minLength": 1
|
|
||||||
},
|
|
||||||
"maxSpeed": {
|
|
||||||
"type": "number",
|
|
||||||
"exclusiveMinimum": 0,
|
|
||||||
"description": "m/s"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"stationId",
|
|
||||||
"maxSpeed"
|
|
||||||
],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "driver_navigation_result",
|
|
||||||
"implementation": "stationId -> station_id,maxSpeed -> options.max_speed;是否已到站以驱动同步/异步语义为准。"
|
|
||||||
},
|
|
||||||
"client.agv.stop": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.AgvService",
|
|
||||||
"method": "cancelNavigation"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "调用对应底盘操作。"
|
|
||||||
},
|
|
||||||
"client.agv.pause": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.AgvService",
|
|
||||||
"method": "pauseNavigation"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "调用对应底盘操作。"
|
|
||||||
},
|
|
||||||
"client.agv.resume": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.AgvService",
|
|
||||||
"method": "resumeNavigation"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "调用对应底盘操作。"
|
|
||||||
},
|
|
||||||
"client.dexhand.angle": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.DexHandService",
|
|
||||||
"method": "SetDexHandAngle"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"values": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"description": "数值/数量由型号和对应Proto字段决定,不能假定是SI单位"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"values"
|
|
||||||
],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "values通过已有DexHand客户端映射到对应请求;接口确认不等同于手指已到位。"
|
|
||||||
},
|
|
||||||
"client.dexhand.position": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.DexHandService",
|
|
||||||
"method": "SetDexHandPos"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"values": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"description": "数值/数量由型号和对应Proto字段决定,不能假定是SI单位"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"values"
|
|
||||||
],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "values通过已有DexHand客户端映射到对应请求;接口确认不等同于手指已到位。"
|
|
||||||
},
|
|
||||||
"client.dexhand.speed": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.DexHandService",
|
|
||||||
"method": "SetDexHandSpeed"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"values": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"description": "数值/数量由型号和对应Proto字段决定,不能假定是SI单位"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"values"
|
|
||||||
],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "values通过已有DexHand客户端映射到对应请求;接口确认不等同于手指已到位。"
|
|
||||||
},
|
|
||||||
"client.dexhand.force": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.DexHandService",
|
|
||||||
"method": "SetDexHandForce"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"values": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "number"
|
|
||||||
},
|
|
||||||
"description": "数值/数量由型号和对应Proto字段决定,不能假定是SI单位"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"values"
|
|
||||||
],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "values通过已有DexHand客户端映射到对应请求;接口确认不等同于手指已到位。"
|
|
||||||
},
|
|
||||||
"client.microphone.record_start": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.MicPhoneService",
|
|
||||||
"method": "StartRecord"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"path": {
|
|
||||||
"type": "string",
|
|
||||||
"minLength": 1,
|
|
||||||
"description": "服务端录音路径"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"path"
|
|
||||||
],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "开始录音时 path -> file_path;停止节点结束录音。"
|
|
||||||
},
|
|
||||||
"client.microphone.record_stop": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.MicPhoneService",
|
|
||||||
"method": "StopRecord"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "开始录音时 path -> file_path;停止节点结束录音。"
|
|
||||||
},
|
|
||||||
"client.microphone.stream_start": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.MicPhoneService",
|
|
||||||
"method": "StreamAudio"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "stream_started",
|
|
||||||
"implementation": "维护服务端麦克风音频接收会话并在客户端播放;启动/停止状态确认后继续流程。"
|
|
||||||
},
|
|
||||||
"client.microphone.stream_stop": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.MicPhoneService",
|
|
||||||
"method": "StreamAudio"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "stream_stopped",
|
|
||||||
"implementation": "维护服务端麦克风音频接收会话并在客户端播放;启动/停止状态确认后继续流程。"
|
|
||||||
},
|
|
||||||
"client.speaker.file_play": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.SpeakerService",
|
|
||||||
"method": "PlayAudio"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"path": {
|
|
||||||
"type": "string",
|
|
||||||
"minLength": 1,
|
|
||||||
"description": "服务端音频文件路径"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"path"
|
|
||||||
],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "path -> audio_path;不是上传本机文件。"
|
|
||||||
},
|
|
||||||
"client.speaker.file_stop": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.SpeakerService",
|
|
||||||
"method": "StopPlayback"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "停止服务端文件播放。"
|
|
||||||
},
|
|
||||||
"client.speaker.capture_stream_start": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.SpeakerService",
|
|
||||||
"method": "StreamAudio"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"inputDevice": {
|
|
||||||
"type": "string",
|
|
||||||
"minLength": 1
|
|
||||||
},
|
|
||||||
"sampleRate": {
|
|
||||||
"type": "integer",
|
|
||||||
"minimum": 8000,
|
|
||||||
"maximum": 192000
|
|
||||||
},
|
|
||||||
"channels": {
|
|
||||||
"type": "integer",
|
|
||||||
"minimum": 1,
|
|
||||||
"maximum": 8
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"required": [
|
|
||||||
"inputDevice",
|
|
||||||
"sampleRate",
|
|
||||||
"channels"
|
|
||||||
],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "stream_started",
|
|
||||||
"implementation": "先建立扬声器发送流,再打开当前客户端本机麦克风采集PCM并编码为Proto音频帧传输;设备名属于当前客户端,网页端需由用户授权浏览器麦克风并提供对应适配,不能直接使用Qt音频设备名。"
|
|
||||||
},
|
|
||||||
"client.speaker.stream_start": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.SpeakerService",
|
|
||||||
"method": "StreamAudio"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "stream_started",
|
|
||||||
"implementation": "开始仅建立发送会话,不自动产生音频;停止会停止本地音源并结束发送会话。"
|
|
||||||
},
|
|
||||||
"client.speaker.stream_stop": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.SpeakerService",
|
|
||||||
"method": "StreamAudio"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "stream_stopped",
|
|
||||||
"implementation": "开始仅建立发送会话,不自动产生音频;停止会停止本地音源并结束发送会话。"
|
|
||||||
},
|
|
||||||
"client.biohead.happy": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.BioHeadService",
|
|
||||||
"method": "Happy"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "调用服务端预设操作;说话动作不等于音频播放,状态查询不保证包含真实舵机状态,成功不保证物理动作已到位。"
|
|
||||||
},
|
|
||||||
"client.biohead.surprise": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.BioHeadService",
|
|
||||||
"method": "Surprise"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "调用服务端预设操作;说话动作不等于音频播放,状态查询不保证包含真实舵机状态,成功不保证物理动作已到位。"
|
|
||||||
},
|
|
||||||
"client.biohead.tired": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.BioHeadService",
|
|
||||||
"method": "ExpressionTired"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "调用服务端预设操作;说话动作不等于音频播放,状态查询不保证包含真实舵机状态,成功不保证物理动作已到位。"
|
|
||||||
},
|
|
||||||
"client.biohead.angry": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.BioHeadService",
|
|
||||||
"method": "ExpressionAngry"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "调用服务端预设操作;说话动作不等于音频播放,状态查询不保证包含真实舵机状态,成功不保证物理动作已到位。"
|
|
||||||
},
|
|
||||||
"client.biohead.sad": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.BioHeadService",
|
|
||||||
"method": "ExpressionSadness"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "调用服务端预设操作;说话动作不等于音频播放,状态查询不保证包含真实舵机状态,成功不保证物理动作已到位。"
|
|
||||||
},
|
|
||||||
"client.biohead.yawn": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.BioHeadService",
|
|
||||||
"method": "ExpressionYawn"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "调用服务端预设操作;说话动作不等于音频播放,状态查询不保证包含真实舵机状态,成功不保证物理动作已到位。"
|
|
||||||
},
|
|
||||||
"client.biohead.speak_start": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.BioHeadService",
|
|
||||||
"method": "SpeakStart"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "调用服务端预设操作;说话动作不等于音频播放,状态查询不保证包含真实舵机状态,成功不保证物理动作已到位。"
|
|
||||||
},
|
|
||||||
"client.biohead.speak_stop": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.BioHeadService",
|
|
||||||
"method": "SpeakStop"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "调用服务端预设操作;说话动作不等于音频播放,状态查询不保证包含真实舵机状态,成功不保证物理动作已到位。"
|
|
||||||
},
|
|
||||||
"client.biohead.emergency_stop": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.BioHeadService",
|
|
||||||
"method": "EmergencyStop"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "调用服务端预设操作;说话动作不等于音频播放,状态查询不保证包含真实舵机状态,成功不保证物理动作已到位。"
|
|
||||||
},
|
|
||||||
"client.biohead.check": {
|
|
||||||
"rpc": {
|
|
||||||
"service": "cmvr.api.BioHeadService",
|
|
||||||
"method": "GetSystemStatus"
|
|
||||||
},
|
|
||||||
"parametersSchema": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {},
|
|
||||||
"required": [],
|
|
||||||
"additionalProperties": false
|
|
||||||
},
|
|
||||||
"successMeaning": "rpc_response",
|
|
||||||
"implementation": "调用服务端预设操作;说话动作不等于音频播放,状态查询不保证包含真实舵机状态,成功不保证物理动作已到位。"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,315 +0,0 @@
|
|||||||
{
|
|
||||||
"operations": {
|
|
||||||
"ControlHeadJoints": "控制头部关节",
|
|
||||||
"GetHeadJointState": "查询头部关节状态",
|
|
||||||
"SetHeadExpression": "设置头部关节表情",
|
|
||||||
"PlayHeadExpression": "播放头部预设表情",
|
|
||||||
"torqueOff": "去使能",
|
|
||||||
"torqueOn": "使能",
|
|
||||||
"clearFault": "清除故障",
|
|
||||||
"moveJPose": "末端位姿关节运动",
|
|
||||||
"moveJ": "关节角度运动",
|
|
||||||
"moveL": "末端直线运动",
|
|
||||||
"ListBaseFrame": "查询参考坐标系",
|
|
||||||
"ListTCPFrame": "查询工具坐标系",
|
|
||||||
"speedJ": "关节速度控制",
|
|
||||||
"speedL": "末端速度控制",
|
|
||||||
"servoJ": "关节伺服控制",
|
|
||||||
"stopMotion": "停止运动",
|
|
||||||
"GetArmInfo": "查询机械臂信息",
|
|
||||||
"getJointState": "查询关节状态",
|
|
||||||
"getRobotState": "查询机器人状态",
|
|
||||||
"getPose": "查询末端位姿",
|
|
||||||
"calibrateZeroQ": "校准零位",
|
|
||||||
"getPoseMatrix": "查询位姿矩阵",
|
|
||||||
"computeForwardKinematics": "计算正运动学",
|
|
||||||
"ExecuteJsonCommand": "设备扩展指令",
|
|
||||||
"EnterTeachingMode": "进入拖动示教",
|
|
||||||
"StartTrajectoryRecording": "开始录制轨迹",
|
|
||||||
"CompleteTeaching": "完成示教",
|
|
||||||
"StopTrajectoryRecording": "停止录制轨迹",
|
|
||||||
"ExitTeachingMode": "退出拖动示教",
|
|
||||||
"ListRecordedTrajectories": "查询已录制轨迹",
|
|
||||||
"MoveToTrajectoryStart": "移动到轨迹起点",
|
|
||||||
"ReplayRecordedTrajectory": "回放轨迹",
|
|
||||||
"CalibrateUserCoordinateSystem": "标定工件坐标系",
|
|
||||||
"CreateUserCoordinateSystem": "创建工件坐标系",
|
|
||||||
"GetUserCoordinateSystem": "查询工件坐标系",
|
|
||||||
"ListUserCoordinateSystems": "查询全部工件坐标系",
|
|
||||||
"UpdateUserCoordinateSystem": "修改工件坐标系",
|
|
||||||
"DeleteUserCoordinateSystem": "删除工件坐标系",
|
|
||||||
"ApplyUserCoordinateSystem": "应用工件坐标系",
|
|
||||||
"GetStatus": "查询设备状态",
|
|
||||||
"StartCamera": "启动相机",
|
|
||||||
"StopCamera": "关闭相机",
|
|
||||||
"GetRGBImage": "采集彩色图像",
|
|
||||||
"GetDepthImage": "采集深度图像",
|
|
||||||
"GetRGBDImages": "采集彩色与深度图像",
|
|
||||||
"StartRecording": "开始录像",
|
|
||||||
"StopRecording": "停止录像",
|
|
||||||
"ControlPtz": "云台控制",
|
|
||||||
"getRuntimeState": "查询底盘运行状态",
|
|
||||||
"getNavigationStatus": "查询导航状态",
|
|
||||||
"emergencyStop": "紧急停止",
|
|
||||||
"relocalize": "重新定位",
|
|
||||||
"navigateToPose": "导航到目标位姿",
|
|
||||||
"navigateToStation": "导航到站点",
|
|
||||||
"followPath": "沿路径导航",
|
|
||||||
"pauseNavigation": "暂停导航",
|
|
||||||
"resumeNavigation": "继续导航",
|
|
||||||
"cancelNavigation": "取消导航",
|
|
||||||
"setVelocity": "底盘速度控制",
|
|
||||||
"stopVelocityControl": "停止速度控制",
|
|
||||||
"listMaps": "查询地图",
|
|
||||||
"listStations": "查询站点",
|
|
||||||
"switchMap": "切换地图",
|
|
||||||
"uploadMap": "上传地图",
|
|
||||||
"downloadMap": "下载地图",
|
|
||||||
"startMapping": "开始建图",
|
|
||||||
"stopMapping": "停止建图",
|
|
||||||
"translate": "底盘平移",
|
|
||||||
"SetDexHandPos": "设置手指位置",
|
|
||||||
"SetDexHandAngle": "设置手指角度",
|
|
||||||
"SetDexHandForce": "设置手指力度",
|
|
||||||
"SetDexHandSpeed": "设置手指速度",
|
|
||||||
"SetDexHandPresetAct": "执行手部预设动作",
|
|
||||||
"GetSensorData": "读取触觉传感器",
|
|
||||||
"StartRecord": "开始录音",
|
|
||||||
"StopRecord": "停止录音",
|
|
||||||
"PauseRecord": "暂停录音",
|
|
||||||
"ResumeRecord": "继续录音",
|
|
||||||
"SetVolume": "设置音量",
|
|
||||||
"GetVolume": "查询音量",
|
|
||||||
"PlayAudio": "播放服务端音频",
|
|
||||||
"StopPlayback": "停止播放",
|
|
||||||
"PausePlayback": "暂停播放",
|
|
||||||
"ResumePlayback": "继续播放",
|
|
||||||
"SetExpression": "设置面部表情",
|
|
||||||
"GetSystemStatus": "查询仿生头状态",
|
|
||||||
"EmergencyStop": "紧急停止",
|
|
||||||
"SpeakStart": "开始说话动作",
|
|
||||||
"SpeakStop": "停止说话动作",
|
|
||||||
"Happy": "高兴表情",
|
|
||||||
"Surprise": "惊讶表情",
|
|
||||||
"ExpressionTired": "疲惫表情",
|
|
||||||
"ExpressionAngry": "愤怒表情",
|
|
||||||
"ExpressionSadness": "悲伤表情",
|
|
||||||
"ExpressionYawn": "打哈欠表情",
|
|
||||||
"ListMotors": "查询电机列表",
|
|
||||||
"GetInfo": "查询电机信息",
|
|
||||||
"GetState": "查询电机状态",
|
|
||||||
"getMode": "查询控制模式",
|
|
||||||
"getQ": "查询位置",
|
|
||||||
"getQd": "查询速度",
|
|
||||||
"getTau": "查询力矩",
|
|
||||||
"reachedTargetQ": "查询是否到位",
|
|
||||||
"setMode": "设置控制模式",
|
|
||||||
"brakeRelease": "松开抱闸",
|
|
||||||
"quickStop": "快速停止",
|
|
||||||
"commandProfilePosition": "轮廓位置控制",
|
|
||||||
"commandProfileVelocity": "轮廓速度控制",
|
|
||||||
"commandProfileTorque": "轮廓力矩控制",
|
|
||||||
"commandCyclicPosition": "周期位置控制",
|
|
||||||
"commandCyclicVelocity": "周期速度控制",
|
|
||||||
"commandCyclicTorque": "周期力矩控制",
|
|
||||||
"setLimitQ": "设置位置限位",
|
|
||||||
"setLimitQd": "设置速度限值",
|
|
||||||
"setLimitQdd": "设置加速度限值"
|
|
||||||
},
|
|
||||||
"fields": {
|
|
||||||
"cancel_expression": "取消后续表情帧",
|
|
||||||
"constraints": "关节运动约束",
|
|
||||||
"expression_id": "表情编号",
|
|
||||||
"expression_name": "表情名称",
|
|
||||||
"gain": "位置增益",
|
|
||||||
"home": "移动到初始位置",
|
|
||||||
"max_acceleration_rad_s2": "最大加速度(rad/s²)",
|
|
||||||
"max_jerk_rad_s3": "最大加加速度(rad/s³)",
|
|
||||||
"max_velocity_rad_s": "最大速度(rad/s)",
|
|
||||||
"move": "关节目标运动",
|
|
||||||
"period_ms": "更新周期(毫秒)",
|
|
||||||
"position_gain": "关节位置增益",
|
|
||||||
"position_rad": "目标角度(rad)",
|
|
||||||
"reconnect": "重新连接并探测设备",
|
|
||||||
"targets": "关节目标列表",
|
|
||||||
"transition_duration_s": "表情过渡时长(秒)",
|
|
||||||
"update_period": "设备更新周期",
|
|
||||||
"acceleration": "加速度",
|
|
||||||
"action": "动作",
|
|
||||||
"adapter_params": "驱动专用选项",
|
|
||||||
"asynchronous": "发送后立即返回",
|
|
||||||
"audio": "音频帧",
|
|
||||||
"audio_path": "服务端音频路径",
|
|
||||||
"base_frame": "参考坐标系",
|
|
||||||
"base_link": "参考坐标系",
|
|
||||||
"base_tcp_pose": "基座下的工具位姿",
|
|
||||||
"blend_radius": "轨迹衔接半径",
|
|
||||||
"blocked_timeout_ms": "阻塞超时(毫秒)",
|
|
||||||
"calibration_points": "标定采样点",
|
|
||||||
"calibration_version": "标定记录版本",
|
|
||||||
"channels": "声道数",
|
|
||||||
"codec": "编码格式",
|
|
||||||
"command": "控制指令",
|
|
||||||
"command_id": "本次调用标识",
|
|
||||||
"content": "地图文件内容",
|
|
||||||
"coordinate": "工件坐标系记录",
|
|
||||||
"coordinate_relative_translation": "沿工件坐标系增量平移",
|
|
||||||
"corner_x": "嘴角左右",
|
|
||||||
"corner_y": "嘴角上下",
|
|
||||||
"data": "二进制数据",
|
|
||||||
"device_id": "目标设备",
|
|
||||||
"dimension": "地图维度",
|
|
||||||
"distance": "移动距离(米)",
|
|
||||||
"duration": "持续时间(秒)",
|
|
||||||
"ee_link": "末端坐标系",
|
|
||||||
"eof": "结束数据流",
|
|
||||||
"expected_device_generation": "预期设备实例编号",
|
|
||||||
"expected_revision": "预期记录版本(0 为最新)",
|
|
||||||
"expected_service_instance_id": "预期服务实例标识",
|
|
||||||
"expr": "表情名称",
|
|
||||||
"expression": "表情参数",
|
|
||||||
"eyeball": "眼球",
|
|
||||||
"eyebrow": "眉毛",
|
|
||||||
"eyelid": "眼睑",
|
|
||||||
"file_name": "轨迹文件名",
|
|
||||||
"file_path": "服务端录音路径",
|
|
||||||
"format": "音频格式",
|
|
||||||
"frame": "参考坐标系",
|
|
||||||
"header": "调用信息",
|
|
||||||
"id": "通道编号",
|
|
||||||
"incremental": "使用增量目标",
|
|
||||||
"jaw": "下颌",
|
|
||||||
"jerk": "加加速度",
|
|
||||||
"joint_name": "关节名称",
|
|
||||||
"joint_velocity_limits": "各关节速度限制",
|
|
||||||
"joints": "关节目标",
|
|
||||||
"key": "选项名称",
|
|
||||||
"left_inside_y": "左侧内缘上下",
|
|
||||||
"left_lip": "左唇",
|
|
||||||
"left_lower_y": "左侧下缘上下",
|
|
||||||
"left_outside_y": "左侧外缘上下",
|
|
||||||
"left_upper_y": "左侧上缘上下",
|
|
||||||
"left_x": "左侧左右",
|
|
||||||
"left_y": "左侧上下",
|
|
||||||
"lower": "下限",
|
|
||||||
"lower_lip_y": "下唇上下",
|
|
||||||
"lower_lip_z": "下唇前后",
|
|
||||||
"lower_x": "下缘左右",
|
|
||||||
"lower_y": "下缘上下",
|
|
||||||
"map_name": "地图名称",
|
|
||||||
"max_acceleration": "最大线加速度(米/秒²)",
|
|
||||||
"max_angular_acceleration": "最大角加速度(弧度/秒²)",
|
|
||||||
"max_angular_speed": "最大角速度(弧度/秒)",
|
|
||||||
"max_chunk_bytes": "单块大小上限(字节)",
|
|
||||||
"max_jerk": "最大加加速度",
|
|
||||||
"max_speed": "最大移动速度(米/秒)",
|
|
||||||
"max_velocity": "最大速度",
|
|
||||||
"mode": "控制模式",
|
|
||||||
"mouth": "嘴部",
|
|
||||||
"name": "名称",
|
|
||||||
"nanos": "纳秒部分",
|
|
||||||
"nb_samples": "每帧采样数",
|
|
||||||
"node_id": "电机节点编号",
|
|
||||||
"nose": "鼻部",
|
|
||||||
"options": "运动设置",
|
|
||||||
"path": "导航路径点",
|
|
||||||
"poll_interval_ms": "状态检查间隔(毫秒)",
|
|
||||||
"pose": "目标位姿",
|
|
||||||
"position": "关节位置",
|
|
||||||
"presetActId": "预设动作编号",
|
|
||||||
"pts": "帧时间戳",
|
|
||||||
"q": "目标位置(弧度)",
|
|
||||||
"qd": "目标速度(弧度/秒)",
|
|
||||||
"qdd": "目标加速度(弧度/秒²)",
|
|
||||||
"reach_angle": "到位角度容差(弧度)",
|
|
||||||
"reach_distance": "到位距离容差(米)",
|
|
||||||
"real_time": "实时模式",
|
|
||||||
"request_json": "驱动扩展指令内容(JSON)",
|
|
||||||
"require_metric_depth": "要求以米标定的深度数据",
|
|
||||||
"resume_token": "断点续传标识",
|
|
||||||
"revision": "记录版本",
|
|
||||||
"right_inside_y": "右侧内缘上下",
|
|
||||||
"right_lip": "右唇",
|
|
||||||
"right_lower_y": "右侧下缘上下",
|
|
||||||
"right_outside_y": "右侧外缘上下",
|
|
||||||
"right_upper_y": "右侧上缘上下",
|
|
||||||
"right_x": "右侧左右",
|
|
||||||
"right_y": "右侧上下",
|
|
||||||
"rx": "绕 X 轴旋转(弧度)",
|
|
||||||
"ry": "绕 Y 轴旋转(弧度)",
|
|
||||||
"rz": "绕 Z 轴旋转(弧度)",
|
|
||||||
"sample_rate": "采样率(赫兹)",
|
|
||||||
"sampling_frequency_hz": "轨迹采样频率(赫兹)",
|
|
||||||
"seconds": "秒",
|
|
||||||
"snapshot": "地图快照",
|
|
||||||
"source_station": "起始站点",
|
|
||||||
"target": "运动目标",
|
|
||||||
"target_station": "目标站点",
|
|
||||||
"tau": "目标力矩(额定力矩千分比)",
|
|
||||||
"tcp_frame": "工具坐标系",
|
|
||||||
"tcp_offset": "工具偏移量",
|
|
||||||
"theta": "平面朝向(弧度)",
|
|
||||||
"timestamp": "调用时间",
|
|
||||||
"torque_slope": "力矩变化率",
|
|
||||||
"translation": "位移量",
|
|
||||||
"upper": "上限",
|
|
||||||
"upper_lip_y": "上唇上下",
|
|
||||||
"upper_lip_z": "上唇前后",
|
|
||||||
"upper_x": "上缘左右",
|
|
||||||
"upper_y": "上缘上下",
|
|
||||||
"user_coordinate_name": "已应用工件坐标系名称",
|
|
||||||
"user_coordinate_revision": "工件坐标系版本(0 为最新)",
|
|
||||||
"user_frame_pose": "工件坐标系位姿",
|
|
||||||
"user_pose": "工件坐标系内的目标位姿",
|
|
||||||
"valid_for_ms": "指令有效期(毫秒)",
|
|
||||||
"value": "目标值",
|
|
||||||
"values": "各通道目标值",
|
|
||||||
"velocity": "速度",
|
|
||||||
"video_path": "服务端录像路径",
|
|
||||||
"volume": "音量",
|
|
||||||
"vx": "X 方向线速度(米/秒)",
|
|
||||||
"vy": "Y 方向线速度(米/秒)",
|
|
||||||
"vz": "Z 方向线速度(米/秒)",
|
|
||||||
"wait_timeout_ms": "等待完成超时(毫秒)",
|
|
||||||
"wx": "绕 X 轴角速度(弧度/秒)",
|
|
||||||
"wy": "绕 Y 轴角速度(弧度/秒)",
|
|
||||||
"wz": "绕 Z 轴角速度(弧度/秒)",
|
|
||||||
"x": "X 位置(米)",
|
|
||||||
"y": "Y 位置(米)",
|
|
||||||
"z": "Z 位置(米)",
|
|
||||||
"speed_ratio": "轨迹回放速度倍率",
|
|
||||||
"speed": "速度(设备单位)",
|
|
||||||
"station_id": "目标站点编号"
|
|
||||||
},
|
|
||||||
"enums": {
|
|
||||||
"START": "开始",
|
|
||||||
"STOP": "停止",
|
|
||||||
"COMMAND_UNSPECIFIED": "未指定",
|
|
||||||
"TILT_UP": "向上",
|
|
||||||
"TILT_DOWN": "向下",
|
|
||||||
"PAN_LEFT": "向左",
|
|
||||||
"PAN_RIGHT": "向右",
|
|
||||||
"UP_LEFT": "左上",
|
|
||||||
"UP_RIGHT": "右上",
|
|
||||||
"DOWN_LEFT": "左下",
|
|
||||||
"DOWN_RIGHT": "右下",
|
|
||||||
"ZOOM_IN": "放大",
|
|
||||||
"ZOOM_OUT": "缩小",
|
|
||||||
"PAN_AUTO": "自动巡航",
|
|
||||||
"AGV_MAP_DIMENSION_UNSPECIFIED": "使用默认地图维度",
|
|
||||||
"AGV_MAP_2D": "二维地图",
|
|
||||||
"AGV_MAP_3D": "三维地图",
|
|
||||||
"AGV_MAP_2D_AND_3D": "二维及三维地图",
|
|
||||||
"AGV_TRANSLATION_MODE_ODOMETRY": "按里程计平移",
|
|
||||||
"AGV_TRANSLATION_MODE_LOCALIZATION": "按定位坐标平移",
|
|
||||||
"ARM_FRAME_BASE": "基座坐标系",
|
|
||||||
"ARM_FRAME_TOOL": "工具坐标系",
|
|
||||||
"ARM_FRAME_WORLD": "世界坐标系",
|
|
||||||
"ARM_FRAME_USER": "用户坐标系",
|
|
||||||
"PCM": "原始 PCM 音频",
|
|
||||||
"MP3": "MP3 音频",
|
|
||||||
"WAV": "WAV 音频",
|
|
||||||
"AAC": "AAC 音频",
|
|
||||||
"OPUS": "Opus 音频"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
The original web SVGs are copied without rasterization from the local am-freescan
|
|
||||||
reference project: am-web/src/cmvr/common/views/flow/icon/. The additional arm.svg,
|
|
||||||
agv.svg and hand.svg use device-specific shapes in the same palette; the arm is
|
|
||||||
not represented by the web project's legacy video-camera icon.
|
|
||||||
|
|
||||||
The Qt workflow canvas renders the source paths with QSvgRenderer, preserving
|
|
||||||
their original colors and geometry at the current canvas zoom and screen DPI.
|
|
||||||
The workflow node style follows NodeTitle.vue (36px badge, 22px icon, 15px title).
|
|
||||||
@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect width="24" height="24" rx="7" fill="#65bee0"/><g fill="none" stroke="#fff" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="9" width="14" height="8" rx="2"/><path d="M8 9V6h8v3M8 17v2m8-2v2M8 13h1m6 0h1M10 6V4h4v2"/></g></svg>
|
|
||||||
|
Before Width: | Height: | Size: 325 B |
@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect width="24" height="24" rx="7" fill="#65bee0"/><g fill="none" stroke="#fff" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><path d="M5 19h14M8 19v-3l5-5-4-4M13 11l3 2 3-3M16 13v3m3-6 1 2"/><circle cx="8" cy="6" r="2"/><circle cx="13" cy="11" r="1.5"/><path d="M8 16h5v3"/></g></svg>
|
|
||||||
|
Before Width: | Height: | Size: 367 B |
@ -1 +0,0 @@
|
|||||||
<svg t="1758526814700" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11094" width="200" height="200"><path d="M983.779623 312.719408a510.292483 510.292483 0 0 0-109.795373-162.701951A511.088926 511.088926 0 0 0 512.000853 0.001707a508.756485 508.756485 0 0 0-361.983396 150.01575A511.088926 511.088926 0 0 0 0.001707 512.000853a508.756485 508.756485 0 0 0 150.01575 361.983397 511.088926 511.088926 0 0 0 162.701951 109.738484c63.089673 26.680844 130.161561 40.163489 199.281445 40.163488a508.756485 508.756485 0 0 0 199.281446-40.163488 508.358264 508.358264 0 0 0 162.701951-109.738484 511.088926 511.088926 0 0 0 109.738484-162.701951c26.680844-63.089673 40.163489-130.161561 40.163488-199.281446a508.642708 508.642708 0 0 0-40.106599-199.281445z m-55.295908 375.181597a451.583247 451.583247 0 0 1-96.881617 143.701093 451.583247 451.583247 0 0 1-143.701093 96.881617c-55.751018 23.60885-114.915364 35.498608-175.900152 35.498607a448.397475 448.397475 0 0 1-175.900151-35.498607 451.583247 451.583247 0 0 1-143.701094-96.881617 451.583247 451.583247 0 0 1-96.881616-143.701093A448.397475 448.397475 0 0 1 60.019384 512.000853c0-60.984787 11.889758-120.206022 35.498608-175.900151 22.755518-53.816799 55.409685-102.172274 96.881616-143.701094a451.583247 451.583247 0 0 1 143.701094-96.881616A448.397475 448.397475 0 0 1 512.000853 60.019384c60.984787 0 120.206022 11.889758 175.900152 35.498608 53.816799 22.755518 102.172274 55.409685 143.701093 96.881616 41.52882 41.52882 74.126099 89.884295 96.881617 143.701094 23.60885 55.751018 35.498608 114.915364 35.498607 175.900151s-11.889758 120.206022-35.498607 175.900152z" fill="#65BEE0" p-id="11095"></path><path d="M263.965711 416.029458a30.094172 30.094172 0 0 0-29.980394 29.980394v131.982002a30.094172 30.094172 0 0 0 60.017677 0V446.009852a30.094172 30.094172 0 0 0-29.980394-29.980394z m124.017571-63.999894a30.094172 30.094172 0 0 0-29.980394 29.980395v259.981789c0 16.49775 13.482644 29.980394 29.980394 29.980394 16.49775 0 30.037283-13.482644 30.037284-29.980394v-259.981789a30.094172 30.094172 0 0 0-30.037284-29.980395zM512.000853 256.00128a30.094172 30.094172 0 0 0-29.980394 29.980394v452.038358c0 16.49775 13.482644 29.980394 29.980394 29.980395 16.49775 0 29.980394-13.482644 29.980395-29.980395V285.981674A30.094172 30.094172 0 0 0 512.000853 256.00128z m248.035142 160.028178a30.094172 30.094172 0 0 0-30.037283 29.980394v131.982002c0 16.49775 13.482644 29.980394 29.980395 29.980395 16.49775 0 30.037283-13.482644 30.037283-29.980395V446.009852a30.094172 30.094172 0 0 0-30.037283-29.980394z m-124.017571-63.999894a30.094172 30.094172 0 0 0-30.037283 29.980395v259.981789a30.094172 30.094172 0 0 0 60.017678 0v-259.981789a30.094172 30.094172 0 0 0-29.980395-29.980395z" fill="#65BEE0" p-id="11096"></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.8 KiB |
@ -1 +0,0 @@
|
|||||||
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1751611040437" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="11706" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M721.6896 390.4512H629.952c-7.36-0.059733-13.9008-3.8912-17.117867-9.992533l-33.9072-62.916267H445.073067L411.144533 380.501333c-3.2 6.058667-9.736533 9.890133-17.0496 9.949867H302.3104c-25.984 0-46.3488 18.875733-46.3488 42.973867v230.8736c0 24.085333 20.356267 42.965333 46.3488 42.965333h419.383467c26.001067 0 46.357333-18.884267 46.357333-42.965333V433.425067c-0.008533-24.098133-20.360533-42.973867-46.3616-42.973867zM512 688.1152c-82.824533 0-150.212267-62.468267-150.212267-139.2512C361.787733 472.072533 429.175467 409.6 512 409.6c82.833067 0 150.2336 62.472533 150.2336 139.268267 0 76.782933-67.400533 139.246933-150.2336 139.246933z" fill="#65BEE0" p-id="11707"></path><path d="M512 0C229.2224 0 0 229.230933 0 512c0 282.7648 229.2224 512 512 512 282.781867 0 512-229.2352 512-512C1024 229.230933 794.781867 0 512 0zM292.974933 298.734933c0-3.106133 2.722133-5.6192 6.058667-5.6192h24.840533c3.3536 0 6.058667 2.5088 6.058667 5.6192v23.022934c0 3.106133-2.7136 5.614933-6.058667 5.614933h-24.840533c-3.336533 0-6.058667-2.513067-6.058667-5.614933v-23.022934zM806.4 664.298667c0 43.285333-37.998933 78.4896-84.7104 78.4896H302.3104C255.598933 742.792533 217.6 707.584 217.6 664.298667V433.425067C217.6 390.126933 255.598933 354.901333 302.3104 354.901333h79.803733l34.154667-63.1552c2.999467-5.504 8.708267-9.122133 15.291733-9.710933a15.581867 15.581867 0 0 1 1.979734-0.0256h157.102933c7.240533 0 13.768533 3.720533 17.066667 9.7024l34.176 63.189333h79.799466c46.715733 0 84.714667 35.2256 84.714667 78.523734v230.8736z" fill="#65BEE0" p-id="11708"></path><path d="M512 445.124267c-29.9776 0-58.0864 10.773333-79.189333 30.331733-21.085867 19.549867-32.699733 45.623467-32.699734 73.408s11.613867 53.8496 32.699734 73.399467c21.098667 19.5584 49.207467 30.331733 79.189333 30.331733 29.981867 0 58.082133-10.773333 79.185067-30.331733s32.7168-45.623467 32.7168-73.399467c0-27.784533-11.618133-53.8496-32.7168-73.408-21.085867-19.554133-49.2032-30.331733-79.185067-30.331733zM609.809067 549.333333c-0.174933 9.642667-8.759467 17.493333-19.1488 17.493334h-0.290134c-5.1328-0.0768-9.915733-1.992533-13.482666-5.410134-3.549867-3.383467-5.474133-7.867733-5.4016-12.599466 0-14.784-6.173867-28.6336-17.348267-39.0016-11.157333-10.333867-26.048-16.055467-41.9456-16.1024-10.487467 0.580267-19.524267-6.8864-20.2496-16.520534-0.3584-4.7232 1.288533-9.309867 4.650667-12.898133 3.362133-3.605333 8.021333-5.764267 13.141333-6.097067 0.827733-0.059733 1.646933-0.059733 2.466133-0.017066 53.853867 0.093867 97.621333 40.7296 97.621334 90.670933v0.482133h-0.0128z" fill="#65BEE0" p-id="11709"></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.9 KiB |
@ -1 +0,0 @@
|
|||||||
<svg class="llm-icon llm-icon-workflow-end " width="1em" height="1em" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20"><rect width="20" height="20" fill="#65BEE0" rx="6"></rect><path fill="#fff" d="M13.143 5.858c.368.261.695.557.98.888.287.331.532.689.736 1.073a5.41 5.41 0 0 1 .625 2.524 5.3 5.3 0 0 1-.435 2.139 5.594 5.594 0 0 1-1.176 1.74 5.597 5.597 0 0 1-1.74 1.176 5.296 5.296 0 0 1-2.14.435c-.75 0-1.46-.145-2.125-.435a5.67 5.67 0 0 1-1.747-1.176 5.459 5.459 0 0 1-1.176-1.74 5.36 5.36 0 0 1-.429-2.139c0-.433.051-.858.153-1.274a5.65 5.65 0 0 1 .435-1.189c.188-.376.421-.727.699-1.054.278-.327.588-.62.931-.882a.755.755 0 0 1 .582-.147.769.769 0 0 1 .509.306c.13.172.18.364.147.576a.773.773 0 0 1-.306.515 3.804 3.804 0 0 0-1.183 1.384 3.892 3.892 0 0 0-.41 1.765c0 .54.101 1.048.306 1.526a3.937 3.937 0 0 0 2.09 2.095c.477.209.985.313 1.525.313.539 0 1.047-.104 1.525-.313.478-.208.895-.49 1.25-.845.356-.356.638-.772.846-1.25.208-.478.313-.987.313-1.526 0-.637-.148-1.24-.442-1.807a3.823 3.823 0 0 0-1.237-1.404.738.738 0 0 1-.325-.502.774.774 0 0 1 .129-.588.75.75 0 0 1 .502-.313.774.774 0 0 1 .588.129Zm-3.15 4.522a.743.743 0 0 1-.544-.227.744.744 0 0 1-.227-.545V4.95a.76.76 0 0 1 .227-.551.733.733 0 0 1 .545-.233c.22 0 .406.077.557.232a.763.763 0 0 1 .227.552v4.657a.743.743 0 0 1-.227.545.758.758 0 0 1-.557.227Z"></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.3 KiB |
@ -1 +0,0 @@
|
|||||||
<svg t="1762999534829" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4760" width="200" height="200"><path d="M512 979C263.472 979 62 777.528 62 529S263.472 79 512 79s450 201.472 450 450-201.472 450-450 450zM337 479c41.421 0 75-33.579 75-75s-33.579-75-75-75-75 33.579-75 75 33.579 75 75 75z m350 0c41.421 0 75-33.579 75-75s-33.579-75-75-75-75 33.579-75 75 33.579 75 75 75zM312 629c0 110.457 89.543 200 200 200s200-89.543 200-200H312z" fill="#65BEE0" p-id="4761"></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 520 B |
@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect width="24" height="24" rx="7" fill="#65bee0"/><path d="M8 12V7a1 1 0 0 1 2 0v4-6a1 1 0 0 1 2 0v6-5a1 1 0 0 1 2 0v5-3a1 1 0 0 1 2 0v6l1-2a1.2 1.2 0 0 1 2 1l-2 5a4 4 0 0 1-4 2h-2a4 4 0 0 1-4-3l-2-4a1 1 0 0 1 2-1l1 2" fill="none" stroke="#fff" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 381 B |
@ -1 +0,0 @@
|
|||||||
<svg class="llm-icon llm-icon-cycle-vertices " width="1em" height="1em" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20"><rect width="20" height="20" fill="#65BEE0" rx="6"></rect><path fill="#fff" fill-rule="evenodd" d="M15.7028 9.15436C15.7418 9.67543 15.7028 10.8288 15.5783 11.3128L17.5 11.5591L15.447 12.8685L13.3941 14.1797L11.8043 12.3341L10.2135 10.4894L12.6676 10.748C12.7142 10.4456 12.739 10.1376 12.7371 9.82282C12.7199 7.26403 10.3951 5.10365 8.10917 4.31062C11.1453 3.53947 15.4252 5.38796 15.7028 9.15436ZM4.23534 10.689C4.21062 10.1679 4.27718 9.01452 4.41505 8.53528L2.5 8.23956L4.58621 6.98061L6.67147 5.72356L8.21378 7.60913L9.75609 9.49186L7.3095 9.17427C7.2553 9.47379 7.22297 9.78187 7.21632 10.0966C7.16877 12.6545 9.43755 14.8719 11.7035 15.7239C8.64928 16.417 4.41695 14.4621 4.23534 10.689Z" clip-rule="evenodd"></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 868 B |
@ -1,4 +0,0 @@
|
|||||||
<svg t="1754641759358" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6343" width="200" height="200">
|
|
||||||
<path d="M512 512m-512 0a512 512 0 1 0 1024 0 512 512 0 1 0-1024 0Z" fill="#65BEE0" p-id="6344"></path>
|
|
||||||
<path d="M512 691.2c-112.64 0-204.8-92.16-204.8-204.8v-25.6c0-7.68 5.12-12.8 12.8-12.8s12.8 5.12 12.8 12.8V485.12c0 98.56 80.64 179.2 179.2 179.2s179.2-80.64 179.2-179.2v-23.04-1.28c0-7.68 5.12-12.8 12.8-12.8s12.8 5.12 12.8 12.8v25.6c0 112.64-92.16 204.8-204.8 204.8z m12.8 38.4h38.4c7.68 0 12.8 5.12 12.8 12.8s-5.12 12.8-12.8 12.8h-102.4c-7.68 0-12.8-5.12-12.8-12.8s5.12-12.8 12.8-12.8h38.4v-38.4h25.6v38.4z m-12.8-89.6c-84.48 0-153.6-69.12-153.6-153.6v-64c0-84.48 69.12-153.6 153.6-153.6s153.6 69.12 153.6 153.6v64c0 84.48-69.12 153.6-153.6 153.6z" fill="#fff" p-id="6345">
|
|
||||||
</path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 840 B |
@ -1 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" fill="none" stroke="#1677ff" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><rect x="8" y="13" width="27" height="24" rx="5"/><path d="M35 21h8v8h-8M13 37v5h17v-5M14 8h14M15 20v10M22 20v10M29 20v10"/></svg>
|
|
||||||
|
Before Width: | Height: | Size: 284 B |
@ -1 +0,0 @@
|
|||||||
<svg t="1758526128932" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2666" width="200" height="200"><path d="M512 575.146667c-10.922667 0-21.845333-2.730667-31.402667-8.192L352.426667 494.933333l-48.810667 27.477334L512 639.658667l208.384-117.248L671.573333 494.933333l-128.170666 72.192c-9.557333 5.290667-20.48 8.021333-31.402667 8.021334z" fill="#65BEE0" p-id="2667"></path><path d="M512 708.437333c-10.922667 0-21.845333-2.730667-31.402667-8.192l-146.432-82.432-30.378666 17.237334L512 752.128l208.384-117.248-30.378667-17.237333-146.432 82.432c-9.728 5.632-20.650667 8.362667-31.573333 8.362666z" fill="#65BEE0" p-id="2668"></path><path d="M512 34.133333C248.149333 34.133333 34.133333 248.149333 34.133333 512s214.016 477.866667 477.866667 477.866667 477.866667-214.016 477.866667-477.866667S775.850667 34.133333 512 34.133333z m248.149333 432.128c20.138667 11.434667 32.768 32.768 32.768 55.978667 0 23.210667-12.458667 44.544-32.597333 55.978667l-0.853333 0.341333 0.682666 0.341333c20.138667 11.264 32.768 32.768 32.768 55.808 0 23.210667-12.458667 44.544-32.768 55.978667l-216.746666 122.026667a64.529067 64.529067 0 0 1-62.976 0l-216.746667-122.026667a64.494933 64.494933 0 0 1-32.768-55.978667c0-23.210667 12.629333-44.544 32.768-55.978666l0.682667-0.341334-0.682667-0.341333a64.494933 64.494933 0 0 1-32.768-55.978667c0-23.210667 12.629333-44.544 32.768-55.978666l18.944-10.581334-18.944-10.752a64.494933 64.494933 0 0 1-32.768-55.978666c0-23.210667 12.458667-44.544 32.768-55.978667l216.746667-122.026667c19.456-10.922667 43.52-10.922667 62.976 0l216.746666 122.026667c20.138667 11.434667 32.768 32.768 32.768 55.978667 0 23.210667-12.629333 44.544-32.768 55.978666l-18.944 10.752 18.944 10.752z" fill="#65BEE0" p-id="2669"></path><path d="M720.384 389.12L512 271.701333 303.616 389.12 512 506.368z" fill="#65BEE0" p-id="2670"></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 1.9 KiB |
@ -1 +0,0 @@
|
|||||||
<svg t="1754883869250" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6366" width="200" height="200"><path d="M511.942201 0.978972C230.218595 0.978972 1.018709 229.934416 1.018709 511.356985c0 281.420161 229.199886 510.373196 510.923492 510.373197 281.726014 0 510.921084-228.953036 510.921084-510.373197C1022.863285 229.934416 793.668215 0.978972 511.942201 0.978972z m84.587765 239.952925h133.102877c8.273699 0 15.674391 4.957476 18.846116 12.63151 3.140417 7.601785 1.293255 16.53054-4.591415 22.216526l-95.881467 94.255867h105.926467c11.23229 0 20.366955 9.139481 20.366955 20.366954 0 11.23229-9.134665 20.371771-20.366955 20.371772H598.204936c-8.273699 0-15.66837-4.957476-18.836483-12.624285-3.146438-7.604193-1.299275-16.532948 4.591415-22.218934l95.882671-94.260684h-83.312573c-11.226269 0-20.366955-9.139481-20.366955-20.366954 0-11.23229 9.140685-20.371771 20.366955-20.371772z m134.256451 490.555334c-58.528804 58.436085-136.258948 90.615729-218.863482 90.615728-82.637046 0-160.333474-32.182052-218.770763-90.615728-58.430064-58.5276-90.614525-136.222824-90.614525-218.770763 0-164.332448 128.456071-300.023039 292.439317-308.918078 0.356428-0.016858 0.704426-0.025287 1.048812-0.025287 5.907549 0 11.47312 2.498607 15.266185 6.862438 4.10494 4.721463 5.882262 10.910783 4.873186 16.980891a321.126932 321.126932 0 0 0-4.350586 52.586335c0 90.50856 20.866676 158.725936 60.345863 197.283951 27.012646 26.394918 63.881241 39.780224 109.590689 39.780224 1.812242 0 3.659405-0.025287 5.494526-0.065024 36.498922-0.829658 70.802682-15.056663 99.19769-41.144523 3.738879-3.472762 8.649393-5.386153 13.816391-5.386153a20.238111 20.238111 0 0 1 7.465716 1.414873c7.185149 2.834564 12.222099 9.665694 12.833806 17.408364 0.558725 7.670421 0.838087 15.479319 0.842903 23.221989 0 82.641862-32.179644 160.340699-90.615728 218.770763z" fill="#64bee0" p-id="6367"></path><path d="M681.386256 557.917765c-56.540756 0-102.916098-17.292765-137.829157-51.395433-25.397884-24.834343-44.40656-58.383102-56.496203-99.710656-10.669953-36.404998-16.078985-79.036644-16.078984-126.710057 0.089107-11.544164 0.60689-22.433272 1.570209-33.232069C341.690162 266.020315 243.273965 379.91222 243.273965 512.711651c0 148.134253 120.514717 268.64897 268.64897 268.64897 141.259774 0 258.335445-109.519644 267.978259-249.956985-28.292655 16.821944-59.169411 25.714575-91.830714 26.438268-2.231286 0.054187-4.480634 0.075861-6.684224 0.075861z" fill="#64bee0" p-id="6368"></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.5 KiB |
@ -1,6 +0,0 @@
|
|||||||
<svg class="llm-icon llm-icon-workflow-start " width="1em" height="1em" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
|
|
||||||
<rect width="20" height="20" fill="#65BEE0" rx="6"></rect>
|
|
||||||
<g clip-path="url(#svg_7692d94d0f__a)">
|
|
||||||
<path fill="#fff" d="M13.448 8.979c.736.483.736 1.692 0 2.176l-5.793 3.808C6.92 15.447 6 14.843 6 13.875V6.258c0-.967.92-1.571 1.655-1.088l5.793 3.809Z"></path>
|
|
||||||
</g>
|
|
||||||
<defs><clipPath id="svg_7692d94d0f__a"><path fill="#fff" d="M3 3h14v14H3z"></path></clipPath></defs></svg>
|
|
||||||
|
Before Width: | Height: | Size: 515 B |
@ -1 +0,0 @@
|
|||||||
<svg t="1762762024042" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7115" width="200" height="200"><path d="M512 512m-512 0a512 512 0 1 0 1024 0 512 512 0 1 0-1024 0Z" fill="#65BEE0" p-id="7116" data-spm-anchor-id="a313x.search_index.0.i4.2cb83a81yhcKKA" class="selected"></path><path d="M440.018824 310.452706c6.625882 0 13.703529 2.198588 20.781176 7.68 11.294118 8.884706 17.709176 22.588235 17.769412 36.954353l0.391529 108.242823 0.120471 43.248942 0.150588 31.442823s20.239059-27.648 49.935059-27.648c15.932235 0 34.484706 7.890824 54.091294 32.165647 0 0 18.191059-30.539294 47.435294-30.539294 15.36 0 33.731765 8.342588 54.091294 33.912471 0 0 17.588706-34.424471 41.562353-34.424471 8.071529 0 16.865882 3.915294 25.99153 14.486588 10.752 12.739765 16.564706 29.063529 16.564705 45.808941v230.098824s-0.722824 5.963294-7.168 14.938353a63.608471 63.608471 0 0 1-51.83247 26.352941l-239.555765 0.060235a73.396706 73.396706 0 0 1-57.313882-27.557647l-131.373177-164.111059a46.019765 46.019765 0 0 1-6.595764-46.983529c4.517647-10.390588 13.251765-19.275294 29.635764-19.275294 8.432941 0 18.763294 2.349176 31.62353 7.951059 42.736941 19.154824 58.006588 59.542588 58.006588 59.542588l0.692706-146.100706 0.210823-43.158588 0.512-105.682824c0.060235-14.546824 6.716235-28.400941 18.31153-37.255529 7.228235-5.571765 16.263529-10.149647 25.961412-10.149647zM436.705882 180.705882a165.647059 165.647059 0 0 1 123.723294 275.787294 38.068706 38.068706 0 0 1-29.455058 12.468706h-1.987765a8.794353 8.794353 0 0 1-8.734118-8.734117l-0.090353-15.450353a15.058824 15.058824 0 0 1 4.336942-10.541177l0.090352-0.090353a123.392 123.392 0 0 0 36.352-87.792941c0-33.189647-12.950588-64.391529-36.352-87.883294A123.663059 123.663059 0 0 0 436.705882 222.117647c-33.189647 0-64.391529 12.950588-87.883294 36.352a123.663059 123.663059 0 0 0-36.352 87.883294c0 33.189647 12.950588 64.391529 36.352 87.883294l0.090353 0.060236c3.162353 3.162353 4.969412 7.499294 4.909177 11.956705a21.353412 21.353412 0 0 1-36.74353 14.697412A165.647059 165.647059 0 0 1 436.705882 180.705882z" fill="#ffffff" p-id="7117" data-spm-anchor-id="a313x.search_index.0.i3.2cb83a81yhcKKA" class=""></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.2 KiB |
@ -1,3 +0,0 @@
|
|||||||
<svg t="1752214385087" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="22912" id="mx_n_1752214385087" width="200" height="200">
|
|
||||||
<path d="M22.658333 502.958333c0 79.929167 12.929167 142.658333 44.195834 212.2375 23.866667 53.104167 53.633333 94.970833 92.716666 137.2125 39.466667 42.645833 92.1125 77.8375 143.766667 103.866667 44.129167 22.2375 126.375 47.141667 191.6625 47.141667h40.6875c89.683333 0 200.170833-41.408333 265.1125-90.433334l25.291667-18.933333c3.383333-2.754167 4.916667-4.875 8.308333-7.604167 48.625-39.1375 106.620833-114.6 129.158333-169.75 31.991667-78.2875 44.475-123.704167 44.475-213.733333 0-107.270833-39.370833-208.329167-101.341666-291.2875-4.275-5.729167-8.595833-11.6375-13.2375-16.829167-65.329167-73.079167-121.3-113.216667-215.470834-148.9-46.554167-17.641667-96.358333-26.429167-146.5625-27.525h-21.558333c-53.033333 1.141667-106.058333 10.654167-155.725 27.195834-8.720833 2.904167-14.5875 4.85-21.945833 8.125-41.483333 18.475-80.633333 37.0875-116.158334 66.029166l-24.075 20.141667C114.5125 205.3875 61.308333 296.270833 36.454167 394.729167c-7.570833 29.975-13.795833 70.329167-13.795834 108.229166z" fill="#65BEE0" p-id="22913"></path>
|
|
||||||
<path d="M677.225 610.004167c9.7 2.791667 58.783333 32.220833 71.15 39.3375 23.420833 13.475 46.275 26.466667 69.804167 39.845833 42.375 24.1 32.45-40.475 32.45-67.75V400.391667c0-27.479167 8.641667-90.616667-31.95-67.2375a9526.625 9526.625 0 0 1-69.891667 39.745833c-11.554167 6.525-63.3125 37.641667-71.145833 39.829167-0.591667-61.695833 6.2-118.329167-88.875-118.291667H277.404167c-38.979167 0-60.320833 1.220833-80.0625 24.183333-21.291667 24.758333-17.229167 49.6125-17.229167 87.075v206.904167c0 38.2-4.554167 61.533333 15.345833 88.9875 15.979167 22.054167 41.204167 26.425 78.404167 26.420833h311.358333c38.166667 0.004167 58.758333-3.583333 77.6-27.204166 18.229167-22.845833 15.033333-57.375 14.404167-90.8z" fill="#fff" p-id="22914" data-spm-anchor-id="a313x.search_index.0.i4.7c873a81tBoiJp" class=""></path></svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.0 KiB |
@ -1,61 +0,0 @@
|
|||||||
"""Generate the multi-resolution Windows icon without third-party packages.
|
|
||||||
|
|
||||||
The geometry mirrors icons/cmvr-app.svg. Run after changing the logo.
|
|
||||||
"""
|
|
||||||
import math
|
|
||||||
import pathlib
|
|
||||||
import struct
|
|
||||||
import zlib
|
|
||||||
|
|
||||||
|
|
||||||
def chunk(kind, data):
|
|
||||||
return struct.pack('>I', len(data)) + kind + data + struct.pack('>I', zlib.crc32(kind + data))
|
|
||||||
|
|
||||||
|
|
||||||
def color_at(x, y):
|
|
||||||
# Rounded blue app tile, a white C, and a cyan status dot.
|
|
||||||
dx, dy = max(abs(x - 32) - 15, 0), max(abs(y - 32) - 15, 0)
|
|
||||||
if dx * dx + dy * dy > 15 * 15:
|
|
||||||
return (0, 0, 0, 0)
|
|
||||||
color = (27, 110, 243, 255)
|
|
||||||
radius = math.hypot(x - 32, y - 32)
|
|
||||||
angle = abs(math.atan2(y - 32, x - 32))
|
|
||||||
if 13.5 <= radius <= 20.5 and angle >= math.radians(40):
|
|
||||||
color = (255, 255, 255, 255)
|
|
||||||
for angle in (-40, 40):
|
|
||||||
cx, cy = 32 + 17 * math.cos(math.radians(angle)), 32 + 17 * math.sin(math.radians(angle))
|
|
||||||
if math.hypot(x - cx, y - cy) <= 3.5:
|
|
||||||
color = (255, 255, 255, 255)
|
|
||||||
dx, dy = max(abs(x - 47.5) - 1.5, 0), max(abs(y - 32.5) - 1.5, 0)
|
|
||||||
if dx * dx + dy * dy <= 9:
|
|
||||||
color = (143, 221, 255, 255)
|
|
||||||
return color
|
|
||||||
|
|
||||||
|
|
||||||
def png(size):
|
|
||||||
rows = bytearray()
|
|
||||||
samples = 4
|
|
||||||
for row in range(size):
|
|
||||||
rows.append(0)
|
|
||||||
for col in range(size):
|
|
||||||
colors = [color_at((col + (sx + .5) / samples) * 64 / size,
|
|
||||||
(row + (sy + .5) / samples) * 64 / size)
|
|
||||||
for sy in range(samples) for sx in range(samples)]
|
|
||||||
alpha = sum(c[3] for c in colors)
|
|
||||||
rgb = [round(sum(c[k] * c[3] for c in colors) / alpha) if alpha else 0 for k in range(3)]
|
|
||||||
rows.extend(rgb + [round(alpha / (samples * samples))])
|
|
||||||
return (b'\x89PNG\r\n\x1a\n' + chunk(b'IHDR', struct.pack('>IIBBBBB', size, size, 8, 6, 0, 0, 0))
|
|
||||||
+ chunk(b'IDAT', zlib.compress(rows, 9)) + chunk(b'IEND', b''))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sizes = (16, 24, 32, 48, 64, 128, 256)
|
|
||||||
images = [png(size) for size in sizes]
|
|
||||||
offset = 6 + 16 * len(images)
|
|
||||||
directory = bytearray(struct.pack('<HHH', 0, 1, len(images)))
|
|
||||||
for size, data in zip(sizes, images):
|
|
||||||
directory.extend(struct.pack('<BBBBHHII', size % 256, size % 256, 0, 0, 1, 32, len(data), offset))
|
|
||||||
offset += len(data)
|
|
||||||
target = pathlib.Path(__file__).resolve().parents[1] / 'icons' / 'cmvr-app.ico'
|
|
||||||
target.write_bytes(directory + b''.join(images))
|
|
||||||
print(target)
|
|
||||||
@ -1,65 +0,0 @@
|
|||||||
"""Generate the external JSON Schema from the catalog exported by taskapi_test or the Qt app."""
|
|
||||||
import json
|
|
||||||
from pathlib import Path
|
|
||||||
root=Path("docs/task-flow")
|
|
||||||
catalog=json.loads((root/"task_operations.json").read_text(encoding="utf-8"))
|
|
||||||
ref=lambda name:{"$ref":"#/$defs/"+name}
|
|
||||||
msgref=lambda name:{"$ref":"#/$defs/message."+name}
|
|
||||||
def scalar(f):
|
|
||||||
if "messageType" in f:return msgref(f["messageType"])
|
|
||||||
if "enumType" in f:return {"enum":[x["name"] for x in catalog["enums"][f["enumType"]]]+[x["number"] for x in catalog["enums"][f["enumType"]]]}
|
|
||||||
t=f["type"]
|
|
||||||
if t in ["string","bytes"]:return {"type":"string",**({"contentEncoding":"base64"} if t=="bytes" else {})}
|
|
||||||
if t=="bool":return {"type":"boolean"}
|
|
||||||
if t in ["int64","sint64","sfixed64"]:return {"type":"string","pattern":"^-?[0-9]+$"}
|
|
||||||
if t in ["uint64","fixed64"]:return {"type":"string","pattern":"^[0-9]+$"}
|
|
||||||
if t in ["float","double"]:return {"type":"number"}
|
|
||||||
unsigned=t in ["uint32","fixed32"]
|
|
||||||
return {"type":"integer","minimum":0 if unsigned else -2147483648,"maximum":4294967295 if unsigned else 2147483647}
|
|
||||||
messages={}
|
|
||||||
for name,m in catalog["messages"].items():
|
|
||||||
if name=="google.protobuf.Timestamp":messages[name]={"type":"string","format":"date-time"};continue
|
|
||||||
props={};rules=[];unions={}
|
|
||||||
for f in m["fields"]:
|
|
||||||
if f["map"]:
|
|
||||||
entry=catalog["messages"][f["messageType"]]["fields"]
|
|
||||||
field={"type":"object","additionalProperties":scalar(next(x for x in entry if x["name"]=="value"))}
|
|
||||||
elif f["repeated"]:field={"type":"array","items":scalar(f)}
|
|
||||||
else:field=scalar(f)
|
|
||||||
props[f["name"]]=field
|
|
||||||
if f["name"]!=f["jsonName"]:
|
|
||||||
props[f["jsonName"]]=field;rules.append({"not":{"required":[f["name"],f["jsonName"]]}})
|
|
||||||
if f.get("oneof"):unions.setdefault(f["oneof"],[]).append(f)
|
|
||||||
for union in unions.values():
|
|
||||||
for i,a in enumerate(union):
|
|
||||||
for b in union[i+1:]:
|
|
||||||
for ak in set([a["name"],a["jsonName"]]):
|
|
||||||
for bk in set([b["name"],b["jsonName"]]):rules.append({"not":{"required":[ak,bk]}})
|
|
||||||
messages[name]={"type":"object","properties":props,"additionalProperties":False,**({"allOf":rules} if rules else {})}
|
|
||||||
policy={"order":"sequential","onError":"stop","automaticRetry":False,"waitStartsAfter":"operation_success","stopBehavior":"stop_scheduling_and_cancel_active_unary"}
|
|
||||||
methods=[m for s in catalog["services"] for m in s["methods"] if not m["clientStreaming"] and not m["serverStreaming"]]
|
|
||||||
common={"id":{"type":"string","minLength":1},"name":{"type":"string"}}
|
|
||||||
task={"type":"object","required":["id","name","kind","deviceType","deviceId","action","parameters","operationId","execution","waitMs","waitUnit"],"properties":{
|
|
||||||
**common,"kind":{"const":"task"},"deviceType":{"type":"string"},"deviceId":{"type":"string","minLength":1},"action":{"type":"string","minLength":1},
|
|
||||||
"parameters":{"type":"object"},"operationId":{"type":"string"},"waitMs":{"type":"integer","minimum":0,"maximum":2147483647},"waitUnit":{"enum":["ms","s"]},
|
|
||||||
"execution":{"oneOf":[ref("rpc"),ref("adapter")]}},"allOf":[]}
|
|
||||||
for m in methods:
|
|
||||||
request=msgref(m["requestType"])
|
|
||||||
task["allOf"].append({"if":{"properties":{"operationId":{"const":m["id"]}}},"then":{"properties":{
|
|
||||||
"parameters":{"type":"object","required":["service","method","request"],"properties":{"service":{"const":m["service"]},"method":{"const":m["method"]},"request":request,"timeoutMs":{"type":"integer","minimum":100,"maximum":1800000}}},
|
|
||||||
"execution":{"properties":{"kind":{"const":"grpc_unary"},"service":{"const":m["service"]},"method":{"const":m["method"]},"request":request}}}}})
|
|
||||||
for a in catalog["clientAdapters"]:
|
|
||||||
task["allOf"].append({"if":{"properties":{"operationId":{"const":a["id"]}}},"then":{"properties":{
|
|
||||||
"deviceType":{"const":a["deviceType"]},"action":{"const":a["action"]},"parameters":a["parametersSchema"],
|
|
||||||
"execution":{"properties":{"kind":{"const":"client_adapter"},"adapter":{"const":a["id"]},"parameters":a["parametersSchema"]}}}}})
|
|
||||||
task["properties"]["operationId"]={"enum":[m["id"] for m in methods]+[a["id"] for a in catalog["clientAdapters"]]}
|
|
||||||
schema={"$schema":"https://json-schema.org/draft/2020-12/schema","$id":"urn:cmvr:task-flow","title":"CMVR portable task flow","type":"object","required":["format","executionPolicy","groups"],"properties":{
|
|
||||||
"format":{"const":"cmvr.task-flow"},"executionPolicy":{"const":policy},"groups":{"type":"array","items":ref("group")}},"$defs":{
|
|
||||||
**{"message."+name:value for name,value in messages.items()},"node":{"oneOf":[ref("task"),ref("loop")]},"task":task,
|
|
||||||
"group":{"type":"object","required":["id","name","nodes"],"properties":{**common,"nodes":{"type":"array","items":ref("node")}}},
|
|
||||||
"loop":{"type":"object","required":["id","name","kind","count","children"],"properties":{**common,"kind":{"const":"loop"},"count":{"type":"integer","minimum":1,"maximum":100000},"collapsed":{"type":"boolean"},"waitMs":{"type":"integer","minimum":0,"maximum":2147483647},"children":{"type":"array","items":ref("node")}}},
|
|
||||||
"rpc":{"type":"object","required":["kind","service","method","request","timeoutMs","completion"],"properties":{"kind":{"const":"grpc_unary"},"service":{"type":"string"},"method":{"type":"string"},"request":{"type":"object"},"timeoutMs":{"type":"integer","minimum":100,"maximum":1800000},"completion":{"const":"rpc_response"}}},
|
|
||||||
"adapter":{"type":"object","required":["kind","adapter","deviceId","parameters","completion"],"properties":{"kind":{"const":"client_adapter"},"adapter":{"type":"string"},"deviceId":{"type":"string"},"parameters":{"type":"object"},"completion":{"const":"adapter_callback"}}}}}
|
|
||||||
task["properties"]["serverCalls"]={"type":"array","minItems":1,"items":{"type":"object","required":["service","method","rpcPath","requestType","responseType","clientStreaming","serverStreaming","mode","request"],"properties":{"service":{"type":"string"},"method":{"type":"string"},"rpcPath":{"type":"string"},"requestType":{"type":"string"},"responseType":{"type":"string"},"clientStreaming":{"type":"boolean"},"serverStreaming":{"type":"boolean"},"mode":{"enum":["unary","open_stream","close_stream"]},"request":{"type":"object"},"sessionKey":{"type":"string"},"runtimeRequestFields":{"type":"array","items":{"type":"string"}},"runtimeHeaderFields":{"type":"array","items":{"type":"string"}}}}}
|
|
||||||
(root/"task-flow.schema.json").write_text(json.dumps(schema,ensure_ascii=False,indent=2)+"\n",encoding="utf-8")
|
|
||||||
print("Generated schema for",len(methods),"unary methods and",len(catalog["clientAdapters"]),"client adapters")
|
|
||||||
@ -1,458 +0,0 @@
|
|||||||
"""Numerical hand-eye algorithms migrated from phone/scripts/handeye_calibration_gui.py.
|
|
||||||
|
|
||||||
Provenance: rotation angle 132-134, pose conversion 167-171, planar/IPPE
|
|
||||||
and ChArUco 174-266, AX=XB, robust MAD, and cross validation 269-592
|
|
||||||
(source snapshot 2026-09-30). Functions retain the upstream frame convention:
|
|
||||||
T_parent_child maps child coordinates into parent coordinates, metres.
|
|
||||||
No runtime dependency on the original GUI or phone project.
|
|
||||||
"""
|
|
||||||
from __future__ import annotations
|
|
||||||
import math
|
|
||||||
from typing import Any
|
|
||||||
import cv2
|
|
||||||
import numpy as np
|
|
||||||
AUTO_SOLVER_LABEL = "auto"
|
|
||||||
HAND_EYE_SOLVER_METHODS = {
|
|
||||||
"TsaiLenz1989": cv2.CALIB_HAND_EYE_TSAI,
|
|
||||||
"ParkBryan1994": cv2.CALIB_HAND_EYE_PARK,
|
|
||||||
"HoraudDornaika1995": cv2.CALIB_HAND_EYE_HORAUD,
|
|
||||||
"AndreffHoraudEspiau1999": cv2.CALIB_HAND_EYE_ANDREFF,
|
|
||||||
"Daniilidis1999": cv2.CALIB_HAND_EYE_DANIILIDIS,
|
|
||||||
}
|
|
||||||
HAND_EYE_CHARACTERISTIC_LENGTH_M = .20
|
|
||||||
HAND_EYE_OUTLIER_TRANSLATION_FLOOR_M = .002
|
|
||||||
HAND_EYE_OUTLIER_ROTATION_FLOOR_RAD = math.radians(.35)
|
|
||||||
|
|
||||||
|
|
||||||
# Upstream handeye_calibration_gui.py:132-134
|
|
||||||
def rotation_angle_degrees(R: np.ndarray) -> float:
|
|
||||||
trace = float(np.clip((np.trace(np.asarray(R, dtype=float)) - 1.0) / 2.0, -1.0, 1.0))
|
|
||||||
return math.degrees(math.acos(trace))
|
|
||||||
|
|
||||||
# Upstream handeye_calibration_gui.py:167-171
|
|
||||||
def rvec_tvec_to_matrix(rvec: np.ndarray, tvec: np.ndarray) -> np.ndarray:
|
|
||||||
out = np.eye(4, dtype=np.float64)
|
|
||||||
out[:3, :3] = cv2.Rodrigues(np.asarray(rvec, dtype=np.float64).reshape(3, 1))[0]
|
|
||||||
out[:3, 3] = np.asarray(tvec, dtype=np.float64).reshape(3)
|
|
||||||
return out
|
|
||||||
|
|
||||||
# Upstream handeye_calibration_gui.py:174-247
|
|
||||||
def estimate_planar_pose(
|
|
||||||
object_points: np.ndarray,
|
|
||||||
image_points: np.ndarray,
|
|
||||||
camera_matrix: np.ndarray,
|
|
||||||
dist_coeffs: np.ndarray,
|
|
||||||
) -> tuple[np.ndarray, np.ndarray]:
|
|
||||||
"""Estimate a planar target pose with IPPE candidates and LM refinement.
|
|
||||||
|
|
||||||
IPPE explicitly handles the two-solution ambiguity of a planar target. The
|
|
||||||
physically valid solution with the smallest reprojection error is refined
|
|
||||||
by Levenberg-Marquardt. ITERATIVE remains as a compatibility fallback.
|
|
||||||
"""
|
|
||||||
obj = np.asarray(object_points, dtype=np.float64).reshape(-1, 3)
|
|
||||||
img = np.asarray(image_points, dtype=np.float64).reshape(-1, 2)
|
|
||||||
if len(obj) < 4 or len(obj) != len(img):
|
|
||||||
raise ValueError("平面目标至少需要 4 个有效的二维-三维对应点")
|
|
||||||
|
|
||||||
candidates: list[tuple[np.ndarray, np.ndarray]] = []
|
|
||||||
if hasattr(cv2, "solvePnPGeneric") and hasattr(cv2, "SOLVEPNP_IPPE"):
|
|
||||||
try:
|
|
||||||
result = cv2.solvePnPGeneric(
|
|
||||||
obj,
|
|
||||||
img,
|
|
||||||
camera_matrix,
|
|
||||||
dist_coeffs,
|
|
||||||
flags=cv2.SOLVEPNP_IPPE,
|
|
||||||
)
|
|
||||||
if result and bool(result[0]):
|
|
||||||
candidates.extend(
|
|
||||||
(np.asarray(rvec, dtype=np.float64).reshape(3, 1),
|
|
||||||
np.asarray(tvec, dtype=np.float64).reshape(3, 1))
|
|
||||||
for rvec, tvec in zip(result[1], result[2])
|
|
||||||
)
|
|
||||||
except cv2.error:
|
|
||||||
candidates.clear()
|
|
||||||
|
|
||||||
if not candidates:
|
|
||||||
ok, rvec, tvec = cv2.solvePnP(
|
|
||||||
obj,
|
|
||||||
img,
|
|
||||||
camera_matrix,
|
|
||||||
dist_coeffs,
|
|
||||||
flags=cv2.SOLVEPNP_ITERATIVE,
|
|
||||||
)
|
|
||||||
if not ok:
|
|
||||||
raise ValueError("无法估计平面目标位姿")
|
|
||||||
candidates.append((rvec, tvec))
|
|
||||||
|
|
||||||
ranked: list[tuple[float, np.ndarray, np.ndarray]] = []
|
|
||||||
for rvec, tvec in candidates:
|
|
||||||
try:
|
|
||||||
if hasattr(cv2, "solvePnPRefineLM"):
|
|
||||||
rvec, tvec = cv2.solvePnPRefineLM(
|
|
||||||
obj,
|
|
||||||
img,
|
|
||||||
camera_matrix,
|
|
||||||
dist_coeffs,
|
|
||||||
rvec,
|
|
||||||
tvec,
|
|
||||||
)
|
|
||||||
rotation = cv2.Rodrigues(np.asarray(rvec, dtype=np.float64).reshape(3, 1))[0]
|
|
||||||
camera_points = (rotation @ obj.T).T + np.asarray(tvec, dtype=np.float64).reshape(1, 3)
|
|
||||||
if not np.all(np.isfinite(camera_points)) or np.min(camera_points[:, 2]) <= 0:
|
|
||||||
continue
|
|
||||||
projected = cv2.projectPoints(obj, rvec, tvec, camera_matrix, dist_coeffs)[0].reshape(-1, 2)
|
|
||||||
error = float(np.sqrt(np.mean(np.sum(np.square(projected - img), axis=1))))
|
|
||||||
if math.isfinite(error):
|
|
||||||
ranked.append((error, np.asarray(rvec, dtype=np.float64), np.asarray(tvec, dtype=np.float64)))
|
|
||||||
except cv2.error:
|
|
||||||
continue
|
|
||||||
if not ranked:
|
|
||||||
raise ValueError("平面目标 PnP 候选解均不满足正深度约束")
|
|
||||||
_, best_rvec, best_tvec = min(ranked, key=lambda item: item[0])
|
|
||||||
return best_rvec.reshape(3, 1), best_tvec.reshape(3, 1)
|
|
||||||
|
|
||||||
# Upstream handeye_calibration_gui.py:250-266
|
|
||||||
def estimate_charuco_pose(
|
|
||||||
board: Any,
|
|
||||||
corners: np.ndarray,
|
|
||||||
ids: np.ndarray,
|
|
||||||
camera_matrix: np.ndarray,
|
|
||||||
dist_coeffs: np.ndarray,
|
|
||||||
) -> tuple[np.ndarray, np.ndarray]:
|
|
||||||
"""Estimate ``T_camera_target`` from the detected ChArUco corners."""
|
|
||||||
detected_corners = np.asarray(corners, dtype=np.float32).reshape(-1, 1, 2)
|
|
||||||
detected_ids = np.asarray(ids, dtype=np.int32).reshape(-1, 1)
|
|
||||||
object_points, image_points = board.matchImagePoints(detected_corners, detected_ids)
|
|
||||||
if object_points is None or image_points is None or len(object_points) < 4:
|
|
||||||
raise ValueError("有效 ChArUco 角点不足,至少需要 4 个对应点")
|
|
||||||
rvec, tvec = estimate_planar_pose(object_points, image_points, camera_matrix, dist_coeffs)
|
|
||||||
if not np.all(np.isfinite(rvec)) or not np.all(np.isfinite(tvec)):
|
|
||||||
raise ValueError("无法从 ChArUco 角点估计 camera→target 位姿")
|
|
||||||
return rvec, tvec
|
|
||||||
|
|
||||||
# Upstream handeye_calibration_gui.py:269-286
|
|
||||||
def ax_xb_motion(
|
|
||||||
robot_poses: list[np.ndarray],
|
|
||||||
target_poses: list[np.ndarray],
|
|
||||||
first: int,
|
|
||||||
second: int,
|
|
||||||
eye_in_hand: bool,
|
|
||||||
) -> tuple[np.ndarray, np.ndarray]:
|
|
||||||
"""Return the OpenCV/MoveIt motion pair satisfying ``A X = X B``."""
|
|
||||||
base_to_eef_i, base_to_eef_j = robot_poses[first], robot_poses[second]
|
|
||||||
if eye_in_hand:
|
|
||||||
# (T_base_eef[j])^-1 T_base_eef[i] X = X T_cam_target[j] (T_cam_target[i])^-1
|
|
||||||
A = np.linalg.inv(base_to_eef_j) @ base_to_eef_i
|
|
||||||
else:
|
|
||||||
# OpenCV's eye-to-hand form uses T_eef_base = (T_base_eef)^-1.
|
|
||||||
# Its returned X is then T_base_camera.
|
|
||||||
A = base_to_eef_j @ np.linalg.inv(base_to_eef_i)
|
|
||||||
B = target_poses[second] @ np.linalg.inv(target_poses[first])
|
|
||||||
return A, B
|
|
||||||
|
|
||||||
# Upstream handeye_calibration_gui.py:289-311
|
|
||||||
def solve_handeye_matrix(
|
|
||||||
robot_poses: list[np.ndarray],
|
|
||||||
target_poses: list[np.ndarray],
|
|
||||||
eye_in_hand: bool,
|
|
||||||
method: int,
|
|
||||||
) -> np.ndarray:
|
|
||||||
"""Run one OpenCV hand-eye solver and validate its SE(3) result."""
|
|
||||||
if len(robot_poses) != len(target_poses) or len(robot_poses) < 5:
|
|
||||||
raise ValueError("手眼标定至少需要 5 组配对位姿")
|
|
||||||
inputs = robot_poses if eye_in_hand else [np.linalg.inv(pose) for pose in robot_poses]
|
|
||||||
rotation, translation = cv2.calibrateHandEye(
|
|
||||||
[pose[:3, :3] for pose in inputs],
|
|
||||||
[pose[:3, 3].reshape(3, 1) for pose in inputs],
|
|
||||||
[pose[:3, :3] for pose in target_poses],
|
|
||||||
[pose[:3, 3].reshape(3, 1) for pose in target_poses],
|
|
||||||
method=method,
|
|
||||||
)
|
|
||||||
solution = np.eye(4, dtype=np.float64)
|
|
||||||
solution[:3, :3] = np.asarray(rotation, dtype=np.float64).reshape(3, 3)
|
|
||||||
solution[:3, 3] = np.asarray(translation, dtype=np.float64).reshape(3)
|
|
||||||
if not np.all(np.isfinite(solution)) or abs(np.linalg.det(solution[:3, :3]) - 1.0) > 1e-3:
|
|
||||||
raise ValueError("求解器返回了无效的刚体变换")
|
|
||||||
return solution
|
|
||||||
|
|
||||||
# Upstream handeye_calibration_gui.py:314-319
|
|
||||||
def _rotation_mean(rotations: list[np.ndarray]) -> np.ndarray:
|
|
||||||
accumulator = np.sum(np.asarray(rotations, dtype=np.float64), axis=0)
|
|
||||||
left, _, right_t = np.linalg.svd(accumulator)
|
|
||||||
correction = np.eye(3)
|
|
||||||
correction[2, 2] = np.linalg.det(left @ right_t)
|
|
||||||
return left @ correction @ right_t
|
|
||||||
|
|
||||||
# Upstream handeye_calibration_gui.py:322-361
|
|
||||||
def fixed_target_consistency(
|
|
||||||
robot_poses: list[np.ndarray],
|
|
||||||
target_poses: list[np.ndarray],
|
|
||||||
solution: np.ndarray,
|
|
||||||
eye_in_hand: bool,
|
|
||||||
) -> dict[str, Any]:
|
|
||||||
"""Measure how constant the physically fixed target/tool transform remains."""
|
|
||||||
fixed_poses = []
|
|
||||||
for robot_pose, target_pose in zip(robot_poses, target_poses):
|
|
||||||
if eye_in_hand:
|
|
||||||
fixed_poses.append(robot_pose @ solution @ target_pose)
|
|
||||||
else:
|
|
||||||
fixed_poses.append(np.linalg.inv(robot_pose) @ solution @ target_pose)
|
|
||||||
center_translation = np.median(np.asarray([pose[:3, 3] for pose in fixed_poses]), axis=0)
|
|
||||||
center_rotation = _rotation_mean([pose[:3, :3] for pose in fixed_poses])
|
|
||||||
translation_errors = np.asarray(
|
|
||||||
[np.linalg.norm(pose[:3, 3] - center_translation) for pose in fixed_poses],
|
|
||||||
dtype=np.float64,
|
|
||||||
)
|
|
||||||
rotation_errors = np.asarray(
|
|
||||||
[math.radians(rotation_angle_degrees(center_rotation.T @ pose[:3, :3])) for pose in fixed_poses],
|
|
||||||
dtype=np.float64,
|
|
||||||
)
|
|
||||||
trans_p95 = float(np.percentile(translation_errors, 95))
|
|
||||||
rot_p95 = float(np.percentile(rotation_errors, 95))
|
|
||||||
# Convert angular scatter to an equivalent displacement at a 20 cm lever arm.
|
|
||||||
score_m = trans_p95 + HAND_EYE_CHARACTERISTIC_LENGTH_M * rot_p95
|
|
||||||
return {
|
|
||||||
"translation_errors_m": translation_errors,
|
|
||||||
"rotation_errors_rad": rotation_errors,
|
|
||||||
"translation_median_m": float(np.median(translation_errors)),
|
|
||||||
"translation_rms_m": float(np.sqrt(np.mean(np.square(translation_errors)))),
|
|
||||||
"translation_p95_m": trans_p95,
|
|
||||||
"translation_max_m": float(np.max(translation_errors)),
|
|
||||||
"rotation_median_rad": float(np.median(rotation_errors)),
|
|
||||||
"rotation_rms_rad": float(np.sqrt(np.mean(np.square(rotation_errors)))),
|
|
||||||
"rotation_p95_rad": rot_p95,
|
|
||||||
"rotation_max_rad": float(np.max(rotation_errors)),
|
|
||||||
"score_m": float(score_m),
|
|
||||||
}
|
|
||||||
|
|
||||||
# Upstream handeye_calibration_gui.py:364-389
|
|
||||||
def ax_xb_all_pair_metrics(
|
|
||||||
robot_poses: list[np.ndarray],
|
|
||||||
target_poses: list[np.ndarray],
|
|
||||||
solution: np.ndarray,
|
|
||||||
eye_in_hand: bool,
|
|
||||||
) -> dict[str, float]:
|
|
||||||
"""Evaluate AX=XB on all pose pairs so metrics do not depend on capture order."""
|
|
||||||
translations: list[float] = []
|
|
||||||
rotations: list[float] = []
|
|
||||||
for first in range(len(robot_poses) - 1):
|
|
||||||
for second in range(first + 1, len(robot_poses)):
|
|
||||||
A, B = ax_xb_motion(robot_poses, target_poses, first, second, eye_in_hand)
|
|
||||||
residual = np.linalg.inv(A @ solution) @ (solution @ B)
|
|
||||||
translations.append(float(np.linalg.norm(residual[:3, 3])))
|
|
||||||
rotations.append(math.radians(rotation_angle_degrees(residual[:3, :3])))
|
|
||||||
return {
|
|
||||||
"pair_count": len(translations),
|
|
||||||
"translation_rms_m": float(np.sqrt(np.mean(np.square(translations)))),
|
|
||||||
"translation_median_m": float(np.median(translations)),
|
|
||||||
"translation_p95_m": float(np.percentile(translations, 95)),
|
|
||||||
"translation_max_m": float(np.max(translations)),
|
|
||||||
"rotation_rms_rad": float(np.sqrt(np.mean(np.square(rotations)))),
|
|
||||||
"rotation_median_rad": float(np.median(rotations)),
|
|
||||||
"rotation_p95_rad": float(np.percentile(rotations, 95)),
|
|
||||||
"rotation_max_rad": float(np.max(rotations)),
|
|
||||||
}
|
|
||||||
|
|
||||||
# Upstream handeye_calibration_gui.py:392-407
|
|
||||||
def dominant_rotation_axes(robot_poses: list[np.ndarray]) -> set[int]:
|
|
||||||
"""Return the base-frame axes covered by meaningful relative rotations."""
|
|
||||||
axes: set[int] = set()
|
|
||||||
for first in range(len(robot_poses) - 1):
|
|
||||||
for second in range(first + 1, len(robot_poses)):
|
|
||||||
relative = np.linalg.inv(robot_poses[first]) @ robot_poses[second]
|
|
||||||
if rotation_angle_degrees(relative[:3, :3]) < 3.0:
|
|
||||||
continue
|
|
||||||
rotvec = cv2.Rodrigues(relative[:3, :3])[0].reshape(3)
|
|
||||||
norm = float(np.linalg.norm(rotvec))
|
|
||||||
if norm <= 1e-9:
|
|
||||||
continue
|
|
||||||
axis = np.abs(rotvec / norm)
|
|
||||||
if float(np.max(axis)) > 0.70:
|
|
||||||
axes.add(int(np.argmax(axis)))
|
|
||||||
return axes
|
|
||||||
|
|
||||||
# Upstream handeye_calibration_gui.py:410-418
|
|
||||||
def _fixed_pose(
|
|
||||||
robot_pose: np.ndarray,
|
|
||||||
target_pose: np.ndarray,
|
|
||||||
solution: np.ndarray,
|
|
||||||
eye_in_hand: bool,
|
|
||||||
) -> np.ndarray:
|
|
||||||
if eye_in_hand:
|
|
||||||
return robot_pose @ solution @ target_pose
|
|
||||||
return np.linalg.inv(robot_pose) @ solution @ target_pose
|
|
||||||
|
|
||||||
# Upstream handeye_calibration_gui.py:421-424
|
|
||||||
def _pose_center(poses: list[np.ndarray]) -> tuple[np.ndarray, np.ndarray]:
|
|
||||||
translation = np.median(np.asarray([pose[:3, 3] for pose in poses]), axis=0)
|
|
||||||
rotation = _rotation_mean([pose[:3, :3] for pose in poses])
|
|
||||||
return rotation, translation
|
|
||||||
|
|
||||||
# Upstream handeye_calibration_gui.py:427-478
|
|
||||||
def leave_one_out_handeye_metrics(
|
|
||||||
robot_poses: list[np.ndarray],
|
|
||||||
target_poses: list[np.ndarray],
|
|
||||||
eye_in_hand: bool,
|
|
||||||
method: int,
|
|
||||||
) -> dict[str, float]:
|
|
||||||
"""Evaluate a solver on poses excluded from each individual fit."""
|
|
||||||
translation_errors: list[float] = []
|
|
||||||
rotation_errors: list[float] = []
|
|
||||||
for held_out in range(len(robot_poses)):
|
|
||||||
train_ids = [index for index in range(len(robot_poses)) if index != held_out]
|
|
||||||
if len(train_ids) < 5:
|
|
||||||
continue
|
|
||||||
train_robot = [robot_poses[index] for index in train_ids]
|
|
||||||
train_target = [target_poses[index] for index in train_ids]
|
|
||||||
try:
|
|
||||||
solution = solve_handeye_matrix(train_robot, train_target, eye_in_hand, method)
|
|
||||||
except (ValueError, cv2.error, np.linalg.LinAlgError):
|
|
||||||
continue
|
|
||||||
train_fixed = [
|
|
||||||
_fixed_pose(robot_pose, target_pose, solution, eye_in_hand)
|
|
||||||
for robot_pose, target_pose in zip(train_robot, train_target)
|
|
||||||
]
|
|
||||||
center_rotation, center_translation = _pose_center(train_fixed)
|
|
||||||
test_fixed = _fixed_pose(
|
|
||||||
robot_poses[held_out],
|
|
||||||
target_poses[held_out],
|
|
||||||
solution,
|
|
||||||
eye_in_hand,
|
|
||||||
)
|
|
||||||
translation_errors.append(float(np.linalg.norm(test_fixed[:3, 3] - center_translation)))
|
|
||||||
rotation_errors.append(
|
|
||||||
math.radians(rotation_angle_degrees(center_rotation.T @ test_fixed[:3, :3]))
|
|
||||||
)
|
|
||||||
if not translation_errors:
|
|
||||||
raise ValueError("留一验证没有得到有效结果")
|
|
||||||
trans = np.asarray(translation_errors, dtype=np.float64)
|
|
||||||
rot = np.asarray(rotation_errors, dtype=np.float64)
|
|
||||||
trans_p95 = float(np.percentile(trans, 95))
|
|
||||||
rot_p95 = float(np.percentile(rot, 95))
|
|
||||||
return {
|
|
||||||
"sample_count": len(translation_errors),
|
|
||||||
"translation_median_m": float(np.median(trans)),
|
|
||||||
"translation_rms_m": float(np.sqrt(np.mean(np.square(trans)))),
|
|
||||||
"translation_p95_m": trans_p95,
|
|
||||||
"translation_max_m": float(np.max(trans)),
|
|
||||||
"rotation_median_rad": float(np.median(rot)),
|
|
||||||
"rotation_rms_rad": float(np.sqrt(np.mean(np.square(rot)))),
|
|
||||||
"rotation_p95_rad": rot_p95,
|
|
||||||
"rotation_max_rad": float(np.max(rot)),
|
|
||||||
"score_m": trans_p95 + HAND_EYE_CHARACTERISTIC_LENGTH_M * rot_p95,
|
|
||||||
}
|
|
||||||
|
|
||||||
# Upstream handeye_calibration_gui.py:481-592
|
|
||||||
def robust_handeye_calibration(
|
|
||||||
robot_poses: list[np.ndarray],
|
|
||||||
target_poses: list[np.ndarray],
|
|
||||||
eye_in_hand: bool,
|
|
||||||
requested_solver: str = AUTO_SOLVER_LABEL,
|
|
||||||
) -> dict[str, Any]:
|
|
||||||
"""Reject transform outliers, compare solvers and return the best solution."""
|
|
||||||
if len(robot_poses) != len(target_poses) or len(robot_poses) < 5:
|
|
||||||
raise ValueError("手眼标定至少需要 5 组配对位姿")
|
|
||||||
active = list(range(len(robot_poses)))
|
|
||||||
rejected: list[dict[str, Any]] = []
|
|
||||||
maximum_rejections = min(4, max(0, len(active) // 5), max(0, len(active) - 6))
|
|
||||||
|
|
||||||
# Remove at most one sample per iteration and recompute the solution. This
|
|
||||||
# avoids a single bad pose shifting the robust center enough to hide itself.
|
|
||||||
while len(rejected) < maximum_rejections and len(active) > 6:
|
|
||||||
active_robot = [robot_poses[index] for index in active]
|
|
||||||
active_target = [target_poses[index] for index in active]
|
|
||||||
candidates: list[tuple[float, str, np.ndarray, dict[str, Any]]] = []
|
|
||||||
method_items = HAND_EYE_SOLVER_METHODS.items()
|
|
||||||
if requested_solver in HAND_EYE_SOLVER_METHODS:
|
|
||||||
method_items = [(requested_solver, HAND_EYE_SOLVER_METHODS[requested_solver])]
|
|
||||||
for name, method in method_items:
|
|
||||||
try:
|
|
||||||
solution = solve_handeye_matrix(active_robot, active_target, eye_in_hand, method)
|
|
||||||
consistency = fixed_target_consistency(active_robot, active_target, solution, eye_in_hand)
|
|
||||||
candidates.append((consistency["score_m"], name, solution, consistency))
|
|
||||||
except (ValueError, cv2.error, np.linalg.LinAlgError):
|
|
||||||
continue
|
|
||||||
if not candidates:
|
|
||||||
raise ValueError("全部手眼求解器均失败,请增加姿态变化后重新采集")
|
|
||||||
_, provisional_name, _, consistency = min(candidates, key=lambda item: item[0])
|
|
||||||
trans = consistency["translation_errors_m"]
|
|
||||||
rot = consistency["rotation_errors_rad"]
|
|
||||||
trans_median = float(np.median(trans))
|
|
||||||
rot_median = float(np.median(rot))
|
|
||||||
trans_mad = float(np.median(np.abs(trans - trans_median)))
|
|
||||||
rot_mad = float(np.median(np.abs(rot - rot_median)))
|
|
||||||
trans_limit = max(
|
|
||||||
HAND_EYE_OUTLIER_TRANSLATION_FLOOR_M,
|
|
||||||
trans_median + 3.5 * 1.4826 * trans_mad,
|
|
||||||
)
|
|
||||||
rot_limit = max(
|
|
||||||
HAND_EYE_OUTLIER_ROTATION_FLOOR_RAD,
|
|
||||||
rot_median + 3.5 * 1.4826 * rot_mad,
|
|
||||||
)
|
|
||||||
severities = np.maximum(trans / trans_limit, rot / rot_limit)
|
|
||||||
worst_local = int(np.argmax(severities))
|
|
||||||
if float(severities[worst_local]) <= 1.0:
|
|
||||||
break
|
|
||||||
rejected.append({
|
|
||||||
"input_index": int(active[worst_local]),
|
|
||||||
"translation_error_m": float(trans[worst_local]),
|
|
||||||
"rotation_error_rad": float(rot[worst_local]),
|
|
||||||
"translation_limit_m": trans_limit,
|
|
||||||
"rotation_limit_rad": rot_limit,
|
|
||||||
"provisional_solver": provisional_name,
|
|
||||||
})
|
|
||||||
del active[worst_local]
|
|
||||||
|
|
||||||
active_robot = [robot_poses[index] for index in active]
|
|
||||||
active_target = [target_poses[index] for index in active]
|
|
||||||
reports: dict[str, dict[str, Any]] = {}
|
|
||||||
solved: dict[str, np.ndarray] = {}
|
|
||||||
for name, method in HAND_EYE_SOLVER_METHODS.items():
|
|
||||||
try:
|
|
||||||
solution = solve_handeye_matrix(active_robot, active_target, eye_in_hand, method)
|
|
||||||
consistency = fixed_target_consistency(active_robot, active_target, solution, eye_in_hand)
|
|
||||||
in_sample = {
|
|
||||||
key: value for key, value in consistency.items()
|
|
||||||
if key not in {"translation_errors_m", "rotation_errors_rad"}
|
|
||||||
}
|
|
||||||
try:
|
|
||||||
cross_validation = leave_one_out_handeye_metrics(
|
|
||||||
active_robot,
|
|
||||||
active_target,
|
|
||||||
eye_in_hand,
|
|
||||||
method,
|
|
||||||
)
|
|
||||||
except (ValueError, cv2.error, np.linalg.LinAlgError):
|
|
||||||
cross_validation = None
|
|
||||||
reports[name] = {
|
|
||||||
"status": "ok",
|
|
||||||
"in_sample": in_sample,
|
|
||||||
"leave_one_out": cross_validation,
|
|
||||||
}
|
|
||||||
solved[name] = solution
|
|
||||||
except (ValueError, cv2.error, np.linalg.LinAlgError) as exc:
|
|
||||||
reports[name] = {"status": "failed", "error": str(exc)}
|
|
||||||
|
|
||||||
available = [name for name in HAND_EYE_SOLVER_METHODS if name in solved]
|
|
||||||
if not available:
|
|
||||||
raise ValueError("异常样本筛选后全部手眼求解器均失败")
|
|
||||||
if requested_solver in solved:
|
|
||||||
selected_name = requested_solver
|
|
||||||
else:
|
|
||||||
def solver_rank(name: str) -> float:
|
|
||||||
validation = reports[name].get("leave_one_out")
|
|
||||||
if validation is not None:
|
|
||||||
return float(validation["score_m"])
|
|
||||||
return float(reports[name]["in_sample"]["score_m"])
|
|
||||||
selected_name = min(available, key=solver_rank)
|
|
||||||
solution = solved[selected_name]
|
|
||||||
return {
|
|
||||||
"solution": solution,
|
|
||||||
"selected_solver": selected_name,
|
|
||||||
"active_indices": active,
|
|
||||||
"rejected": rejected,
|
|
||||||
"solver_reports": reports,
|
|
||||||
"consistency": fixed_target_consistency(active_robot, active_target, solution, eye_in_hand),
|
|
||||||
"pair_metrics": ax_xb_all_pair_metrics(active_robot, active_target, solution, eye_in_hand),
|
|
||||||
}
|
|
||||||
@ -1,324 +0,0 @@
|
|||||||
"""Joint robot-world/hand-eye pixel refinement (new extension, not a phone port).
|
|
||||||
|
|
||||||
Related formulation: Tabb and Ahmad Yousef (2017), 'Solving the robot-world,
|
|
||||||
hand-eye(s) calibration problem with iterative methods', reprojection class:
|
|
||||||
https://doi.org/10.1007/s00138-017-0841-7 ; author manuscript with erratum:
|
|
||||||
https://arxiv.org/abs/1907.12425 . This is an independent NumPy/OpenCV LM
|
|
||||||
implementation, with fixed intrinsics, distortion and robot poses.
|
|
||||||
|
|
||||||
Column-vector T_parent_child matrices use metres. X is flange<-camera for
|
|
||||||
eye-in-hand, base<-camera otherwise. Y is base<-target / flange<-target.
|
|
||||||
Predicted camera<-target is inv(X) inv(G) Y / inv(X) G Y, respectively.
|
|
||||||
All RMS values are sqrt(mean(||pixel residual||^2)), including outliers.
|
|
||||||
Acceptance is a pixel consistency gate, never a hardware/mm accuracy claim.
|
|
||||||
"""
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import math
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
import cv2
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
from handeye_math import solve_handeye_matrix
|
|
||||||
|
|
||||||
HUBER_PX = 1.5
|
|
||||||
MAX_ITERATIONS = 80
|
|
||||||
MAX_CONDITION = 1e6
|
|
||||||
MAX_POINTS_PER_FRAME = 10000
|
|
||||||
MAX_TOTAL_POINTS = 100000
|
|
||||||
PARAMETER_SCALE = np.tile([1., 1., 1., .2, .2, .2], 2)
|
|
||||||
|
|
||||||
|
|
||||||
def _array(value, shape, name):
|
|
||||||
try:
|
|
||||||
result = np.asarray(value, dtype=np.float64)
|
|
||||||
except (TypeError, ValueError) as exc:
|
|
||||||
raise ValueError(f'{name}: expected finite numeric array') from exc
|
|
||||||
if result.size != math.prod(shape) or not np.all(np.isfinite(result)):
|
|
||||||
raise ValueError(f'{name}: expected {math.prod(shape)} finite numbers')
|
|
||||||
return result.reshape(shape)
|
|
||||||
|
|
||||||
|
|
||||||
def _matrix(value, name):
|
|
||||||
matrix = _array(value, (4, 4), name)
|
|
||||||
r = matrix[:3, :3]
|
|
||||||
if (not np.allclose(matrix[3], [0, 0, 0, 1], atol=1e-8, rtol=0)
|
|
||||||
or not np.allclose(r.T @ r, np.eye(3), atol=1e-5, rtol=0)
|
|
||||||
or abs(np.linalg.det(r)-1.) > 1e-5):
|
|
||||||
raise ValueError(f'{name}: expected a proper SE(3) transform')
|
|
||||||
return matrix.copy()
|
|
||||||
|
|
||||||
|
|
||||||
def _inverse(t):
|
|
||||||
result = np.eye(4)
|
|
||||||
result[:3, :3] = t[:3, :3].T
|
|
||||||
result[:3, 3] = -result[:3, :3] @ t[:3, 3]
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def _skew(points):
|
|
||||||
p = np.asarray(points).reshape(-1, 3)
|
|
||||||
result = np.zeros((len(p), 3, 3))
|
|
||||||
result[:, 0, 1], result[:, 0, 2] = -p[:, 2], p[:, 1]
|
|
||||||
result[:, 1, 0], result[:, 1, 2] = p[:, 2], -p[:, 0]
|
|
||||||
result[:, 2, 0], result[:, 2, 1] = -p[:, 1], p[:, 0]
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def _increment(t, delta):
|
|
||||||
"""Right multiplication by the SE(3) exponential; twist = [omega, v]."""
|
|
||||||
omega, velocity = delta[:3], delta[3:]
|
|
||||||
theta = float(np.linalg.norm(omega))
|
|
||||||
w = _skew(omega)[0]
|
|
||||||
if theta < 1e-6:
|
|
||||||
a, b = .5-theta**2/24., 1./6.-theta**2/120.
|
|
||||||
else:
|
|
||||||
a, b = (1.-math.cos(theta))/theta**2, (theta-math.sin(theta))/theta**3
|
|
||||||
exp = np.eye(4)
|
|
||||||
exp[:3, :3] = cv2.Rodrigues(omega)[0]
|
|
||||||
exp[:3, 3] = (np.eye(3)+a*w+b*w@w) @ velocity
|
|
||||||
return t @ exp
|
|
||||||
|
|
||||||
|
|
||||||
def _validated(robot_poses, observations, initial_matrix, eye_in_hand):
|
|
||||||
if not isinstance(eye_in_hand, (bool, np.bool_)):
|
|
||||||
raise ValueError('eye_in_hand must be boolean')
|
|
||||||
if not isinstance(observations, (list, tuple)) or not 6 <= len(observations) <= 100:
|
|
||||||
raise ValueError('Joint refinement requires 6..100 observations')
|
|
||||||
if not isinstance(robot_poses, (list, tuple, np.ndarray)) or len(robot_poses) != len(observations):
|
|
||||||
raise ValueError('Robot poses and observations must be paired')
|
|
||||||
x = _matrix(initial_matrix, 'initial_matrix')
|
|
||||||
robots, data, total = [], [], 0
|
|
||||||
id_coordinates = {}
|
|
||||||
for i, (pose, obs) in enumerate(zip(robot_poses, observations)):
|
|
||||||
try:
|
|
||||||
g = _matrix(pose, f'robot[{i}]')
|
|
||||||
c = _matrix(obs['T_camera_target'], f'observation[{i}].T_camera_target')
|
|
||||||
count = len(obs['object_points'])
|
|
||||||
if not 6 <= count <= MAX_POINTS_PER_FRAME:
|
|
||||||
raise ValueError('Each frame requires 6..10000 matched corners')
|
|
||||||
total += count
|
|
||||||
if total > MAX_TOTAL_POINTS:
|
|
||||||
raise ValueError('Total corner count exceeds 100000')
|
|
||||||
obj = _array(obs['object_points'], (count, 3), 'object_points')
|
|
||||||
img = _array(obs['image_points'], (count, 2), 'image_points')
|
|
||||||
ids = _array(obs['corner_ids'], (count,), 'corner_ids')
|
|
||||||
if (np.shape(obs['object_points']) != (count, 3) or np.shape(obs['image_points']) != (count, 2)
|
|
||||||
or np.shape(obs['corner_ids']) != (count,)):
|
|
||||||
raise ValueError('Expected matched N x 3 object points, N x 2 image points and N corner IDs')
|
|
||||||
if np.any(ids < 0) or np.any(ids > 2147483647) or np.any(ids != np.floor(ids)) or len(np.unique(ids)) != count:
|
|
||||||
raise ValueError('corner_ids must be unique nonnegative integers')
|
|
||||||
for corner_id, point in zip(ids, obj):
|
|
||||||
previous = id_coordinates.setdefault(int(corner_id), point)
|
|
||||||
if not np.allclose(previous, point, atol=1e-9, rtol=0):
|
|
||||||
raise ValueError('A corner ID must refer to the same object point in every frame')
|
|
||||||
centered = obj - obj.mean(axis=0)
|
|
||||||
singular = np.linalg.svd(centered, compute_uv=False)
|
|
||||||
if singular[1] <= max(1e-9, singular[0]*1e-6) or singular[2] > max(1e-9, singular[0]*1e-6):
|
|
||||||
raise ValueError('Object points must be planar and noncollinear')
|
|
||||||
if len(np.unique(obj, axis=0)) != count:
|
|
||||||
raise ValueError('Duplicate object points')
|
|
||||||
k = _array(obs['K'], (3, 3), 'K')
|
|
||||||
if k[0,0] <= 0 or k[1,1] <= 0 or not np.allclose(k[2], [0,0,1], atol=1e-10, rtol=0) or abs(k[0,1])+abs(k[1,0]) > 1e-10:
|
|
||||||
raise ValueError('K must have positive focal lengths and standard zero-skew form')
|
|
||||||
d = np.asarray(obs['D'], dtype=np.float64).reshape(-1)
|
|
||||||
if len(d) not in (0,4,5,8,12,14) or not np.all(np.isfinite(d)):
|
|
||||||
raise ValueError('Invalid distortion coefficients')
|
|
||||||
width, height = obs['width'], obs['height']
|
|
||||||
if (isinstance(width, bool) or isinstance(height, bool) or int(width) != width or int(height) != height
|
|
||||||
or min(width, height) < 2 or max(width, height) > 8192 or width*height > 32000000):
|
|
||||||
raise ValueError('Invalid image dimensions')
|
|
||||||
if np.any(img < 0) or np.any(img[:,0] >= width) or np.any(img[:,1] >= height):
|
|
||||||
raise ValueError('Image corners must be inside the calibrated image')
|
|
||||||
depths = (obj @ c[:3,:3].T + c[:3,3])[:,2]
|
|
||||||
if np.min(depths) <= 1e-8:
|
|
||||||
raise ValueError('All PnP corners must have positive depth')
|
|
||||||
robots.append(g)
|
|
||||||
data.append(dict(c=c, obj=obj, skew=_skew(obj), img=img, k=k, d=d,
|
|
||||||
motion=_inverse(g) if eye_in_hand else g))
|
|
||||||
except (KeyError, TypeError, OverflowError) as exc:
|
|
||||||
raise ValueError(f'Invalid observation {i}: {exc}') from exc
|
|
||||||
return robots, data, x
|
|
||||||
|
|
||||||
|
|
||||||
def _initial_fixed(data, x):
|
|
||||||
poses = [_inverse(o['motion']) @ x @ o['c'] for o in data]
|
|
||||||
u, _, vt = np.linalg.svd(np.sum([p[:3,:3] for p in poses], axis=0))
|
|
||||||
y = np.eye(4)
|
|
||||||
y[:3,:3] = u @ np.diag([1., 1., np.linalg.det(u@vt)]) @ vt
|
|
||||||
y[:3,3] = np.median([p[:3,3] for p in poses], axis=0)
|
|
||||||
return y
|
|
||||||
|
|
||||||
|
|
||||||
def _evaluate(data, x, y, jacobian=False):
|
|
||||||
residuals, blocks = [], []
|
|
||||||
xi = _inverse(x)
|
|
||||||
for obs in data:
|
|
||||||
prediction = xi @ obs['motion'] @ y
|
|
||||||
pc = obs['obj'] @ prediction[:3,:3].T + prediction[:3,3]
|
|
||||||
if not np.all(np.isfinite(pc)) or np.min(pc[:,2]) <= 1e-8:
|
|
||||||
raise ValueError('Predicted corners violate positive depth')
|
|
||||||
projected, camera_j = cv2.projectPoints(pc, np.zeros(3), np.zeros(3), obs['k'], obs['d'])
|
|
||||||
residuals.append((projected.reshape(-1,2)-obs['img']).ravel())
|
|
||||||
if jacobian:
|
|
||||||
dp = camera_j[:,3:6].reshape(-1,2,3)
|
|
||||||
geometric = np.concatenate((_skew(pc), np.broadcast_to(-np.eye(3), (len(pc),3,3)),
|
|
||||||
-prediction[:3,:3] @ obs['skew'], np.broadcast_to(prediction[:3,:3], (len(pc),3,3))), axis=2)
|
|
||||||
blocks.append((dp @ geometric).reshape(-1,12)*PARAMETER_SCALE)
|
|
||||||
residual = np.concatenate(residuals)
|
|
||||||
if not np.all(np.isfinite(residual)):
|
|
||||||
raise ValueError('Nonfinite reprojection')
|
|
||||||
return residual, np.vstack(blocks) if jacobian else None
|
|
||||||
|
|
||||||
|
|
||||||
def _cost_weights(residual):
|
|
||||||
norms = np.linalg.norm(residual.reshape(-1,2), axis=1)
|
|
||||||
cost = np.sum(np.where(norms <= HUBER_PX, .5*norms**2, HUBER_PX*(norms-.5*HUBER_PX)))
|
|
||||||
weights = np.repeat(np.minimum(1., HUBER_PX/np.maximum(norms, 1e-15)), 2)
|
|
||||||
return float(cost), weights
|
|
||||||
|
|
||||||
|
|
||||||
def _condition(jacobian, weights):
|
|
||||||
weighted = jacobian*np.sqrt(weights[:,None])
|
|
||||||
if not np.all(np.isfinite(weighted)):
|
|
||||||
raise ValueError('Nonfinite joint Jacobian')
|
|
||||||
singular = np.linalg.svd(weighted, compute_uv=False)
|
|
||||||
if singular[-1] <= singular[0]/MAX_CONDITION or singular[0] <= 1e-12:
|
|
||||||
raise ValueError('Joint Jacobian is rank deficient or poorly conditioned; increase robot pose diversity')
|
|
||||||
return weighted, float(singular[0]/singular[-1])
|
|
||||||
|
|
||||||
|
|
||||||
def _fit(data, x, y):
|
|
||||||
x, y = x.copy(), y.copy()
|
|
||||||
damping, converged, iterations = 1e-3, False, 0
|
|
||||||
initial_residual, _ = _evaluate(data, x, y)
|
|
||||||
initial_cost, _ = _cost_weights(initial_residual)
|
|
||||||
for iteration in range(MAX_ITERATIONS):
|
|
||||||
iterations = iteration+1
|
|
||||||
residual, j = _evaluate(data, x, y, True)
|
|
||||||
cost, weights = _cost_weights(residual)
|
|
||||||
jw, condition = _condition(j, weights)
|
|
||||||
h = jw.T @ jw
|
|
||||||
gradient = j.T @ (weights*residual)
|
|
||||||
diagonal = np.maximum(np.diag(h), 1e-12)
|
|
||||||
if np.max(np.abs(gradient)/np.sqrt(diagonal)) < 1e-7:
|
|
||||||
converged = True
|
|
||||||
break
|
|
||||||
accepted_step = False
|
|
||||||
for _ in range(16):
|
|
||||||
step = np.linalg.solve(h+damping*np.diag(diagonal), -gradient)
|
|
||||||
# Bound trial motion to a local basin; translation scale is 0.2m.
|
|
||||||
length = max(np.linalg.norm(step[:3]), np.linalg.norm(step[6:9]),
|
|
||||||
np.linalg.norm(step[3:6]), np.linalg.norm(step[9:12]))
|
|
||||||
if length > .3:
|
|
||||||
step *= .3/length
|
|
||||||
physical = step*PARAMETER_SCALE
|
|
||||||
trial_x = _increment(x, physical[:6])
|
|
||||||
trial_y = _increment(y, physical[6:])
|
|
||||||
try:
|
|
||||||
trial_residual, _ = _evaluate(data, trial_x, trial_y)
|
|
||||||
trial_cost, _ = _cost_weights(trial_residual)
|
|
||||||
except (ValueError, cv2.error):
|
|
||||||
trial_cost = math.inf
|
|
||||||
if trial_cost < cost:
|
|
||||||
x, y = trial_x, trial_y
|
|
||||||
accepted_step = True
|
|
||||||
damping = max(damping/3., 1e-12)
|
|
||||||
# Small progress alone is insufficient while heavily damped.
|
|
||||||
if (np.linalg.norm(step) < 1e-9 or cost-trial_cost < 1e-10*max(1., cost)) and damping < 1e-3:
|
|
||||||
converged = True
|
|
||||||
break
|
|
||||||
damping *= 10.
|
|
||||||
if damping > 1e14:
|
|
||||||
break
|
|
||||||
if converged or not accepted_step:
|
|
||||||
break
|
|
||||||
residual, j = _evaluate(data, x, y, True)
|
|
||||||
cost, weights = _cost_weights(residual)
|
|
||||||
_, condition = _condition(j, weights)
|
|
||||||
return dict(x=x, y=y, residual=residual, initial_residual=initial_residual,
|
|
||||||
initial_cost=initial_cost, cost=cost, condition=condition,
|
|
||||||
converged=converged, iterations=iterations)
|
|
||||||
|
|
||||||
|
|
||||||
def _rms(residual):
|
|
||||||
return float(np.sqrt(np.mean(np.sum(residual.reshape(-1,2)**2, axis=1))))
|
|
||||||
|
|
||||||
|
|
||||||
def refine_joint(robot_poses, observations, initial_matrix, eye_in_hand) -> dict[str, Any]:
|
|
||||||
"""Fit both transforms; reject quality failures without a successful fallback.
|
|
||||||
|
|
||||||
Invalid/degenerate input raises ValueError. Numerical nonconvergence and
|
|
||||||
cross-validation failures return accepted=False and explicit quality_flags.
|
|
||||||
Validation fits see only their training poses, PnP estimates and corners;
|
|
||||||
neither the supplied initial matrix nor the full-fit matrices are reused.
|
|
||||||
The robust loss must not increase (relative tolerance 1e-9); all-point RMS
|
|
||||||
may rise by at most max(0.01px, 1% of initial RMS), and must be <=1.5px.
|
|
||||||
Held-out all-point RMS must be <=3px with every frame validated exactly once.
|
|
||||||
"""
|
|
||||||
robots, data, x0 = _validated(robot_poses, observations, initial_matrix, eye_in_hand)
|
|
||||||
y0 = _initial_fixed(data, x0)
|
|
||||||
full = _fit(data, x0, y0)
|
|
||||||
flags = []
|
|
||||||
if not full['converged']:
|
|
||||||
flags.append('refinement_not_converged')
|
|
||||||
initial_rms, final_rms = _rms(full['initial_residual']), _rms(full['residual'])
|
|
||||||
if full['cost'] > full['initial_cost']+1e-9*max(1., full['initial_cost']):
|
|
||||||
flags.append('robust_objective_not_improved')
|
|
||||||
if final_rms > initial_rms+max(.01, .01*initial_rms):
|
|
||||||
flags.append('all_point_rms_increased')
|
|
||||||
if final_rms > 1.5:
|
|
||||||
flags.append('high_refinement_reprojection')
|
|
||||||
n = len(data)
|
|
||||||
folds = [list(range(i, n, 3)) for i in range(3)] if n >= 9 else [[i] for i in range(n)]
|
|
||||||
heldout, fold_reports, validation_residuals = {}, [], []
|
|
||||||
for fold_id, test in enumerate(folds):
|
|
||||||
test_set = set(test)
|
|
||||||
train = [i for i in range(n) if i not in test_set]
|
|
||||||
report = dict(fold=fold_id, train_indices=train, held_out_indices=test, valid=False)
|
|
||||||
try:
|
|
||||||
train_data = [data[i] for i in train]
|
|
||||||
train_x = _matrix(solve_handeye_matrix([robots[i] for i in train], [data[i]['c'] for i in train],
|
|
||||||
eye_in_hand, cv2.CALIB_HAND_EYE_PARK), 'validation initialization')
|
|
||||||
fit = _fit(train_data, train_x, _initial_fixed(train_data, train_x))
|
|
||||||
if not fit['converged']:
|
|
||||||
raise ValueError('Validation fit did not converge')
|
|
||||||
fold_residuals = []
|
|
||||||
for i in test:
|
|
||||||
residual, _ = _evaluate([data[i]], fit['x'], fit['y'])
|
|
||||||
fold_residuals.append((i, residual))
|
|
||||||
for i, residual in fold_residuals:
|
|
||||||
heldout[i] = _rms(residual)
|
|
||||||
validation_residuals.append(residual)
|
|
||||||
report.update(valid=True, rms_px=_rms(np.concatenate([r for _, r in fold_residuals])),
|
|
||||||
iterations=fit['iterations'], jacobian_condition=fit['condition'])
|
|
||||||
except (ValueError, cv2.error, np.linalg.LinAlgError) as exc:
|
|
||||||
report['error'] = str(exc)
|
|
||||||
fold_reports.append(report)
|
|
||||||
validation_rms = _rms(np.concatenate(validation_residuals)) if validation_residuals else None
|
|
||||||
if len(heldout) != n:
|
|
||||||
flags.append('incomplete_cross_validation')
|
|
||||||
if validation_rms is not None and validation_rms > 3.:
|
|
||||||
flags.append('high_validation_reprojection')
|
|
||||||
details, offset = [], 0
|
|
||||||
for i, obs in enumerate(data):
|
|
||||||
end = offset+2*len(obs['obj'])
|
|
||||||
details.append(dict(input_index=i, used=True, corner_count=len(obs['obj']),
|
|
||||||
initial_rms_px=_rms(full['initial_residual'][offset:end]),
|
|
||||||
final_rms_px=_rms(full['residual'][offset:end]), validation_rms_px=heldout.get(i),
|
|
||||||
validation_used=i in heldout))
|
|
||||||
offset = end
|
|
||||||
metrics = dict(initial_rms_px=initial_rms, final_rms_px=final_rms, validation_rms_px=validation_rms,
|
|
||||||
validation_sample_count=len(heldout), validation_coverage=len(heldout)/n,
|
|
||||||
validation_fold_count=len(folds), validation_point_count=sum(len(data[i]['obj']) for i in heldout),
|
|
||||||
iterations=full['iterations'], jacobian_condition=full['condition'],
|
|
||||||
initial_robust_cost=full['initial_cost'], final_robust_cost=full['cost'], huber_delta_px=HUBER_PX,
|
|
||||||
final_rms_limit_px=1.5, validation_rms_limit_px=3., max_jacobian_condition=MAX_CONDITION,
|
|
||||||
samples_total=n, samples_used=n, point_count=offset//2, accepted=not flags)
|
|
||||||
return dict(matrix=full['x'].ravel().tolist(), fixed_matrix=full['y'].ravel().tolist(),
|
|
||||||
initial_matrix=x0.ravel().tolist(), initial_fixed_matrix=y0.ravel().tolist(),
|
|
||||||
matrix_name='T_flange_camera' if eye_in_hand else 'T_base_camera',
|
|
||||||
fixed_matrix_name='T_base_target' if eye_in_hand else 'T_flange_target',
|
|
||||||
method='joint_reprojection_lm', converged=full['converged'], accepted=not flags,
|
|
||||||
metrics=metrics, quality_flags=flags, sample_diagnostics=details, validation_folds=fold_reports)
|
|
||||||
@ -1,331 +0,0 @@
|
|||||||
"""Isolated OpenCV worker for Qt. One UTF-8 JSON request/reply per line.
|
|
||||||
|
|
||||||
Protocol 1 uses row-major 16-element SE(3) matrices, metres and radians.
|
|
||||||
T_parent_child transforms child coordinates into parent coordinates. The
|
|
||||||
worker never opens cameras or robots: every measurement comes from the caller.
|
|
||||||
Detect supports a PNG in image_png_base64 or stride-aware frame planes.
|
|
||||||
Solve requires paired T_base_flange/T_camera_target and reprojection_px.
|
|
||||||
ok means the operation ran; valid (and metrics.accepted) controls acceptance.
|
|
||||||
Phone provenance is listed in handeye_math.py and at the ported stages below.
|
|
||||||
"""
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import base64
|
|
||||||
import json
|
|
||||||
import math
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
import cv2
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
# -I / embedded Python intentionally exclude the working directory and script
|
|
||||||
# directory. Only add our explicitly deployed sibling algorithm modules.
|
|
||||||
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
||||||
from handeye_math import (HAND_EYE_SOLVER_METHODS, dominant_rotation_axes,
|
|
||||||
estimate_planar_pose, robust_handeye_calibration, rvec_tvec_to_matrix,
|
|
||||||
ax_xb_all_pair_metrics, fixed_target_consistency)
|
|
||||||
|
|
||||||
PROTOCOL = 1
|
|
||||||
MAX_DIMENSION = 8192
|
|
||||||
MAX_PIXELS = 32_000_000
|
|
||||||
MAX_LINE_BYTES = 180_000_000
|
|
||||||
MAX_REPROJECTION_PX = 1.5
|
|
||||||
MAX_PHOTO_BYTES = 2 * 1024 * 1024
|
|
||||||
|
|
||||||
|
|
||||||
def capture_photo(image: np.ndarray) -> str:
|
|
||||||
# Keep full frame coordinates for the measured corners; never resize.
|
|
||||||
for quality in (90, 75, 55, 35):
|
|
||||||
ok, encoded = cv2.imencode('.jpg', image, [cv2.IMWRITE_JPEG_QUALITY, quality])
|
|
||||||
if ok and encoded.nbytes <= MAX_PHOTO_BYTES:
|
|
||||||
return base64.b64encode(encoded).decode('ascii')
|
|
||||||
raise ValueError('采样照片编码失败或超过 2 MiB,请降低视频分辨率后重采')
|
|
||||||
|
|
||||||
|
|
||||||
def finite_array(value: Any, shape: tuple[int, ...], name: str) -> np.ndarray:
|
|
||||||
result = np.asarray(value, dtype=np.float64)
|
|
||||||
if result.size != math.prod(shape) or not np.all(np.isfinite(result)):
|
|
||||||
raise ValueError(f'{name}: expected {math.prod(shape)} finite numbers')
|
|
||||||
return result.reshape(shape)
|
|
||||||
|
|
||||||
|
|
||||||
def matrix(value: Any, name: str) -> np.ndarray:
|
|
||||||
result = finite_array(value, (4, 4), name)
|
|
||||||
rotation = result[:3, :3]
|
|
||||||
if not np.allclose(result[3], [0,0,0,1], atol=1e-8, rtol=0):
|
|
||||||
raise ValueError(f'{name}: invalid homogeneous bottom row')
|
|
||||||
if not np.allclose(rotation.T @ rotation, np.eye(3), atol=1e-5, rtol=0) or abs(np.linalg.det(rotation)-1) > 1e-5:
|
|
||||||
raise ValueError(f'{name}: rotation must be proper orthonormal SO(3)')
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def dimensions(width: Any, height: Any) -> tuple[int, int]:
|
|
||||||
w,h=int(width),int(height)
|
|
||||||
if w != width or h != height or min(w,h)<2 or max(w,h)>MAX_DIMENSION or w*h>MAX_PIXELS:
|
|
||||||
raise ValueError('Invalid image dimensions (maximum 8192 per axis / 32 megapixels)')
|
|
||||||
return w,h
|
|
||||||
|
|
||||||
|
|
||||||
def decode_frame(request: dict) -> np.ndarray:
|
|
||||||
w,h=dimensions(request['width'], request['height'])
|
|
||||||
if 'frame' not in request:
|
|
||||||
encoded=base64.b64decode(request['image_png_base64'],validate=True)
|
|
||||||
# Check the PNG header before allowing OpenCV to allocate decoded pixels.
|
|
||||||
if len(encoded)<24 or encoded[:8] != b'\x89PNG\r\n\x1a\n':
|
|
||||||
raise ValueError('image_png_base64 must contain a PNG image')
|
|
||||||
pw,ph=int.from_bytes(encoded[16:20],'big'),int.from_bytes(encoded[20:24],'big')
|
|
||||||
if (pw,ph)!=(w,h): raise ValueError('PNG dimensions differ from calibrated width/height')
|
|
||||||
image=cv2.imdecode(np.frombuffer(encoded,np.uint8),cv2.IMREAD_COLOR)
|
|
||||||
if image is None: raise ValueError('Could not decode PNG image')
|
|
||||||
return image
|
|
||||||
frame=request['frame']
|
|
||||||
if dimensions(frame['width'],frame['height'])!=(w,h):
|
|
||||||
raise ValueError('Frame dimensions differ from calibrated width/height')
|
|
||||||
fmt=frame['format'];planes=frame['planes']
|
|
||||||
count={'RGBA':1,'I420':3,'NV12':2}.get(fmt)
|
|
||||||
if count is None or len(planes)!=count: raise ValueError('Unsupported frame format or plane count')
|
|
||||||
def plane(index: int, rows: int, row_bytes: int) -> np.ndarray:
|
|
||||||
stride=int(frame.get(f'stride{index}',row_bytes))
|
|
||||||
if stride<row_bytes or stride>row_bytes+65536: raise ValueError('Invalid plane stride')
|
|
||||||
raw=base64.b64decode(planes[index],validate=True)
|
|
||||||
# Trailing row padding may be omitted by frame producers.
|
|
||||||
minimum=(rows-1)*stride+row_bytes
|
|
||||||
if len(raw)<minimum or len(raw)>rows*stride: raise ValueError('Frame plane length does not match dimensions/stride')
|
|
||||||
return np.ndarray((rows,row_bytes),dtype=np.uint8,buffer=raw,strides=(stride,1)).copy()
|
|
||||||
if fmt=='RGBA': return cv2.cvtColor(plane(0,h,w*4).reshape(h,w,4),cv2.COLOR_RGBA2BGR)
|
|
||||||
if w%2 or h%2: raise ValueError('I420/NV12 frames require even dimensions')
|
|
||||||
y=plane(0,h,w)
|
|
||||||
if fmt=='I420':
|
|
||||||
packed=np.concatenate((y.ravel(),plane(1,h//2,w//2).ravel(),plane(2,h//2,w//2).ravel())).reshape(h*3//2,w)
|
|
||||||
return cv2.cvtColor(packed,cv2.COLOR_YUV2BGR_I420)
|
|
||||||
packed=np.vstack((y,plane(1,h//2,w)))
|
|
||||||
return cv2.cvtColor(packed,cv2.COLOR_YUV2BGR_NV12)
|
|
||||||
|
|
||||||
|
|
||||||
def detect(request: dict) -> dict:
|
|
||||||
k=finite_array(request['K'],(3,3),'K')
|
|
||||||
d=np.asarray(request.get('D',[]),dtype=np.float64).reshape(-1)
|
|
||||||
if len(d) not in (0,4,5,8,12,14) or not np.all(np.isfinite(d)):
|
|
||||||
raise ValueError('D requires 0, 4, 5, 8, 12 or 14 finite coefficients')
|
|
||||||
if k[0,0]<=0 or k[1,1]<=0 or not np.allclose(k[2],[0,0,1],atol=1e-10):
|
|
||||||
raise ValueError('Invalid calibrated camera matrix')
|
|
||||||
image=decode_frame(request)
|
|
||||||
gray=cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
|
|
||||||
config=request['board'];kind=config['type']
|
|
||||||
cols,rows=int(config['columns']),int(config['rows'])
|
|
||||||
square=float(config['square_size_m'])
|
|
||||||
if not 3<=cols<=100 or not 3<=rows<=100 or not math.isfinite(square) or square<=0:
|
|
||||||
raise ValueError('Board requires 3..100 columns/rows and positive square_size_m')
|
|
||||||
# Port of phone HandEyeApp.detect (1905-1952), object-point layout
|
|
||||||
# (1644-1650), and _board (1584-1597), with stricter boundary validation.
|
|
||||||
if kind=='chessboard':
|
|
||||||
found,corners=False,None
|
|
||||||
try:
|
|
||||||
found,corners=cv2.findChessboardCornersSB(gray,(cols,rows),flags=cv2.CALIB_CB_EXHAUSTIVE|cv2.CALIB_CB_ACCURACY)
|
|
||||||
except (AttributeError,cv2.error):
|
|
||||||
pass
|
|
||||||
if not found:
|
|
||||||
found,corners=cv2.findChessboardCorners(gray,(cols,rows),flags=cv2.CALIB_CB_ADAPTIVE_THRESH|cv2.CALIB_CB_NORMALIZE_IMAGE)
|
|
||||||
if found:
|
|
||||||
corners=cv2.cornerSubPix(gray,corners,(5,5),(-1,-1),(cv2.TERM_CRITERIA_EPS|cv2.TERM_CRITERIA_MAX_ITER,40,1e-3))
|
|
||||||
if not found or corners is None or len(corners)!=cols*rows:
|
|
||||||
return dict(ok=True,valid=False,error=f'未检测到 {cols}×{rows} 棋盘格内角点',corners=[],axes=[],quality_flags=['board_not_found'])
|
|
||||||
obj=np.zeros((cols*rows,3),np.float64)
|
|
||||||
obj[:,:2]=np.mgrid[0:cols,0:rows].T.reshape(-1,2)*square
|
|
||||||
img=np.asarray(corners,np.float64).reshape(-1,2)
|
|
||||||
ids=np.arange(len(img))
|
|
||||||
elif kind=='charuco':
|
|
||||||
marker=float(config['marker_size_m']);name=config.get('dictionary','DICT_4X4_50')
|
|
||||||
if not math.isfinite(marker) or not 0<marker<square:
|
|
||||||
raise ValueError('marker_size_m must be positive and smaller than square_size_m')
|
|
||||||
if not isinstance(name,str) or not name.startswith('DICT_') or not hasattr(cv2.aruco,name):
|
|
||||||
raise ValueError('Unknown ArUco dictionary')
|
|
||||||
dictionary=cv2.aruco.getPredefinedDictionary(getattr(cv2.aruco,name))
|
|
||||||
board=cv2.aruco.CharucoBoard((cols,rows),square,marker,dictionary)
|
|
||||||
corners,ids,_,_=cv2.aruco.CharucoDetector(board).detectBoard(gray)
|
|
||||||
if ids is None or len(ids)<6:
|
|
||||||
return dict(ok=True,valid=False,error='至少需要 6 个 ChArUco 角点',corners=[] if corners is None else corners.reshape(-1,2).tolist(),axes=[],quality_flags=['insufficient_corners'])
|
|
||||||
obj,img=board.matchImagePoints(corners,ids)
|
|
||||||
obj=np.asarray(obj,np.float64).reshape(-1,3);img=np.asarray(img,np.float64).reshape(-1,2)
|
|
||||||
else: raise ValueError('board.type must be chessboard or charuco')
|
|
||||||
rvec,tvec=estimate_planar_pose(obj,img,k,d)
|
|
||||||
target=rvec_tvec_to_matrix(rvec,tvec)
|
|
||||||
projected=cv2.projectPoints(obj,rvec,tvec,k,d)[0].reshape(-1,2)
|
|
||||||
error=float(np.mean(np.linalg.norm(projected-img,axis=1)))
|
|
||||||
axis=square*2
|
|
||||||
axes=cv2.projectPoints(np.array([[0,0,0],[axis,0,0],[0,axis,0],[0,0,axis]],np.float64),rvec,tvec,k,d)[0].reshape(-1,2)
|
|
||||||
valid=math.isfinite(error) and error<=MAX_REPROJECTION_PX
|
|
||||||
result = dict(ok=True,valid=valid,T_camera_target=target.ravel().tolist(),corners=img.tolist(),ids=np.asarray(ids).ravel().tolist(),axes=axes.tolist(),reprojection_px=error,quality_flags=[] if valid else ['high_reprojection'],error='' if valid else '重投影误差超过 1.5 px',board_type=kind,
|
|
||||||
image_points=img.tolist(),object_points=obj.tolist(),corner_ids=np.asarray(ids).ravel().tolist(),
|
|
||||||
K=k.ravel().tolist(),D=d.tolist(),width=int(image.shape[1]),height=int(image.shape[0]))
|
|
||||||
if valid and request.get('capture_photo') is True:
|
|
||||||
result['photo_jpeg'] = capture_photo(image)
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def observable(robots: list[np.ndarray]) -> bool:
|
|
||||||
# Rotation vectors must span two independent axes, rather than two bins
|
|
||||||
# for one diagonal axis. Translation solve also needs full rank.
|
|
||||||
vectors=[];translation_blocks=[]
|
|
||||||
for i in range(len(robots)-1):
|
|
||||||
for j in range(i+1,len(robots)):
|
|
||||||
rotation=robots[i][:3,:3].T @ robots[j][:3,:3]
|
|
||||||
vector=cv2.Rodrigues(rotation)[0].ravel()
|
|
||||||
if np.linalg.norm(vector)>=math.radians(3): vectors.append(vector)
|
|
||||||
translation_blocks.append(rotation-np.eye(3))
|
|
||||||
if len(vectors)<2: return False
|
|
||||||
values=np.linalg.svd(np.asarray(vectors),compute_uv=False)
|
|
||||||
motion_values=np.linalg.svd(np.vstack(translation_blocks),compute_uv=False)
|
|
||||||
return bool(values[1]>.03*values[0] and motion_values[-1]>.03*motion_values[0])
|
|
||||||
|
|
||||||
|
|
||||||
def solve(request: dict) -> dict:
|
|
||||||
optimization=request.get('optimization','pose_only')
|
|
||||||
if optimization not in ('pose_only','joint_reprojection'):
|
|
||||||
raise ValueError('Unknown optimization; expected pose_only or joint_reprojection')
|
|
||||||
mode={'EyeInHand':'eye_in_hand','EyeToHand':'eye_to_hand'}.get(request.get('mode'),request.get('mode'))
|
|
||||||
if mode not in ('eye_in_hand','eye_to_hand'): raise ValueError('Unknown hand-eye mode')
|
|
||||||
method=request.get('method','auto')
|
|
||||||
if method!='auto' and method not in HAND_EYE_SOLVER_METHODS: raise ValueError('Unknown hand-eye solver')
|
|
||||||
samples=request['samples']
|
|
||||||
if not isinstance(samples,list) or not 5<=len(samples)<=100:
|
|
||||||
raise ValueError('手眼标定需要 5 到 100 组配对位姿,建议至少 12 组')
|
|
||||||
robots=[];targets=[];errors=[]
|
|
||||||
for index,sample in enumerate(samples):
|
|
||||||
robots.append(matrix(sample['T_base_flange'],f'samples[{index}].T_base_flange'))
|
|
||||||
target=matrix(sample['T_camera_target'],f'samples[{index}].T_camera_target')
|
|
||||||
if target[2,3]<=0: raise ValueError(f'samples[{index}]: board origin must have positive camera depth')
|
|
||||||
targets.append(target)
|
|
||||||
error=float(sample['reprojection_px'])
|
|
||||||
if not math.isfinite(error) or error<0: raise ValueError('Every sample requires finite nonnegative reprojection_px')
|
|
||||||
errors.append(error)
|
|
||||||
if not observable(robots): raise ValueError('姿态变化不足:需要至少两个独立旋转轴(超过 3°)')
|
|
||||||
# Phone reprojection MAD filtering (2712-2748), but never retain a
|
|
||||||
# >1.5px observation merely to reach the mathematical minimum.
|
|
||||||
median=float(np.median(errors));mad=float(np.median(np.abs(np.asarray(errors)-median)))
|
|
||||||
limit=min(MAX_REPROJECTION_PX,max(.65,median+3.5*1.4826*mad))
|
|
||||||
original=[i for i,e in enumerate(errors) if e<=limit]
|
|
||||||
if len(original)<5: raise ValueError('重投影质量合格样本不足 5 个(上限 1.5 px)')
|
|
||||||
selected_robots=[robots[i] for i in original]
|
|
||||||
if not observable(selected_robots): raise ValueError('剔除重投影异常后姿态变化不足')
|
|
||||||
result=robust_handeye_calibration(selected_robots,[targets[i] for i in original],mode=='eye_in_hand',method)
|
|
||||||
active=[original[i] for i in result['active_indices']]
|
|
||||||
final=matrix(result['solution'],'solution')
|
|
||||||
consistency=result['consistency'];pairs=result['pair_metrics']
|
|
||||||
quality=[]
|
|
||||||
if not observable([robots[i] for i in active]): quality.append('insufficient_rotation_excitation')
|
|
||||||
# Phone's independent validation gates (3085-3094): 5 mm / 2 degrees.
|
|
||||||
if pairs['translation_rms_m']>.005: quality.append('high_ax_xb_translation')
|
|
||||||
if pairs['rotation_rms_rad']>math.radians(2): quality.append('high_ax_xb_rotation')
|
|
||||||
if consistency['translation_max_m']>.005: quality.append('high_fixed_target_translation')
|
|
||||||
if consistency['rotation_max_rad']>math.radians(2): quality.append('high_fixed_target_rotation')
|
|
||||||
cv=result['solver_reports'][result['selected_solver']].get('leave_one_out')
|
|
||||||
if cv is not None:
|
|
||||||
if cv['translation_max_m']>.005: quality.append('high_cross_validation_translation')
|
|
||||||
if cv['rotation_max_rad']>math.radians(2): quality.append('high_cross_validation_rotation')
|
|
||||||
if cv['sample_count']!=len(active): quality.append('incomplete_cross_validation')
|
|
||||||
metrics=dict(accepted=not quality,reprojection_mean_px=float(np.mean([errors[i] for i in active])),reprojection_max_px=max(errors[i] for i in active),ax_xb_translation_rms_m=pairs['translation_rms_m'],ax_xb_rotation_rms_rad=pairs['rotation_rms_rad'],fixed_target_translation_max_m=consistency['translation_max_m'],fixed_target_rotation_max_rad=consistency['rotation_max_rad'],pair_count=pairs['pair_count'],samples_total=len(samples),samples_used=len(active))
|
|
||||||
active_set=set(active)
|
|
||||||
rejected=sorted(set(range(len(samples)))-active_set)
|
|
||||||
details=[]
|
|
||||||
for i in range(len(samples)):
|
|
||||||
detail=dict(input_index=i,used=i in active_set,reprojection_px=errors[i])
|
|
||||||
if i in active_set:
|
|
||||||
local=active.index(i)
|
|
||||||
detail.update(fixed_pose_translation_error_m=float(consistency['translation_errors_m'][local]),fixed_pose_rotation_error_rad=float(consistency['rotation_errors_rad'][local]))
|
|
||||||
else: detail['reason']='reprojection_outlier' if i not in original else 'transform_outlier'
|
|
||||||
details.append(detail)
|
|
||||||
response=dict(ok=True,valid=not quality,mode=mode,matrix=final.ravel().tolist(),matrix_name='T_flange_camera' if mode=='eye_in_hand' else 'T_base_camera',selected_solver=result['selected_solver'],active_indices=active,rejected_indices=rejected,sample_diagnostics=details,metrics=metrics,quality_flags=quality,ax_xb_all_pair_metrics=pairs,fixed_target_consistency={k:v for k,v in consistency.items() if not isinstance(v,np.ndarray)},solver_evaluations=result['solver_reports'],rotation_axis_coverage=sorted(dominant_rotation_axes([robots[i] for i in active])),reprojection_limit_px=limit,independent_validation_required=True,error='' if not quality else '标定质量未通过:'+', '.join(quality),optimization=optimization)
|
|
||||||
if optimization=='pose_only':
|
|
||||||
return response
|
|
||||||
# This is a new joint reprojection stage, not a claim that the phone GUI
|
|
||||||
# originally performed Robot-world calibration. Both fixed transforms are
|
|
||||||
# variables; robot poses and each observation's intrinsics remain measured.
|
|
||||||
from handeye_refinement import refine_joint
|
|
||||||
if len(active)<6:
|
|
||||||
raise ValueError('联合标定需要至少 6 组有效样本,以进行独立留出验证')
|
|
||||||
active_robots=[robots[i] for i in active]
|
|
||||||
active_targets=[targets[i] for i in active]
|
|
||||||
refinement=refine_joint(active_robots,[samples[i] for i in active],final,mode=='eye_in_hand')
|
|
||||||
refined=matrix(refinement['matrix'],'refined solution')
|
|
||||||
pairs=ax_xb_all_pair_metrics(active_robots,active_targets,refined,mode=='eye_in_hand')
|
|
||||||
consistency=fixed_target_consistency(active_robots,active_targets,refined,mode=='eye_in_hand')
|
|
||||||
refined_quality=list(refinement.get('quality_flags',[]))
|
|
||||||
if not refinement.get('converged'): refined_quality.append('joint_optimization_not_converged')
|
|
||||||
if not refinement.get('accepted') and not refined_quality: refined_quality.append('joint_quality_rejected')
|
|
||||||
if pairs['translation_rms_m']>.005: refined_quality.append('high_ax_xb_translation')
|
|
||||||
if pairs['rotation_rms_rad']>math.radians(2): refined_quality.append('high_ax_xb_rotation')
|
|
||||||
if consistency['translation_max_m']>.005: refined_quality.append('high_fixed_target_translation')
|
|
||||||
if consistency['rotation_max_rad']>math.radians(2): refined_quality.append('high_fixed_target_rotation')
|
|
||||||
refinement['quality_flags']=sorted(set(refined_quality))
|
|
||||||
refinement['accepted']=not refined_quality
|
|
||||||
refinement['metrics']['accepted']=not refined_quality
|
|
||||||
refined_metrics=dict(metrics)
|
|
||||||
refined_metrics.update(accepted=not refined_quality,
|
|
||||||
ax_xb_translation_rms_m=pairs['translation_rms_m'],ax_xb_rotation_rms_rad=pairs['rotation_rms_rad'],
|
|
||||||
fixed_target_translation_max_m=consistency['translation_max_m'],fixed_target_rotation_max_rad=consistency['rotation_max_rad'],
|
|
||||||
joint_reprojection_rms_px=refinement['metrics']['final_rms_px'],
|
|
||||||
validation_reprojection_rms_px=refinement['metrics']['validation_rms_px'])
|
|
||||||
# Preserve sample indices in the original capture list, including removals
|
|
||||||
# made by the phone's robust initialization stage.
|
|
||||||
refined_details=refinement.get('sample_diagnostics',[])
|
|
||||||
for detail in refined_details:
|
|
||||||
detail['input_index']=active[detail['input_index']]
|
|
||||||
for fold in refinement.get('validation_folds',[]):
|
|
||||||
for field in ('train_indices','held_out_indices'):
|
|
||||||
fold[field]=[active[i] for i in fold[field]]
|
|
||||||
for local,index in enumerate(active):
|
|
||||||
details[index]['fixed_pose_translation_error_m']=float(consistency['translation_errors_m'][local])
|
|
||||||
details[index]['fixed_pose_rotation_error_rad']=float(consistency['rotation_errors_rad'][local])
|
|
||||||
if local<len(refined_details): details[index]['joint']=refined_details[local]
|
|
||||||
refinement['active_indices']=active
|
|
||||||
response.update(matrix=refined.ravel().tolist(),refinement=refinement,
|
|
||||||
valid=not refined_quality,quality_flags=refinement['quality_flags'],metrics=refined_metrics,
|
|
||||||
initial_metrics=metrics,ax_xb_all_pair_metrics=pairs,
|
|
||||||
fixed_target_consistency={k:v for k,v in consistency.items() if not isinstance(v,np.ndarray)},
|
|
||||||
error='' if not refined_quality else '联合标定质量未通过:'+', '.join(refinement['quality_flags']))
|
|
||||||
return response
|
|
||||||
|
|
||||||
|
|
||||||
def handle_request(request: Any) -> dict:
|
|
||||||
try:
|
|
||||||
if not isinstance(request,dict): raise ValueError('Request must be a JSON object')
|
|
||||||
operation=request.get('op')
|
|
||||||
if operation=='check':
|
|
||||||
# Import here as well so a partial deployment fails during preflight,
|
|
||||||
# before users spend time collecting samples.
|
|
||||||
from handeye_refinement import refine_joint
|
|
||||||
result=dict(ok=True,valid=True,protocol=PROTOCOL,opencv_version=cv2.__version__,numpy_version=np.__version__,methods=['auto',*HAND_EYE_SOLVER_METHODS],capabilities=['chessboard','charuco','eye_in_hand','eye_to_hand','RGBA','I420','NV12','joint_reprojection','raw_corner_observations'],matrix_convention='T_parent_child; row-major; metres')
|
|
||||||
elif operation=='detect': result=detect(request)
|
|
||||||
elif operation=='solve': result=solve(request)
|
|
||||||
else: raise ValueError('Unknown op; expected check, detect or solve')
|
|
||||||
except Exception as exc:
|
|
||||||
result=dict(ok=False,valid=False,error=str(exc),quality_flags=['operation_failed'])
|
|
||||||
result.setdefault('protocol',PROTOCOL)
|
|
||||||
if isinstance(request,dict) and 'id' in request: result['id']=request['id']
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
|
||||||
# cv2 diagnostics go to stderr; stdout remains strictly NDJSON.
|
|
||||||
if hasattr(sys.stdin,'reconfigure'): sys.stdin.reconfigure(encoding='utf-8')
|
|
||||||
if hasattr(sys.stdout,'reconfigure'): sys.stdout.reconfigure(encoding='utf-8')
|
|
||||||
cv2.setNumThreads(2)
|
|
||||||
while True:
|
|
||||||
line=sys.stdin.readline(MAX_LINE_BYTES+1)
|
|
||||||
if not line: break
|
|
||||||
if len(line)>MAX_LINE_BYTES:
|
|
||||||
# Discard this request's tail, then accept the next line.
|
|
||||||
while line and not line.endswith('\n'): line=sys.stdin.readline(MAX_LINE_BYTES+1)
|
|
||||||
result=dict(ok=False,valid=False,protocol=PROTOCOL,error='Request exceeds size limit')
|
|
||||||
else:
|
|
||||||
try: result=handle_request(json.loads(line))
|
|
||||||
except (ValueError,TypeError) as exc: result=dict(ok=False,valid=False,protocol=PROTOCOL,error='Invalid JSON: '+str(exc))
|
|
||||||
try: output=json.dumps(result,ensure_ascii=False,allow_nan=False,separators=(',',':'))
|
|
||||||
except ValueError: output=json.dumps(dict(ok=False,valid=False,protocol=PROTOCOL,error='Nonfinite algorithm result'))
|
|
||||||
print(output,flush=True)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__=='__main__': main()
|
|
||||||
@ -1,90 +0,0 @@
|
|||||||
"""Build the application-local Windows x64 hand-eye runtime, without pip.
|
|
||||||
|
|
||||||
Run with the already validated Python 3.12 environment. Only NumPy/OpenCV
|
|
||||||
packages and their licenses are copied; no venv/Anaconda paths are retained.
|
|
||||||
The output is a fresh directory; deployment is handled by qmake/CMake.
|
|
||||||
"""
|
|
||||||
import argparse
|
|
||||||
import hashlib
|
|
||||||
import importlib.metadata
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
from pathlib import Path
|
|
||||||
import shutil
|
|
||||||
import struct
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import sysconfig
|
|
||||||
import urllib.request
|
|
||||||
import zipfile
|
|
||||||
|
|
||||||
VERSION = '3.12.4'
|
|
||||||
ARCHIVE = f'python-{VERSION}-embed-amd64.zip'
|
|
||||||
URL = f'https://www.python.org/ftp/python/{VERSION}/{ARCHIVE}'
|
|
||||||
SHA256 = '15fea3c9367653a85086fe37216b4d1a1c78688fa5e1587e1db0b0f658856564'
|
|
||||||
PACKAGES = {'numpy': '2.5.2', 'opencv-contrib-python': '4.11.0.86'}
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
root = Path(__file__).resolve().parents[1]
|
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
|
||||||
parser.add_argument('--output', type=Path, default=root/'third_party/handeye-runtime')
|
|
||||||
parser.add_argument('--archive', type=Path, default=root/'third_party/handeye-downloads'/ARCHIVE)
|
|
||||||
args = parser.parse_args()
|
|
||||||
if os.name != 'nt' or sys.version_info[:2] != (3, 12) or struct.calcsize('P') != 8:
|
|
||||||
parser.error('Use the validated Windows x64 Python 3.12 environment')
|
|
||||||
if args.output.exists():
|
|
||||||
parser.error('Output already exists; select a new --output directory for a rebuild')
|
|
||||||
site = Path(sysconfig.get_path('purelib')).resolve()
|
|
||||||
distributions = {}
|
|
||||||
for name, version in PACKAGES.items():
|
|
||||||
distribution = importlib.metadata.distribution(name)
|
|
||||||
if distribution.version != version:
|
|
||||||
parser.error(f'{name}: expected {version}, found {distribution.version}')
|
|
||||||
metadata = [p for p in distribution.files if str(p).endswith('.dist-info/METADATA')]
|
|
||||||
if len(metadata) != 1:
|
|
||||||
parser.error(f'{name}: missing distribution metadata and licenses')
|
|
||||||
distributions[name] = distribution.locate_file(metadata[0]).parent
|
|
||||||
if not args.archive.exists():
|
|
||||||
args.archive.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
urllib.request.urlretrieve(URL, args.archive)
|
|
||||||
if hashlib.sha256(args.archive.read_bytes()).hexdigest() != SHA256:
|
|
||||||
parser.error('Python archive SHA256 mismatch')
|
|
||||||
output = args.output.resolve()
|
|
||||||
output.mkdir(parents=True)
|
|
||||||
with zipfile.ZipFile(args.archive) as archive:
|
|
||||||
# Official archive has flat paths; reject traversal before extracting.
|
|
||||||
for name in archive.namelist():
|
|
||||||
if not (output/name).resolve().is_relative_to(output):
|
|
||||||
raise ValueError('Unsafe archive entry')
|
|
||||||
archive.extractall(output)
|
|
||||||
target = output/'Lib/site-packages'
|
|
||||||
target.mkdir(parents=True)
|
|
||||||
for name in ('numpy', 'numpy.libs', 'cv2'):
|
|
||||||
shutil.copytree(site/name, target/name,
|
|
||||||
ignore=shutil.ignore_patterns('__pycache__', '*.pyc', 'tests'))
|
|
||||||
for metadata in distributions.values():
|
|
||||||
shutil.copytree(metadata, target/metadata.name)
|
|
||||||
# All paths resolve relative to python312.dll. Do not import site or run
|
|
||||||
# user .pth files; dependency DLL loaders are part of NumPy/OpenCV.
|
|
||||||
(output/'python312._pth').write_text('python312.zip\n.\nLib/site-packages\n', encoding='ascii')
|
|
||||||
probe = ('import sys,json,numpy,cv2; '
|
|
||||||
'assert hasattr(cv2,"aruco"); '
|
|
||||||
'print(json.dumps(dict(python=sys.version,numpy=numpy.__version__,opencv=cv2.__version__)))')
|
|
||||||
env = dict(os.environ, PYTHONHOME='invalid-external-python', PYTHONPATH='invalid-external-packages',
|
|
||||||
PATH=os.path.join(os.environ['SystemRoot'], 'System32'))
|
|
||||||
result = subprocess.run([str(output/'python.exe'), '-I', '-B', '-c', probe],
|
|
||||||
cwd=output, env=env, check=True, capture_output=True, text=True)
|
|
||||||
manifest = dict(schema=1, platform='windows-amd64', python=VERSION,
|
|
||||||
python_archive_url=URL, python_archive_sha256=SHA256, packages=PACKAGES,
|
|
||||||
probe=json.loads(result.stdout))
|
|
||||||
manifest['files'] = {str(p.relative_to(output)).replace('\\', '/'):
|
|
||||||
hashlib.sha256(p.read_bytes()).hexdigest()
|
|
||||||
for p in sorted(output.rglob('*')) if p.is_file()}
|
|
||||||
(output/'manifest.json').write_text(json.dumps(manifest, indent=2), encoding='utf-8')
|
|
||||||
print(json.dumps(dict(runtime=str(output), files=len(manifest['files']),
|
|
||||||
size_mb=round(sum(p.stat().st_size for p in output.rglob('*') if p.is_file())/1048576, 1))))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
"""Package the task JSON contract, schemas, catalog, reference parser and Proto closure."""
|
|
||||||
from pathlib import Path
|
|
||||||
import json, re, zipfile, os, subprocess, shutil, hashlib
|
|
||||||
root=Path.cwd(); docs=root/"docs/task-flow"; staging=root/"artifacts/TaskFlow_20261110"
|
|
||||||
staging.mkdir(parents=True,exist_ok=True)
|
|
||||||
files=[]
|
|
||||||
for p in sorted(docs.iterdir()):
|
|
||||||
if p.is_file():
|
|
||||||
dst=staging/p.name;shutil.copyfile(p,dst);files.append(dst)
|
|
||||||
verify=staging/"verify-example.mjs"
|
|
||||||
test=(root/"tests/task_flow_reference_test.mjs").read_text(encoding="utf-8").replace("../docs/task-flow/", "./")
|
|
||||||
verify.write_text(test,encoding="utf-8");files.append(verify)
|
|
||||||
catalog=json.loads((docs/"task_operations.json").read_text(encoding="utf-8"))
|
|
||||||
seen=set()
|
|
||||||
def copy_proto(name):
|
|
||||||
if name in seen:return
|
|
||||||
seen.add(name);source=root/"protos"/name
|
|
||||||
if not source.is_file():source=root/"include"/name
|
|
||||||
if not source.is_file():raise FileNotFoundError(name)
|
|
||||||
text=source.read_text(encoding="utf-8");dst=staging/"protos"/name;dst.parent.mkdir(parents=True,exist_ok=True);shutil.copyfile(source,dst);files.append(dst)
|
|
||||||
for dependency in re.findall(r'^import\s+(?:public\s+|weak\s+)?"([^"]+)"',text,re.M):copy_proto(dependency)
|
|
||||||
services=[]
|
|
||||||
for service in catalog["services"]:
|
|
||||||
name=service["service"].split(".")[-1]
|
|
||||||
candidates=[]
|
|
||||||
for p in (root/"protos/cmvr/api").glob("*service.proto"):
|
|
||||||
if re.search(r'\bservice\s+'+name+r'\s*\{',p.read_text(encoding="utf-8")):candidates.append(p)
|
|
||||||
assert len(candidates)==1,name
|
|
||||||
filename=candidates[0].relative_to(root/"protos").as_posix();services.append(filename);copy_proto(filename)
|
|
||||||
lines=["CMVR device RPC catalog / 2026-11-10",""]
|
|
||||||
for service in catalog["services"]:
|
|
||||||
lines.append(service["deviceType"]+" / "+service["service"])
|
|
||||||
for m in service["methods"]:
|
|
||||||
kind="Streaming: dedicated adapter required" if m["clientStreaming"] or m["serverStreaming"] else "Unary: structured task editor"
|
|
||||||
lines.append(" "+m["method"]+" | "+kind+" | "+m["requestType"]+" -> "+m["responseType"])
|
|
||||||
lines.append("")
|
|
||||||
listing=staging/"rpc_catalog.txt";listing.write_text("\n".join(lines),encoding="utf-8-sig");files.append(listing)
|
|
||||||
env=os.environ.copy();env["PATH"]=str(root/"lib")+os.pathsep+env.get("PATH","")
|
|
||||||
descriptor=staging/"api_descriptor.pb"
|
|
||||||
subprocess.run([str(root/"tools/protoc.exe"),"--experimental_allow_proto3_optional","--proto_path="+str(staging/"protos"),"--include_imports","--include_source_info","--descriptor_set_out="+str(descriptor),*services],env=env,check=True)
|
|
||||||
files.append(descriptor)
|
|
||||||
manifest={str(p.relative_to(staging)).replace("\\","/"):hashlib.sha256(p.read_bytes()).hexdigest() for p in files}
|
|
||||||
manifest_path=staging/"SHA256.json";manifest_path.write_text(json.dumps(manifest,ensure_ascii=False,indent=2),encoding="utf-8");files.append(manifest_path)
|
|
||||||
out=root/"artifacts/TaskFlow_JSON_Protocol_20261110.zip"
|
|
||||||
with zipfile.ZipFile(out,"w",zipfile.ZIP_DEFLATED) as z:
|
|
||||||
for p in files:z.write(p,p.relative_to(staging))
|
|
||||||
with zipfile.ZipFile(out) as z:assert z.testzip() is None
|
|
||||||
print("ZIP:",out,"files:",len(files),"bytes:",out.stat().st_size)
|
|
||||||
print("SHA256:",hashlib.sha256(out.read_bytes()).hexdigest())
|
|
||||||
@ -1,151 +0,0 @@
|
|||||||
"""Stage the already-built Windows x64 Release with its redistributable runtime."""
|
|
||||||
import argparse
|
|
||||||
import hashlib
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
import struct
|
|
||||||
import subprocess
|
|
||||||
import zipfile
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
ROOT = Path(__file__).resolve().parent.parent
|
|
||||||
NAME = 'CmvrControlStation-Windows-x64-Release'
|
|
||||||
|
|
||||||
|
|
||||||
def pe_imports(file):
|
|
||||||
data = file.read_bytes()
|
|
||||||
if data[:2] != b'MZ':
|
|
||||||
raise ValueError(f'Not a Windows executable: {file}')
|
|
||||||
pe = struct.unpack_from('<I', data, 0x3c)[0]
|
|
||||||
if data[pe:pe + 4] != b'PE\0\0':
|
|
||||||
raise ValueError(f'Invalid PE header: {file}')
|
|
||||||
machine, count = struct.unpack_from('<HH', data, pe + 4)
|
|
||||||
optional_size = struct.unpack_from('<H', data, pe + 20)[0]
|
|
||||||
optional = pe + 24
|
|
||||||
magic = struct.unpack_from('<H', data, optional)[0]
|
|
||||||
directory = optional + (112 if magic == 0x20b else 96)
|
|
||||||
import_rva = struct.unpack_from('<I', data, directory + 8)[0]
|
|
||||||
section_start = optional + optional_size
|
|
||||||
sections = [struct.unpack_from('<8sIIII', data, section_start + i * 40)
|
|
||||||
for i in range(count)]
|
|
||||||
|
|
||||||
def offset(rva):
|
|
||||||
for _, virtual_size, virtual_address, raw_size, raw_start in sections:
|
|
||||||
if virtual_address <= rva < virtual_address + max(virtual_size, raw_size):
|
|
||||||
return raw_start + rva - virtual_address
|
|
||||||
if rva < section_start:
|
|
||||||
return rva
|
|
||||||
raise ValueError(f'Unmapped import RVA in {file}')
|
|
||||||
|
|
||||||
imports = []
|
|
||||||
if import_rva:
|
|
||||||
cursor = offset(import_rva)
|
|
||||||
while True:
|
|
||||||
descriptor = struct.unpack_from('<IIIII', data, cursor)
|
|
||||||
if not any(descriptor):
|
|
||||||
break
|
|
||||||
start = offset(descriptor[3])
|
|
||||||
imports.append(data[start:data.index(b'\0', start)].decode('ascii'))
|
|
||||||
cursor += 20
|
|
||||||
return machine, imports
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
parser = argparse.ArgumentParser(description=__doc__)
|
|
||||||
parser.add_argument('--qt', default='C:/Qt/Qt5.12.4/5.12.4/mingw73_64')
|
|
||||||
parser.add_argument('--compiler', default='C:/Qt/Qt5.12.4/Tools/mingw730_64/bin')
|
|
||||||
args = parser.parse_args()
|
|
||||||
qt, compiler = Path(args.qt), Path(args.compiler)
|
|
||||||
built = ROOT / 'bin/release/CmvrControlStation.exe'
|
|
||||||
deploy = qt / 'bin/windeployqt.exe'
|
|
||||||
if not built.is_file() or not deploy.is_file():
|
|
||||||
raise RuntimeError('Build the Release application and provide its matching Qt kit first')
|
|
||||||
stage = ROOT / 'dist' / NAME
|
|
||||||
if stage.parent.resolve() != (ROOT / 'dist').resolve() or stage.name != NAME:
|
|
||||||
raise RuntimeError('Unexpected staging path')
|
|
||||||
if stage.exists():
|
|
||||||
shutil.rmtree(stage)
|
|
||||||
stage.mkdir(parents=True)
|
|
||||||
shutil.copy2(built, stage / built.name)
|
|
||||||
for dll in (ROOT / 'lib').glob('*.dll'):
|
|
||||||
shutil.copy2(dll, stage / dll.name)
|
|
||||||
for name in ['libgcc_s_seh-1.dll', 'libstdc++-6.dll', 'libwinpthread-1.dll']:
|
|
||||||
shutil.copy2(compiler / name, stage / name)
|
|
||||||
env = dict(os.environ)
|
|
||||||
env['PATH'] = str(qt / 'bin') + os.pathsep + str(compiler) + os.pathsep + env.get('PATH', '')
|
|
||||||
print('Deploying Qt Release runtime...', flush=True)
|
|
||||||
subprocess.run([str(deploy), '--release', '--compiler-runtime', '--no-translations',
|
|
||||||
str(stage / built.name)], env=env, check=True)
|
|
||||||
subprocess.run(['powershell.exe', '-NoProfile', '-ExecutionPolicy', 'RemoteSigned',
|
|
||||||
'-File', str(ROOT / 'scripts/repair_qt3d_release.ps1'),
|
|
||||||
'-RuntimeDirectory', str(stage)], check=True)
|
|
||||||
scene = stage / 'sceneparsers'
|
|
||||||
scene.mkdir(exist_ok=True)
|
|
||||||
shutil.copy2(qt / 'plugins/sceneparsers/assimpsceneimport.dll', scene / 'assimpsceneimport.dll')
|
|
||||||
shutil.copytree(ROOT / 'models', stage / 'models')
|
|
||||||
shutil.copytree(ROOT / 'third_party/handeye-runtime', stage / 'runtime/handeye',
|
|
||||||
ignore=shutil.ignore_patterns('__pycache__', '*.pyc'))
|
|
||||||
algorithms = stage / 'scripts'
|
|
||||||
algorithms.mkdir()
|
|
||||||
for name in ['handeye_worker.py', 'handeye_math.py', 'handeye_refinement.py']:
|
|
||||||
shutil.copy2(ROOT / 'scripts' / name, algorithms / name)
|
|
||||||
(stage / 'data').mkdir()
|
|
||||||
shutil.copy2(ROOT / 'resources/application_settings.json', stage / 'data/application_settings.json')
|
|
||||||
for name in ['quic-test-server.pfx', 'quic-test-ca.crt']:
|
|
||||||
shutil.copy2(ROOT / 'certs' / name, stage / name)
|
|
||||||
(stage / 'qt.conf').write_text('[Paths]\nPlugins=.\n', encoding='utf-8')
|
|
||||||
(stage / '使用说明.txt').write_text(
|
|
||||||
'CMVR 控制台 Windows x64 Release 免安装包\n\n'
|
|
||||||
'完整解压到可写目录,双击 CmvrControlStation.exe。不要只复制 exe。\n'
|
|
||||||
'已包含 Qt 5.12.4、MinGW运行库、音视频DLL、Qt插件、模型与手眼标定Python环境。\n'
|
|
||||||
'普通界面使用不需要另行安装Qt;手眼标定使用随包运行环境。\n'
|
|
||||||
'无实物演示:勾选“演示模式”,地址填127.0.0.1,再连接。确认提示“演示数据源”。\n'
|
|
||||||
'使用真实设备时取消演示模式,核实服务地址和设备状态后再操作。\n'
|
|
||||||
'图形驱动有问题时可尝试“启动_兼容模式.cmd”,使用软件OpenGL。\n'
|
|
||||||
'本包为Windows 64位程序,不适用于麒麟Linux;未在其他电脑上实机验证。\n'
|
|
||||||
'quic-test-server.pfx为工程开发测试证书,仅供QUIC测试。\n', encoding='utf-8-sig')
|
|
||||||
(stage / '启动_兼容模式.cmd').write_bytes(
|
|
||||||
b'@echo off\r\ncd /d "%~dp0"\r\nset "QT_OPENGL=software"\r\n'
|
|
||||||
b'"%~dp0CmvrControlStation.exe"\r\n')
|
|
||||||
|
|
||||||
# Check imports of the executable, redistributable root DLLs and Qt plugins.
|
|
||||||
# Windows API-set names are virtual OS modules, not redistributable files.
|
|
||||||
system = Path(os.environ.get('SystemRoot', 'C:/Windows')) / 'System32'
|
|
||||||
binaries = [stage / built.name] + list(stage.glob('*.dll'))
|
|
||||||
binaries += [p for p in stage.glob('*/*.dll') if p.parent.name not in ['runtime']]
|
|
||||||
missing = []
|
|
||||||
for binary in binaries:
|
|
||||||
machine, imports = pe_imports(binary)
|
|
||||||
if machine != 0x8664:
|
|
||||||
raise RuntimeError(f'Not x64: {binary}')
|
|
||||||
for name in imports:
|
|
||||||
if name.lower().startswith(('api-ms-', 'ext-ms-')):
|
|
||||||
continue
|
|
||||||
if not any((folder / name).exists() for folder in [binary.parent, stage, system]):
|
|
||||||
missing.append((str(binary.relative_to(stage)), name))
|
|
||||||
if missing:
|
|
||||||
raise RuntimeError(f'Missing DLL dependencies: {missing}')
|
|
||||||
# Qt's debug configuration is recorded in its plugin metadata.
|
|
||||||
if any((stage / name).exists() for name in ['Qt5Cored.dll', 'Qt5Guid.dll', 'Qt5Widgetsd.dll', 'platforms/qwindowsd.dll']):
|
|
||||||
raise RuntimeError('Debug Qt DLL detected in Release package')
|
|
||||||
manifest = {}
|
|
||||||
for file in sorted(stage.rglob('*')):
|
|
||||||
if file.is_file():
|
|
||||||
manifest[file.relative_to(stage).as_posix()] = hashlib.sha256(file.read_bytes()).hexdigest()
|
|
||||||
(stage / 'SHA256.json').write_text(json.dumps(manifest, ensure_ascii=False, indent=2) + '\n', encoding='utf-8')
|
|
||||||
archive = stage.with_suffix('.zip')
|
|
||||||
print(f'Writing archive ({len(manifest)} files)...', flush=True)
|
|
||||||
with zipfile.ZipFile(archive, 'w', zipfile.ZIP_DEFLATED, compresslevel=5) as output:
|
|
||||||
for file in sorted(stage.rglob('*')):
|
|
||||||
if file.is_file():
|
|
||||||
output.write(file, NAME + '/' + file.relative_to(stage).as_posix())
|
|
||||||
with zipfile.ZipFile(archive) as output:
|
|
||||||
if output.testzip() is not None:
|
|
||||||
raise RuntimeError('ZIP integrity validation failed')
|
|
||||||
print(json.dumps({'archive': str(archive), 'size_bytes': archive.stat().st_size,
|
|
||||||
'pe_files_checked': len(binaries), 'files': len(manifest) + 1}, ensure_ascii=False))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
|
||||||
@ -1,66 +0,0 @@
|
|||||||
param([string]$RuntimeDirectory = (Join-Path $PSScriptRoot '..\bin\release'), [switch]$IfPresent)
|
|
||||||
$ErrorActionPreference = 'Stop'
|
|
||||||
function FileHash([string]$path) { $algorithm = [Security.Cryptography.SHA256]::Create(); try { return [BitConverter]::ToString($algorithm.ComputeHash([IO.File]::ReadAllBytes($path))).Replace('-', '') } finally { $algorithm.Dispose() } }
|
|
||||||
$dll = Join-Path ([IO.Path]::GetFullPath($RuntimeDirectory)) 'Qt53DRender.dll'
|
|
||||||
if (!(Test-Path -LiteralPath $dll)) { if ($IfPresent) { Write-Output "Qt3D runtime not deployed yet; repair will run during packaging."; exit 0 }; throw "Qt3D runtime not found: $dll" }
|
|
||||||
$originalHash = '40FD189F1E233FCDCC07A8BC7E226DB7FBF86DBC4A6480C70E31FE1A185936F7'
|
|
||||||
$repairedHash = 'AABB4931C7F7145205F3DEA5DAA1F096600EDD16258FC0A67A5C4F203C5A5DE0'
|
|
||||||
$actual = (FileHash $dll)
|
|
||||||
if ($actual -eq $repairedHash) { Write-Output 'Qt3D Release register-preservation repair already installed.'; exit 0 }
|
|
||||||
if ($actual -ne $originalHash) { throw "Unrecognized Qt3D runtime; refusing a version-specific repair: $actual" }
|
|
||||||
|
|
||||||
# This exact Qt 5.12.4 MinGW x64 build's QVector<QNodeId>::contains helper calls
|
|
||||||
# a find helper that clobbers R11. Other optimized callers retain their container
|
|
||||||
# pointer in R11 across contains(), subsequently passing null to QVector::append.
|
|
||||||
# Preserve R11 in this function's own first parameter home slot. Stack allocation
|
|
||||||
# and nonvolatile saves stay unchanged; extend its x64 runtime-function extent.
|
|
||||||
[byte[]]$bytes = [IO.File]::ReadAllBytes($dll)
|
|
||||||
$pe = [BitConverter]::ToInt32($bytes, 0x3c)
|
|
||||||
$optional = $pe + 24
|
|
||||||
if ([BitConverter]::ToUInt16($bytes, $optional) -ne 0x20b) { throw 'Expected PE32+ image' }
|
|
||||||
$sections = $optional + [BitConverter]::ToUInt16($bytes, $pe + 20)
|
|
||||||
function Offset([int]$rva) {
|
|
||||||
for ($i = 0; $i -lt [BitConverter]::ToUInt16($bytes, $pe + 6); $i++) {
|
|
||||||
$s = $sections + $i * 40
|
|
||||||
$va = [BitConverter]::ToInt32($bytes, $s + 12)
|
|
||||||
$size = [BitConverter]::ToInt32($bytes, $s + 16)
|
|
||||||
if ($rva -ge $va -and $rva -lt ($va + $size)) { return [BitConverter]::ToInt32($bytes, $s + 20) + $rva - $va }
|
|
||||||
}
|
|
||||||
throw ('Unmapped RVA: 0x{0:x}' -f $rva)
|
|
||||||
}
|
|
||||||
$rva = 0x1c2690
|
|
||||||
$start = Offset $rva
|
|
||||||
$code = [Array]::CreateInstance([byte], 62)
|
|
||||||
[Array]::Copy($bytes, $start, $code, 0, 5)
|
|
||||||
[Array]::Copy([byte[]](0x4c,0x89,0x5c,0x24,0x30), 0, $code, 5, 5) # save R11
|
|
||||||
[Array]::Copy($bytes, $start + 5, $code, 10, 41)
|
|
||||||
[Array]::Copy([byte[]](0x4c,0x8b,0x5c,0x24,0x30), 0, $code, 51, 5) # restore R11
|
|
||||||
[Array]::Copy($bytes, $start + 46, $code, 56, 6)
|
|
||||||
[BitConverter]::GetBytes([int](0x1c3bc0 - ($rva + 45))).CopyTo($code, 41)
|
|
||||||
$code.CopyTo($bytes, $start)
|
|
||||||
$bytes[$start + 62] = 0x90
|
|
||||||
$bytes[$start + 63] = 0x90
|
|
||||||
$directory = $optional + 112 + 3 * 8
|
|
||||||
$pdata = [BitConverter]::ToInt32($bytes, $directory)
|
|
||||||
$size = [BitConverter]::ToInt32($bytes, $directory + 4)
|
|
||||||
$found = $false
|
|
||||||
for ($i = 0; $i -lt $size; $i += 12) {
|
|
||||||
$entry = Offset ($pdata + $i)
|
|
||||||
if ([BitConverter]::ToInt32($bytes, $entry) -eq $rva) {
|
|
||||||
if ([BitConverter]::ToInt32($bytes, $entry + 4) -ne ($rva + 52)) { throw 'Unexpected unwind extent' }
|
|
||||||
[BitConverter]::GetBytes([int]($rva + 62)).CopyTo($bytes, $entry + 4)
|
|
||||||
$found = $true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$found) { throw 'Missing x64 runtime-function entry' }
|
|
||||||
$sha = [Security.Cryptography.SHA256]::Create()
|
|
||||||
try { $after = [BitConverter]::ToString($sha.ComputeHash($bytes)).Replace('-', '') } finally { $sha.Dispose() }
|
|
||||||
if ($after -ne $repairedHash) { throw "Unexpected repaired image hash: $after" }
|
|
||||||
$backupDir = Join-Path $RuntimeDirectory 'crash_dumps\dependency_backups'
|
|
||||||
New-Item -ItemType Directory -Path $backupDir -Force | Out-Null
|
|
||||||
$backup = Join-Path $backupDir 'Qt53DRender.original.dll'
|
|
||||||
if (!(Test-Path -LiteralPath $backup)) { Copy-Item -LiteralPath $dll -Destination $backup }
|
|
||||||
elseif ((FileHash $backup) -ne $originalHash) { throw 'Backup differs from the expected original; preserving it' }
|
|
||||||
[IO.File]::WriteAllBytes($dll, $bytes)
|
|
||||||
Write-Output "Repaired Qt3D Release runtime: $dll; original preserved at $backup"
|
|
||||||
@ -1,343 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
# Qt 5 / CMVR setup using the target machine's configured distribution repositories.
|
|
||||||
set -euo pipefail
|
|
||||||
export LC_ALL=C
|
|
||||||
|
|
||||||
log() { printf '\n[CMVR] %s\n' "$*"; }
|
|
||||||
fail() { printf '\n[ERROR] %s\n' "$*" >&2; return 1; }
|
|
||||||
have() { command -v "$1" >/dev/null 2>&1; }
|
|
||||||
|
|
||||||
usage() {
|
|
||||||
cat <<'HELP'
|
|
||||||
CMVR setup for Kylin Linux x86 (Qt 5.12+, CMake 3.16+).
|
|
||||||
bash setup_kylin.sh Install Qt and development/runtime dependencies
|
|
||||||
bash setup_kylin.sh --source /path/qt_client Install, configure and build Release
|
|
||||||
bash setup_kylin.sh --app /path/CmvrControlStation
|
|
||||||
Install and check an existing Linux application
|
|
||||||
bash setup_kylin.sh --check Check installed tools/dependencies only
|
|
||||||
bash setup_kylin.sh --dry-run Print repository package plan without installing
|
|
||||||
Options:
|
|
||||||
--source DIR Full qt_client source tree, not the Windows ZIP
|
|
||||||
--app FILE Existing native Linux ELF application
|
|
||||||
--jobs N Parallel build jobs (default: 4)
|
|
||||||
--with-qtcreator Also install the optional Qt Creator IDE
|
|
||||||
--no-update Use current package metadata (e.g. prepared offline repositories)
|
|
||||||
--check Do not install, build, or generate a launcher
|
|
||||||
--dry-run Do not refresh repositories, install, build, or generate files
|
|
||||||
-h, --help Show this help
|
|
||||||
Run as the desktop user; the script invokes sudo only for package management.
|
|
||||||
No robot connections, motor commands or service restarts are performed.
|
|
||||||
HELP
|
|
||||||
}
|
|
||||||
|
|
||||||
detect_platform() {
|
|
||||||
[[ $(uname -s) == Linux ]] || { fail 'Run this script on the Kylin Linux computer.'; return 1; }
|
|
||||||
ARCH=$(uname -m)
|
|
||||||
case "$ARCH" in x86_64|i386|i486|i586|i686) ;; *) fail "Expected Linux x86, detected $ARCH"; return 1 ;; esac
|
|
||||||
OS_NAME=Linux
|
|
||||||
if [[ -r /etc/os-release ]]; then
|
|
||||||
# Standard distribution-owned identification file.
|
|
||||||
OS_NAME=$(. /etc/os-release; printf '%s' "${PRETTY_NAME:-Linux}")
|
|
||||||
fi
|
|
||||||
if have apt-get && have dpkg; then PM=apt
|
|
||||||
elif have dnf; then PM=dnf
|
|
||||||
elif have yum; then PM=yum
|
|
||||||
else fail 'No supported package manager: apt-get, dnf or yum.'; return 1
|
|
||||||
fi
|
|
||||||
log "System: $OS_NAME; architecture: $ARCH; package manager: $PM"
|
|
||||||
}
|
|
||||||
|
|
||||||
package_available() {
|
|
||||||
local pkg=$1 candidate
|
|
||||||
if [[ $PM == apt ]]; then
|
|
||||||
candidate=$(apt-cache policy "$pkg" 2>/dev/null | awk '/Candidate:/ {print $2; exit}')
|
|
||||||
[[ -n $candidate && $candidate != '(none)' ]]
|
|
||||||
else
|
|
||||||
# rpm -q handles packages already installed but absent from current repository metadata.
|
|
||||||
rpm -q "$pkg" >/dev/null 2>&1 || "$PM" -q list "$pkg" >/dev/null 2>&1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
select_package() {
|
|
||||||
local required=$1 label=$2 pkg
|
|
||||||
shift 2
|
|
||||||
for pkg in "$@"; do
|
|
||||||
if package_available "$pkg"; then
|
|
||||||
PACKAGES+=("$pkg")
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [[ $required == required ]]; then
|
|
||||||
MISSING+=("$label: $*")
|
|
||||||
else
|
|
||||||
log "Optional package unavailable ($label): $*"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
resolve_packages() {
|
|
||||||
PACKAGES=(); MISSING=()
|
|
||||||
if [[ $PM == apt ]]; then
|
|
||||||
select_package required 'C/C++ compiler' build-essential
|
|
||||||
select_package required CMake cmake
|
|
||||||
select_package required 'build tool' ninja-build make
|
|
||||||
select_package required pkg-config pkg-config pkgconf
|
|
||||||
select_package required 'Qt5 base development' qtbase5-dev
|
|
||||||
select_package required 'Qt5 development tools' qtbase5-dev-tools
|
|
||||||
select_package required 'Qt5 qmake' qt5-qmake
|
|
||||||
select_package required 'Qt5 multimedia' qtmultimedia5-dev
|
|
||||||
select_package required 'Qt5 3D modules' qt3d5-dev
|
|
||||||
select_package required 'Qt3D mesh plugin' qt3d-assimpsceneimport-plugin
|
|
||||||
select_package required 'Protobuf development' libprotobuf-dev
|
|
||||||
select_package required protoc protobuf-compiler
|
|
||||||
select_package required 'gRPC C++ development' libgrpc++-dev
|
|
||||||
select_package required 'gRPC code generator' protobuf-compiler-grpc
|
|
||||||
select_package required 'FFmpeg codec' libavcodec-dev
|
|
||||||
select_package required 'FFmpeg utility' libavutil-dev
|
|
||||||
select_package required 'FFmpeg scaling' libswscale-dev
|
|
||||||
select_package required urdfdom liburdfdom-dev
|
|
||||||
select_package required TinyXML libtinyxml-dev
|
|
||||||
select_package required Assimp libassimp-dev
|
|
||||||
select_package required OpenGL libgl1-mesa-dev libgl-dev
|
|
||||||
select_package required 'XCB integration' libxcb-xinerama0
|
|
||||||
select_package optional 'XCB cursor' libxcb-cursor0
|
|
||||||
select_package optional 'Qt Wayland integration' qtwayland5
|
|
||||||
select_package optional 'Qt multimedia backend' libqt5multimedia5-plugins
|
|
||||||
select_package optional 'GStreamer base codecs' gstreamer1.0-plugins-base
|
|
||||||
select_package optional 'GStreamer additional codecs' gstreamer1.0-plugins-good
|
|
||||||
select_package optional 'Mesa diagnostics' mesa-utils
|
|
||||||
select_package optional 'Chinese fonts' fonts-noto-cjk fonts-wqy-microhei
|
|
||||||
select_package required 'ELF inspection' file
|
|
||||||
select_package required 'Python examples' python3
|
|
||||||
if (( WITH_CREATOR )); then select_package required QtCreator qtcreator; fi
|
|
||||||
else
|
|
||||||
select_package required 'C compiler' gcc
|
|
||||||
select_package required 'C++ compiler' gcc-c++
|
|
||||||
select_package required CMake cmake cmake3
|
|
||||||
select_package required 'build tool' ninja-build make
|
|
||||||
select_package required pkg-config pkgconf-pkg-config pkgconfig
|
|
||||||
select_package required 'Qt5 base development' qt5-qtbase-devel
|
|
||||||
select_package required 'Qt5 multimedia' qt5-qtmultimedia-devel
|
|
||||||
select_package required 'Qt5 3D modules' qt5-qt3d-devel
|
|
||||||
select_package required 'Qt3D runtime/plugins' qt5-qt3d
|
|
||||||
select_package required 'Protobuf development' protobuf-devel
|
|
||||||
select_package required protoc protobuf-compiler
|
|
||||||
select_package required 'gRPC development' grpc-devel
|
|
||||||
select_package optional 'gRPC C++ split package' grpc-c++-devel grpc-c++
|
|
||||||
select_package required 'gRPC code generator' grpc-plugins
|
|
||||||
select_package required FFmpeg ffmpeg-devel
|
|
||||||
select_package required urdfdom urdfdom-devel
|
|
||||||
select_package required TinyXML tinyxml-devel
|
|
||||||
select_package required Assimp assimp-devel
|
|
||||||
select_package required OpenGL mesa-libGL-devel libglvnd-devel
|
|
||||||
select_package required 'XCB integration' xcb-util-wm
|
|
||||||
select_package optional 'XCB image support' xcb-util-image
|
|
||||||
select_package optional 'XCB key support' xcb-util-keysyms
|
|
||||||
select_package optional 'XCB render support' xcb-util-renderutil
|
|
||||||
select_package optional 'XCB cursor' xcb-util-cursor
|
|
||||||
select_package optional 'Qt5 graphics integration' qt5-qtbase-gui
|
|
||||||
select_package optional 'Qt Wayland integration' qt5-qtwayland
|
|
||||||
select_package optional 'GStreamer base codecs' gstreamer1-plugins-base
|
|
||||||
select_package optional 'GStreamer additional codecs' gstreamer1-plugins-good
|
|
||||||
select_package optional 'Mesa diagnostics' glx-utils
|
|
||||||
select_package optional 'Chinese fonts' google-noto-sans-cjk-fonts wqy-microhei-fonts
|
|
||||||
select_package required 'ELF inspection' file
|
|
||||||
select_package required 'Python examples' python3
|
|
||||||
if (( WITH_CREATOR )); then select_package required QtCreator qt-creator qtcreator; fi
|
|
||||||
fi
|
|
||||||
if ((${#MISSING[@]})); then
|
|
||||||
printf '\nRequired packages unavailable in this system\047s repositories:\n' >&2
|
|
||||||
printf ' %s\n' "${MISSING[@]}" >&2
|
|
||||||
fail 'Ask the system administrator to enable the matching Kylin development/media repositories, then rerun. No foreign repositories were added.'
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
install_packages() {
|
|
||||||
local -a privilege=()
|
|
||||||
if (( EUID != 0 )); then
|
|
||||||
have sudo || { fail 'Package installation requires root or sudo.'; return 1; }
|
|
||||||
privilege=(sudo)
|
|
||||||
fi
|
|
||||||
if (( UPDATE_METADATA )); then
|
|
||||||
log 'Refreshing configured repository metadata...'
|
|
||||||
if [[ $PM == apt ]]; then "${privilege[@]}" apt-get update
|
|
||||||
else "${privilege[@]}" "$PM" makecache
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
resolve_packages
|
|
||||||
log 'Installing Qt5 and CMVR dependencies...'
|
|
||||||
if [[ $PM == apt ]]; then
|
|
||||||
"${privilege[@]}" apt-get install -y --no-install-recommends "${PACKAGES[@]}"
|
|
||||||
else
|
|
||||||
"${privilege[@]}" "$PM" install -y "${PACKAGES[@]}"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
version_at_least() {
|
|
||||||
[[ $(printf '%s\n%s\n' "$2" "$1" | sort -V | head -n 1) == "$2" ]]
|
|
||||||
}
|
|
||||||
|
|
||||||
probe_dependencies() {
|
|
||||||
local tool qt_version cmake_version tmp status
|
|
||||||
CMAKE_TOOL=''
|
|
||||||
for tool in cmake cmake3; do
|
|
||||||
if have "$tool"; then
|
|
||||||
cmake_version=$("$tool" --version | awk 'NR==1 {print $3}')
|
|
||||||
if version_at_least "$cmake_version" 3.16; then CMAKE_TOOL=$(command -v "$tool"); break; fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
[[ -n $CMAKE_TOOL ]] || { fail 'CMake >= 3.16 is required; repository package is too old or missing.'; return 1; }
|
|
||||||
QMAKE_TOOL=''
|
|
||||||
for tool in qmake-qt5 qmake /usr/lib64/qt5/bin/qmake /usr/lib/qt5/bin/qmake; do
|
|
||||||
if have "$tool"; then
|
|
||||||
qt_version=$("$tool" -query QT_VERSION 2>/dev/null) || continue
|
|
||||||
if [[ $qt_version == 5.* ]] && version_at_least "$qt_version" 5.12; then
|
|
||||||
QMAKE_TOOL=$(command -v "$tool"); break
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
[[ -n $QMAKE_TOOL ]] || { fail 'Qt 5.12+ qmake is required. Qt6 alone cannot build this Qt5 project.'; return 1; }
|
|
||||||
log "Using Qt $qt_version ($QMAKE_TOOL); CMake $cmake_version"
|
|
||||||
for tool in c++ pkg-config protoc grpc_cpp_plugin file python3; do
|
|
||||||
have "$tool" || { fail "Missing executable: $tool"; return 1; }
|
|
||||||
done
|
|
||||||
if ! python3 -c 'import sys; sys.exit(0 if sys.version_info >= (3,9) else 1)'; then
|
|
||||||
log 'Python is older than 3.9: Qt UI builds can continue, but the classroom example requires Python 3.9+.'
|
|
||||||
fi
|
|
||||||
tmp=$(mktemp -d "${TMPDIR:-/tmp}/cmvr-dependency-probe.XXXXXXXX")
|
|
||||||
cat > "$tmp/CMakeLists.txt" <<'CMAKE'
|
|
||||||
cmake_minimum_required(VERSION 3.16)
|
|
||||||
project(CmvrDependencyProbe LANGUAGES CXX)
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
find_package(Qt5 5.12 REQUIRED COMPONENTS Core Gui Widgets Network Multimedia 3DCore 3DRender 3DExtras 3DInput 3DAnimation)
|
|
||||||
find_package(Protobuf CONFIG QUIET)
|
|
||||||
if(NOT Protobuf_FOUND)
|
|
||||||
find_package(Protobuf REQUIRED)
|
|
||||||
endif()
|
|
||||||
find_package(gRPC CONFIG REQUIRED)
|
|
||||||
if(NOT TARGET protobuf::protoc OR NOT TARGET gRPC::grpc_cpp_plugin)
|
|
||||||
message(FATAL_ERROR "Protobuf/gRPC compiler CMake targets are missing")
|
|
||||||
endif()
|
|
||||||
find_package(PkgConfig REQUIRED)
|
|
||||||
pkg_check_modules(FFMPEG REQUIRED libavcodec libavutil libswscale)
|
|
||||||
find_path(URDF_INCLUDE urdf_parser/urdf_parser.h PATH_SUFFIXES include include/urdfdom)
|
|
||||||
find_path(TINYXML_INCLUDE tinyxml.h PATH_SUFFIXES include)
|
|
||||||
find_library(URDF_LIBRARY urdfdom_model)
|
|
||||||
if(NOT URDF_INCLUDE OR NOT TINYXML_INCLUDE OR NOT URDF_LIBRARY)
|
|
||||||
message(FATAL_ERROR "urdfdom or TinyXML development files are missing")
|
|
||||||
endif()
|
|
||||||
execute_process(COMMAND "${PROBE_QMAKE}" -query QT_INSTALL_PLUGINS OUTPUT_VARIABLE PLUGINS OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
if(NOT EXISTS "${PLUGINS}/platforms/libqxcb.so")
|
|
||||||
message(FATAL_ERROR "Qt xcb platform plugin is missing")
|
|
||||||
endif()
|
|
||||||
if(NOT EXISTS "${PLUGINS}/sceneparsers/libassimpsceneimport.so")
|
|
||||||
message(FATAL_ERROR "Qt3D Assimp scene parser is missing; install the distribution's matching Qt3D mesh plugin")
|
|
||||||
endif()
|
|
||||||
message(STATUS "CMVR dependency probe passed")
|
|
||||||
CMAKE
|
|
||||||
status=0
|
|
||||||
"$CMAKE_TOOL" -S "$tmp" -B "$tmp/build" "-DPROBE_QMAKE=$QMAKE_TOOL" || status=$?
|
|
||||||
# Remove only the private directory just created by mktemp.
|
|
||||||
if [[ $tmp == "${TMPDIR:-/tmp}"/cmvr-dependency-probe.* ]]; then rm -rf -- "$tmp"; fi
|
|
||||||
(( status == 0 )) || { fail 'Dependency probe failed; review the CMake error above. Installation is not declared complete.'; return 1; }
|
|
||||||
check_plugin "$($QMAKE_TOOL -query QT_INSTALL_PLUGINS)/platforms/libqxcb.so"
|
|
||||||
check_plugin "$($QMAKE_TOOL -query QT_INSTALL_PLUGINS)/sceneparsers/libassimpsceneimport.so"
|
|
||||||
}
|
|
||||||
|
|
||||||
check_plugin() {
|
|
||||||
local file=$1 output
|
|
||||||
[[ -f $file ]] || { fail "File not found: $file"; return 1; }
|
|
||||||
if ! output=$(ldd "$file" 2>&1); then
|
|
||||||
printf '%s\n' "$output" >&2; fail "Cannot resolve ELF dependencies: $file"; return 1
|
|
||||||
fi
|
|
||||||
if [[ $output == *'not found'* ]]; then
|
|
||||||
printf '%s\n' "$output" >&2; fail "Missing shared libraries: $file"; return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
check_app() {
|
|
||||||
local app=$1 description
|
|
||||||
[[ -f $app ]] || { fail "Application not found: $app"; return 1; }
|
|
||||||
description=$(file -Lb -- "$app")
|
|
||||||
[[ $description == ELF* ]] || { fail 'Provide a native Linux ELF application, not the Windows .exe.'; return 1; }
|
|
||||||
if [[ $ARCH != x86_64 && $description == *64-bit* ]]; then fail 'A 64-bit application cannot run on this 32-bit OS.'; return 1; fi
|
|
||||||
check_plugin "$app"
|
|
||||||
log "ELF loader dependencies resolved: $app"
|
|
||||||
log 'If symbol/GLIBC/Qt ABI errors remain, rebuild from source on this machine. File presence alone does not prove ABI compatibility.'
|
|
||||||
}
|
|
||||||
|
|
||||||
build_source() {
|
|
||||||
local source=$1 output_dir build_dir
|
|
||||||
[[ -f $source/CMakeLists.txt && -f $source/src/main.cpp && -d $source/protos/cmvr ]] || {
|
|
||||||
fail '--source must point to the complete qt_client source tree.'; return 1;
|
|
||||||
}
|
|
||||||
build_dir=$source/build/kylin-release
|
|
||||||
log "Configuring Release in $build_dir"
|
|
||||||
"$CMAKE_TOOL" -S "$source" -B "$build_dir" -DCMAKE_BUILD_TYPE=Release -DCMVR_WITH_MSQUIC=OFF
|
|
||||||
"$CMAKE_TOOL" --build "$build_dir" --parallel "$JOBS"
|
|
||||||
APP=$source/bin/release/CmvrControlStation
|
|
||||||
check_app "$APP"
|
|
||||||
output_dir=$(dirname -- "$APP")
|
|
||||||
cat > "$output_dir/run_cmvr.sh" <<'LAUNCHER'
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
cd -- "$(dirname -- "$0")"
|
|
||||||
if [[ ${CMVR_SOFTWARE_OPENGL:-0} == 1 ]]; then
|
|
||||||
export QT_OPENGL=software LIBGL_ALWAYS_SOFTWARE=1
|
|
||||||
fi
|
|
||||||
exec ./CmvrControlStation "$@"
|
|
||||||
LAUNCHER
|
|
||||||
chmod u+x -- "$output_dir/run_cmvr.sh"
|
|
||||||
log "Ready: bash \"$output_dir/run_cmvr.sh\""
|
|
||||||
log 'For offline class: select Demo mode before connecting. This script does not launch the GUI or connect to devices.'
|
|
||||||
}
|
|
||||||
|
|
||||||
main() {
|
|
||||||
local source='' arg
|
|
||||||
APP=''; JOBS=4; WITH_CREATOR=0; UPDATE_METADATA=1; CHECK_ONLY=0; DRY_RUN=0
|
|
||||||
while (($#)); do
|
|
||||||
arg=$1; shift
|
|
||||||
case "$arg" in
|
|
||||||
--source|--app|--jobs)
|
|
||||||
(($#)) || { fail "Missing value for $arg"; return 2; }
|
|
||||||
case "$arg" in --source) source=$1 ;; --app) APP=$1 ;; --jobs) JOBS=$1 ;; esac
|
|
||||||
shift ;;
|
|
||||||
--with-qtcreator) WITH_CREATOR=1 ;;
|
|
||||||
--no-update) UPDATE_METADATA=0 ;;
|
|
||||||
--check) CHECK_ONLY=1 ;;
|
|
||||||
--dry-run) DRY_RUN=1 ;;
|
|
||||||
-h|--help) usage; return 0 ;;
|
|
||||||
*) fail "Unknown option: $arg"; usage; return 2 ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
[[ $JOBS =~ ^[1-9][0-9]*$ ]] || { fail '--jobs must be a positive integer.'; return 2; }
|
|
||||||
(( !(CHECK_ONLY && DRY_RUN) )) || { fail 'Choose either --check or --dry-run.'; return 2; }
|
|
||||||
if [[ -n $source ]]; then
|
|
||||||
[[ -d $source ]] || { fail "Source directory does not exist: $source"; return 2; }
|
|
||||||
source=$(cd -- "$source" && pwd -P)
|
|
||||||
[[ -f $source/CMakeLists.txt && -f $source/src/main.cpp ]] || { fail 'Source tree is incomplete.'; return 2; }
|
|
||||||
fi
|
|
||||||
if [[ -n $APP ]]; then
|
|
||||||
[[ -f $APP ]] || { fail "Application does not exist: $APP"; return 2; }
|
|
||||||
APP=$(cd -- "$(dirname -- "$APP")" && printf '%s/%s' "$PWD" "$(basename -- "$APP")")
|
|
||||||
fi
|
|
||||||
detect_platform
|
|
||||||
if (( DRY_RUN )); then
|
|
||||||
resolve_packages
|
|
||||||
log 'Dry run: required/available package plan (current metadata only)'
|
|
||||||
printf ' %s\n' "${PACKAGES[@]}"
|
|
||||||
log 'No sudo, installation, build or GUI launch was performed.'
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
if (( ! CHECK_ONLY )); then install_packages; fi
|
|
||||||
probe_dependencies
|
|
||||||
if [[ -n $APP ]]; then check_app "$APP"; fi
|
|
||||||
if [[ -n $source ]] && (( ! CHECK_ONLY )); then build_source "$source"; fi
|
|
||||||
log 'Dependency checks passed. No devices were controlled.'
|
|
||||||
if [[ -z $source && -z $APP ]]; then
|
|
||||||
log 'To build: bash setup_kylin.sh --source /path/to/qt_client'
|
|
||||||
log 'To check a Linux release: bash setup_kylin.sh --check --app /path/to/CmvrControlStation'
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ ${BASH_SOURCE[0]} == "$0" ]]; then main "$@"; fi
|
|
||||||
@ -1,63 +0,0 @@
|
|||||||
麒麟 Linux:一键安装 Qt 与 CMVR 上位机依赖
|
|
||||||
|
|
||||||
1. 把 setup_kylin.sh 复制到麒麟电脑,在该目录打开终端。
|
|
||||||
安装依赖(安装 Qt 库和开发工具,不默认安装 Qt Creator):
|
|
||||||
bash setup_kylin.sh
|
|
||||||
需要 Qt Creator IDE 时:
|
|
||||||
bash setup_kylin.sh --with-qtcreator
|
|
||||||
|
|
||||||
2. 如果电脑已有完整的 Linux 上位机源码,安装后直接构建 Release:
|
|
||||||
bash setup_kylin.sh --source /你的路径/qt_client
|
|
||||||
把路径替换为包含 CMakeLists.txt、src 和 protos 的工程目录。
|
|
||||||
默认4个编译任务,内存较小时可用 --jobs 2。
|
|
||||||
成功后输出为:qt_client/bin/release/CmvrControlStation。
|
|
||||||
启动:
|
|
||||||
bash /你的路径/qt_client/bin/release/run_cmvr.sh
|
|
||||||
|
|
||||||
3. 如果已有 Linux 版程序,只安装依赖并检查它:
|
|
||||||
bash setup_kylin.sh --app /你的路径/CmvrControlStation
|
|
||||||
该模式不编译,也不修改这个程序。安装的依赖来自当前系统仓库。
|
|
||||||
若它来自其他 Linux 版本,Qt/GLIBC/编译器 ABI 仍可能不兼容,需在本机重新构建。
|
|
||||||
|
|
||||||
4. 已安装过时可以仅检查:
|
|
||||||
bash setup_kylin.sh --check
|
|
||||||
bash setup_kylin.sh --check --app /你的路径/CmvrControlStation
|
|
||||||
仅查看当前仓库的安装计划:
|
|
||||||
bash setup_kylin.sh --dry-run
|
|
||||||
使用已准备好的离线/本地软件源,不刷新元数据:
|
|
||||||
bash setup_kylin.sh --no-update
|
|
||||||
--no-update 不代表随脚本附带了安装包;缺少包文件时仍需可访问的软件源。
|
|
||||||
|
|
||||||
脚本内容
|
|
||||||
自动识别 Linux x86 架构、系统名称及 APT / DNF / YUM。
|
|
||||||
按本机仓库中可用的包名安装 Qt5、Multimedia、Qt3D、Assimp网格插件、
|
|
||||||
Protobuf/gRPC、FFmpeg、urdfdom、TinyXML、OpenGL/XCB、CMake和编译工具。
|
|
||||||
安装后检查 Qt>=5.12、CMake>=3.16、CMake依赖、Qt平台与网格插件、ELF缺失库。
|
|
||||||
源码构建默认关闭 MsQuic/QUIC,不影响普通界面和演示模式。
|
|
||||||
普通上位机运行和课堂Python示例不依赖pip。手眼标定算法的Python扩展环境需另外准备。
|
|
||||||
课堂示例还要求Python>=3.9,版本不足时脚本会提示。
|
|
||||||
|
|
||||||
使用条件
|
|
||||||
需要已有正确的麒麟软件源和管理员安装权限,按提示输入sudo密码。
|
|
||||||
无需以root启动整个脚本;编译和生成启动器使用当前桌面用户。
|
|
||||||
本脚本不修改软件源、不禁用签名校验、不删除软件锁、不关闭防火墙。
|
|
||||||
仓库缺少必需包时会列出包名并停止;需管理员配置同版本开发/媒体仓库后重跑。
|
|
||||||
安装包、依赖或编译失败时不会显示“全部安装成功”。
|
|
||||||
发行版仓库内的版本可能不足,脚本会在实际检查中报告;不能保证所有麒麟版本无需调整。
|
|
||||||
没有把未经验证的 Ubuntu/Fedora 外部仓库强行加入麒麟系统。
|
|
||||||
|
|
||||||
注意
|
|
||||||
先前 Windows Release 压缩包中的 .exe 不能用这个脚本变成 Linux 程序。
|
|
||||||
本脚本包不含完整上位机源码或预编译 Linux 程序。
|
|
||||||
已有对应的 Linux 上位机后,勾选“演示模式”,地址填127.0.0.1,再连接即可用于无实物讲课。
|
|
||||||
脚本不会启动GUI、连接机器人、控制电机或重启cmvr-es。
|
|
||||||
图形驱动异常时,可尝试启动脚本的兼容选项:
|
|
||||||
CMVR_SOFTWARE_OPENGL=1 bash /你的路径/qt_client/bin/release/run_cmvr.sh
|
|
||||||
|
|
||||||
验证范围
|
|
||||||
已在开发机进行 Bash 语法检查与模拟包管理器测试,尚未在目标麒麟电脑上安装验证。
|
|
||||||
包名参考与项目要求:
|
|
||||||
项目 CMakeLists.txt 与 README.md
|
|
||||||
https://www.kylinos.cn/upload/1/kycms/20250617/1934877956515139584.pdf
|
|
||||||
https://packages.ubuntu.com/jammy/qt3d-assimpsceneimport-plugin
|
|
||||||
https://packages.fedoraproject.org/pkgs/qt5-qt3d/qt5-qt3d-devel/index.html
|
|
||||||
@ -1,179 +0,0 @@
|
|||||||
#include "actionqueuetestwidget.h"
|
|
||||||
#include "robotclient.h"
|
|
||||||
#include "appmessagebox.h"
|
|
||||||
#include "cmvr/api/system_service.grpc.pb.h"
|
|
||||||
#include <grpcpp/grpcpp.h>
|
|
||||||
#include <google/protobuf/util/json_util.h>
|
|
||||||
#include <QComboBox>
|
|
||||||
#include <QDoubleSpinBox>
|
|
||||||
#include <QSpinBox>
|
|
||||||
#include <QGroupBox>
|
|
||||||
#include <QGridLayout>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QPlainTextEdit>
|
|
||||||
#include <QPushButton>
|
|
||||||
#include <QJsonDocument>
|
|
||||||
#include <QJsonObject>
|
|
||||||
#include <QThread>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QDateTime>
|
|
||||||
#include <QUuid>
|
|
||||||
#include <chrono>
|
|
||||||
#include <cmath>
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
QString json(const google::protobuf::Message& message) {
|
|
||||||
std::string text; google::protobuf::util::JsonPrintOptions options;
|
|
||||||
options.add_whitespace=true; options.preserve_proto_field_names=true;
|
|
||||||
google::protobuf::util::MessageToJsonString(message,&text,options);
|
|
||||||
return QString::fromStdString(text);
|
|
||||||
}
|
|
||||||
QString caption(const QString& name) {
|
|
||||||
if(name=="__builtin_base__")return QStringLiteral("基座坐标系");
|
|
||||||
if(name=="__builtin_tool__")return QStringLiteral("工具坐标系");
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ActionQueueTestWidget::ActionQueueTestWidget(RobotClient* client,QWidget* parent)
|
|
||||||
:QWidget(parent),m_client(client) {
|
|
||||||
auto* layout=new QVBoxLayout(this);
|
|
||||||
auto* group=new QGroupBox(QStringLiteral("服务端动作队列 · 应用坐标系 → 末端位姿运动"),this);
|
|
||||||
auto* grid=new QGridLayout(group);
|
|
||||||
m_coordinate=new QComboBox(group);m_refresh=new QPushButton(QStringLiteral("刷新坐标系"),group);
|
|
||||||
grid->addWidget(new QLabel(QStringLiteral("参考坐标系"),group),0,0);
|
|
||||||
grid->addWidget(m_coordinate,0,1,1,4);grid->addWidget(m_refresh,0,5);
|
|
||||||
const char* axes[]={"X · m","Y · m","Z · m","RX · rad","RY · rad","RZ · rad"};
|
|
||||||
for(int i=0;i<6;++i){
|
|
||||||
grid->addWidget(new QLabel(QString::fromUtf8(axes[i]),group),1,i);
|
|
||||||
auto* input=new QDoubleSpinBox(group);input->setDecimals(6);input->setRange(-100000,100000);
|
|
||||||
input->setButtonSymbols(QAbstractSpinBox::NoButtons);m_target[i]=input;grid->addWidget(input,2,i);
|
|
||||||
connect(input,QOverload<double>::of(&QDoubleSpinBox::valueChanged),this,[this]{preview();});
|
|
||||||
}
|
|
||||||
m_pose=new QPushButton(QStringLiteral("获取所选坐标系当前位姿并填入目标"),group);
|
|
||||||
grid->addWidget(m_pose,3,0,1,6);
|
|
||||||
m_speed=new QDoubleSpinBox(group);m_speed->setDecimals(3);m_speed->setRange(.001,2);m_speed->setValue(.005);m_speed->setSuffix(" m/s");
|
|
||||||
m_accel=new QDoubleSpinBox(group);m_accel->setDecimals(3);m_accel->setRange(.001,10);m_accel->setValue(.01);m_accel->setSuffix(" m/s²");
|
|
||||||
m_deadline=new QSpinBox(group);m_deadline->setRange(1,1800);m_deadline->setValue(120);m_deadline->setSuffix(" s");
|
|
||||||
grid->addWidget(new QLabel(QStringLiteral("速度"),group),4,0);grid->addWidget(m_speed,4,1);
|
|
||||||
grid->addWidget(new QLabel(QStringLiteral("加速度"),group),4,2);grid->addWidget(m_accel,4,3);
|
|
||||||
grid->addWidget(new QLabel(QStringLiteral("队列总超时"),group),4,4);grid->addWidget(m_deadline,4,5);
|
|
||||||
m_motion=new QComboBox(group);m_motion->addItem(QStringLiteral("MoveL · 直线运动"));
|
|
||||||
grid->addWidget(new QLabel(QStringLiteral("运动方式"),group),5,0);grid->addWidget(m_motion,5,1,1,5);
|
|
||||||
layout->addWidget(group);
|
|
||||||
auto* tip=new QLabel(QStringLiteral("目标是所选坐标系下的完整绝对 TCP 位姿。队列先应用坐标系,再执行所选运动。当前服务端支持 MoveL 直线运动。"),this);
|
|
||||||
tip->setWordWrap(true);layout->addWidget(tip);
|
|
||||||
auto* buttons=new QHBoxLayout;
|
|
||||||
m_execute=new QPushButton(QStringLiteral("执行两步动作队列"),this);m_execute->setObjectName("primaryButton");
|
|
||||||
m_cancel=new QPushButton(QStringLiteral("取消当前队列"),this);m_cancel->setObjectName("dangerButton");
|
|
||||||
buttons->addWidget(m_execute);buttons->addWidget(m_cancel);buttons->addStretch();layout->addLayout(buttons);
|
|
||||||
m_status=new QLabel(QStringLiteral("尚未执行"),this);m_status->setWordWrap(true);m_status->setTextInteractionFlags(Qt::TextSelectableByMouse);layout->addWidget(m_status);
|
|
||||||
auto* documents=new QHBoxLayout;
|
|
||||||
auto* requestGroup=new QGroupBox(QStringLiteral("请求 JSON · 可复制"),this);auto* requestLayout=new QVBoxLayout(requestGroup);
|
|
||||||
m_request=new QPlainTextEdit(requestGroup);m_request->setReadOnly(true);requestLayout->addWidget(m_request);
|
|
||||||
auto* responseGroup=new QGroupBox(QStringLiteral("原始反馈 / 错误 · 可复制"),this);auto* responseLayout=new QVBoxLayout(responseGroup);
|
|
||||||
m_response=new QPlainTextEdit(responseGroup);m_response->setReadOnly(true);responseLayout->addWidget(m_response);
|
|
||||||
documents->addWidget(requestGroup);documents->addWidget(responseGroup);layout->addLayout(documents,1);
|
|
||||||
connect(m_refresh,&QPushButton::clicked,this,[this]{query("list");});
|
|
||||||
connect(m_pose,&QPushButton::clicked,this,[this]{query("selected_pose");});
|
|
||||||
connect(m_coordinate,QOverload<int>::of(&QComboBox::currentIndexChanged),this,[this]{preview();updateActions();});
|
|
||||||
for(auto* b:{m_speed,m_accel})connect(b,QOverload<double>::of(&QDoubleSpinBox::valueChanged),this,[this]{preview();});
|
|
||||||
connect(m_deadline,QOverload<int>::of(&QSpinBox::valueChanged),this,[this]{preview();});
|
|
||||||
connect(m_motion,QOverload<int>::of(&QComboBox::currentIndexChanged),this,[this](int index){
|
|
||||||
if(m_jointMode){m_jointVelocity=m_speed->value();m_jointAcceleration=m_accel->value();}
|
|
||||||
else{m_linearVelocity=m_speed->value();m_linearAcceleration=m_accel->value();}
|
|
||||||
m_jointMode=index==1;
|
|
||||||
m_speed->setRange(.001,m_jointMode?10:2);m_accel->setRange(.001,m_jointMode?100:10);
|
|
||||||
m_speed->setSuffix(m_jointMode?" rad/s":" m/s");m_accel->setSuffix(m_jointMode?" rad/s²":" m/s²");
|
|
||||||
m_speed->setValue(m_jointMode?m_jointVelocity:m_linearVelocity);m_accel->setValue(m_jointMode?m_jointAcceleration:m_linearAcceleration);preview();
|
|
||||||
});
|
|
||||||
connect(m_execute,&QPushButton::clicked,this,[this]{execute();});
|
|
||||||
connect(m_cancel,&QPushButton::clicked,this,[this]{if(m_context){m_context->TryCancel();m_status->setText(QStringLiteral("正在取消,等待服务端返回;取消不代表已确认停稳。"));}});
|
|
||||||
connect(client,&RobotClient::rpcFinished,this,[this](const QString& service,const QString& token,bool ok,const QString& text){
|
|
||||||
if(service!="cmvr.user_coordinates"||m_pending.isEmpty()||token!=QString::number(m_token))return;
|
|
||||||
const QString operation=m_pending;m_pending.clear();
|
|
||||||
const auto r=QJsonDocument::fromJson(text.toUtf8()).object();
|
|
||||||
if(!ok||!r.value("success").toBool()||r.value("device_id").toString()!=m_device){m_status->setText(QStringLiteral("读取失败:")+text);updateActions();return;}
|
|
||||||
if(operation=="list"){
|
|
||||||
const QString previous=m_coordinate->currentData().toString();m_profiles=r.value("coordinates").toArray();m_coordinate->clear();
|
|
||||||
for(const auto& v:m_profiles){const auto p=v.toObject();const QString name=p.value("name").toString();m_coordinate->addItem(caption(name)+QStringLiteral(" · 版本 ")+p.value("revision").toVariant().toString(),name);}
|
|
||||||
const int at=m_coordinate->findData(previous);if(at>=0)m_coordinate->setCurrentIndex(at);
|
|
||||||
m_status->setText(QStringLiteral("已读取服务端坐标系。"));
|
|
||||||
}else{
|
|
||||||
const auto pose=r.value("pose").toArray();QString expected=m_coordinate->currentData().toString();if(expected=="__builtin_base__")expected="base";
|
|
||||||
bool valid=pose.size()==6&&r.value("reference").toString()==expected&&r.value("end_frame").toString()=="tcp";
|
|
||||||
for(const auto& v:pose)valid=valid&&v.isDouble()&&std::isfinite(v.toDouble());
|
|
||||||
if(valid){for(int i=0;i<6;++i)m_target[i]->setValue(pose[i].toDouble());m_status->setText(QStringLiteral("已填入所选坐标系下当前 TCP 绝对位姿,请按需要调整目标。"));}
|
|
||||||
else m_status->setText(QStringLiteral("位姿反馈参考系或数值无效,未填入目标。"));
|
|
||||||
}
|
|
||||||
preview();updateActions();
|
|
||||||
});
|
|
||||||
preview();updateActions();
|
|
||||||
}
|
|
||||||
ActionQueueTestWidget::~ActionQueueTestWidget(){
|
|
||||||
if(m_context)m_context->TryCancel();
|
|
||||||
if(m_thread){m_thread->wait();delete m_thread;}
|
|
||||||
}
|
|
||||||
void ActionQueueTestWidget::setContext(const QString& endpoint,const QString& device,bool connected){
|
|
||||||
if(endpoint==m_endpoint&&device==m_device&&connected==m_connected)return;
|
|
||||||
if(m_context)m_context->TryCancel();
|
|
||||||
++m_token;m_pending.clear();m_endpoint=endpoint;m_device=device;m_connected=connected;m_profiles={};m_coordinate->clear();
|
|
||||||
m_status->setText(QStringLiteral("连接或设备已变化,请刷新坐标系。"));preview();updateActions();
|
|
||||||
}
|
|
||||||
void ActionQueueTestWidget::updateActions(){
|
|
||||||
const bool ready=m_connected&&!m_device.isEmpty()&&!m_busy&&m_pending.isEmpty();
|
|
||||||
m_refresh->setEnabled(ready);m_coordinate->setEnabled(!m_busy&&m_pending.isEmpty());
|
|
||||||
m_pose->setEnabled(ready&&m_coordinate->currentIndex()>=0);m_execute->setEnabled(ready&&m_coordinate->currentIndex()>=0);
|
|
||||||
m_cancel->setEnabled(m_busy);for(auto* b:m_target)b->setEnabled(!m_busy);
|
|
||||||
m_speed->setEnabled(!m_busy);m_accel->setEnabled(!m_busy);m_deadline->setEnabled(!m_busy);m_motion->setEnabled(!m_busy);
|
|
||||||
}
|
|
||||||
void ActionQueueTestWidget::preview(){
|
|
||||||
QJsonObject target;const char* keys[]={"x","y","z","rx","ry","rz"};for(int i=0;i<6;++i)target[keys[i]]=m_target[i]->value();
|
|
||||||
const int i=m_coordinate->currentIndex();const auto profile=i>=0&&i<m_profiles.size()?m_profiles[i].toObject():QJsonObject();
|
|
||||||
const QJsonObject header{{"device_id",m_device}};
|
|
||||||
const QJsonObject apply{{"header",header},{"name",m_coordinate->currentData().toString()},{"expected_revision",profile.value("revision").toVariant().toString()}};
|
|
||||||
QJsonObject move{{"header",header},{"target",target},{"options",QJsonObject{{"velocity",m_speed->value()},{"acceleration",m_accel->value()}}}};
|
|
||||||
if(m_jointMode){move.insert("user_coordinate_name",m_coordinate->currentData().toString());move.insert("user_coordinate_revision",profile.value("revision").toVariant().toString());}
|
|
||||||
const QJsonObject request{{"steps",QJsonArray{QJsonObject{{"arm_apply_user_coordinate",apply}},QJsonObject{{"arm_move_l",move}}}},{"total_timeout_ms",m_deadline->value()*1000}};
|
|
||||||
m_request->setPlainText(QString::fromUtf8(QJsonDocument(request).toJson(QJsonDocument::Indented)));
|
|
||||||
}
|
|
||||||
void ActionQueueTestWidget::query(const QString& operation){
|
|
||||||
if(m_busy||!m_pending.isEmpty()||!m_connected)return;
|
|
||||||
m_token=qMax(m_token+1,quint64(QDateTime::currentMSecsSinceEpoch()));m_pending=operation;
|
|
||||||
const quint64 token=m_token;
|
|
||||||
m_client->requestUserCoordinates(m_device,{{"operation",operation},{"name",m_coordinate->currentData().toString()}},token);
|
|
||||||
m_status->setText(QStringLiteral("读取中…"));updateActions();
|
|
||||||
QTimer::singleShot(25000,this,[this,token]{if(token==m_token&&!m_pending.isEmpty()){m_pending.clear();++m_token;m_status->setText(QStringLiteral("读取超时,请刷新。"));updateActions();}});
|
|
||||||
}
|
|
||||||
void ActionQueueTestWidget::execute(){
|
|
||||||
if(m_busy||!m_pending.isEmpty()||!m_connected||m_coordinate->currentIndex()<0)return;
|
|
||||||
preview();
|
|
||||||
cmvr::api::ActionQueueCommand::Request request;
|
|
||||||
const auto parsed=google::protobuf::util::JsonStringToMessage(m_request->toPlainText().toStdString(),&request);
|
|
||||||
if(!parsed.ok()){m_status->setText(QString::fromStdString(parsed.ToString()));return;}
|
|
||||||
if(AppMessageBox::question(this,QStringLiteral("执行动作队列"),QStringLiteral("将先应用“%1”,再执行 %2 到界面完整绝对目标。速度 %3 %4。请确认目标和现场空间安全;MoveJ 路径不保证直线。").arg(caption(m_coordinate->currentData().toString()),m_jointMode?QStringLiteral("末端位姿 MoveJ"):QStringLiteral("MoveL")).arg(m_speed->value()).arg(m_jointMode?"rad/s":"m/s"))!=AppMessageBox::Yes)return;
|
|
||||||
// The exact transmitted headers are included in the visible request for diagnosis.
|
|
||||||
const auto now=QDateTime::currentMSecsSinceEpoch();
|
|
||||||
for(auto& step:*request.mutable_steps()){
|
|
||||||
auto* h=step.has_arm_move_l()?step.mutable_arm_move_l()->mutable_header():step.mutable_arm_apply_user_coordinate()->mutable_header();
|
|
||||||
h->mutable_timestamp()->set_seconds(now/1000);h->mutable_timestamp()->set_nanos((now%1000)*1000000);
|
|
||||||
}
|
|
||||||
m_request->setPlainText(json(request));m_response->clear();m_busy=true;
|
|
||||||
m_status->setText(QStringLiteral("队列执行中,等待服务端返回。"));updateActions();
|
|
||||||
if(m_thread){m_thread->wait();delete m_thread;}
|
|
||||||
m_context=std::make_shared<grpc::ClientContext>();
|
|
||||||
m_context->set_deadline(std::chrono::system_clock::now()+std::chrono::milliseconds(request.total_timeout_ms()+5000));
|
|
||||||
const auto context=m_context;const QString endpoint=m_endpoint;
|
|
||||||
m_thread=QThread::create([this,request,context,endpoint]{
|
|
||||||
auto stub=cmvr::api::SystemService::NewStub(grpc::CreateChannel(endpoint.toStdString(),grpc::InsecureChannelCredentials()));
|
|
||||||
cmvr::api::ActionQueueCommand::Feedback feedback;
|
|
||||||
const auto status=stub->ExecuteActionQueue(context.get(),request,&feedback);
|
|
||||||
const QString response=json(feedback);
|
|
||||||
const bool ok=status.ok()&&feedback.header().success()&&feedback.result()==cmvr::api::ACTION_RESULT_CODE_COMPLETED;
|
|
||||||
const QString detail=status.ok()?QStringLiteral("%1 · 完成 %2 / 2 步%3 · %4").arg(ok?QStringLiteral("成功"):QStringLiteral("失败")).arg(feedback.completed_steps()).arg(feedback.has_failed_step_index()?QStringLiteral(" · 失败节点 %1").arg(feedback.failed_step_index()+1):QString()).arg(QString::fromStdString(feedback.header().error_message())):QStringLiteral("gRPC 错误 %1:%2;执行结果未确认,请检查服务端状态。").arg(status.error_code()).arg(QString::fromStdString(status.error_message()));
|
|
||||||
QMetaObject::invokeMethod(this,[this,response,detail]{m_busy=false;m_context.reset();m_response->setPlainText(response+"\n"+detail);m_status->setText(detail);updateActions();},Qt::QueuedConnection);
|
|
||||||
});
|
|
||||||
m_thread->start();
|
|
||||||
}
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QJsonArray>
|
|
||||||
#include <array>
|
|
||||||
#include <memory>
|
|
||||||
class RobotClient; class QComboBox; class QDoubleSpinBox; class QSpinBox;
|
|
||||||
class QPlainTextEdit; class QPushButton; class QLabel; class QThread;
|
|
||||||
namespace grpc { class ClientContext; }
|
|
||||||
class ActionQueueTestWidget final : public QWidget {
|
|
||||||
public:
|
|
||||||
explicit ActionQueueTestWidget(RobotClient*, QWidget* = nullptr);
|
|
||||||
~ActionQueueTestWidget() override;
|
|
||||||
void setContext(const QString&, const QString&, bool);
|
|
||||||
private:
|
|
||||||
RobotClient* m_client;
|
|
||||||
QString m_endpoint, m_device, m_pending;
|
|
||||||
bool m_connected=false, m_busy=false;
|
|
||||||
quint64 m_token=0;
|
|
||||||
QJsonArray m_profiles;
|
|
||||||
QComboBox* m_coordinate;
|
|
||||||
QComboBox* m_motion;
|
|
||||||
bool m_jointMode=false;
|
|
||||||
double m_linearVelocity=.005,m_linearAcceleration=.01,m_jointVelocity=.1,m_jointAcceleration=.5;
|
|
||||||
std::array<QDoubleSpinBox*,6> m_target;
|
|
||||||
QDoubleSpinBox *m_speed,*m_accel;
|
|
||||||
QSpinBox* m_deadline;
|
|
||||||
QPushButton *m_refresh,*m_pose,*m_execute,*m_cancel;
|
|
||||||
QPlainTextEdit *m_request,*m_response;
|
|
||||||
QLabel* m_status;
|
|
||||||
QThread* m_thread=nullptr;
|
|
||||||
std::shared_ptr<grpc::ClientContext> m_context;
|
|
||||||
void updateActions();
|
|
||||||
void preview();
|
|
||||||
void query(const QString&);
|
|
||||||
void execute();
|
|
||||||
};
|
|
||||||