Driver for Arizona USB Pressure Sensor
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hipnuc-usb-apiserver-0.0.2.tar.gz
(15.5 kB
view hashes)
Built Distribution
Close
Hashes for hipnuc-usb-apiserver-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60d49d9d0bdc9aa438fb6d7afb9d327565a5a184aa5fbdcfe3994d359aaecff3 |
|
MD5 | 4714f9dfadbe0aad2bda7fe9cc918116 |
|
BLAKE2b-256 | 3a328704637e0a9fbe597491f4437fc8e8123ef805ac6c9d01d97ae04171b4ba |
Close
Hashes for hipnuc_usb_apiserver-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb4e058525c11c283e00f80995dc7a18de47aa8710f115e0cb2949ddf9c9ea0f |
|
MD5 | 33ab4357618f418aa6e1db209ca0a027 |
|
BLAKE2b-256 | 3fc1bf2238e89d7fe6035450d4e0644db061270aec7baf7709843ea8d3bcca28 |