Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Turtlesim Demo #445

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Abdelrahmanosama372
Copy link

@Abdelrahmanosama372 Abdelrahmanosama372 commented Dec 10, 2024

Description

This PR introduces the Turtlesim demo in Rust, providing a Rust implementation of the turtlesim simulation. This PR addresses issue [#124]

Key Features:

  • turtlesim_rs: A Rust-based implementation of the turtlesim simulator, providing a complete ROS 2 integration for visualizing and controlling turtles. This package includes the core simulation logic, turtle control, and rendering components, ported from the C++ turtlesim package.
  • turtlesim_rs_msgs: Added the necessary message types and services to support the turtlesim_rs simulator.

Tutorials:

Here’s a checklist of the tutorials included and upcoming:

  • turtle_teleop_key: Control the turtle using keyboard input.
  • mimic: Mimic the movements of one turtle in another.
  • draw_square: Program a turtle to draw a square.

What's Next:

  • Add the mimic and draw_square tutorials.

This package provides message and service definitions for the turtlesim_rs package.
- Downgraded dependencies to work with rust lower than 1.75.
- Replaced strong Arc clones with Weak references in thread spawns
- Ensured threads terminate when the associated Arc is dropped
@roboticswithjulia
Copy link

I have to say that this is an awesome example! Congratulations for the result!
I just tried to build this package and it builds successfully by default. I just tried to execute the turtlesim node, with ros2 run turtlesim_rs turtlesim_node and I didn't get any output neither any error. I am using docker btw.
This is the output of the terminal:

root@fbdbf6950fd3:/workspace# ros2 run turtlesim_rs turtlesim_node 
root@fbdbf6950fd3:/workspace# 

Maybe I am also missing a Readme.md about how to run each package, just to help in each package execution. Thank you!

@Abdelrahmanosama372
Copy link
Author

I just tried to build this package and it builds successfully by default. I just tried to execute the turtlesim node, with ros2 run turtlesim_rs turtlesim_node and I didn't get any output neither any error. I am using docker btw.

Thank you for your feedback and for testing the package!

I was able to reproduce the issue and found that it was related to some missing dependencies for GUI applications in Docker. To resolve this, you need to:

  1. Allow Docker to access the display (run this on your host machine):

    xhost +local:docker
  2. Run the container with the necessary permissions for X11:

    docker run --env=DISPLAY --device=/dev/dri:/dev/dri -v /tmp/.X11-unix:/tmp/.X11-unix ...
  3. Install missing dependencies inside the container:

    apt install libxkbcommon-x11-0 libxcursor1 libxi6 libegl1-mesa libgl1-mesa-dri

    Alternatively, you can add these dependencies directly to the Dockerfile and rebuild the image to avoid installing them manually each time.

Let me know if you run into any other problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants