Skip to content

Commit 1b3bd5f

Browse files
committed
Update README.md
1 parent 7e9a162 commit 1b3bd5f

File tree

1 file changed

+17
-69
lines changed

1 file changed

+17
-69
lines changed

README.md

Lines changed: 17 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![deps](https://juliahub.com/docs/General/ROS2/stable/deps.svg)](https://juliahub.com/ui/Packages/General/ROS2?t=2)
55
[![pkgeval](https://juliahub.com/docs/General/ROS2/stable/pkgeval.svg)](https://juliahub.com/ui/Packages/General/ROS2)
66

7-
ROS2.jl is a comprehensive Julia wrapper for ROS2's Python client library (rclpy), providing 99.5% of rclpy's functionality with Julia-friendly interfaces. It enables high-performance robotics development by combining Julia's computational power with ROS2's distributed systems capabilities.
7+
ROS2.jl is a Julia wrapper for ROS2's Python client library (rclpy), enabling robotics development in Julia with ROS2's distributed systems capabilities.
88

99
[日本語のREADMEはこちら](#ros2jl-1)
1010

@@ -31,6 +31,7 @@ ROS2.jl is a comprehensive Julia wrapper for ROS2's Python client library (rclpy
3131

3232
| ROS2.jl Version | ROS2 Version | Julia Version | Python Version |
3333
|----------------|--------------|---------------|----------------|
34+
| 0.2.x | Jazzy | 1.10+ | 3.12 |
3435
| 0.1.x | Jazzy | 1.10+ | 3.12 |
3536

3637
## Features
@@ -43,11 +44,11 @@ ROS2.jl is a comprehensive Julia wrapper for ROS2's Python client library (rclpy
4344
- ROS Time, Duration, Clock
4445
- Time conversions and operations
4546
- **Coordinate Transformations**
46-
- Full TF2 support (Transform Listener/Broadcaster)
47+
- TF2 support (Transform Listener/Broadcaster)
4748
- Static transform broadcasting
4849
- **Dynamic Message System**
49-
- 258+ message types automatically supported
5050
- Runtime message creation and field access
51+
- Message type introspection
5152
- **Advanced Execution**
5253
- Multi-threaded executors
5354
- Custom QoS profiles
@@ -93,27 +94,21 @@ sudo apt install ros-jazzy-rclcpp-components ros-jazzy-composition-demo
9394
```julia
9495
using ROS2
9596

96-
# Initialize ROS2
9797
init()
9898

99-
# Create a node
10099
node = ROSNode("example_node")
101100

102-
# Create a publisher
103101
pub = Publisher(node, "hello", "std_msgs.msg.String")
104102

105-
# Create and publish a message
106103
msg = create_msg("std_msgs.msg.String")
107104
msg.data = "Hello from Julia!"
108105
publish(pub, msg)
109106

110-
# Create a subscriber
111107
function callback(msg)
112108
println("Received: ", msg.data)
113109
end
114110
sub = Subscriber(node, "hello", "std_msgs.msg.String", callback)
115111

116-
# Spin the node
117112
spin(node)
118113
```
119114

@@ -125,7 +120,6 @@ using ROS2
125120
init()
126121
node = ROSNode("service_example")
127122

128-
# Service Server
129123
function add_callback(request, response)
130124
response.sum = request.a + request.b
131125
println("Request: $(request.a) + $(request.b) = $(response.sum)")
@@ -134,7 +128,6 @@ end
134128

135129
server = ServiceServer(node, "add_two_ints", "example_interfaces.srv.AddTwoInts", add_callback)
136130

137-
# Service Client (in another script)
138131
client = ServiceClient(node, "add_two_ints", "example_interfaces.srv.AddTwoInts")
139132

140133
if wait_for_service(client, timeout=5.0)
@@ -157,20 +150,17 @@ using ROS2
157150
init()
158151
node = ROSNode("action_example")
159152

160-
# Action Client
161153
client = ActionClient(node, "fibonacci", "example_interfaces.action.Fibonacci")
162154

163155
goal = create_goal("example_interfaces.action.Fibonacci")
164156
goal.order = 10
165157

166-
# Send goal with feedback callback
167158
function feedback_callback(feedback_msg)
168159
println("Feedback: $(feedback_msg.feedback.partial_sequence)")
169160
end
170161

171162
future = send_goal(client, goal, feedback_callback)
172163

173-
# Wait for result
174164
result = send_goal_sync(client, goal, timeout=10.0)
175165
if result !== nothing
176166
println("Final sequence: $(result.result.sequence)")
@@ -187,14 +177,12 @@ using ROS2
187177
init()
188178
node = ROSNode("tf_example")
189179

190-
# Transform Broadcaster
191180
broadcaster = TransformBroadcaster(node)
192181

193182
transform = create_transform_stamped("map", "base_link", (1.0, 2.0, 0.0), (0.0, 0.0, 0.0, 1.0))
194183
transform.header.stamp = to_msg_time(now())
195184
send_transform(broadcaster, transform)
196185

197-
# Transform Listener
198186
listener = TransformListener(node)
199187

200188
try
@@ -215,11 +203,9 @@ using ROS2
215203
init()
216204
node = ROSNode("dynamic_msg_example")
217205

218-
# Get available message types
219206
available_types = get_available_message_types()
220207
println("Available message types: $(length(available_types))")
221208

222-
# Create messages dynamically
223209
twist_msg = create_msg_dynamic("geometry_msgs.msg.Twist")
224210
twist_msg.linear.x = 1.0
225211
twist_msg.angular.z = 0.5
@@ -229,7 +215,6 @@ pose_msg.header.stamp = to_msg_time(now())
229215
pose_msg.header.frame_id = "map"
230216
pose_msg.pose.position.x = 1.0
231217

232-
# Check message fields
233218
fields = get_message_fields("geometry_msgs.msg.Twist")
234219
println("Twist message fields: $fields")
235220

@@ -243,30 +228,25 @@ using ROS2
243228

244229
init()
245230

246-
# Set custom domain ID
247231
set_domain_id(1)
248232
println("Domain ID: $(get_domain_id())")
249233

250234
node = ROSNode("advanced_node")
251235

252-
# Multi-threaded executor
253-
executor = MultiThreadedExecutor(4) # 4 threads
236+
executor = MultiThreadedExecutor(4)
254237
add_node(executor, node)
255238

256-
# Custom QoS
257239
custom_qos = QoSProfile("best_effort", "volatile", "keep_last", 10)
258-
pub = Publisher(node, "high_freq_data", "std_msgs.msg.String", qos=custom_qos)
240+
pub = Publisher(node, "high_freq_data", "std_msgs.msg.String")
259241

260-
# Timer with high frequency
261242
counter = Ref(0)
262-
timer = ROSTimer(node, 0.01, () -> begin # 100Hz
243+
timer = ROSTimer(node, 0.01, () -> begin
263244
counter[] += 1
264245
msg = create_msg_dynamic("std_msgs.msg.String")
265246
msg.data = "High frequency message #$(counter[])"
266247
publish(pub, msg)
267248
end)
268249

269-
# Run with multi-threaded executor
270250
spin_executor(executor)
271251
```
272252

@@ -277,26 +257,18 @@ using ROS2
277257

278258
init()
279259

280-
# First, start component container in another terminal:
281-
# ros2 run rclcpp_components component_container
282-
283-
# Create component manager
284260
manager = ComponentManager("ComponentManager")
285261

286-
# List loaded components
287262
components = list_components(manager)
288263
if components !== nothing
289264
println("Loaded components: $(length(components.unique_ids))")
290265

291-
# Load a component
292266
response = load_component(manager, "composition", "composition::Talker", "julia_talker")
293267
if response !== nothing && response.success
294268
println("Loaded component with ID: $(response.unique_id)")
295269

296-
# Run for a while
297270
sleep(5.0)
298271

299-
# Unload component
300272
unload_response = unload_component(manager, response.unique_id)
301273
if unload_response !== nothing && unload_response.success
302274
println("Component unloaded successfully")
@@ -315,12 +287,10 @@ using ROS2
315287
init()
316288
node = ROSNode("param_example")
317289

318-
# Declare parameters
319290
declare_parameter(node, "max_speed", 1.0)
320291
declare_parameter(node, "robot_name", "my_robot")
321292
declare_parameter(node, "use_lidar", true)
322293

323-
# Get parameters
324294
max_speed = get_parameter(node, "max_speed")
325295
robot_name = get_parameter(node, "robot_name")
326296
use_lidar = get_parameter(node, "use_lidar")
@@ -329,10 +299,8 @@ println("Max speed: $max_speed")
329299
println("Robot name: $robot_name")
330300
println("Use LiDAR: $use_lidar")
331301

332-
# Set parameters
333302
set_parameter(node, "max_speed", 2.0)
334303

335-
# Parameter callback
336304
function param_callback(params)
337305
for param in params
338306
println("Parameter changed: $(param.name) = $(param.value)")
@@ -354,21 +322,19 @@ node = ROSNode("logging_example")
354322

355323
logger = get_logger(node)
356324

357-
# Different log levels
358325
debug(logger, "Debug message")
359326
info(logger, "Info message")
360327
warn(logger, "Warning message")
361328
log_error(logger, "Error message")
362329
fatal(logger, "Fatal message")
363330

364-
# Set log level
365331
set_level(logger, INFO)
366332

367333
shutdown()
368334
```
369335

370336
## Advanced Examples
371-
Check the `examples/` directory for comprehensive examples:
337+
Check the `examples/` directory for comprehensive examples.
372338

373339

374340
## API Reference
@@ -382,8 +348,8 @@ Check the `examples/` directory for comprehensive examples:
382348
- `is_ok()` - Check if ROS2 is running
383349

384350
### Topic Communication
385-
- `Publisher(node, topic, msg_type, qos=DEFAULT_QOS)` - Create publisher
386-
- `Subscriber(node, topic, msg_type, callback, qos=DEFAULT_QOS)` - Create subscriber
351+
- `Publisher(node, topic, msg_type)` - Create publisher
352+
- `Subscriber(node, topic, msg_type, callback)` - Create subscriber
387353
- `publish(pub, msg)` - Publish message
388354
- `create_msg(msg_type)` - Create message
389355
- `create_msg_dynamic(msg_type)` - Create message dynamically
@@ -441,21 +407,18 @@ Check the `examples/` directory for comprehensive examples:
441407

442408
1. **PyCall Configuration**
443409
```bash
444-
# If you encounter Python import errors
445410
ENV["PYTHON"] = "/usr/bin/python3"
446411
using Pkg; Pkg.build("PyCall")
447412
```
448413

449414
2. **ROS2 Environment**
450415
```bash
451-
# Always source ROS2 before starting Julia
452416
source /opt/ros/jazzy/setup.bash
453417
julia
454418
```
455419

456420
3. **Component Container**
457421
```bash
458-
# Start component container for component management
459422
ros2 run rclcpp_components component_container
460423
```
461424

@@ -478,12 +441,10 @@ julia --project -e 'using Pkg; Pkg.test()'
478441
```
479442

480443
## TODO
481-
- Lifecycle Nodes (Advanced State Management, Basic functions are already transplanted)
444+
- Lifecycle Nodes (Advanced State Management)
482445
- Advanced Security Features
483446
- DDS Vendor-Specific Configuration
484447
- Advanced Introspection and Debugging
485-
- Priority-based Scheduling
486-
487448

488449
## Community Contributions Welcome
489450
We're looking for contributors to help with:
@@ -502,7 +463,7 @@ This project is licensed under the MIT License - see the LICENSE file for detail
502463

503464
# ROS2.jl
504465

505-
ROS2.jl は,ROS2のPythonクライアントライブラリ(rclpy)のJuliaラッパーで,rclpyの機能をJuliaフレンドリーなインターフェースで提供します
466+
ROS2.jl は,ROS2のPythonクライアントライブラリ(rclpy)のJuliaラッパーで,rclpyの機能をJuliaフレンドリーなインターフェースで提供する
506467

507468
## 依存関係
508469

@@ -524,33 +485,27 @@ ROS2.jl は,ROS2のPythonクライアントライブラリ(rclpy)のJulia
524485
- ros-jazzy-lifecycle(ライフサイクルノード用)
525486

526487
## 簡単な使い方
527-
詳しい使い方は`examples/`以下のファイルを参照してください
488+
詳しい使い方は`examples/`以下のファイルを参照
528489
### 基本的なパブリッシャー/サブスクライバー
529490

530491
```julia
531492
using ROS2
532493

533-
# ROS2の初期化
534494
init()
535495

536-
# ノードの作成
537496
node = ROSNode("example_node")
538497

539-
# パブリッシャーの作成
540498
pub = Publisher(node, "hello", "std_msgs.msg.String")
541499

542-
# メッセージの作成と送信
543500
msg = create_msg("std_msgs.msg.String")
544501
msg.data = "Hello from Julia!"
545502
publish(pub, msg)
546503

547-
# サブスクライバーの作成
548504
function callback(msg)
549505
println("Received: ", msg.data)
550506
end
551507
sub = Subscriber(node, "hello", "std_msgs.msg.String", callback)
552508

553-
# ノードのスピン
554509
spin(node)
555510
```
556511

@@ -561,30 +516,25 @@ using ROS2
561516

562517
init()
563518

564-
# カスタムドメインIDの設定
565519
set_domain_id(1)
566520
println("Domain ID: $(get_domain_id())")
567521

568522
node = ROSNode("advanced_node")
569523

570-
# マルチスレッド実行器
571-
executor = MultiThreadedExecutor(4) # 4スレッド
524+
executor = MultiThreadedExecutor(4)
572525
add_node(executor, node)
573526

574-
# カスタムQoS
575527
custom_qos = QoSProfile("best_effort", "volatile", "keep_last", 10)
576-
pub = Publisher(node, "high_freq_data", "std_msgs.msg.String", qos=custom_qos)
528+
pub = Publisher(node, "high_freq_data", "std_msgs.msg.String")
577529

578-
# 高頻度タイマー
579530
counter = Ref(0)
580-
timer = ROSTimer(node, 0.01, () -> begin # 100Hz
531+
timer = ROSTimer(node, 0.01, () -> begin
581532
counter[] += 1
582533
msg = create_msg_dynamic("std_msgs.msg.String")
583534
msg.data = "高頻度メッセージ #$(counter[])"
584535
publish(pub, msg)
585536
end)
586537

587-
# マルチスレッド実行器で実行
588538
spin_executor(executor)
589539
```
590540

@@ -596,11 +546,9 @@ using ROS2
596546
init()
597547
node = ROSNode("dynamic_msg_example")
598548

599-
# 利用可能なメッセージ型を取得
600549
available_types = get_available_message_types()
601550
println("利用可能なメッセージ型: $(length(available_types))")
602551

603-
# メッセージを動的に作成
604552
twist_msg = create_msg_dynamic("geometry_msgs.msg.Twist")
605553
twist_msg.linear.x = 1.0
606554
twist_msg.angular.z = 0.5
@@ -621,6 +569,6 @@ shutdown()
621569

622570
## ライセンス
623571

624-
このプロジェクトはMITライセンスの下で提供されています - 詳細はLICENSEファイルを参照してください
572+
このプロジェクトはMITライセンスの下で提供されている - 詳細はLICENSEファイルを参照
625573

626574
© 2025 Michitoshi Tsubaki (@Michi-Tsubaki)

0 commit comments

Comments
 (0)