You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**Turtle Rendering**: 3D turtle models with real-time pose updates
165
+
-**Following Logic**: Calculates distance, angle, and velocity commands for turtle2 following behavior
156
166
-**Transform Monitoring**: Live display of transform data and frame relationships
157
-
-**User Interaction**: Control buttons and visual feedback systems
167
+
-**User Interaction**: Control buttons, keyboard handling, and visual feedback systems
158
168
159
169
### HTML Interface (index.html)
160
170
@@ -201,7 +211,7 @@ world → turtle2
201
211
-**A**: Turn left
202
212
-**D**: Turn right
203
213
204
-
💡 **Tip**: Click on the 3D visualization area first to ensure keyboard focus, then use WASD keys to drive turtle1 around the turtlesim environment.
214
+
💡 **Tip**: Click on the 3D visualization area first to ensure keyboard focus, then use WASD keys to drive turtle1 around the turtlesim environment. turtle2 will automatically follow turtle1!
205
215
206
216
**Camera Controls**:
207
217
@@ -214,10 +224,30 @@ world → turtle2
214
224
215
225
### Turtle Management
216
226
217
-
-**Spawn Turtle1**: Creates turtle1 at position (5.5, 5.5)
218
-
-**Spawn Turtle2**: Creates turtle2 at position (4.0, 2.0)
227
+
-**Spawn Turtle2**: Creates turtle2 at position (4.0, 2.0) - turtle1 is automatically spawned by turtlesim
219
228
-**Stop All**: Halts all turtle motion commands
220
229
230
+
### Turtle Following Behavior
231
+
232
+
Once turtle2 is spawned, it will automatically follow turtle1 with the following intelligent behaviors:
233
+
234
+
-**Distance-based Speed**: turtle2 moves faster when far from turtle1, slower when close
235
+
-**Angle Correction**: turtle2 continuously adjusts its heading to face turtle1
236
+
-**Smart Stopping**: turtle2 stops moving when within 0.5 units of turtle1 to avoid collision
237
+
-**Real-time Updates**: Following commands are sent every second based on current turtle positions
238
+
239
+
**Following Algorithm Details**:
240
+
241
+
-**Linear Velocity**: Proportional to distance (max speed: 2.0 units/sec)
242
+
-**Angular Velocity**: Proportional to angle difference (4.0 × angle error)
243
+
-**Minimum Following Distance**: 0.5 units (prevents excessive oscillation)
244
+
245
+
You can observe the following behavior by:
246
+
247
+
1. Spawning turtle2 using the "Spawn Turtle2" button
248
+
2. Using WASD keys to move turtle1 around
249
+
3. Watching turtle2 chase turtle1 in both the turtlesim window and 3D visualization
250
+
221
251
### Demo Control
222
252
223
253
-**Start Demo**: Initializes all TF2 broadcasters and systems
@@ -246,10 +276,12 @@ world → turtle2
246
276
- Check if ROS2 daemon is running: `ros2 daemon status`
247
277
- Verify ROS2 installation: `ros2 --version`
248
278
249
-
2.**"Turtlesim not responding"**
279
+
2.**"Turtlesim not responding" or "Failed to spawn turtle2"**
250
280
251
281
- Verify turtlesim is running: `ros2 run turtlesim turtlesim_node`
252
282
- Check available topics: `ros2 topic list`
283
+
- Ensure spawn service is available: `ros2 service list | grep spawn`
284
+
- Try restarting turtlesim_node if spawn calls fail
0 commit comments