forked from TablewareBox/Uni-Lab-OS
-
Notifications
You must be signed in to change notification settings - Fork 0
Sii #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Sii #2
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
审阅者指南引入全新的 SII 设备家族(USB 相机、WiFi/PTZ 相机,以及 Laiyu XYZ 移液工作站),提供完整的驱动实现和注册表条目,同时移除若干已不再使用的传统设备注册定义。 启动 WiFi/PTZ 相机推流的时序图sequenceDiagram
participant Orchestrator as UniLabOS_device_runtime
participant Camera as CameraController_Wifi
participant FFmpeg as FFmpeg_process
participant WS as Signal_backend_ws
participant SRS as SRS_media_server
participant IPCam as IP_camera_RTSP
Orchestrator->>Camera: start(config)
activate Camera
Camera->>Camera: apply_config_and_init_ptz()
Camera->>FFmpeg: spawn_process(rtsp=self.camera_rtsp_url, out=self.rtmp_url)
Note over FFmpeg,IPCam: FFmpeg pulls RTSP from IPCam and pushes RTMP to SRS
Camera->>WS: open_websocket(signal_backend_url)
Camera->>Camera: start_event_loop_thread()
Camera-->>Orchestrator: {status: started, urls...}
deactivate Camera
WS-->>Camera: {command: start_stream}
activate Camera
Camera->>Camera: _start_ffmpeg() (idempotent)
deactivate Camera
WS-->>Camera: {type: offer, sdp, cameraId}
activate Camera
Camera->>SRS: HTTP POST webrtc_api {api, streamurl, sdp}
SRS-->>Camera: {sdp: answer_sdp}
Camera-->>WS: {type: answer, sdp: answer_sdp, cameraId, hostId}
deactivate Camera
XYZ 移液站移动到目标点并保存该点的时序图sequenceDiagram
participant Runtime as UniLabOS_device_runtime
participant Station as Station
participant XYZ as XYZStepperController
participant Pipette as SOPAPipetteYYQ
participant Bus as SharedRS485Bus
participant Axes as XYZ_stepper_axes
Runtime->>Station: move_to_point(name, speed, acc, z_offset)
activate Station
Station->>Station: _ensure_connected()
Station->>Station: lookup points[name]
Station->>Station: move_xyz(x, y, z+z_offset, speed, acc)
Station->>XYZ: move_xyz_work(x, y, z+z_offset, speed, acc)
activate XYZ
XYZ->>XYZ: compute_machine_steps_from_work_origin()
XYZ->>Bus: write_modbus_frames(target_steps)
Bus->>Axes: drive_stepper_motors()
XYZ->>XYZ: wait_complete(X,Y,Z)
deactivate XYZ
Station-->>Runtime: move_to_point done
deactivate Station
Runtime->>Station: save_current_position_as_point(name)
activate Station
Station->>Station: read _last_target_work[x,y,z]
Station->>Station: save_point(name, x, y, z)
Station->>Station: update points[name]
Station-->>Runtime: save_current_position_as_point done
deactivate Station
SII 相机驱动和 PTZ 控制器的类图classDiagram
class CameraController_USB {
+str host_id
+str signal_backend_url
+str rtmp_url
+str webrtc_api
+str webrtc_stream_url
+str video_device
+int width
+int height
+int fps
+str video_bitrate
+str audio_device
+str audio_bitrate
-object _ws
-Popen _ffmpeg_process
-bool _running
-bool _websocket_connected
-Future _loop_task
-AbstractEventLoop _loop
-Thread _loop_thread
+start(config Dict) Dict
+stop() Dict
+get_status() Dict
+running bool
+websocket_connected bool
+ffmpeg_running bool
-_run_main_loop() void
-_recv_loop() void
-_handle_message(data Dict) void
-_start_ffmpeg() void
-_stop_ffmpeg() void
-_handle_webrtc_offer(offer_sdp str) str
}
class PTZController {
+str host
+int port
+str user
+str password
+ONVIFCamera cam
+object media_service
+object ptz_service
+object profile
+connect() bool
-_continuous_move(pan float, tilt float, zoom float, duration float) bool
+stop() bool
+move_up(speed float, duration float) bool
+move_down(speed float, duration float) bool
+move_left(speed float, duration float) bool
+move_right(speed float, duration float) bool
+zoom_in(speed float, duration float) bool
+zoom_out(speed float, duration float) bool
-_force_stop(retries int, delay float) bool
}
class CameraController_Wifi {
+str host_id
+str signal_backend_url
+str rtmp_url
+str webrtc_api
+str webrtc_stream_url
+str camera_rtsp_url
+str ptz_host
+int ptz_port
+str ptz_user
+str ptz_password
-PTZController _ptz
-object _ws
-Popen _ffmpeg_process
-bool _running
-Future _loop_task
-AbstractEventLoop _loop
-Thread _loop_thread
+start(config Dict) Dict
+stop() Dict
+get_status() Dict
+ptz_move_up(speed float, duration float) bool
+ptz_move_down(speed float, duration float) bool
+ptz_move_left(speed float, duration float) bool
+ptz_move_right(speed float, duration float) bool
+zoom_in(speed float, duration float) bool
+zoom_out(speed float, duration float) bool
+ptz_stop() void
-_init_ptz_if_possible() void
-_run_main_loop() void
-_recv_loop() void
-_handle_message(data Dict) void
-_start_ffmpeg() void
-_stop_ffmpeg() void
-_handle_webrtc_offer(offer_sdp str) str
}
CameraController_Wifi --> PTZController : uses
SII Laiyu XYZ 移液工作站及驱动的类图classDiagram
class SharedRS485Bus {
+str port
+int baudrate
+float timeout
+Serial serial
+Lock lock
+open() bool
+close() void
+reset_input() void
+write(data bytes) void
+read(n int) bytes
+read_exact(n int, overall_timeout float) bytes
}
class XYZModbus {
+SharedRS485Bus bus
+bool ignore_crc_error
+set_ignore_crc(flag bool) void
+read_regs(slave int, addr int, count int) List~int~
+write_reg(slave int, addr int, val int) bool
+write_regs(slave int, start int, values List~int~) bool
-_crc16(data bytes) bytes
-_xfer(slave int, payload bytes, retries int, delay_before_read float) bytes
}
class MotorStatus {
<<enum>>
STANDBY
RUNNING
COLLISION_STOP
FORWARD_LIMIT_STOP
FORWARD_LIMIT_STOP
REVERSE_LIMIT_STOP
}
class XYZStepperController {
+SharedRS485Bus bus
+XYZModbus modbus
+Dict axis_addr
+Dict work_origin_steps
+bool is_homed
+get_status(axis str) List~int~
+enable(axis str, state bool) bool
+wait_complete(axis str, timeout float) bool
+move_to(axis str, steps int, speed int, acc int, precision int) bool
+move_xyz_work(x float, y float, z float, speed int, acc int) void
+mm_to_steps(axis str, mm float) int
+steps_to_mm(axis str, steps int) float
+define_current_as_zero(save_path str) void
+return_to_work_origin(speed int, acc int) void
-_to_machine_steps(axis str, mm float) int
-_load_work_origin(path str) bool
-s16(v int) int
-s32(h int, l int) int
}
class SOPAConfig {
+int address
+float timeout
}
class SOPAPipetteYYQ {
+SharedRS485Bus bus
+SOPAConfig config
+initialize() bool
+eject_tip() bool
+aspirate(volume_uL float) void
+dispense(volume_uL float) void
+set_max_speed(speed int) void
+set_start_speed(speed int) void
+set_cutoff_speed(speed int) void
+set_acceleration(accel int) void
+get_status() str
+get_tip_status() bool
-_send_and_read(cmd str, delay_before_read float) str
}
class Station {
+str port
+int baudrate
+SharedRS485Bus bus
+XYZStepperController xyz
+SOPAPipetteYYQ pip
+str points_file
+str origin_file
+Dict points
+Dict _last_target_work
+connect() void
+disconnect() void
+move_xyz(x float, y float, z float, speed int, acc int) void
+move_to_point(name str, speed int, acc int, z_offset float) void
+aspirate(volume_uL float) void
+dispense(volume_uL float) void
+eject_tip() void
+save_point(name str, x float, y float, z float) void
+save_current_position_as_point(name str) void
+define_current_as_zero() void
-_load_points() void
-_ensure_connected() void
}
SharedRS485Bus <.. XYZModbus : uses
XYZStepperController --> XYZModbus
XYZStepperController --> MotorStatus
SOPAPipetteYYQ --> SharedRS485Bus
Station --> SharedRS485Bus
Station --> XYZStepperController
Station --> SOPAPipetteYYQ
文件级变更
技巧和命令与 Sourcery 交互
自定义使用体验打开你的 控制面板 以:
获取帮助Original review guide in EnglishReviewer's GuideIntroduce a new SII device family (USB camera, WiFi/PTZ camera, and Laiyu XYZ pipette station) with full driver implementations and registry entries, while removing several legacy device registry definitions that are no longer used. Sequence diagram for starting WiFi/PTZ camera streamingsequenceDiagram
participant Orchestrator as UniLabOS_device_runtime
participant Camera as CameraController_Wifi
participant FFmpeg as FFmpeg_process
participant WS as Signal_backend_ws
participant SRS as SRS_media_server
participant IPCam as IP_camera_RTSP
Orchestrator->>Camera: start(config)
activate Camera
Camera->>Camera: apply_config_and_init_ptz()
Camera->>FFmpeg: spawn_process(rtsp=self.camera_rtsp_url, out=self.rtmp_url)
Note over FFmpeg,IPCam: FFmpeg pulls RTSP from IPCam and pushes RTMP to SRS
Camera->>WS: open_websocket(signal_backend_url)
Camera->>Camera: start_event_loop_thread()
Camera-->>Orchestrator: {status: started, urls...}
deactivate Camera
WS-->>Camera: {command: start_stream}
activate Camera
Camera->>Camera: _start_ffmpeg() (idempotent)
deactivate Camera
WS-->>Camera: {type: offer, sdp, cameraId}
activate Camera
Camera->>SRS: HTTP POST webrtc_api {api, streamurl, sdp}
SRS-->>Camera: {sdp: answer_sdp}
Camera-->>WS: {type: answer, sdp: answer_sdp, cameraId, hostId}
deactivate Camera
Sequence diagram for moving to a point and saving it in XYZ pipette stationsequenceDiagram
participant Runtime as UniLabOS_device_runtime
participant Station as Station
participant XYZ as XYZStepperController
participant Pipette as SOPAPipetteYYQ
participant Bus as SharedRS485Bus
participant Axes as XYZ_stepper_axes
Runtime->>Station: move_to_point(name, speed, acc, z_offset)
activate Station
Station->>Station: _ensure_connected()
Station->>Station: lookup points[name]
Station->>Station: move_xyz(x, y, z+z_offset, speed, acc)
Station->>XYZ: move_xyz_work(x, y, z+z_offset, speed, acc)
activate XYZ
XYZ->>XYZ: compute_machine_steps_from_work_origin()
XYZ->>Bus: write_modbus_frames(target_steps)
Bus->>Axes: drive_stepper_motors()
XYZ->>XYZ: wait_complete(X,Y,Z)
deactivate XYZ
Station-->>Runtime: move_to_point done
deactivate Station
Runtime->>Station: save_current_position_as_point(name)
activate Station
Station->>Station: read _last_target_work[x,y,z]
Station->>Station: save_point(name, x, y, z)
Station->>Station: update points[name]
Station-->>Runtime: save_current_position_as_point done
deactivate Station
Class diagram for SII camera drivers and PTZ controllerclassDiagram
class CameraController_USB {
+str host_id
+str signal_backend_url
+str rtmp_url
+str webrtc_api
+str webrtc_stream_url
+str video_device
+int width
+int height
+int fps
+str video_bitrate
+str audio_device
+str audio_bitrate
-object _ws
-Popen _ffmpeg_process
-bool _running
-bool _websocket_connected
-Future _loop_task
-AbstractEventLoop _loop
-Thread _loop_thread
+start(config Dict) Dict
+stop() Dict
+get_status() Dict
+running bool
+websocket_connected bool
+ffmpeg_running bool
-_run_main_loop() void
-_recv_loop() void
-_handle_message(data Dict) void
-_start_ffmpeg() void
-_stop_ffmpeg() void
-_handle_webrtc_offer(offer_sdp str) str
}
class PTZController {
+str host
+int port
+str user
+str password
+ONVIFCamera cam
+object media_service
+object ptz_service
+object profile
+connect() bool
-_continuous_move(pan float, tilt float, zoom float, duration float) bool
+stop() bool
+move_up(speed float, duration float) bool
+move_down(speed float, duration float) bool
+move_left(speed float, duration float) bool
+move_right(speed float, duration float) bool
+zoom_in(speed float, duration float) bool
+zoom_out(speed float, duration float) bool
-_force_stop(retries int, delay float) bool
}
class CameraController_Wifi {
+str host_id
+str signal_backend_url
+str rtmp_url
+str webrtc_api
+str webrtc_stream_url
+str camera_rtsp_url
+str ptz_host
+int ptz_port
+str ptz_user
+str ptz_password
-PTZController _ptz
-object _ws
-Popen _ffmpeg_process
-bool _running
-Future _loop_task
-AbstractEventLoop _loop
-Thread _loop_thread
+start(config Dict) Dict
+stop() Dict
+get_status() Dict
+ptz_move_up(speed float, duration float) bool
+ptz_move_down(speed float, duration float) bool
+ptz_move_left(speed float, duration float) bool
+ptz_move_right(speed float, duration float) bool
+zoom_in(speed float, duration float) bool
+zoom_out(speed float, duration float) bool
+ptz_stop() void
-_init_ptz_if_possible() void
-_run_main_loop() void
-_recv_loop() void
-_handle_message(data Dict) void
-_start_ffmpeg() void
-_stop_ffmpeg() void
-_handle_webrtc_offer(offer_sdp str) str
}
CameraController_Wifi --> PTZController : uses
Class diagram for SII Laiyu XYZ pipette station and driversclassDiagram
class SharedRS485Bus {
+str port
+int baudrate
+float timeout
+Serial serial
+Lock lock
+open() bool
+close() void
+reset_input() void
+write(data bytes) void
+read(n int) bytes
+read_exact(n int, overall_timeout float) bytes
}
class XYZModbus {
+SharedRS485Bus bus
+bool ignore_crc_error
+set_ignore_crc(flag bool) void
+read_regs(slave int, addr int, count int) List~int~
+write_reg(slave int, addr int, val int) bool
+write_regs(slave int, start int, values List~int~) bool
-_crc16(data bytes) bytes
-_xfer(slave int, payload bytes, retries int, delay_before_read float) bytes
}
class MotorStatus {
<<enum>>
STANDBY
RUNNING
COLLISION_STOP
FORWARD_LIMIT_STOP
FORWARD_LIMIT_STOP
REVERSE_LIMIT_STOP
}
class XYZStepperController {
+SharedRS485Bus bus
+XYZModbus modbus
+Dict axis_addr
+Dict work_origin_steps
+bool is_homed
+get_status(axis str) List~int~
+enable(axis str, state bool) bool
+wait_complete(axis str, timeout float) bool
+move_to(axis str, steps int, speed int, acc int, precision int) bool
+move_xyz_work(x float, y float, z float, speed int, acc int) void
+mm_to_steps(axis str, mm float) int
+steps_to_mm(axis str, steps int) float
+define_current_as_zero(save_path str) void
+return_to_work_origin(speed int, acc int) void
-_to_machine_steps(axis str, mm float) int
-_load_work_origin(path str) bool
-s16(v int) int
-s32(h int, l int) int
}
class SOPAConfig {
+int address
+float timeout
}
class SOPAPipetteYYQ {
+SharedRS485Bus bus
+SOPAConfig config
+initialize() bool
+eject_tip() bool
+aspirate(volume_uL float) void
+dispense(volume_uL float) void
+set_max_speed(speed int) void
+set_start_speed(speed int) void
+set_cutoff_speed(speed int) void
+set_acceleration(accel int) void
+get_status() str
+get_tip_status() bool
-_send_and_read(cmd str, delay_before_read float) str
}
class Station {
+str port
+int baudrate
+SharedRS485Bus bus
+XYZStepperController xyz
+SOPAPipetteYYQ pip
+str points_file
+str origin_file
+Dict points
+Dict _last_target_work
+connect() void
+disconnect() void
+move_xyz(x float, y float, z float, speed int, acc int) void
+move_to_point(name str, speed int, acc int, z_offset float) void
+aspirate(volume_uL float) void
+dispense(volume_uL float) void
+eject_tip() void
+save_point(name str, x float, y float, z float) void
+save_current_position_as_point(name str) void
+define_current_as_zero() void
-_load_points() void
-_ensure_connected() void
}
SharedRS485Bus <.. XYZModbus : uses
XYZStepperController --> XYZModbus
XYZStepperController --> MotorStatus
SOPAPipetteYYQ --> SharedRS485Bus
Station --> SharedRS485Bus
Station --> XYZStepperController
Station --> SOPAPipetteYYQ
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
由 Sourcery 提供的摘要
在移除若干旧版设备定义的同时,新增 SII 设备支持。
新功能:
增强:
杂项:
Original summary in English
Summary by Sourcery
Add SII device support while removing several legacy device definitions.
New Features:
Enhancements:
Chores: