diff --git a/README.md b/README.md index 5fad33a626c..e691ab1f54a 100644 --- a/README.md +++ b/README.md @@ -17,27 +17,46 @@ Want to use ROS, but don't want to run Ubuntu? This project uses the power of [N ## Examples -Turtlebot 3 simulation in Gazebo: +Turtlebot 3 simulation in Gazebo on noetic distro: ``` nix-shell \ -I nix-ros-overlay=https://github.com/lopsided98/nix-ros-overlay/archive/master.tar.gz \ --option extra-substituters 'https://ros.cachix.org' \ --option trusted-public-keys 'cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ros.cachix.org-1:dSyZxI8geDCJrwgvCOHDoAfOm5sV1wCPjBkKL+38Rvo=' \ - '' + '' # If not on NixOS, nixGL (https://github.com/guibou/nixGL) is needed for OpenGL support roslaunch turtlebot3_gazebo turtlebot3_world.launch # Spawn a new nix-shell in a new terminal and then: roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch ``` +Turtlebot 3 simulation in Gazebo on humble distro: +``` +nix-shell \ + -I nix-ros-overlay=https://github.com/lopsided98/nix-ros-overlay/archive/master.tar.gz \ + --option extra-substituters 'https://ros.cachix.org' \ + --option trusted-public-keys 'cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ros.cachix.org-1:dSyZxI8geDCJrwgvCOHDoAfOm5sV1wCPjBkKL+38Rvo=' \ + '' +# If not on NixOS, nixGL (https://github.com/guibou/nixGL) is needed for OpenGL support +ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py +# Spawn a new nix-shell in a new terminal and then: +ros2 run turtlebot3_teleop teleop_keyboard +``` + ### Flakes -With [Flakes enabled][flake], the equivalent of the above is: +With [Flakes enabled][flake], the equivalent of the above for noetic distro is: ``` -nix develop github:lopsided98/nix-ros-overlay#example-turtlebot3-gazebo +nix develop github:lopsided98/nix-ros-overlay#example-noetic-turtlebot3-gazebo # Then use roslaunch commands as above ``` +With [Flakes enabled][flake], the equivalent of the above for humble distro is: +``` +nix develop github:lopsided98/nix-ros-overlay#example-humble-turtlebot3-gazebo +# Then use ros2 commands as above +``` + Using the overlay in your `flake.nix`-based project could look like this: diff --git a/distros/humble/overrides.nix b/distros/humble/overrides.nix index cc74b7332ba..76bce441125 100644 --- a/distros/humble/overrides.nix +++ b/distros/humble/overrides.nix @@ -30,6 +30,12 @@ in with lib; { gazebo = self.gazebo_11; + gazebo-ros = rosSuper.gazebo-ros.overrideAttrs ({ + buildInputs ? [], ... + }: { + buildInputs = buildInputs ++ [ self.qt5.qtbase ]; + }); + google-benchmark-vendor = lib.patchExternalProjectGit rosSuper.google-benchmark-vendor { url = "https://github.com/google/benchmark.git"; rev = "c05843a9f622db08ad59804c190f98879b76beba"; @@ -105,6 +111,12 @@ in with lib; { propagatedBuildInputs = propagatedBuildInputs ++ [ rosSelf.moveit-ros-planning ]; }); + nav2-costmap-2d = rosSuper.nav2-costmap-2d.overrideAttrs({ + ... + }: { + env.NIX_CFLAGS_COMPILE = toString [ "-Wno-error=array-bounds" ]; + }); + novatel-oem7-driver = (patchExternalProjectGit rosSuper.novatel-oem7-driver { url = "https://github.com/novatel/novatel_edie"; rev = "d02ccc2dfe531d642c1e2ca8a8c0f8205c856f23"; diff --git a/examples/humble-turtlebot3-gazebo.nix b/examples/humble-turtlebot3-gazebo.nix new file mode 100755 index 00000000000..a01e5a71de5 --- /dev/null +++ b/examples/humble-turtlebot3-gazebo.nix @@ -0,0 +1,23 @@ +# Run: +# ros2 launch turtlebot3_gazebo turtlebot3_world.launch.py +# ros2 run turtlebot3_teleop teleop_keyboard + +{ pkgs ? import ../. {} }: +with pkgs; +with rosPackages.humble; +with pythonPackages; + +mkShell { + buildInputs = [ + glibcLocales + (buildEnv { paths = [ + ros-base + turtlebot3-teleop + turtlebot3-gazebo + ]; }) + ]; + + ROS_HOSTNAME = "localhost"; + ROS_MASTER_URI = "http://localhost:11311"; + TURTLEBOT3_MODEL = "burger"; +} diff --git a/examples/turtlebot3-gazebo.nix b/examples/noetic-turtlebot3-gazebo.nix similarity index 100% rename from examples/turtlebot3-gazebo.nix rename to examples/noetic-turtlebot3-gazebo.nix diff --git a/flake.nix b/flake.nix index bb8549f09a9..c40332f2d7d 100644 --- a/flake.nix +++ b/flake.nix @@ -18,7 +18,7 @@ legacyPackages = pkgs.rosPackages; devShells = { - example-turtlebot3-gazebo = import ./examples/turtlebot3-gazebo.nix { inherit pkgs; }; + example-noetic-turtlebot3-gazebo = import ./examples/noetic-turtlebot3-gazebo.nix { inherit pkgs; }; example-ros2-basic = import ./examples/ros2-basic.nix { inherit pkgs; }; example-ros2-gz = import ./examples/ros2-gz.nix { inherit pkgs; };