2026-02-03 13:36:52 +08:00
|
|
|
# grpc_client
|
|
|
|
|
|
|
|
|
|
## Environment
|
|
|
|
|
|
|
|
|
|
- Python: 3.9.25
|
|
|
|
|
|
|
|
|
|
## Setup
|
|
|
|
|
|
|
|
|
|
```bash
|
2026-06-17 09:36:26 +08:00
|
|
|
python -m pip install -r requirements.txt
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Use the same Python interpreter you run the clients with. For example:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
C:\Users\lgv\miniconda3\envs\grpc_client\python.exe -m pip install -r requirements.txt
|
2026-02-03 13:36:52 +08:00
|
|
|
```
|
|
|
|
|
|
2026-06-24 15:49:54 +08:00
|
|
|
## Troubleshooting
|
|
|
|
|
|
|
|
|
|
If you encounter the following error:
|
|
|
|
|
|
|
|
|
|
```text
|
|
|
|
|
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in ".../site-packages/cv2/qt/plugins"
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
run:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
pip uninstall opencv-python opencv-contrib-python -y
|
|
|
|
|
pip install opencv-python-headless
|
|
|
|
|
```
|
|
|
|
|
|
2026-02-03 13:36:52 +08:00
|
|
|
## Generate gRPC code
|
|
|
|
|
|
|
|
|
|
From repo root:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
python scripts/gen_grpc_py.py
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
This reads `.proto` files under `protos/` and writes Python code to `generated/`.
|
|
|
|
|
|
|
|
|
|
## Run (module mode)
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
python -m clients.movej_client
|
|
|
|
|
python -m clients.get_joint_state_client
|
|
|
|
|
python -m clients.get_pose_client
|
|
|
|
|
python -m clients.torque_on_client
|
|
|
|
|
python -m clients.torque_off_client
|
|
|
|
|
python -m clients.torque_key_client
|
|
|
|
|
python -m clients.save_joint_to_csv
|
|
|
|
|
python -m clients.http_server
|
2026-06-17 09:36:26 +08:00
|
|
|
python -m clients.hlc_client
|
2026-02-03 13:36:52 +08:00
|
|
|
```
|
|
|
|
|
|
2026-02-25 06:23:32 +08:00
|
|
|
## UI (PyQt)
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
python -m ui.app
|
|
|
|
|
```
|
|
|
|
|
|
2026-02-03 13:36:52 +08:00
|
|
|
## Runtime parameters
|
|
|
|
|
|
|
|
|
|
- gRPC server address/port: set in `clients/base_client.py` (default `192.168.0.222:50052`).
|
|
|
|
|
- HTTP server host/port: set in `clients/http_server.py` (default `0.0.0.0:8000`).
|
2026-06-24 15:49:54 +08:00
|
|
|
- Arm `device_id` defaults to `right_arm`. Use `left_arm` when controlling the left arm.
|
2026-02-25 06:23:32 +08:00
|
|
|
- UI parameters (host/port/device_id/interval) are set in the PyQt window and passed to the runner.
|