semvec/pypi-packages huggingface dataset:
ros2-ndarray-msg-utils 0.2.0
A ROS2 package for transmitting NumPy ndarrays between ROS2 nodes.
Requires Python: >=3.10
Keywords: AI, ML, Machine Learning, Message, Numpy, PyTorch, ROS, ROS2, Torch

[![ROS2 Humble](https://img.shields.io/badge/ROS2-Humble-blue.svg)](https://docs.ros.org/en/humble/index.html)
[![ROS2 Jazzy](https://img.shields.io/badge/ROS2-Jazzy-blue.svg)](https://docs.ros.org/en/jazzy/index.html)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Document Style](https://img.shields.io/badge/%20docstyle-google-3666d6.svg)](https://google.github.io/styleguide/pyguide.html#s3.8-comments-and-docstrings)
[![Lint & Format / Test](https://github.com/Geson-anko/numpy_ndarray_msgs/actions/workflows/main.yml/badge.svg)](https://github.com/Geson-anko/numpy_ndarray_msgs/actions/workflows/main.yml)

# ROS2 NDArray Message

A ROS2 package for transmitting NumPy ndarrays between ROS2 nodes.

## Features

- Custom ROS2 message type for numpy.ndarray
- Bi-directional conversion between NumPy arrays and ROS2 messages
- Multi-dimensional array support with various data types
- Type-safe Python utilities with full type hints

## Requirements

- ROS2 Humble or higher
- Python 3.10+

## Installation

```bash
cd ~/ros2_ws/src
git clone https://github.com/Geson-anko/numpy_ndarray_msgs.git
cd ../
colcon build --packages-select numpy_ndarray_msgs
source install/setup.sh
```

### Install Python Utility Package

```bash
pip install ros2-ndarray-msg-utils
```

## Usage

### Python Utility Package

```python
import numpy as np
from ndarray_msg_utils import to_ros_msg, from_ros_msg, NDArray
from rclpy.clock import ROSClock

# Convert NumPy array to ROS2 message
array = np.array([[1, 2], [3, 4]], dtype=np.float32)

# Type Hint
msg: NDArray

msg = to_ros_msg(array)

# with Header
msg = to_ros_msg(array, timestamp=ROSClock().now(), frame_id="array_frame")

# Convert back to NumPy array
restored = from_ros_msg(msg)
```

### PyTorch Support

```bash
pip install "ros2-ndarray-msg-utils[torch]"
```

```py
import torch
from ndarray_msg_utils.torch import to_ros_msg, from_ros_msg

# Convert PyTorch tensor to ROS2 message
tensor = torch.tensor([[1, 2], [3, 4]], dtype=torch.float32)
msg = to_ros_msg(tensor)

# Convert back to PyTorch tensor
restored = from_ros_msg(msg)
```

## License

MIT License
ressetter 0.1.1.post1
Auto-set resolution and refresh rate on Windows
Requires Python: <3.14,>=3.12

# ResSetter

Simple utility to force a display resolution and refresh rate on Windows.

Originally created because my 120 Hz TV is stupid and would reset back to 60 Hz every time you turned it off. You can run this script and it'll do what it says on the tin: set the resolution and refresh rate to what you want.

You can use command line arguments to set a custom resolution or refresh rate:

- `--width` and `--height` for resolution
- `--refresh` for refresh rate

A cooler way to use it if you're suffering from a problem like mine is to use the `--background` argument, which will leave the script running and monitor for input (key presses or mouse movement). After a period of inactivity, when it detects input, it triggers the resolution and refresh rate change.

I couldn't get anything to reliably detect when the TV turned on or off, so instead I came up with this idea of resetting the resolution as soon as you (presumably) sit back down at the computer and wake it up. I've been using it for months and it's been rock solid.

You can also use arguments to specify the waiting period:
- `--timeout` sets the length of inactivity before new input will trigger a reset (in seconds)
- `--set-delay` will set the number of seconds after activity is detected before the reset will trigger

It will retry if it's unable to set the resolution at first:
- `--retry-delay` will set how long to wait before another retry (in seconds)
- `--max-retries` will set the max number of retries before it gives up

## Running the Script

```bash
pip install ressetter  # to install
ressetter  # to immediately set the resolution
ressetter --background  # to run the script in background mode
```

## Compiling the Script

If you want to turn the script into an EXE to run it more easily (e.g. on startup), you can do that with `pyinstaller` and the included spec file:

```bash
pyinstaller --noconfirm --clean --distpath=dist --workpath=build ressetter.spec
```

Then just take the compiled EXE, stick it somewhere accessible, and create a shortcut to it in your Start menu's Startup folder.

**Pro tip:** You can also set a shortcut key for it to something like `Ctrl+Alt+Shift+R` in Properties so you can invoke it without having to find and open it.