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.3.0.tar.gz
(16.3 kB
view hashes)
Built Distribution
Close
Hashes for hipnuc-usb-apiserver-0.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 679963409bf42548ab91189537d2c994ea7cbee72aebc6eb28f011266170c3eb |
|
MD5 | 0d9108775fafb90e5b6d616e79bc26b2 |
|
BLAKE2b-256 | 6d9db3699bf9c92d522a09dbc8abece6a34e5d2eae3dc1e333ed16e2fa8b63a6 |
Close
Hashes for hipnuc_usb_apiserver-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9ecf973cd6722929e907e1843d38382b4919843992e4308c016b1c909dfd458 |
|
MD5 | 2d39c678202fe2425b7b853653548c27 |
|
BLAKE2b-256 | f8ae2bb695a424ce8792d9f4015803b6c1292ff4f25022d5b040a81cef8cf559 |