A modern ROS 2 workspace showcasing pixi-build-ros - the simplest way to build and manage ROS packages.
# Clone this repository
git clone https://github.com/ruben-arts/ros_workspace.git# Install and build everything
pixi install# Start turtle simulator (terminal 1)
pixi run sim# Start navigation controller (terminal 2)
pixi run navigator# Send movement command (terminal 3)
pixi run talker 5.5 8.0Watch the turtle smoothly navigate to your coordinates using a PID controller!
- Zero configuration: No complex extra's needed, just a small pixi toml and the rest is automated.
- Isolated builds: Each package builds in its own clean environment
- Cross-platform: Same commands work on Linux, macOS, and Windows
- Dependency magic: Automatically handles ROS dependencies
- Fast iteration: Incremental builds and smart caching
- Pixi installed
- No ROS installation needed - pixi handles everything!
This repository contains a complete working example with:
- Turtle Simulator: Visual robot simulation environment
- Python Talker: Publishes target coordinates via command line
- C++ Navigator: PID controller that moves turtle to target
- Python Navigator: Alternative Python implementation
# Turtle simulator GUI
pixi run sim
# C++ navigation with PID control
pixi run navigator
# Python navigation (alternative)
pixi run navigator-py
# Send coordinates: pixi run talker <x> <y>
pixi run talker 2.5 7.0- Talker publishes target coordinates on the
/coordinatestopic - Navigator subscribes to coordinates and turtle pose
- PID Controller calculates smooth movement commands
- Turtle moves smoothly to the target position
Try different coordinates and watch the intelligent navigation!
mkdir my_ros_workspace && cd my_ros_workspacepixi init --channel https://prefix.dev/pixi-build-backends --channel https://prefix.dev/conda-forge --channel https://prefix.dev/robostack-stagingpixi add ros-humble-desktoppixi run ros2 run turtlesim turtlesim_nodeYou should see a turtle appear in a graphical window!
Create the ROS package:
pixi run ros2 pkg create --build-type ament_python --destination-directory src --node-name my_node my_python_pkgAdd pixi-build-ros configuration:
cd src/my_python_pkg
cat > pixi.toml << 'EOF'
[package]
name = "undefined" # Change this to your package name or keep undefined to fetch it from the package.xml
version = "0.0.0" # Change this to your package version or keep 0.0.0 to fetch it from the package.xml
[package.build.backend]
name = "pixi-build-ros"
version = ">=0.1.1"
[package.build.config]
distro = "humble"
EOFRegister with workspace (root pixi.toml):
[dependencies]
ros-humble-desktop = ">=0.10.0,<0.11"
ros-humble-my-python-pkg = { path = "src/my_python_pkg" }Create the ROS package:
pixi run ros2 pkg create --build-type ament_cmake --destination-directory src --node-name my_node my_cpp_pkg --dependencies rclcpp std_msgsAdd pixi-build-ros configuration:
cd src/my_cpp_pkg
cat > pixi.toml << 'EOF'
[package]
name = "undefined" # Change this to your package name or keep undefined to fetch it from the package.xml
version = "0.0.0" # Change this to your package version or keep 0.0.0 to fetch it from the package.xml
[package.build.backend]
name = "pixi-build-ros"
version = ">=0.1.1"
[package.build.config]
distro = "humble"
EOFRegister with workspace:
[dependencies]
ros-humble-desktop = ">=0.10.0,<0.11"
ros-humble-my-python-pkg = { path = "src/my_python_pkg" }
ros-humble-my-cpp-pkg = { path = "src/my_cpp_pkg" }pixi task add my-python "ros2 run my_python_pkg my_node"
pixi task add my-cpp "ros2 run my_cpp_pkg my_node"Build conda packages for deployment:
# Creates .conda files for distribution
pixi buildShare your packages:
- Upload to prefix.dev
- Distribute to your team
- Deploy to production environments
Missing dependencies:
pixi info # Check configured channels
pixi list --explicit # List all explicitly installed packages
pixi list # List all installed packages
pixi tree -i package-name # Check dependency tree of a packageCache problems:
pixi clean # Full clean of the current .pixi folder in the workspace
pixi clean --build # Only clear build artifacts in the workspace
pixi clean cache --build # Clear build backend cache
pixi clean cache # Only clear cache, might be deleting more then you want, so watch out!ROS commands not found:
pixi shell # Enter pixi environment
ros2 --help # Test ROS installation- Pixi: Documentation | Discord
- ROS 2: Documentation | Answers
- pixi-build-ros: GitHub
Happy Robot Building! 🤖✨