Difference between revisions of "ROS 2 Suite node sample"

From ESS-WIKI
Jump to: navigation, search
(update)
(.)
Line 1: Line 1:
== c++ sample ==
+
<h2>c++ sample</h2>
  
Run example for subscribe, you can open a terminal to executing command:
+
<p>Run example for subscribe, you can open a terminal to executing command:</p>
  
 
<pre>
 
<pre>
Line 7: Line 7:
 
</pre>
 
</pre>
  
Open a new terminal to executing command to publish:
+
<p>Open a new terminal to executing command to publish:</p>
  
 
<pre>
 
<pre>
Line 13: Line 13:
 
</pre>
 
</pre>
  
 +
<p><img _cke_saved_src="Ros2 suite node sample cpp.png" _fck_mw_filename="Ros2 suite node sample cpp.png" src="/wiki/images/5/56/Ros2_suite_node_sample_cpp.png" /></p>
  
 +
<p>&nbsp;</p>
  
 +
<h2>rclnodejs sample</h2>
  
== rclnodejs sample ==
+
<p>Run example for subscribe, you can open a terminal to executing command:</p>
 
 
Run example for subscribe, you can open a terminal to executing command:
 
  
 
<pre>
 
<pre>
Line 25: Line 26:
 
</pre>
 
</pre>
  
Open a new terminal to executing command to publish:
+
<p>Open a new terminal to executing command to publish:</p>
  
 
<pre>
 
<pre>
Line 32: Line 33:
 
</pre>
 
</pre>
  
 +
<p>&nbsp;</p>
  
== rclpy sample ==
+
<h2>rclpy sample</h2>
  
Run example for subscribe, you can open a terminal to executing command:
+
<p>Run example for subscribe, you can open a terminal to executing command:</p>
  
 
<pre>
 
<pre>
Line 42: Line 44:
 
</pre>
 
</pre>
  
Open a new terminal to executing command to publish:
+
<p>Open a new terminal to executing command to publish:</p>
  
 
<pre>
 
<pre>
Line 49: Line 51:
 
</pre>
 
</pre>
  
== turtlesim ==
+
<h2>turtlesim</h2>
  
Open a terminal to start turtlesim by executing command:
+
<p>Open a terminal to start turtlesim by executing command:</p>
  
 
<pre>
 
<pre>
Line 57: Line 59:
 
</pre>
 
</pre>
  
The simulator window should appear, with a random turtle in the center.
+
<p>The simulator window should appear, with a random turtle in the center.</p>
  
Open a new terminal, run a new node to control the turtle in the first node by executing command:
+
<p>Open a new terminal, run a new node to control the turtle in the first node by executing command:</p>
  
 
<pre>
 
<pre>
Line 65: Line 67:
 
</pre>
 
</pre>
  
Use the arrow keys on your keyboard to control the turtle. It will move around the screen, using its attached “pen” to draw the path it followed so far.
+
<p>Use the arrow keys on your keyboard to control the turtle. It will move around the screen, using its attached &ldquo;pen&rdquo; to draw the path it followed so far.</p>

Revision as of 09:12, 16 December 2022

c++ sample

Run example for subscribe, you can open a terminal to executing command:

ros2 run demo_nodes_cpp listener

Open a new terminal to executing command to publish:

ros2 run demo_nodes_cpp talker

<img _cke_saved_src="Ros2 suite node sample cpp.png" _fck_mw_filename="Ros2 suite node sample cpp.png" src="/wiki/images/5/56/Ros2_suite_node_sample_cpp.png" />

 

rclnodejs sample

Run example for subscribe, you can open a terminal to executing command:

cd /usr/local/Advantech/ros/foxy/sample_code/rclnodejs_sample
node sub.js

Open a new terminal to executing command to publish:

cd /usr/local/Advantech/ros/foxy/sample_code/rclnodejs_sample
node pub.js

 

rclpy sample

Run example for subscribe, you can open a terminal to executing command:

cd /usr/local/Advantech/ros/foxy/sample_code/rclpy_sample
python3 subscriber.py

Open a new terminal to executing command to publish:

cd /usr/local/Advantech/ros/foxy/sample_code/rclpy_sample
python3 publish.py

turtlesim

Open a terminal to start turtlesim by executing command:

ros2 run turtlesim turtlesim_node

The simulator window should appear, with a random turtle in the center.

Open a new terminal, run a new node to control the turtle in the first node by executing command:

ros2 run turtlesim turtle_teleop_key

Use the arrow keys on your keyboard to control the turtle. It will move around the screen, using its attached “pen” to draw the path it followed so far.