qhsim SDK
Python SDK for the simulation-carema render backend.
Install
Install the latest published SDK from PyPI:
python -m pip install -U qhsim
Install a specific version:
python -m pip install qhsim==0.1.1
For local development from this repository:
cd D:\fengguo\Agent\repo\simulation-carema
python -m pip install -e sdk
The package requires Python 3.9 or later.
Configuration
user_id and design_id must be the encrypted IDs expected by the backend.
Defaults used by the HTTP backend and demos:
- service base URL:
https://qh-sensor-simulation-prodtest.k8s-txyun-prod.qunhequnhe.com - service base prefix:
/qh-sensor-simulation/api/c - snapshot type ID:
720 - HTTPS certificate verification: disabled by default for prodtest self-signed certificates
Enable HTTPS certificate verification explicitly when you have a trusted CA:
simulation_app = SimulationApp(
user_id="3FO4KV8SHSLV",
config={
"verify_ssl": True,
"cafile": "internal-ca.pem",
},
)
Quick Start
from qhsim import SimulationApp
from qhsim.core.api import World
from qhsim.core.math import Position, Target
from qhsim.sensors.camera import Camera
simulation_app = SimulationApp(
user_id="3FO4KV8SHSLV",
config={"snapshot_type_id": 720},
)
try:
world = World(simulation_app)
scene = world.load_scene(design_id="3FO3EEB7MV3B")
camera = Camera(
name="camera",
position=Position(0.0, 238.0, 1300.0),
target=Target(0.0, 1938.0, 1300.0),
fov=80.0,
clarity=1,
)
scene.add(camera)
camera.set_world_pose(
position=Position(0.0, 238.0, 1600.0),
target=Target(0.0, 1938.0, 1300.0),
)
submitted = world.render(camera)
print(submitted.task_id)
final = world.poll_render_result(
submitted.task_id,
interval=3.0,
max_attempts=20000,
)
print(final.status)
print(final.image_urls)
finally:
simulation_app.close()
The SDK calls:
GET /qh-sensor-simulation/api/c/scene/models?designId=...POST /qh-sensor-simulation/api/c/camera/renderGET /qh-sensor-simulation/api/c/camera/render/result?rootTaskId=...
user_id is sent as the required x-qh-id header. design_id is sent as designId in query/body.
Demos
Run the simple flow from an installed package:
python sdk\examples\basic_http_flow.py
Run the debug flow, which loads a scene, submits two camera poses, polls until the render result is ready, and prints task/result fields:
python sdk\examples\debug_http_render_flow.py
Override demo inputs with environment variables:
$env:QHSIM_USER_ID="3FO4KV8SHSLV"
$env:QHSIM_DESIGN_ID="3FO3EEB7MV3B"
$env:QHSIM_SNAPSHOT_TYPE_ID="720"
$env:QHSIM_POLL_INTERVAL="3"
$env:QHSIM_POLL_ATTEMPTS="20000"
python sdk\examples\debug_http_render_flow.py
Run the concurrent render pressure demo:
$env:QHSIM_TASKS="50"
$env:QHSIM_TIMEOUT_SECONDS="1800"
$env:QHSIM_OUTPUT="sdk\examples\concurrent_http_render_results.json"
python sdk\examples\concurrent_http_render_flow.py
The concurrent demo writes a JSON summary containing task IDs, camera poses, final status, result readiness, image URLs, COS keys, errors, poll attempts, and durations.
If you run examples directly from a checkout without editable install, set PYTHONPATH first:
$env:PYTHONPATH="D:\fengguo\Agent\repo\simulation-carema\sdk"
python sdk\examples\debug_http_render_flow.py
Public API
qhsim
SimulationApp: SDK runtime entrypoint.update()close()is_running()
qhsim.core
Worldload_scene(design_id)render(camera=None)get_render_result(task_id)poll_render_result(task_id, interval=3.0, max_attempts=20000, print_progress=True, require_result=True)
Sceneadd(obj)get_objects()get_object(object_id=None, object_name=None)
ModelDataPositionTargetBoundingBoxRenderData
qhsim.sensors
Cameraset_world_pose(position, target)get_world_pose()get_history_pose()get_history_pos_json()to_render_history()
qhsim.backends
HttpBackendload_scene(design_id)render(design_id, camera_history, camera_name)get_render_result(root_task_id)
DEFAULT_BASE_URLDEFAULT_SERVICE_BASE_PREFIXDEFAULT_SNAPSHOT_TYPE_ID
To swap the transport in tests, pass a backend object with load_scene(), render(), and get_render_result():
simulation_app = SimulationApp(config={"backend": custom_backend})
Publish
The package version is defined in sdk/pyproject.toml.
Set a PyPI API token in the current shell, then run the upload script:
$env:TWINE_PASSWORD="pypi-..."
python sdk\upload_latest.py
The script builds the current version, runs twine check, and uploads only the current version's wheel and source distribution.
Metadata
Release files for qhsim 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| qhsim-0.1.2.tar.gz | 13.6 kB | Without provenance | Details for qhsim-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| qhsim-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for qhsim-0.1.2-py3-none-any.whl |
Total release size: 25.1 kB
Release files / qhsim-0.1.2.tar.gz
| Download URL | qhsim-0.1.2.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c156693f4b0f7cf04b7ae9d598eef842d703b3090511efd57f1d30ca785596d
|
|
BLAKE2b-256 checksum How to use checksums |
385650f87fdf920757269968ebc73771570a5f35d0e2d687c78881111cf66430
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / qhsim-0.1.2-py3-none-any.whl
| Download URL | qhsim-0.1.2-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4fe276d607d0ace2891f4058bb613bbff09a2af85fe149a5534c0038997a0937
|
|
BLAKE2b-256 checksum How to use checksums |
2c87ac18527736beca2ebf6a8f78dad7159fd4db35c2dca071231520a48008b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for qhsim 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.