Skip to content

Commit f8a3372

Browse files
committed
Change name
1 parent 023630f commit f8a3372

File tree

3 files changed

+16
-28
lines changed

3 files changed

+16
-28
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,20 @@
11
#!/usr/bin/env julia
2-
3-
# simple_pub_sub.jl
2+
# This example demonstrates a simple publisher that sends a String message.
43
using ROS2
54

65
function main()
7-
# Creating node
86
node = ROSNode("test_node")
9-
10-
# Creating publisher
117
pub = Publisher(node, "test_topic", "std_msgs.msg.String")
12-
13-
# Creating message
148
msg = create_msg("std_msgs.msg.String")
159
msg.data = "Hello from Julia!"
16-
1710
println("Publishing message...")
1811
publish(pub, msg)
19-
20-
# Wait
21-
for i in 1:10
12+
for i = 1:10
2213
spin_once(node)
2314
sleep(0.1)
2415
end
25-
2616
shutdown()
2717
println("Done!")
2818
end
2919

30-
main()
20+
main()
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
#!/usr/bin/env julia
2-
# simple_publisher.jl
3-
# description: sample publishing code
2+
# This example demonstrates a simple publisher that sends a String message.
43

54
using ROS2
65

76
function main()
87
# Creating node
98
node = ROSNode("simple_publisher")
10-
9+
1110
# Creating publisher
1211
pub = Publisher(node, "hello_topic", "std_msgs.msg.String")
13-
12+
1413
counter = 1
15-
14+
1615
# Starting publish loop
1716
try
1817
while is_ok()
1918
msg = create_msg("std_msgs.msg.String")
2019
msg.data = "Hello $(counter)"
2120
publish(pub, msg)
22-
21+
2322
println("Published: Hello $(counter)")
24-
25-
# ROS event processing
26-
spin_once(node, timeout_sec=0.1)
27-
23+
24+
spin_once(node, timeout_sec = 0.1)
25+
2826
counter += 1
2927
sleep(1.0)
3028
end
@@ -42,4 +40,4 @@ function main()
4240
end
4341
end
4442

45-
main()
43+
main()
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ end
1010
function main()
1111
# Creating node
1212
node = ROSNode("simple_subscriber")
13-
13+
1414
# Creating subscriber
1515
sub = Subscriber(node, "hello_topic", "std_msgs.msg.String", callback)
16-
16+
1717
# Starting subscribe loop
1818
try
1919
while is_ok()
2020
# ROS event processing
21-
spin_once(node, timeout_sec=0.1)
21+
spin_once(node, timeout_sec = 0.1)
2222
# wait
2323
sleep(0.1)
2424
end
@@ -36,4 +36,4 @@ function main()
3636
end
3737
end
3838

39-
main()
39+
main()

0 commit comments

Comments
 (0)