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 space nav2 #80

Merged
merged 10 commits into from
Jan 30, 2024
Merged

Add space nav2 #80

merged 10 commits into from
Jan 30, 2024

Conversation

mkhansenbot
Copy link
Contributor

This adds a Dockerfile to build navigation2 on top of Space ROS. It also adds corresponding build.sh and run.sh to build and run the container. Finally, it adds a build step to the workflow to build the osrf/space_nav2 image

Initial files were provided on a branch by @mjeronimo

@mkhansenbot
Copy link
Contributor Author

This is the first PR for: space-ros/space-ros#67

@alexbuyval
Copy link
Contributor

@mkhansenbot I have just tested it locally. I have successfully build the docker image and run it.
However I noticed that 'src' folder was repeated twice in nav2 workspace path.
/home/spaceros-user/nav2_ws/src/src
I think if it was not done by intention you need to remove 'src' in line 46-47 of Dockerfile

RUN mkdir -p ${NAVIGATION2_WS}
WORKDIR ${NAVIGATION2_WS}

Anyway, is there any demos inside which should I test?

@mkhansenbot mkhansenbot marked this pull request as draft August 27, 2023 15:42
@mkhansenbot
Copy link
Contributor Author

Good catch, I found the issue and will push a fix today. I'll also add a README with instructions.

I can currently run the mars_rover demo, along with Nav2 and SLAM, however, SLAM doesn't work yet because I need to add a lidar and encoders to the model to have it publish the /scan and odom topics. I'll submit a separate PR for that to the space-ros/simulation repo

@alexbuyval
Copy link
Contributor

Hi @mkhansenbot
I have just rebuilt the docker and tested it. Everything looks good. Also I have successfully run all launch files you described in the readme. It looks that all nodes started correctly, but since we don't have a correct odometry there are warnings like this:
Timed out waiting for transform from base_link to odom to become available, tf error: Invalid frame ID "odom" passed to canTransform argument target_frame - frame does not exist
As I understand it is ok, right?

@Bckempa Bckempa added this to the humble-2024.01.0 milestone Dec 3, 2023
@quarkytale
Copy link
Contributor

I think the odometry can be solved by adding a OdometryPublisher plugin, see ros_gz_sim_demos/worlds/vehicle.sdf. This tutorial might help as well https://gazebosim.org/docs/fortress/ros2_interop

@mkhansenbot mkhansenbot marked this pull request as ready for review January 21, 2024 17:56
@mkhansenbot
Copy link
Contributor Author

This is now ready for review. I moved the demo specific files into a separate folder "nav2_demo" and moved the instructions for running the demo into the README in that folder.

Copy link
Contributor

@Bckempa Bckempa left a comment

Choose a reason for hiding this comment

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

Haven't built and tested yet but here are some preliminary comments

LABEL org.label-schema.vendor="Open Robotics"
LABEL org.label-schema.version=${VERSION}
LABEL org.label-schema.url="https://github.com/space-ros"
LABEL org.label-schema.vcs-url="https://github.com/space-ros/docker-images"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
LABEL org.label-schema.vcs-url="https://github.com/space-ros/docker-images"
LABEL org.label-schema.vcs-url="https://github.com/space-ros/docker"

Comment on lines +47 to +50
COPY mars_map* /home/spaceros-user/nav2_ws

# Install nav2 config file for mars rover demo
COPY nav2_params.yaml /home/spaceros-user/nav2_ws
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should be able to use the NAVIGATION2_WS variable (maybe as a build arg instead of env var) but I know variable expansion in COPY expressions has been difficult in the past so I'm going to test this myself before adding a suggested patch.

# Run the Mars Rover demo with Nav2 and SLAM toolbox

## Terminal 1 - launch the mars_rover demo
Follow instructions on space-ros/docker/space-robots/README.md
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Follow instructions on space-ros/docker/space-robots/README.md
Follow instructions in the [space-robots `README.md`](../space-robots/README.md)

Exec into the same space_nav2 container and launch Rviz2
```
docker exec -it -e DISPLAY=:0 osrf_space_nav2_demo bash
source /opt/ros/humble/setup.bash
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we installing Space ROS and Humble in the nav container?

To build the docker image, run:

```
$ ./build.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't consistent with how shell scripts are listed in the demo container README, we should make it consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you mean by this, is it the leading $ that is different?


