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
Copy file name to clipboardExpand all lines: content/hardware/04.pro/boards/portenta-x8/tutorials/16.getting-started-with-ros2/content.md
+68-1Lines changed: 68 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -454,14 +454,81 @@ With all files in place, you are now ready to build and launch your dockerized R
454
454
docker compose up --build
455
455
```
456
456
457
-
This command builds the custom Docker image according to your Dockerfile specifications. Then, it starts the container with all the configurations defined in docker-compose.yml. The `--build` flag ensures the image is rebuilt, including any changes you have made to the files.
457
+
This command builds the custom Docker image according to your Dockerfile specifications. Then, it starts the container with all the configurations defined in `docker-compose.yml`. The `--build` flag ensures the image is rebuilt, including any changes you have made to the files.
458
+
459
+
The following sequence of the commands also works:
460
+
461
+
```bash
462
+
docker build . -t turtlesim_auto
463
+
```
464
+
465
+
```bash
466
+
docker run -it --rm \
467
+
--privileged \
468
+
-e WAYLAND_DISPLAY=wayland-1 \
469
+
-e XDG_RUNTIME_DIR=/run/user/63 \
470
+
-e QT_QPA_PLATFORM=wayland \
471
+
-v /run/user/63:/run/user/63 \
472
+
-v /tmp/.X11-unix:/tmp/.X11-unix:rw \
473
+
--name turtlesim_container \
474
+
turtlesim_auto
475
+
```
458
476
459
477
As the container starts, you will see a detailed output showing the initialization process in your terminal. The turtlesim window should appear on your external display within a few seconds, with the turtle already performing pre-defined movements.
460
478
461
479

462
480
463
481
The turtle will simultaneously run square-drawing patterns while maintaining a circular trajectory, creating a hybrid spiral-square pattern.
464
482
483
+

484
+
485
+
When the turtle _crashes_ into a wall, while the example is running, you will eventually see log lines like:
486
+
487
+
```bash
488
+
[WARN] [turtlesim]: Oh no! I hit the wall!
489
+
```
490
+
491
+
Nothing is wrong, `turtlesim` clamps the pose to keep the turtle inside the blue window and keeps drawing. You can clear or reset the screen at any time:
492
+
493
+
```bash
494
+
# clear the drawing
495
+
ros2 service call /clear std_srvs/srv/Empty {}
496
+
497
+
# reset turtle position (also clears)
498
+
ros2 service call /reset std_srvs/srv/Empty {}
499
+
```
500
+
501
+
The motion parameters can be adjusted and avoid wall collisions in `start_turtlesim.sh`. Edit that sketch to use smaller values that keep the turtle away from the edges:
| `sleep 5` (delay before circular motion) | `5 s` | `2 – 3 s` (optional) | Starts circle soonera and reduces distance covered during square routine |
523
+
524
+
After saving the changes, rebuild and relaunch:
525
+
526
+
```bash
527
+
docker compose up --build
528
+
```
529
+
530
+
The turtle will now trace a tighter spiral–square pattern and stay comfortably inside the boundaries. These warnings are a helpful indicator that the simulation’s collision logic is working and fine tuning the script gives you full control over the turtle’s behavior.
531
+
465
532
### Managing the Dockerized Application
466
533
467
534
Docker Compose provides useful commands for managing your deployed application. Understanding these commands helps you maintain and troubleshoot your ROS2 deployment effectively.
0 commit comments