NOS: Node Orchestration System
A declarative domain-specific language (DSL) for ROS2 robotics development.
Overview
NOS reduces ROS2 boilerplate by 70-80% while maintaining full compatibility with existing ROS2 tooling. It provides:
- Declarative syntax for node, topic, and parameter definitions
- Type-safe interfaces with compile-time validation
- Robust Expression Parsing: Full support for mathematical and logical operators with standard precedence.
- Lifecycle management integrated into the language
- Launch file generation from unified definitions
- Code generation for both Python and C++ (C++ in Phase 2)
Current Progress
For detailed status on implementation, testing, and roadmap, see progress.md.
Why NOS?
| Aspect | Native ROS2 Python | NOS | Reduction |
|---|---|---|---|
| Simple Node | ~60 lines | ~15 lines | 75% |
| Lifecycle Node | ~120 lines | ~25 lines | 79% |
| Launch File | ~80 lines | ~20 lines | 75% |
| Parameters (10 params) | ~50 lines | ~10 lines | 80% |
Requirements
- Python 3.8 or higher
- ROS2 (for runtime usage)
- ANTLR4 Python runtime (installed automatically)
Installation
From Source
-
Clone the repository:
git clone https://github.com/your-org/nos.git cd nos
-
Install in development mode:
pip install -e .
Adding to PATH
To use the nos command from anywhere, ensure your Python script directory is in your system's PATH.
Windows:
- Search for "Edit the system environment variables".
- Click "Environment Variables".
- Under "User variables", find
Pathand click "Edit". - Add the path to your Python Scripts folder (e.g.,
%APPDATA%\Python\Python3x\Scripts).
Linux/macOS:
Add this to your .bashrc or .zshrc:
export PATH="$PATH:/home/user/.local/bin"
Quick Start: Turtlesim Circle
NOS allows you to define, compile, and run ROS2 nodes directly.
1. Create circle.node
package turtlesim_example
version "0.1.0"
depends: ["rclpy", "geometry_msgs"]
node CircleGenerator {
publications {
cmd_vel: geometry_msgs::Twist @topic("/turtle1/cmd_vel")
}
on_init -> {
self.get_logger().info("Starting circular motion...")
# Create a timer to publish at 10Hz
self.create_timer(0.1, self.timer_callback)
}
on timer_callback() -> {
msg = Twist()
msg.linear.x = 2.0
msg.angular.z = 1.0
self.cmd_vel.publish(msg)
}
}
2. Run Directly
You can skip the manual build process and run the node immediately from the source file:
# Start Turtlesim first in another terminal:
# ros2 run turtlesim turtlesim_node
# Compile and run the NOS node instantly
nos circle.node --run
The --run flag automatically handles code generation, temporary workspace setup, and execution.
Project Structure
nos/
├── grammar/ # ANTLR4 generated parser files (auto-generated)
├── ast/ # Abstract Syntax Tree
├── semantic/ # Semantic analysis
├── codegen/ # Code generation
├── runtime/ # Runtime library
├── compiler/ # Compilation pipeline
└── security/ # Security validation
tests/ # Test suite
├── unit/ # Unit tests
└── integration/ # Integration tests
Note: Files in grammar/ are auto-generated by ANTLR4 from grammar definitions. Do not edit them manually.
File Extensions
.nos- System definition files (packages, imports, launch declarations).node- Node component definitions.interface- Message/service/action interface definitions
Key Features
1. Declarative Parameters
parameters {
max_velocity: float = 1.0 @range(0.0, 5.0) @unit("m/s")
enable_filter: bool = true
}
2. Type-Safe Topics
subscriptions {
scan: sensor_msgs::LaserScan @topic("/scan")
}
publications {
processed: sensor_msgs::LaserScan @topic("/processed")
}
3. Launch File Generation
launch NavigationStack {
group sensors @namespace("sensors") {
lidar: LidarDriver { ... }
camera: CameraDriver { ... }
}
}
4. Lifecycle Integration
node MyNode {
lifecycle: managed # Enables lifecycle management
on_init { ... }
on_shutdown { ... }
}
Compilation Pipeline
NOS Source
|
v
+-------------+
| Parse | ANTLR4 lexer/parser
| (ANTLR4) | generates parse tree
+------+------+
|
v
+--------------+
| Build AST | Parse tree converted
| | to typed AST
+------+-------+
|
v
+--------------+
| Analyze | Semantic analysis
| | validates symbols
+------+-------+
|
v
+-------------+
| Generate | Target code generated
| (Python) | for ROS2 nodes
+-------------+
CLI Usage
# Basic compilation
nos input.node -o output_dir/
# With verbose output
nos input.node -v
# Dry run (validate only)
nos input.node --dry-run
# Multiple files
nos file1.node file2.nos -o generated/
# Show version
nos --version
Development
Running Tests
# Run all tests
pytest
# With coverage
pytest --cov=nos --cov-report=term-missing
# Run specific test file
pytest tests/unit/test_ast_builder.py
Code Style
# Format code with black
black nos/ tests/
# Type checking
mypy nos/
# Linting
flake8 nos/ tests/
See CONTRIBUTING.md for detailed contribution guidelines.
Status
Phase 1: Core Language (Complete) ✓
- ANTLR4 grammar definitions
- AST and semantic analyzer
- Python code generator
- Launch file transpiler
- Runtime library
- Security validation
- Callback syntax & custom events (Issue #6)
Phase 2: Extended Features (Planned)
- C++ code generator
- Enhanced IDE support (LSP)
- Visual diagram generation
- Package management tools
See CHANGELOG.md for detailed release information.
Documentation
- Architecture Overview - Detailed design document
- Contributing Guide - Development setup and guidelines
- Changelog - Version history and changes
License
Apache License 2.0 - See LICENSE for details.
Acknowledgments
NOS was inspired by the verbosity challenges in ROS2 development and aims to provide a more ergonomic interface while maintaining full compatibility with the ROS2 ecosystem.
Metadata
Release files for nos 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nos-0.1.7.tar.gz | 111.7 kB | Without provenance | Details for nos-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nos-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for nos-0.1.7-py3-none-any.whl |
Total release size: 233.7 kB
Release files / nos-0.1.7.tar.gz
| Download URL | nos-0.1.7.tar.gz |
|---|---|
| Size | 111.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c7a00be5aecc2c111d6893acee1f7ecbad2acce8c152c81b9a8f73f913a6dad
|
|
BLAKE2b-256 checksum How to use checksums |
7c62997470a5ceba1f025e19e5ee45f8117b442430020f67bcbf622ced2d7f08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Release files / nos-0.1.7-py3-none-any.whl
| Download URL | nos-0.1.7-py3-none-any.whl |
|---|---|
| Size | 122.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f8dd82384262bdf8eb0459fd6af109c08ff4fc26fe35b2d0580992f48b00d14
|
|
BLAKE2b-256 checksum How to use checksums |
c30b8c2656de4f8777e4d4c7a553b336603d64f4e8ad4bb9a0684837f4aad044
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.12
|
Security for nos 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.