Continuation from Last Time
Last time, I stopped right after creating the working directory in preparation for teleoperation.
As a memo for myself, here’s the target directory structure:
my_robot_teleop/ ← ROS 2 package (for colcon build)
├── package.xml (manually written)
├── setup.py (manually written)
├── resource/ (manually written)
├── setup.cfg (manually written)
└── my_robot_teleop/ ← Python package (for import)
├── my Python files
└── __init__.py (needed for ros2 run?)
(Directory and file view in VSCode)
My target is simple:
When idle → the turtle should move in a circle
When a key is pressed → follow the key input instead
(A slightly lowered goal, but still a hard path for a beginner!)
The Target Setup
1. Circle motion node → publishes to /circle_vel
2. Modified teleop node → publishes to /keyboard_vel
3. Mixer node → outputs to /turtle1/cmd_vel
4. turtlesim_node → the actual turtle moves
(Node relationship diagram)
So basically, when there’s key input, it follows the key. When idle, it defaults to circular motion.
Checking Before Building More
I already had key input set up, so I tried remapping TurtleSim to move directly from the keyboard.
ChatGPT gave me this command:
ros2 run turtlesim turtlesim_node --ros-args -r /turtle1/cmd_vel:=/keyboard_vel
(Screenshot: Turtle moving via keyboard input)
Somehow, I managed to get my custom-made node (well, technically written by ChatGPT 😅) to control the turtle!
Next Steps
1. Use the teleop_keyboard node to publish velocity to /keyboard_vel
2. Create a new circle_motion node to publish circular motion velocity to /circle_vel
3. Create a mixer node that combines /keyboard_vel + /circle_vel → /turtle1/cmd_vel
Of course, ChatGPT wrote the code for each node.
Then, update setup.py to add them to entry_points:
entry_points={
'console_scripts': [
'teleop_keyboard = my_robot_teleop.teleop_keyboard:main',
'circle_motion = my_robot_teleop.circle_motion:main',
'mixer = my_robot_teleop.mixer:main',
],
},
Rebuild with:
cd ~/ros2_ws
colcon build
source install/setup.bash
When opening a new terminal, don’t forget to re-run:
cd ~/ros2_ws
source install/setup.bash
By the way, there’s a shortcut so you don’t have to type this every time, but I’ll save that trick for next time.
(Screenshot: Turtle moving successfully)
Summary
Continuing from last time, I played around with ROS2 using TurtleSim, with lots of help from ChatGPT.
By lowering my goal a bit—and letting ChatGPT carry me most of the way—I still got to see my plan actually come to life. And that’s an amazing feeling!
Just when I was about to dive into Gazebo (the simulator)… my free GPT-5 quota ended for the day.
Seriously, it always cuts off at the best moment.
Could it be… ChatGPT is doing this on purpose?



