Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=' \
'<nix-ros-overlay/examples/turtlebot3-gazebo.nix>'
'<nix-ros-overlay/examples/noetic-turtlebot3-gazebo.nix>'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't change the names of existing files (and attributes below). Users may rely on these names in their Nix expressions and this would break them.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was discussing that with @mdrodrigo and he brought a valid point that the example was not working as nobody noticed that it was failing to build. So I'm pretty sure that users are not relying on this otherwise we would have received issues about it failing to build and run. Considering that I think that would be better to rename the attribute so it is clear which version it is using and causes less confusion for users when testing it.

What do you think?

# 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=' \
'<nix-ros-overlay/examples/humble-turtlebot3-gazebo.nix>'
# 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:

<!-- The following comment is for https://github.com/zimbatm/mdsh -->
Expand Down
12 changes: 12 additions & 0 deletions distros/humble/overrides.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down
23 changes: 23 additions & 0 deletions examples/humble-turtlebot3-gazebo.nix
Original file line number Diff line number Diff line change
@@ -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
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This package depends on gazebo_ros_pkgs, which is deprecated. They recommend to follow https://gazebosim.org/docs/latest/gazebo_classic_migration. Seems like https://gazebosim.org/docs/latest/migrating_gazebo_classic_ros2_packages/ might be what you need.

I also wonder whether #591 contains what you intend to do here or not. There is a new example ros2-turtlebot4-gz.nix.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proposed pull request certainly tackles some of the issues, and I appreciate that effort! However, I believe it's really important for the layer to create a welcoming experience for new users. If there's a common issue with building widely used packages, it might not provide the best first-time experience for them. I encourage you to take a closer look at my earlier comments and consider the options I've suggested- they're intended to help us all move forward together!

]; })
];

ROS_HOSTNAME = "localhost";
ROS_MASTER_URI = "http://localhost:11311";
TURTLEBOT3_MODEL = "burger";
}
File renamed without changes.
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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; };

Expand Down