Name | hipnuc-usb-apiserver JSON |
Version |
0.0.2
JSON |
| download |
home_page | |
Summary | Driver for Arizona USB Pressure Sensor |
upload_time | 2023-02-11 12:41:24 |
maintainer | |
docs_url | None |
author | davidliyutong |
requires_python | >=3.7 |
license | |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# HIPNUC USB APIServer
![Upload Python Package](https://github.com/mvig-robotflow/arizon_usb_apiserver/workflows/Upload%20Python%20Package/badge.svg)
[![Pypi](https://img.shields.io/pypi/v/arizon_usb_apiserver.svg)](https://pypi.org/project/arizon_usb_apiserver/)
## Installation
Clone & `cd` into this repository then:
```shell
python setup.py install
```
Or download from PyPI:
```shell
python -m pip install hipnuc-usb-apiserver
```
## Get Started
To generate configuration from command line interaction run:
```shell
python -m hipnuc_usb_apiserver configure
```
To launch the apiserver, run:
```shell
python -m hipnuc_usb_apiserver apiserver
```
To use the gRPC api on `localhost:8080`, use this snippet:
```python
import grpc
import hipnuc_usb_apiserver.grpc.imu_packet_pb2 as imu_packet_pb2
import hipnuc_usb_apiserver.grpc.imu_packet_pb2_grpc as imu_packet_pb2_grpc
import time
import tqdm
def run():
channel = grpc.insecure_channel('localhost:8080')
stub = imu_packet_pb2_grpc.IMUPacketServiceStub(channel)
response = stub.SetStatus(imu_packet_pb2.IMUSetStatusRequest(
status=True))
print("SetStatus client received: " + str(response))
response = stub.GetPacket(imu_packet_pb2.IMUPacketRequest(
timestamp=time.time_ns()))
print("GetPacket client received: " + str(response))
response = stub.GetPacketArray(
imu_packet_pb2.IMUPacketArrayRequest(timestamp=time.time_ns()))
print("GetPacketArray client received: " + str(response))
response = stub.GetPacketStream(
imu_packet_pb2.IMUPacketRequest(timestamp=time.time_ns()))
print("GetPacketStream client received: " + str(response))
try:
with tqdm.tqdm() as pbar:
while True:
# time.sleep(0.0005)
data = next(response)
pbar.set_description(str(data.yaw) + ' - ' + str(data.index))
pbar.update(1)
# print)
except KeyboardInterrupt as e:
response.cancel()
response = stub.SetStatus(imu_packet_pb2.IMUSetStatusRequest(
status=False))
print("SetStatus client received: " + str(response))
if __name__ == '__main__':
run()
```
> for custom port configuration, change the `localhost:8080`
## Developping
For developping purpose, read this section.
### Build gRPC
To update gRPC defs, run:
```shell
cd hipnuc_usb_apiserver/grpc
python -m grpc_tools.protoc -I../../manifests/protos --python_out=. --pyi_out=. --grpc_python_out=. ../../manifests/protos/imu_packet.proto
```
Raw data
{
"_id": null,
"home_page": "",
"name": "hipnuc-usb-apiserver",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "davidliyutong",
"author_email": "davidliyutong@sjtu.edu.cn",
"download_url": "https://files.pythonhosted.org/packages/3a/32/8704637e0a9fbe597491f4437fc8e8123ef805ac6c9d01d97ae04171b4ba/hipnuc-usb-apiserver-0.0.2.tar.gz",
"platform": null,
"description": "# HIPNUC USB APIServer\n\n![Upload Python Package](https://github.com/mvig-robotflow/arizon_usb_apiserver/workflows/Upload%20Python%20Package/badge.svg)\n[![Pypi](https://img.shields.io/pypi/v/arizon_usb_apiserver.svg)](https://pypi.org/project/arizon_usb_apiserver/)\n\n## Installation\n\nClone & `cd` into this repository then:\n\n```shell\npython setup.py install\n```\n\nOr download from PyPI:\n\n```shell\npython -m pip install hipnuc-usb-apiserver\n```\n\n## Get Started\n\nTo generate configuration from command line interaction run:\n\n```shell\npython -m hipnuc_usb_apiserver configure\n```\n\nTo launch the apiserver, run:\n\n```shell\npython -m hipnuc_usb_apiserver apiserver\n```\n\nTo use the gRPC api on `localhost:8080`, use this snippet:\n\n```python\nimport grpc\nimport hipnuc_usb_apiserver.grpc.imu_packet_pb2 as imu_packet_pb2\nimport hipnuc_usb_apiserver.grpc.imu_packet_pb2_grpc as imu_packet_pb2_grpc\nimport time\nimport tqdm\n\ndef run():\n channel = grpc.insecure_channel('localhost:8080')\n stub = imu_packet_pb2_grpc.IMUPacketServiceStub(channel)\n \n response = stub.SetStatus(imu_packet_pb2.IMUSetStatusRequest(\n status=True))\n print(\"SetStatus client received: \" + str(response))\n \n response = stub.GetPacket(imu_packet_pb2.IMUPacketRequest(\n timestamp=time.time_ns()))\n print(\"GetPacket client received: \" + str(response))\n\n response = stub.GetPacketArray(\n imu_packet_pb2.IMUPacketArrayRequest(timestamp=time.time_ns()))\n print(\"GetPacketArray client received: \" + str(response))\n\n response = stub.GetPacketStream(\n imu_packet_pb2.IMUPacketRequest(timestamp=time.time_ns()))\n print(\"GetPacketStream client received: \" + str(response))\n\n try:\n with tqdm.tqdm() as pbar:\n while True:\n # time.sleep(0.0005)\n data = next(response)\n pbar.set_description(str(data.yaw) + ' - ' + str(data.index))\n pbar.update(1)\n # print)\n except KeyboardInterrupt as e:\n response.cancel()\n \n response = stub.SetStatus(imu_packet_pb2.IMUSetStatusRequest(\n status=False))\n print(\"SetStatus client received: \" + str(response))\n\n\nif __name__ == '__main__':\n run()\n```\n\n> for custom port configuration, change the `localhost:8080`\n\n## Developping\n\nFor developping purpose, read this section.\n\n### Build gRPC\n\nTo update gRPC defs, run:\n\n```shell\ncd hipnuc_usb_apiserver/grpc\npython -m grpc_tools.protoc -I../../manifests/protos --python_out=. --pyi_out=. --grpc_python_out=. ../../manifests/protos/imu_packet.proto\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Driver for Arizona USB Pressure Sensor",
"version": "0.0.2",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "3fc1bf2238e89d7fe6035450d4e0644db061270aec7baf7709843ea8d3bcca28",
"md5": "33ab4357618f418aa6e1db209ca0a027",
"sha256": "fb4e058525c11c283e00f80995dc7a18de47aa8710f115e0cb2949ddf9c9ea0f"
},
"downloads": -1,
"filename": "hipnuc_usb_apiserver-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "33ab4357618f418aa6e1db209ca0a027",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 18262,
"upload_time": "2023-02-11T12:41:22",
"upload_time_iso_8601": "2023-02-11T12:41:22.549437Z",
"url": "https://files.pythonhosted.org/packages/3f/c1/bf2238e89d7fe6035450d4e0644db061270aec7baf7709843ea8d3bcca28/hipnuc_usb_apiserver-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3a328704637e0a9fbe597491f4437fc8e8123ef805ac6c9d01d97ae04171b4ba",
"md5": "4714f9dfadbe0aad2bda7fe9cc918116",
"sha256": "60d49d9d0bdc9aa438fb6d7afb9d327565a5a184aa5fbdcfe3994d359aaecff3"
},
"downloads": -1,
"filename": "hipnuc-usb-apiserver-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "4714f9dfadbe0aad2bda7fe9cc918116",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 15476,
"upload_time": "2023-02-11T12:41:24",
"upload_time_iso_8601": "2023-02-11T12:41:24.152339Z",
"url": "https://files.pythonhosted.org/packages/3a/32/8704637e0a9fbe597491f4437fc8e8123ef805ac6c9d01d97ae04171b4ba/hipnuc-usb-apiserver-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-11 12:41:24",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "hipnuc-usb-apiserver"
}