Difference between revisions of "ROS 2 Suite node sample"
(update) |
(update) |
||
| Line 1: | Line 1: | ||
| − | + | == c++ sample == | |
| − | |||
| − | |||
Run example for subscribe, you can open a terminal to executing command: | Run example for subscribe, you can open a terminal to executing command: | ||
| Line 18: | Line 16: | ||
| − | + | == rclnodejs sample == | |
Run example for subscribe, you can open a terminal to executing command: | Run example for subscribe, you can open a terminal to executing command: | ||
| Line 35: | Line 33: | ||
| − | + | == rclpy sample == | |
Run example for subscribe, you can open a terminal to executing command: | Run example for subscribe, you can open a terminal to executing command: | ||
| Line 50: | Line 48: | ||
python3 publish.py | python3 publish.py | ||
</pre> | </pre> | ||
| + | |||
| + | == turtlesim == | ||
| + | |||
| + | Open a terminal to start turtlesim by executing command: | ||
| + | |||
| + | <pre> | ||
| + | ros2 run turtlesim turtlesim_node | ||
| + | </pre> | ||
| + | |||
| + | 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: | ||
| + | |||
| + | <pre> | ||
| + | ros2 run turtlesim turtle_teleop_key | ||
| + | </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. | ||
Revision as of 09:11, 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
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.