The new image is named **osrf/space_nav2:latest**.

There is a run.sh script provided for convenience that will run the spaceros image in a container.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to mention that rocker is required here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can add it but I don't see it mentioned on the space_robots README, so we should be consistent. I added issue #128 to fix this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is a demo, should we pin these to commits so they don't move out from under us?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this same issue exists for the MoveIt2 demo, I created an issue so we can resolve it for both. #127

## Terminal 2 - launch Nav2
Start the space_nav2 container and launch the navigation2 nodes
```
run.sh
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to note that this requires rocker?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Filed issue #128

LABEL org.label-schema.vendor="Open Robotics"
LABEL org.label-schema.version=${VERSION}
LABEL org.label-schema.url="https://github.com/space-ros"
LABEL org.label-schema.vcs-url="https://github.com/space-ros/docker-images"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
LABEL org.label-schema.vcs-url="https://github.com/space-ros/docker-images"
LABEL org.label-schema.vcs-url="https://github.com/space-ros/docker"

Copy link
Contributor

Choose a reason for hiding this comment

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

@xfiderek should we copy the exclude packages text files pattern here now or hold off incase we convert to Earthfile in the next release?

Copy link
Contributor

@xfiderek xfiderek Jan 22, 2024

Choose a reason for hiding this comment

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

If you are asking in context of rosdep then I would double check if we need rosdep commands at all in here. I think that unless Nav2 requires some non-ROS dependencies then it should not be required 1. @mkhansenbot have you by any chance tried to build this image without rosdep commands? If not maybe its worth trying / we can try together. Btw I see that list of skip keys here is a bit different than in spaceros base image. Is there a specific reason to that?

If it turns out that rosdep is needed I would already make use of text file, however I see that there is a divergence between:

  • "excluded-pkgs.txt"
  • skip keys in spaceros image
  • skip keys in this image

so unless we can address the divergence soon, we need to postpone it.

On the side note (not related to this PR), your question @Bckempa made me wondering and I think that we should have a better way to track what exactly is installed by rosdep and we should be saving such thing as an artifact in base image. What do you think? If yes, we can create item and include it after this release.

Footnotes

  1. As far as I tested, rosdep in base image does not install any ROS-related dependencies.

@mkhansenbot
Copy link
Contributor Author

Please let me know what is needed to get this approved. I think I need to add an issue number to each commit and squash some commits to clean up the history, is that correct?

@mkhansenbot
Copy link
Contributor Author

@Bckempa - I can make the small changes you suggested above when I add the issue number to the commits. I'll do this tonight

@mkhansenbot
Copy link
Contributor Author

I squashed and added the issue to the commit messages. I also fixed the two issues that @Bckempa found in the README files

I think this is ready for review

@ivanperez-keera
Copy link
Contributor

ivanperez-keera commented Jan 30, 2024

@mkhansenbot I think there's a level of detailed being retained here that is unnecessary. I sent you an email with two proposals (one more aggressive, one middle ground). Please check and confirm. Thanks!


EDIT: Just documentation, my thought process is the following:

I think the way to explain this PR is in two or three commits, keeping the detailed history is not necessary.

Proposal one:

image

Alternative middle ground:

image

In the second proposal, other commits not listed there are just squashed with related commits (e.g., fixes to the README are squashed with the commit that introduces the README; it makes no sense to introduce it without fixes and fix it later).

@mkhansenbot
Copy link
Contributor Author

I'm fine with your second proposal

@@ -0,0 +1,47 @@
# Navigation2 Docker Image

The Navigation2 Docker image uses the Space ROS docker image (*openrobotics/spaceros:latest*) as its base image. The Navigation2 Dockerfile installs all of the prerequisite system dependencies to build Navigation2
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this refer to osrf/spaceros:latest instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Resolved.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I made a mistake in my fix below 664665f. It should be space-ros with a hyphen. My commit message spells it right but my actual commit spells it wrong.

@ivanperez-keera
Copy link
Contributor

I'm waiting for this to build before I merge.

@ivanperez-keera ivanperez-keera merged commit bf23e58 into space-ros:main Jan 30, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

8 participants