HIPNUC USB APIServer
Installation
Clone & cd into this repository then:
python setup.py install
Or download from PyPI:
python -m pip install hipnuc-usb-apiserver
Get Started
To generate configuration from command line interaction run:
python -m hipnuc_usb_apiserver configure
To launch the apiserver, run:
python -m hipnuc_usb_apiserver apiserver
To use the gRPC api on localhost:8080, use this snippet:
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:
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
Metadata
Release files for hipnuc-usb-apiserver 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hipnuc-usb-apiserver-0.3.0.tar.gz | 16.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hipnuc_usb_apiserver-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.8 kB
Release files / hipnuc-usb-apiserver-0.3.0.tar.gz
| Download URL | hipnuc-usb-apiserver-0.3.0.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
679963409bf42548ab91189537d2c994ea7cbee72aebc6eb28f011266170c3eb
|
|
BLAKE2b-256 checksum How to use checksums |
6d9db3699bf9c92d522a09dbc8abece6a34e5d2eae3dc1e333ed16e2fa8b63a6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / hipnuc_usb_apiserver-0.3.0-py3-none-any.whl
| Download URL | hipnuc_usb_apiserver-0.3.0-py3-none-any.whl |
|---|---|
| Size | 19.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c9ecf973cd6722929e907e1843d38382b4919843992e4308c016b1c909dfd458
|
|
BLAKE2b-256 checksum How to use checksums |
f8ae2bb695a424ce8792d9f4015803b6c1292ff4f25022d5b040a81cef8cf559
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|