Skip to content

Commit

Permalink
Merge pull request #299 from leggedrobotics/dev/sim_jackal_example
Browse files Browse the repository at this point in the history
Jackal example and docker container
  • Loading branch information
JonasFrey96 authored Apr 1, 2024
2 parents 2d8f0ba + b788284 commit a515298
Show file tree
Hide file tree
Showing 39 changed files with 1,557 additions and 78 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.neptune*
wild_visual_navigation/.neptune*
wild_visual_navigation/notebooks*
wild_visual_navigation_ros/output*
results/*
assets/dino/*
assets/stego/cocostuff27_vit_base_5.ckpt
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,13 @@ python wild_visual_navigation_ros/scripts/wvn_learning_node.py

## Development

### Install pre-commit
```shell
pip3 install pre-commit
cd wild_visual_navigation && python3 -m pre_commit install
cd wild_visual_navigation && python3 -m pre_commit run
```

### Code formatting
```shell
# for formatting
Expand Down
8 changes: 4 additions & 4 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#####################
# Base image #
#####################
FROM nvidia/cuda:11.8.0-runtime-ubuntu20.04 as base
FROM nvidia/cuda:12.3.2-runtime-ubuntu20.04 as base

# Labels
LABEL maintainer="Matias Mattamala;Jonas Frey"
Expand Down Expand Up @@ -80,7 +80,7 @@ RUN cd /root \
termcolor \
pydensecrf@git+https://github.com/lucasb-eyer/pydensecrf.git \
liegroups@git+https://github.com/mmattamala/liegroups \
opencv-python>=4.6
opencv-python

# ==
# Remove cache and extra files
Expand All @@ -97,7 +97,7 @@ ARG DEBIAN_FRONTEND=dialog
# Run bash
# ==
CMD ["/bin/bash"]
WORKDIR /root
WORKDIR /root/catkin_ws


###############################################################
Expand All @@ -109,7 +109,7 @@ FROM base as dev

ENV DEBIAN_FRONTEND=noninteractive

RUN mkdir -p catkin_ws/src \
RUN mkdir -p /root/catkin_ws/src \
&& source /opt/ros/noetic/setup.bash \
&& source "/root/.bashrc" \
&& cd /root/catkin_ws && catkin build \
Expand Down
54 changes: 47 additions & 7 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
# Docker files
# Jackal Simulation Demo

## Build and run containers
We provide an example package to demonstrate Wild Visual Navigation on a simulated environment with a Clearpath Jackal robot.

This example should be self-contained and it should run on a Docker container. This was tested on Ubuntu machines, we do not expect the GUI to run on Windows or Mac computers (due to X11 support).


## Build the image

To build the container:

```sh
docker compose -f docker-compose.yaml build
docker compose -f docker-compose-gui-nvidia.yaml build
```

## Run the container

To run the container (terminal-based):

```sh
docker compose -f docker-compose.yaml up -d
docker compose -f docker-compose-gui-nvidia.yaml up -d
```

To launch bash on the container:
Expand All @@ -20,15 +27,48 @@ To launch bash on the container:
docker compose exec wvn bash
```

## Stop the container

To stop the container:

```sh
docker compose -f docker-compose.yaml stop
```

To run the GUI-enabled version and check the Gazebo environment:
## Running Wild Visual Navigation

You can either run the following commands in 4 terminals that initialize a bash terminal in the container, or you can use VS Code with the Docker extension to instantiate terminal in the container directly.

### Launch Jackal sim

```sh
roslaunch wild_visual_navigation_jackal sim.launch
```

### Launch WVN

```sh
roslaunch wild_visual_navigation_jackal wild_visual_navigation.launch
```

### Launch Teleop node

```sh
roslaunch wild_visual_navigation_jackal teleop.launch
```

### Launch RViz window

```sh
roslaunch wild_visual_navigation_jackal view.launch
```


## Troubleshooting

If the GUI doesn't work, you might need to allow the X Server to connect before running the container:

```sh
docker compose -f docker-compose-gui.yaml up -d
docker compose exec wvn_gui bash
xhost +Local:*
xhost
```
2 changes: 1 addition & 1 deletion docker/docker-compose-gui-nvidia.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: "3.9"
services:
wvn:
wvn_nvidia:
extends:
file: docker-compose-gui.yaml
service: wvn
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose-nvidia.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version: "3.9"
services:
wvn:
wvn_nvidia:
extends:
file: docker-compose.yaml
service: wvn
Expand Down
1 change: 0 additions & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ services:
volumes:
- ../../wild_visual_navigation:/root/catkin_ws/src/wild_visual_navigation
- ../../self_supervised_segmentation:/root/catkin_ws/src/self_supervised_segmentation
- ../../segment-anything:/root/catkin_ws/src/segment-anything
environment:
- ROS_IP=127.0.0.1
command: "/bin/bash"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.0.2)
project(wild_visual_navigation_sim)
project(wild_visual_navigation_jackal)

find_package(catkin REQUIRED COMPONENTS
rospy
Expand All @@ -24,4 +24,10 @@ catkin_package(
message(${CATKIN_PACKAGE_SHARE_DESTINATION})
install(DIRECTORY launch Media worlds
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
)

############
## Python ##
############
catkin_install_python(PROGRAMS scripts/jackal_state_converter_node.py
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})
39 changes: 39 additions & 0 deletions wild_visual_navigation_jackal/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Wild Visual Navigation Sim

Simulation environment to test Wild Visual Navigation (WVN). We use a modified Clearpath Jackal (adding a camera).

## Requirements


```sh
wget https://packages.clearpathrobotics.com/public.key -O - | sudo apt-key add -
sudo sh -c 'echo "deb https://packages.clearpathrobotics.com/stable/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/clearpath-latest.list'
sudo apt-get update
```

```sh
sudo apt update
sudo apt install -y \
ros-noetic-jackal-simulator \
ros-noetic-jackal-desktop \
ros-noetic-teleop-twist-keyboard \
ros-noetic-rqt-robot-steering \
```

## Running

```sh
roslaunch wild_visual_navigation_jackal sim.launch
```

```sh
roslaunch wild_visual_navigation_jackal teleop.launch
```

```sh
roslaunch wild_visual_navigation_jackal view.launch
```

```sh
roslaunch wild_visual_navigation_jackal wild_visual_navigation.launch
```
Loading

0 comments on commit a515298

Please sign in to comment.