This repository was created as part of a learning journey into the Rust programming language, which is increasingly popular in the embedded systems field. Recognized for its performance and memory safety, Rust is often considered a faster and more efficient alternative to C++.
This is a minimal trajectory tracking controller for mobile robots, inspired by the controller_server
component of the Nav2 framework.
The goals of this project are to:
- Apply Rust concepts in a robotics context
- Explore interoperability between Rust and the ROS2 middleware using the
rclrs
crate - Provide a working Follow path controller to follow generated trajectories
- Lifecycle-inspired architecture (configure → activate → deactivate...)
- Path types supported: linear, circular, sinusoidal just for example
- Integration with
turtlesim
for basic simulation - Option to switch between simulated pose and real-time pose feedback
Before building this project, make sure you have:
- Rust (stable or nightly)
- ROS2 Humble (or any version compatible with
rclrs
) - rclrs (Rust bindings for ROS2):
👉 Follow instructions here: https://github.com/ros2-rust/ros2_rust turtlesim
for basic robot simulation:sudo apt install ros-humble-turtlesim
-
Clone this repository:
cd ~/ros_ws/src git clone https://github.com/Klein237/rust_controller.git
-
Build the package with
colcon
:cd ~/ros_ws source /opt/ros/humble/setup.bash colcon build --packages-select rust_controller
-
Source your environment:
source install/setup.bash
ros2 run turtlesim turtlesim_node
ros2 service call /turtle1/teleport_absolute turtlesim/srv/TeleportAbsolute "{x: 1.0, y: 1.0, theta: 0.9}"
python3 rust_controller/script/wrapper_turtle.py
ros2 run rust_controller rust_controller
rust_controller/
├── src/
│ ├── main.rs
│ ├── controller_server.rs
│ ├── path_handler.rs
│ └── ...
├── package.xml
├── Cargo.toml
└── README.md
Contributions are welcome!
Here’s how you can help:
- Fork the repository
- Create a branch:
git checkout -b feature/my-feature
- Commit your changes:
git commit -am 'Add new feature'
- Push to your branch:
git push origin feature/my-feature
- Open a pull request 📬
Big thanks to the ROS2 and Rust communities for the amazing tools and libraries.
This project is also a tribute to all Rust learners starting from scratch — one step at a time 🚶♂️
MIT License. See the LICENSE file for details.