Add Xiaozhao arms and head models, device selection, and fresh GetPose queries with configurable end links. Reset polling, commands, and plots on device changes. Expose MoveJ jerk and joint zero calibration, improve joint naming and plot handling, and cover model switching and request lifecycles with regression tests. Update AprilTag generation to default to PDF and include the refreshed exports, model meshes, and existing workspace artifacts.
107 lines
3.9 KiB
Markdown
107 lines
3.9 KiB
Markdown
# grpc_client
|
|
|
|
## Environment
|
|
|
|
- Python: 3.9.25
|
|
|
|
## Setup
|
|
|
|
```bash
|
|
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
|
|
```
|
|
|
|
## 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
|
|
```
|
|
|
|
## 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
|
|
python -m clients.hlc_client
|
|
```
|
|
|
|
## UI (PyQt)
|
|
|
|
```bash
|
|
python -m ui.app
|
|
```
|
|
|
|
Select **Settings → Robot Model** for the robot in use. The UI remembers the
|
|
selection and shows its URDF path:
|
|
|
|
| Robot Model | URDF | Default GetPose links |
|
|
| --- | --- | --- |
|
|
| `xiaoyan` (initial default) | `robot_model/xiaoyan_description/dual_arm.urdf` | `PELVIS_S` → `R_FINGER_TIP` |
|
|
| `xiaozhao` | `robot_model/xiaozhao/urdf/xiaozhao.urdf` | `base_link` → `tcp-right` |
|
|
|
|
**Settings → Device ID** is a device dropdown populated from the configured joint groups
|
|
present in the selected URDF. `xiaoyan` offers `right_arm` / `left_arm`;
|
|
`xiaozhao` offers `xiaozhao_right_arm` / `xiaozhao_left_arm` / `xiaozhao_head`.
|
|
These service IDs are mapped in `ui/robot_models.py`. Selecting a device updates the GetPose end link
|
|
(`L_WRIST_R_S` for xiaoyan's left arm, `tcp-left` for xiaozhao's left arm) and
|
|
uses that device ID for commands and polling. Xiaozhao's **Head / Neck** device
|
|
has `neck-joint1`, `neck-joint2`, and `neck-joint3` in that order, with GetPose
|
|
defaults `base_link` → `neck_Link3`. Its joints are included in the joint status,
|
|
MoveJ, SpeedJ, and plot lists; selecting it also sets the MoveL pose-query EE Link
|
|
to `neck_Link3`. Changing the robot model keeps the selected joint group when
|
|
available and falls back to the right arm otherwise; startup defaults to the right arm.
|
|
|
|
Switching refreshes Joint Status, MoveJ, SpeedJ, plots, and GetPose link choices
|
|
from the selected URDF. Fixed joints are excluded from joint commands. It also
|
|
stops JointState/GetPose polling and clears previous samples, selected joints,
|
|
and command targets; changing the selected device clears this data as well.
|
|
Start polling again after selecting the robot/device and setting Host and Port.
|
|
URDF load errors appear in Log and keep the previous
|
|
model active. The UI reads joint/link metadata without loading mesh files.
|
|
|
|
In **Motion → MoveL**, select **EE Link (GetPose)** and click **Fill Current Pose**
|
|
to make one fresh GetPose request using the current Host, Port, Device ID, and
|
|
the **Base Link** selected in the GetPose panel. Continuous GetPose polling is
|
|
optional. A successful response fills all six pose fields; a failed request
|
|
keeps their previous values. Changing the robot, device, address, or query links
|
|
cancels any pending request. The EE Link defaults to the selected device's endpoint
|
|
and is used only for this pose query. The filled coordinates are relative to the
|
|
chosen Base Link; the MoveL command's Frame selection is retained.
|
|
|
|
## 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`).
|
|
- Standalone clients default to `right_arm`; the UI uses the selected model's arm IDs listed above.
|
|
- UI parameters (host/port/device_id/interval) are set in the PyQt window and passed to the runner.
|