129 lines
4.1 KiB
Markdown
129 lines
4.1 KiB
Markdown
# LJnano
|
|
|
|
A lightweight, stripped-down version of LJ specifically designed to run the chain of clitools (generator + filters + exports) for pointlist processing.
|
|
|
|
## Overview
|
|
|
|
LJnano provides a local laser simulator that connects to a browser interface via WebSockets. It's designed to be minimal and focused on running the bundled clitools chain efficiently. LJnano comes with its own set of clitools in the `clitools/` directory, which includes generators, filters, and exporters for processing point lists.
|
|
|
|
## Installation
|
|
|
|
### Requirements
|
|
|
|
LJnano requires the following Python packages:
|
|
|
|
- websocket-client: For WebSocket client functionality
|
|
- websocket-server: For WebSocket server functionality
|
|
- redis: For Redis database interaction
|
|
- pyOSC3: For OSC protocol support (used by some generators)
|
|
|
|
### Quick Install
|
|
|
|
A `requirements.txt` file is provided for easy installation of all dependencies:
|
|
|
|
```bash
|
|
pip3 install -r requirements.txt
|
|
```
|
|
|
|
### Manual Install
|
|
|
|
Alternatively, you can install dependencies individually:
|
|
|
|
```bash
|
|
pip3 install websocket-client websocket-server redis pyOSC3
|
|
```
|
|
|
|
## Usage
|
|
|
|
### Starting the Server
|
|
|
|
```bash
|
|
python3 nano.py
|
|
```
|
|
|
|
Options:
|
|
- `-v, --verbose`: Enable verbose output
|
|
- `-s, --server`: WS server IP (default: 127.0.0.1)
|
|
- `-p, --port`: WS port to bind to (default: 9001)
|
|
- `-k, --key`: Redis key to update
|
|
|
|
### Browser Interface
|
|
|
|
Open `www/simulocal.html` in a browser to view the laser simulation.
|
|
|
|
### Running the Clitools Chain
|
|
|
|
LJnano is designed to work with its bundled clitools chain located in the `clitools/` directory:
|
|
|
|
1. **Generators** (`clitools/generators/`): Create point lists
|
|
2. **Filters** (`clitools/filters/`): Process and modify point lists
|
|
3. **Exporters** (`clitools/exports/`): Output point lists to various formats
|
|
|
|
These tools can be chained together using Unix pipes. For example:
|
|
|
|
```bash
|
|
python3 clitools/generators/dummy.py | python3 clitools/filters/kaleidoscope.py | python3 clitools/exports/tonano.py
|
|
```
|
|
|
|
For detailed chain operations and examples, see `clitools/README.md`
|
|
|
|
### Using LJnano Output in Browser
|
|
|
|
To use LJnano output in a browser, use the `tonano.py` exporter located in `clitools/exports/`:
|
|
|
|
```bash
|
|
# Example usage of tonano.py exporter
|
|
python3 clitools/exports/tonano.py
|
|
```
|
|
|
|
Options for tonano.py:
|
|
- `-v, --verbose`: Enable verbose output
|
|
- `-s, --server`: WS server IP (default: 127.0.0.1)
|
|
- `-p, --port`: WS port to bind to (default: 9001)
|
|
- `-k, --key`: Redis key to update (default: /pl/0/0)
|
|
- `-o, --old`: Use old school 0-800 coordinate space
|
|
|
|
## Architecture
|
|
|
|
LJnano uses WebSockets on port 9001 by default to communicate between the server and the browser interface. The system allows for real-time visualization of laser point lists.
|
|
|
|
## Changelog
|
|
|
|
### v0.1b (Current Version)
|
|
|
|
#### Core Features
|
|
- WebSocket server on port 9001 for real-time communication
|
|
- Browser-based visualization interface (www/simulocal.html)
|
|
- Redis integration for storing and retrieving point lists
|
|
- Support for multiple laser simulations
|
|
- Status indicators for laser state and connections
|
|
|
|
#### Bundled Clitools
|
|
|
|
**Generators** (in `clitools/generators/`):
|
|
- dummy.py: Basic point list generator
|
|
- audio.py: Audio-reactive point generation
|
|
- turtle1.py: Turtle graphics based generator
|
|
- blank.py: Empty template for creating new generators
|
|
- audiogen3.py: Advanced audio-reactive generator
|
|
- Support for NetLogo integration via file-based input
|
|
|
|
**Filters** (in `clitools/filters/`):
|
|
- kaleidoscope.py: Mirrors points based on a pivot
|
|
- anaglyph.py: Creates 3D anaglyph effects
|
|
- colorcycle.py: Cycles through colors for points
|
|
- redilysis.py: Redis-based analysis and modification
|
|
|
|
**Exporters** (in `clitools/exports/`):
|
|
- tonano.py: Sends point lists to LJnano for visualization
|
|
- tonano800.py: Sends point lists in 0-800 coordinate space
|
|
- toRedis.py: Exports point lists to Redis
|
|
- toUDP.py: Sends point lists via UDP
|
|
- toWS.py: Sends point lists via WebSockets
|
|
- toNull.py: Discards point lists (for testing)
|
|
|
|
#### Browser Interface
|
|
- Real-time point list visualization
|
|
- Status indicators for connections
|
|
- Support for multiple laser displays
|
|
- Canvas-based rendering of laser points |