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
9495using ROS2
9596
96- # Initialize ROS2
9797init ()
9898
99- # Create a node
10099node = ROSNode (" example_node" )
101100
102- # Create a publisher
103101pub = Publisher (node, " hello" , " std_msgs.msg.String" )
104102
105- # Create and publish a message
106103msg = create_msg (" std_msgs.msg.String" )
107104msg. data = " Hello from Julia!"
108105publish (pub, msg)
109106
110- # Create a subscriber
111107function callback (msg)
112108 println (" Received: " , msg. data)
113109end
114110sub = Subscriber (node, " hello" , " std_msgs.msg.String" , callback)
115111
116- # Spin the node
117112spin (node)
118113```
119114
@@ -125,7 +120,6 @@ using ROS2
125120init ()
126121node = ROSNode (" service_example" )
127122
128- # Service Server
129123function add_callback (request, response)
130124 response. sum = request. a + request. b
131125 println (" Request: $(request. a) + $(request. b) = $(response. sum) " )
134128
135129server = ServiceServer (node, " add_two_ints" , " example_interfaces.srv.AddTwoInts" , add_callback)
136130
137- # Service Client (in another script)
138131client = ServiceClient (node, " add_two_ints" , " example_interfaces.srv.AddTwoInts" )
139132
140133if wait_for_service (client, timeout= 5.0 )
@@ -157,20 +150,17 @@ using ROS2
157150init ()
158151node = ROSNode (" action_example" )
159152
160- # Action Client
161153client = ActionClient (node, " fibonacci" , " example_interfaces.action.Fibonacci" )
162154
163155goal = create_goal (" example_interfaces.action.Fibonacci" )
164156goal. order = 10
165157
166- # Send goal with feedback callback
167158function feedback_callback (feedback_msg)
168159 println (" Feedback: $(feedback_msg. feedback. partial_sequence) " )
169160end
170161
171162future = send_goal (client, goal, feedback_callback)
172163
173- # Wait for result
174164result = send_goal_sync (client, goal, timeout= 10.0 )
175165if result != = nothing
176166 println (" Final sequence: $(result. result. sequence) " )
@@ -187,14 +177,12 @@ using ROS2
187177init ()
188178node = ROSNode (" tf_example" )
189179
190- # Transform Broadcaster
191180broadcaster = TransformBroadcaster (node)
192181
193182transform = create_transform_stamped (" map" , " base_link" , (1.0 , 2.0 , 0.0 ), (0.0 , 0.0 , 0.0 , 1.0 ))
194183transform. header. stamp = to_msg_time (now ())
195184send_transform (broadcaster, transform)
196185
197- # Transform Listener
198186listener = TransformListener (node)
199187
200188try
@@ -215,11 +203,9 @@ using ROS2
215203init ()
216204node = ROSNode (" dynamic_msg_example" )
217205
218- # Get available message types
219206available_types = get_available_message_types ()
220207println (" Available message types: $(length (available_types)) " )
221208
222- # Create messages dynamically
223209twist_msg = create_msg_dynamic (" geometry_msgs.msg.Twist" )
224210twist_msg. linear. x = 1.0
225211twist_msg. angular. z = 0.5
@@ -229,7 +215,6 @@ pose_msg.header.stamp = to_msg_time(now())
229215pose_msg. header. frame_id = " map"
230216pose_msg. pose. position. x = 1.0
231217
232- # Check message fields
233218fields = get_message_fields (" geometry_msgs.msg.Twist" )
234219println (" Twist message fields: $fields " )
235220
@@ -243,30 +228,25 @@ using ROS2
243228
244229init ()
245230
246- # Set custom domain ID
247231set_domain_id (1 )
248232println (" Domain ID: $(get_domain_id ()) " )
249233
250234node = ROSNode (" advanced_node" )
251235
252- # Multi-threaded executor
253- executor = MultiThreadedExecutor (4 ) # 4 threads
236+ executor = MultiThreadedExecutor (4 )
254237add_node (executor, node)
255238
256- # Custom QoS
257239custom_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
261242counter = 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)
267248end )
268249
269- # Run with multi-threaded executor
270250spin_executor (executor)
271251```
272252
@@ -277,26 +257,18 @@ using ROS2
277257
278258init ()
279259
280- # First, start component container in another terminal:
281- # ros2 run rclcpp_components component_container
282-
283- # Create component manager
284260manager = ComponentManager (" ComponentManager" )
285261
286- # List loaded components
287262components = list_components (manager)
288263if 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
315287init ()
316288node = ROSNode (" param_example" )
317289
318- # Declare parameters
319290declare_parameter (node, " max_speed" , 1.0 )
320291declare_parameter (node, " robot_name" , " my_robot" )
321292declare_parameter (node, " use_lidar" , true )
322293
323- # Get parameters
324294max_speed = get_parameter (node, " max_speed" )
325295robot_name = get_parameter (node, " robot_name" )
326296use_lidar = get_parameter (node, " use_lidar" )
@@ -329,10 +299,8 @@ println("Max speed: $max_speed")
329299println (" Robot name: $robot_name " )
330300println (" Use LiDAR: $use_lidar " )
331301
332- # Set parameters
333302set_parameter (node, " max_speed" , 2.0 )
334303
335- # Parameter callback
336304function 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
355323logger = get_logger (node)
356324
357- # Different log levels
358325debug (logger, " Debug message" )
359326info (logger, " Info message" )
360327warn (logger, " Warning message" )
361328log_error (logger, " Error message" )
362329fatal (logger, " Fatal message" )
363330
364- # Set log level
365331set_level (logger, INFO)
366332
367333shutdown ()
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
4424081 . ** PyCall Configuration**
443409``` bash
444- # If you encounter Python import errors
445410ENV[" PYTHON" ] = " /usr/bin/python3"
446411using Pkg; Pkg.build(" PyCall" )
447412```
448413
4494142 . ** ROS2 Environment**
450415``` bash
451- # Always source ROS2 before starting Julia
452416source /opt/ros/jazzy/setup.bash
453417julia
454418```
455419
4564203 . ** Component Container**
457421``` bash
458- # Start component container for component management
459422ros2 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
489450We'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
531492using ROS2
532493
533- # ROS2の初期化
534494init ()
535495
536- # ノードの作成
537496node = ROSNode (" example_node" )
538497
539- # パブリッシャーの作成
540498pub = Publisher (node, " hello" , " std_msgs.msg.String" )
541499
542- # メッセージの作成と送信
543500msg = create_msg (" std_msgs.msg.String" )
544501msg. data = " Hello from Julia!"
545502publish (pub, msg)
546503
547- # サブスクライバーの作成
548504function callback (msg)
549505 println (" Received: " , msg. data)
550506end
551507sub = Subscriber (node, " hello" , " std_msgs.msg.String" , callback)
552508
553- # ノードのスピン
554509spin (node)
555510```
556511
@@ -561,30 +516,25 @@ using ROS2
561516
562517init ()
563518
564- # カスタムドメインIDの設定
565519set_domain_id (1 )
566520println (" Domain ID: $(get_domain_id ()) " )
567521
568522node = ROSNode (" advanced_node" )
569523
570- # マルチスレッド実行器
571- executor = MultiThreadedExecutor (4 ) # 4スレッド
524+ executor = MultiThreadedExecutor (4 )
572525add_node (executor, node)
573526
574- # カスタムQoS
575527custom_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- # 高頻度タイマー
579530counter = 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)
585536end )
586537
587- # マルチスレッド実行器で実行
588538spin_executor (executor)
589539```
590540
@@ -596,11 +546,9 @@ using ROS2
596546init ()
597547node = ROSNode (" dynamic_msg_example" )
598548
599- # 利用可能なメッセージ型を取得
600549available_types = get_available_message_types ()
601550println (" 利用可能なメッセージ型: $(length (available_types)) 個" )
602551
603- # メッセージを動的に作成
604552twist_msg = create_msg_dynamic (" geometry_msgs.msg.Twist" )
605553twist_msg. linear. x = 1.0
606554twist_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