Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasFrey96 committed Feb 20, 2024
1 parent 71d7831 commit 1f4f110
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 502 deletions.
73 changes: 51 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

<p align="center">
<a href="#citation">Citation</a> •
<a href="#setup">Setup</a> •
<a href="#instalation">Installation</a> •
<a href="#overview">Overview</a> •
<a href="#experiments">Experiments</a> •
<a href="#contributing">Contributing</a> •
<a href="#credits">Credits</a>
<a href="#development">Development</a>

![Formatting](https://github.com/leggedrobotics/wild_visual_navigation/actions/workflows/formatting.yml/badge.svg)
</p>
Expand Down Expand Up @@ -53,7 +53,6 @@ Checkout out also our other works.

<img align="right" width="40" height="40" src="https://github.com/leggedrobotics/wild_visual_navigation/blob/main/assets/images/dino.png" alt="Dino">


## Installation

1. Clone the WVN and our STEGO reimplementation.
Expand Down Expand Up @@ -85,10 +84,6 @@ The paths can be specified by modifying `wild_visual_navigation/wild_visual_navi
Add your desired global paths.
Per default, all results are stored in `wild_visual_navigation/results`.

<img align="right" width="40" height="40" src="https://github.com/leggedrobotics/wild_visual_navigation/blob/main/assets/images/dino.png" alt="Dino">

## Overview



<img align="right" width="40" height="40" src="https://github.com/leggedrobotics/wild_visual_navigation/blob/main/assets/images/dino.png" alt="Dino">
Expand All @@ -106,7 +101,21 @@ What we provide:
<img align="right" width="40" height="40" src="https://github.com/leggedrobotics/wild_visual_navigation/blob/main/assets/images/dino.png" alt="Dino">

## Experiments
### [Online] Ros-Mode

### Inference pre-trained model


### Online adaptation [Simulation]


### Online adaptation [Rosbag]

<img align="left" width="120" height="120" src="https://github.com/leggedrobotics/wild_visual_navigation/blob/main/assets/images/mpi_outdoor_trav.png" alt="MPI Outdoor">
<img align="left" width="120" height="120" src="https://github.com/leggedrobotics/wild_visual_navigation/blob/main/assets/images/mpi_indoor_trav.png" alt="MPI Indoor">
<img align="left" width="120" height="120" src="https://github.com/leggedrobotics/wild_visual_navigation/blob/main/assets/images/bahnhofstrasse_trav.png" alt="Bahnhofstrasse">
<img align="left" width="120" height="120" src="https://github.com/leggedrobotics/wild_visual_navigation/blob/main/assets/images/mountain_bike_train_trav.png" alt="Mountain Bike">


#### Setup
Let`s set up a new catkin_ws:
```shell
Expand All @@ -118,8 +127,7 @@ catkin config --extend /opt/ros/noetic
catkin config --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo

# Clone Repos
git clone [email protected]:ANYbotics/anymal_c_simple_description.git
git clone [email protected]:IFL-CAMP/tf_bag.git
git clone [email protected]:ANYbotics/anymal_d_simple_description.git
git clone [email protected]:ori-drs/procman_ros.git

# Symlink WVN
Expand All @@ -130,8 +138,7 @@ rosdep install -ryi --from-paths . --ignore-src

# Build
cd ~/catkin_ws
catkin build anymal_c_simple_description
catkin build tf_bag
catkin build anymal_d_simple_description
catkin build procman_ros
catkin build wild_visual_navigation_ros

Expand All @@ -142,25 +149,36 @@ source ~/catkin_ws/devel/setup.bash

After successfully building the ros workspace you can run the full pipeline by either using the launch file (this requires all packages to be installed into your system python installation), or by running the nodes from the virtual environment as plain python scripts.

- Run WVN Nodes:

- Run wild_visual_navigation
```shell
python wild_visual_navigation_ros/scripts/wvn_feature_extractor_node.py
roslaunch wild_visual_navigation_ros wild_visual_navigation.launch
```

- (ANYmal replay only) Load ANYmal description for RViZ
```shell
python wild_visual_navigation_ros/scripts/wvn_learning_node.py
roslaunch anymal_d_simple_description load.launch
```

- (optionally) RVIZ:
- (ANYmal replay only) Replay Rosbag:
```shell
roslaunch wild_visual_navigation_ros view.launch
robag play --clock path_to_mission/*.bag
```

- (replay only) Replay Rosbag:
- RVIZ:
```shell
rosrun play --clock path_to_mission/*.bag
roslaunch wild_visual_navigation_ros view.launch
```


Degugging (sometimes it is desirable to run the nodes seperate):
```shell
python wild_visual_navigation_ros/scripts/wvn_feature_extractor_node.py
```
```shell
python wild_visual_navigation_ros/scripts/wvn_learning_node.py
```


- The general configuration files can be found under: `wild_visual_navigation/cfg/experiment_params.py`
- This configuration is used in the `offline-model-training` and in the `online-ros` mode.
Expand All @@ -170,6 +188,9 @@ rosrun play --clock path_to_mission/*.bag
- We set an environment variable to automatically load the correct global paths and trigger some special behavior e.g. when training on a cluster.


<img align="right" width="40" height="40" src="https://github.com/leggedrobotics/wild_visual_navigation/blob/main/assets/images/dino.png" alt="Dino">

## Development

### Code formatting
```shell
Expand All @@ -188,7 +209,6 @@ Introduction to [pytest](https://github.com/pluralsight/intro-to-pytest).
pytest
```


### Open-Sourcing
Generating headers
```shell
Expand All @@ -201,4 +221,13 @@ addheader wild_visual_navigation_anymal -t header.txt -p \*.py --sep-len 79 --co

addheader wild_visual_navigation_ros -t header.txt -p \*CMakeLists.txt --sep-len 79 --comment='#' --sep=' '
addheader wild_visual_navigation_anymal -t header.txt -p \*.py -p \*CMakeLists.txt --sep-len 79 --comment='#' --sep=' '
```
```

### Releasing ANYmal data
```shell
rosrun procman_ros sheriff -l ~/git/wild_visual_navigation/wild_visual_navigation_anymal/config/procman/record_rosbags.pmd --start-roscore
```

```shell
rosbag_play --tf --sem --flp --wvn mission/*.bag
```
Binary file added assets/images/bahnhofstrasse_raw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/bahnhofstrasse_trav.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/mountain_bike_trail_raw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/mountain_bike_trail_trav.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/mpi_indoor_raw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/mpi_indoor_trav.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/mpi_outdoor_raw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/mpi_outdoor_trav.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/usr/bin/env python

import rospy
import cv2
import os
from sensor_msgs.msg import Image
from cv_bridge import CvBridge
from message_filters import ApproximateTimeSynchronizer, Subscriber
from PIL import Image as PILImage

class ImageSaver:
def __init__(self):
rospy.init_node('image_saver', anonymous=True)
self.bridge = CvBridge()
self.count = 0


self.dir_path = "/Data/open_source_dataset"
# Create directories to store images
# Subscriber for the images with approximate time synchronization
self.trav_sub = Subscriber("/wild_visual_navigation_visu_traversability_rear/traversability_overlayed", Image)
self.raw_sub = Subscriber("/wide_angle_camera_rear/image_color_rect_resize", Image)
self.sync = ApproximateTimeSynchronizer([self.trav_sub, self.raw_sub], queue_size=1, slop=0.3)
self.sync.registerCallback(self.callback)

def callback(self, trav_msg, raw_msg):
try:
trav_cv2 = self.bridge.imgmsg_to_cv2(trav_msg, desired_encoding="passthrough")
raw_cv2 = self.bridge.imgmsg_to_cv2(raw_msg, desired_encoding="passthrough")

# Convert images to RGBA format
trav_rgba = cv2.cvtColor(trav_cv2, cv2.COLOR_RGB2BGR)
raw_rgba = cv2.cvtColor(raw_cv2, cv2.COLOR_BGR2BGRA)

# Save traversability image
trav_filename = os.path.join(self.dir_path, f"{self.count}_trav.png")
cv2.imwrite(trav_filename, trav_rgba)
rospy.loginfo(f"Saved traversability image: {trav_filename}")

# Save raw image
raw_filename = os.path.join(self.dir_path, f"{self.count}_raw.png")
cv2.imwrite(raw_filename, raw_rgba)
rospy.loginfo(f"Saved raw image: {raw_filename}")

self.count += 1
except Exception as e:
rospy.logerr(f"Error processing images: {e}")

if __name__ == '__main__':
try:
ImageSaver()
rospy.spin()
except rospy.ROSInterruptException:
pass
Loading

0 comments on commit 1f4f110

Please sign in to comment.