A generic ROS2 subscriber for numbers, strings, images, and video.
Project description
aksub
=====
A generic ROS2 subscriber that can receive numbers, strings, images, or video frames with minimal setup.
Installation
------------
First, make sure you have a working ROS2 environment with `rclpy` and `cv_bridge` installed.
Then clone this repository and install:
git clone https://github.com/yourname/aksub.git
cd aksub
pip install .
Usage
-----
Example Python usage:
import aksub
aksub.metadata(
mode=None, # Auto-detect from datatype
datatype="Float64", # e.g., "String", "Int32", "Image"
node_name="num_subscriber",
topic_name="number",
queue=10,
delay=1.0
)
print("Received value:", aksub.received_value)
Supported Datatypes
-------------------
- String (std_msgs.msg.String)
- Int32 (std_msgs.msg.Int32)
- Float32 (std_msgs.msg.Float32)
- Float64 (std_msgs.msg.Float64)
- Bool (std_msgs.msg.Bool)
- Image (sensor_msgs.msg.Image)
Accessing Received Data
-----------------------
- For String, Int, Float, Bool: `aksub.received_value` will be a Python primitive (str, int, float, bool).
- For Image/Video: `aksub.received_value` will be an OpenCV BGR image (numpy array).
Example for image:
import cv2
frame = aksub.received_value
if frame is not None:
cv2.imshow("Received Image", frame)
cv2.waitKey(0)
Example for video stream:
import cv2
while True:
frame = aksub.received_value
if frame is not None:
cv2.imshow("Video", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
cv2.destroyAllWindows()
Notes
-----
- `mode` can be "number", "string", "image", "video", or None for auto-detect.
- You can change `node_name`, `queue`, and `delay` in `metadata()`.
- `delay` can be used to control the processing interval.
- Requires `rclpy` and `cv_bridge` to be installed in your ROS2 Python environment.
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
aksub-0.1.1.tar.gz
(3.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
aksub-0.1.1-py3-none-any.whl
(3.7 kB
view details)
File details
Details for the file aksub-0.1.1.tar.gz.
File metadata
- Download URL: aksub-0.1.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3089473b6d445a849c0eaddba038550ef15009ab2e740c2b5cf6dc5ada55c5f7
|
|
| MD5 |
c9fbab877108b457e63a8781199ca833
|
|
| BLAKE2b-256 |
2c2fce218dc925f87300cfb6194f55fbfbf22b043fb5daccd06337362ee3dc51
|
File details
Details for the file aksub-0.1.1-py3-none-any.whl.
File metadata
- Download URL: aksub-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df481a5629861820282db2999dfc89a419d2764509ee8132a5760143eae5bbe9
|
|
| MD5 |
25a8ed75d0ceee3390f8113522e8edb3
|
|
| BLAKE2b-256 |
fd5dddfb9568e71cf3013ada23f0439330906c46acb0338aee73797f796820ab
|