Skip to content

Commit 607e704

Browse files
authored
Add README for typescript demos for indexing (#1276)
This PR adds a comprehensive README file for the TypeScript demos directory, providing documentation for ROS2 communication pattern demonstrations with TypeScript type safety. - Added detailed documentation explaining three demo categories: topics, services, and actions - Included structured overview of TypeScript features and development practices - Created complexity progression table to guide users through learning path Fix: #1275
1 parent 9cd592e commit 607e704

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

ts_demo/README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# TypeScript Demos
2+
3+
This directory contains TypeScript demonstrations showcasing rclnodejs functionality with full type safety and modern development practices. Each demo illustrates core ROS2 communication patterns using TypeScript interfaces and best practices.
4+
5+
## 📂 Available Demos
6+
7+
### 📨 **[topics/](./topics/)** - Publisher/Subscriber Pattern
8+
9+
Basic ROS2 topic communication with TypeScript type safety
10+
11+
- **Publisher**: Sends timestamped string messages at regular intervals
12+
- **Subscriber**: Receives and displays messages with colorful console output
13+
- **Features**: Message counting, error handling, graceful shutdown
14+
15+
### 🔧 **[services/](./services/)** - Request/Response Pattern
16+
17+
Synchronous service calls for immediate responses
18+
19+
- **Service Server**: Provides AddTwoInts service for integer addition
20+
- **Service Client**: Makes requests with random numbers at intervals
21+
- **Features**: Service discovery, request counting, comprehensive error handling
22+
23+
### **[actions/](./actions/)** - Long-Running Task Pattern
24+
25+
Asynchronous actions with progress feedback and cancellation
26+
27+
- **Action Server**: Calculates Fibonacci sequences with progress updates
28+
- **Action Client**: Sends goals, monitors progress, handles results
29+
- **Features**: Goal cancellation, feedback processing, result handling
30+
31+
## 🛠️ TypeScript Features
32+
33+
### Type Safety
34+
35+
- **Full typing** for all ROS2 messages, services, and actions
36+
- **Compile-time validation** of message structures
37+
- **IntelliSense support** in VS Code and other TypeScript editors
38+
39+
### Modern Development
40+
41+
- **ES2020+ syntax** with async/await patterns
42+
- **Modular architecture** with clean separation of concerns
43+
- **Error boundaries** with comprehensive exception handling
44+
- **Graceful shutdown** handling for SIGINT/SIGTERM
45+
46+
### Code Quality
47+
48+
- **Consistent formatting** with prettier/eslint configurations
49+
- **Build validation** with TypeScript strict mode
50+
- **Runtime safety** with proper error handling patterns
51+
52+
## 📊 Complexity Progression
53+
54+
| Demo | Complexity | Communication | Best For |
55+
| ------------ | ----------------- | ------------- | ---------------------- |
56+
| **topics** | ⭐ Basic | Pub/Sub | Learning fundamentals |
57+
| **services** | ⭐⭐ Intermediate | Req/Response | Synchronous operations |
58+
| **actions** | ⭐⭐⭐ Advanced | Goal-oriented | Long-running tasks |
59+
60+
## 🔗 Related Resources
61+
62+
- [rclnodejs Tutorials](../tutorials/) - Comprehensive API documentation
63+
- [Electron Demos](../electron_demo/) - GUI applications with rclnodejs
64+
- [TypeScript Handbook](https://www.typescriptlang.org/docs/) - Language reference
65+
- [ROS2 Documentation](https://docs.ros.org/) - Official ROS2 concepts

0 commit comments

Comments
 (0)