Skip to main content

Yivo

Python GitHub

Trying to standardize the way I access sensors.

Python

from yivo import Yivo, MsgInfo

# make some messages we want to send/receive
A = namedtuple("A","x y")      # id = 1
B = namedtuple("B", "x y z t") # id = 2

msgdb = MsgInfo()
msgdb[1] = ("2f", A) # 2 floats
msgdb[2] = ("4f", B) # 4 floats

yivo = Yivo(msgdb)
pkt = yivo.pack(1, A(1.,2.))

id = 0
while id == 0:
    b = serial_read() # get a byte from somewhere
    id = yivo.parse(b) # 0 or msg_id

err, msg = yivo.unpack() # err > 0 if failure to unpack

API

Part In Checksum Type Description
Header uint8_t[2] default $K
Size x uint16_t 0-65,535 bytes, stored as [L,H] => `(H << 8)
Type x uint8_t 255 message IDs, 0 is not allowed as an ID
Data x uint8_t[Size] payload data array
Checksum uint8_t XOR of size, type, and data bytes
0 1 2 3 4 ... -1
$ K L H T ... checksum

gentools

Generate messages for python and C/C++.

Type Bytes Format Python C/C++
uint8 1 B int uint8_t
uint16 2 H int uint16_t
uint32 4 I int uint32_t
uint64 8 Q int uint64_t
int8 1 b int int8_t
int16 2 h int int16_t
int32 4 i int int32_t
int64 8 q int int64_t
float 4 f float float
double 8 d float double
# comment ...
# comment ...

float     a # comment about var
uint8     b
int16[12] c

<enum something uint16_t
bob=0
tom=2
jerry=32
enum>
{
    "namespace": "foobar",
    "license": "MIT Kevin Walchko (c) 2023",
    "output": "test",
    "1": "messages/vec.yivo",
    "2": "messages/quat.yivo",
    "4": "messages/imu.yivo",
    "5": "messages/cal.yivo"
}

MIT License

Copyright (c) 2020 Mom's Friendly Robot Company

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for yivo 2025.8.23.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yivo 2025.8.23.1
File Size Uploaded
yivo-2025.8.23.1.tar.gz 15.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yivo 2025.8.23.1
File Interpreter ABI Platform
yivo-2025.8.23.1-py3-none-any.whl Python 3 none any Details

Total release size: 31.8 kB

Release files / yivo-2025.8.23.1.tar.gz

Download URL yivo-2025.8.23.1.tar.gz
Size 15.0 kB
Tags Source
SHA-256 checksum
How to use checksums
41ae7ec5f30a8ff4da6a40b30e1556395904169979bb902608ac1b2e1cbcdfa8
BLAKE2b-256 checksum
How to use checksums
0732492dba73598995f31d7072f9bf81dd97e837b5305990c9e9944b1084b5b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.13.4 Darwin/24.6.0

Release files / yivo-2025.8.23.1-py3-none-any.whl

Download URL yivo-2025.8.23.1-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d187dd1eb3d4cb254681b3840c4861220e64d815369be081425b42f369402efb
BLAKE2b-256 checksum
How to use checksums
fd3d61a6298591b97b288b033ec417e887d6cf24af82f7d294f62d4320168047
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.1.3 CPython/3.13.4 Darwin/24.6.0

Release history Release notifications | RSS feed

This release

2025.8.23.1 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page