@aigentic/agentic-robotics 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +337 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
# agentic-robotics-node
|
|
2
|
+
|
|
3
|
+
[](https://crates.io/crates/agentic-robotics-node)
|
|
4
|
+
[](https://docs.rs/agentic-robotics-node)
|
|
5
|
+
[](../../LICENSE)
|
|
6
|
+
[](https://www.npmjs.com/package/agentic-robotics)
|
|
7
|
+
|
|
8
|
+
**Node.js/TypeScript bindings for Agentic Robotics**
|
|
9
|
+
|
|
10
|
+
Part of the [Agentic Robotics](https://github.com/ruvnet/vibecast) framework - high-performance robotics middleware with ROS2 compatibility.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- ๐ **TypeScript Support**: Full type definitions included
|
|
15
|
+
- โก **Native Performance**: Rust-powered via NAPI
|
|
16
|
+
- ๐ **Async/Await**: Modern JavaScript async patterns
|
|
17
|
+
- ๐ก **Pub/Sub**: ROS2-compatible topic messaging
|
|
18
|
+
- ๐ฏ **Type-Safe**: Compile-time type checking in TypeScript
|
|
19
|
+
- ๐ **High Performance**: 540ns serialization, 30ns messaging
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install agentic-robotics
|
|
25
|
+
# or
|
|
26
|
+
yarn add agentic-robotics
|
|
27
|
+
# or
|
|
28
|
+
pnpm add agentic-robotics
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
### TypeScript
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import { Node, Publisher, Subscriber } from 'agentic-robotics';
|
|
37
|
+
|
|
38
|
+
// Create a node
|
|
39
|
+
const node = new Node('robot_node');
|
|
40
|
+
|
|
41
|
+
// Create publisher
|
|
42
|
+
const pubStatus = node.createPublisher<string>('/status');
|
|
43
|
+
|
|
44
|
+
// Create subscriber
|
|
45
|
+
const subCommands = node.createSubscriber<string>('/commands');
|
|
46
|
+
|
|
47
|
+
// Publish messages
|
|
48
|
+
pubStatus.publish('Robot initialized');
|
|
49
|
+
|
|
50
|
+
// Subscribe to messages
|
|
51
|
+
subCommands.onMessage((msg) => {
|
|
52
|
+
console.log('Received command:', msg);
|
|
53
|
+
});
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### JavaScript
|
|
57
|
+
|
|
58
|
+
```javascript
|
|
59
|
+
const { Node } = require('agentic-robotics');
|
|
60
|
+
|
|
61
|
+
const node = new Node('robot_node');
|
|
62
|
+
|
|
63
|
+
const pubStatus = node.createPublisher('/status');
|
|
64
|
+
pubStatus.publish('Robot active');
|
|
65
|
+
|
|
66
|
+
const subSensor = node.createSubscriber('/sensor');
|
|
67
|
+
subSensor.onMessage((data) => {
|
|
68
|
+
console.log('Sensor data:', data);
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Examples
|
|
73
|
+
|
|
74
|
+
### Autonomous Navigator
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { Node } from 'agentic-robotics';
|
|
78
|
+
|
|
79
|
+
interface Pose {
|
|
80
|
+
x: number;
|
|
81
|
+
y: number;
|
|
82
|
+
theta: number;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
interface Velocity {
|
|
86
|
+
linear: number;
|
|
87
|
+
angular: number;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const node = new Node('navigator');
|
|
91
|
+
|
|
92
|
+
// Subscribe to current pose
|
|
93
|
+
const subPose = node.createSubscriber<Pose>('/robot/pose');
|
|
94
|
+
|
|
95
|
+
// Publish velocity commands
|
|
96
|
+
const pubCmd = node.createPublisher<Velocity>('/cmd_vel');
|
|
97
|
+
|
|
98
|
+
// Navigation logic
|
|
99
|
+
subPose.onMessage((pose) => {
|
|
100
|
+
const target = { x: 10, y: 10 };
|
|
101
|
+
const cmd = computeVelocity(pose, target);
|
|
102
|
+
pubCmd.publish(cmd);
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
function computeVelocity(current: Pose, target: { x: number; y: number }): Velocity {
|
|
106
|
+
const dx = target.x - current.x;
|
|
107
|
+
const dy = target.y - current.y;
|
|
108
|
+
const distance = Math.sqrt(dx * dx + dy * dy);
|
|
109
|
+
const targetAngle = Math.atan2(dy, dx);
|
|
110
|
+
const angleError = targetAngle - current.theta;
|
|
111
|
+
|
|
112
|
+
return {
|
|
113
|
+
linear: Math.min(distance * 0.5, 1.0),
|
|
114
|
+
angular: angleError * 2.0,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Vision Processing
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { Node } from 'agentic-robotics';
|
|
123
|
+
|
|
124
|
+
interface Image {
|
|
125
|
+
width: number;
|
|
126
|
+
height: number;
|
|
127
|
+
data: Uint8Array;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
interface Detection {
|
|
131
|
+
label: string;
|
|
132
|
+
confidence: number;
|
|
133
|
+
bbox: { x: number; y: number; w: number; h: number };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const node = new Node('vision_node');
|
|
137
|
+
|
|
138
|
+
const subImage = node.createSubscriber<Image>('/camera/image');
|
|
139
|
+
const pubDetections = node.createPublisher<Detection[]>('/detections');
|
|
140
|
+
|
|
141
|
+
subImage.onMessage(async (image) => {
|
|
142
|
+
const detections = await detectObjects(image);
|
|
143
|
+
pubDetections.publish(detections);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
async function detectObjects(image: Image): Promise<Detection[]> {
|
|
147
|
+
// Your ML inference here
|
|
148
|
+
return [
|
|
149
|
+
{ label: 'person', confidence: 0.95, bbox: { x: 100, y: 100, w: 50, h: 100 } },
|
|
150
|
+
];
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Multi-Robot Coordination
|
|
155
|
+
|
|
156
|
+
```typescript
|
|
157
|
+
import { Node } from 'agentic-robotics';
|
|
158
|
+
|
|
159
|
+
class RobotAgent {
|
|
160
|
+
private node: Node;
|
|
161
|
+
private id: string;
|
|
162
|
+
|
|
163
|
+
constructor(id: string) {
|
|
164
|
+
this.id = id;
|
|
165
|
+
this.node = new Node(`robot_${id}`);
|
|
166
|
+
|
|
167
|
+
// Subscribe to team status
|
|
168
|
+
const subTeam = this.node.createSubscriber<TeamStatus>('/team/status');
|
|
169
|
+
subTeam.onMessage((status) => this.onTeamUpdate(status));
|
|
170
|
+
|
|
171
|
+
// Publish own status
|
|
172
|
+
const pubStatus = this.node.createPublisher<RobotStatus>(`/robot/${id}/status`);
|
|
173
|
+
setInterval(() => {
|
|
174
|
+
pubStatus.publish({
|
|
175
|
+
id: this.id,
|
|
176
|
+
position: this.getPosition(),
|
|
177
|
+
battery: this.getBatteryLevel(),
|
|
178
|
+
});
|
|
179
|
+
}, 100);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
private onTeamUpdate(status: TeamStatus) {
|
|
183
|
+
console.log(`Robot ${this.id} received team update:`, status);
|
|
184
|
+
// Coordinate with other robots
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
private getPosition() {
|
|
188
|
+
return { x: 0, y: 0, z: 0 };
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
private getBatteryLevel() {
|
|
192
|
+
return 95;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Create robot swarm
|
|
197
|
+
const robots = [
|
|
198
|
+
new RobotAgent('scout_1'),
|
|
199
|
+
new RobotAgent('scout_2'),
|
|
200
|
+
new RobotAgent('worker_1'),
|
|
201
|
+
];
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## API Reference
|
|
205
|
+
|
|
206
|
+
### Node
|
|
207
|
+
|
|
208
|
+
```typescript
|
|
209
|
+
class Node {
|
|
210
|
+
constructor(name: string);
|
|
211
|
+
|
|
212
|
+
createPublisher<T>(topic: string): Publisher<T>;
|
|
213
|
+
createSubscriber<T>(topic: string): Subscriber<T>;
|
|
214
|
+
|
|
215
|
+
shutdown(): void;
|
|
216
|
+
}
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Publisher
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
class Publisher<T> {
|
|
223
|
+
publish(message: T): Promise<void>;
|
|
224
|
+
getTopic(): string;
|
|
225
|
+
}
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Subscriber
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
class Subscriber<T> {
|
|
232
|
+
onMessage(callback: (message: T) => void): void;
|
|
233
|
+
getTopic(): string;
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Performance
|
|
238
|
+
|
|
239
|
+
The Node.js bindings maintain near-native performance:
|
|
240
|
+
|
|
241
|
+
| Operation | Node.js | Rust Native | Overhead |
|
|
242
|
+
|-----------|---------|-------------|----------|
|
|
243
|
+
| **Publish** | 850 ns | 540 ns | 57% |
|
|
244
|
+
| **Subscribe** | 120 ns | 30 ns | 4x |
|
|
245
|
+
| **Serialization** | 1.2 ยตs | 540 ns | 2.2x |
|
|
246
|
+
|
|
247
|
+
Still significantly faster than traditional ROS2 Node.js bindings!
|
|
248
|
+
|
|
249
|
+
## Building from Source
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
# Clone repository
|
|
253
|
+
git clone https://github.com/ruvnet/vibecast
|
|
254
|
+
cd vibecast
|
|
255
|
+
|
|
256
|
+
# Build Node.js addon
|
|
257
|
+
npm install
|
|
258
|
+
npm run build:node
|
|
259
|
+
|
|
260
|
+
# Run tests
|
|
261
|
+
npm test
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## TypeScript Configuration
|
|
265
|
+
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"compilerOptions": {
|
|
269
|
+
"target": "ES2020",
|
|
270
|
+
"module": "commonjs",
|
|
271
|
+
"strict": true,
|
|
272
|
+
"esModuleInterop": true
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Examples
|
|
278
|
+
|
|
279
|
+
See the [examples directory](../../examples) for complete working examples:
|
|
280
|
+
|
|
281
|
+
- `01-hello-robot.ts` - Basic pub/sub
|
|
282
|
+
- `02-autonomous-navigator.ts` - A* pathfinding
|
|
283
|
+
- `06-vision-tracking.ts` - Object tracking with Kalman filters
|
|
284
|
+
- `08-adaptive-learning.ts` - Experience-based learning
|
|
285
|
+
|
|
286
|
+
Run any example:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
npm run build:ts
|
|
290
|
+
node examples/01-hello-robot.ts
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## ROS2 Compatibility
|
|
294
|
+
|
|
295
|
+
The Node.js bindings are fully compatible with ROS2:
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
// Publish to ROS2 topic
|
|
299
|
+
const pubCmd = node.createPublisher<Twist>('/cmd_vel');
|
|
300
|
+
pubCmd.publish({
|
|
301
|
+
linear: { x: 0.5, y: 0, z: 0 },
|
|
302
|
+
angular: { x: 0, y: 0, z: 0.1 },
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
// Subscribe from ROS2 topic
|
|
306
|
+
const subPose = node.createSubscriber<PoseStamped>('/robot/pose');
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
Bridge with ROS2:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
# Terminal 1: Node.js app
|
|
313
|
+
node my-robot.js
|
|
314
|
+
|
|
315
|
+
# Terminal 2: ROS2
|
|
316
|
+
ros2 topic echo /cmd_vel
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## License
|
|
320
|
+
|
|
321
|
+
Licensed under either of:
|
|
322
|
+
|
|
323
|
+
- Apache License, Version 2.0 ([LICENSE-APACHE](../../LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
|
324
|
+
- MIT License ([LICENSE-MIT](../../LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
|
325
|
+
|
|
326
|
+
at your option.
|
|
327
|
+
|
|
328
|
+
## Links
|
|
329
|
+
|
|
330
|
+
- **Homepage**: [ruv.io](https://ruv.io)
|
|
331
|
+
- **Documentation**: [docs.rs/agentic-robotics-node](https://docs.rs/agentic-robotics-node)
|
|
332
|
+
- **npm Package**: [npmjs.com/package/agentic-robotics](https://www.npmjs.com/package/agentic-robotics)
|
|
333
|
+
- **Repository**: [github.com/ruvnet/vibecast](https://github.com/ruvnet/vibecast)
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
**Part of the Agentic Robotics framework** โข Built with โค๏ธ by the Agentic Robotics Team
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aigentic/agentic-robotics",
|
|
3
|
+
"version": "0.1.3",
|
|
4
|
+
"description": "High-performance agentic robotics framework with ROS2 compatibility - Node.js bindings",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"types": "index.d.ts",
|
|
7
|
+
"napi": {
|
|
8
|
+
"name": "agentic-robotics-node",
|
|
9
|
+
"triples": {
|
|
10
|
+
"defaults": true,
|
|
11
|
+
"additional": [
|
|
12
|
+
"x86_64-unknown-linux-gnu",
|
|
13
|
+
"aarch64-unknown-linux-gnu",
|
|
14
|
+
"x86_64-apple-darwin",
|
|
15
|
+
"aarch64-apple-darwin"
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/ruvnet/vibecast.git",
|
|
22
|
+
"directory": "crates/agentic-robotics-node"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://ruv.io",
|
|
25
|
+
"license": "MIT OR Apache-2.0",
|
|
26
|
+
"keywords": [
|
|
27
|
+
"robotics",
|
|
28
|
+
"ros",
|
|
29
|
+
"ros2",
|
|
30
|
+
"middleware",
|
|
31
|
+
"agents",
|
|
32
|
+
"napi-rs",
|
|
33
|
+
"rust",
|
|
34
|
+
"native"
|
|
35
|
+
],
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">= 14"
|
|
38
|
+
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"registry": "https://registry.npmjs.org/",
|
|
41
|
+
"access": "public"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "cargo build --release",
|
|
45
|
+
"test": "node test.js"
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"index.js",
|
|
49
|
+
"index.d.ts",
|
|
50
|
+
"agentic-robotics.*.node",
|
|
51
|
+
"README.md"
|
|
52
|
+
]
|
|
53
|
+
}
|