Skip to content

Commit c255c58

Browse files
tharp789andrewjong
andauthored
Tharp/mac vo integration (#188)
* adding mac-vo, working docker, node does not spin up yet * adding MAC-VO update * MACVO node can be intialized, have not tested it with image stream * MACVO runs with camera parameter server, but crashes after couple of frames * working inference * trying to get manuel dimension setting working * working manual dimensions, now removing from submodule * removing MAC-VO-ROS2 submodule for custom wrapper * adding mac-vo submoudle * merging robot docker file into existing docker file * fixing error in docker file * working commit with transfer of macvo and updated docker file, not adding submodule and cant connect to nucleus server * adding corrected macvo submodule * removing old submodules from .gitmodules * working macvo integration * testing and adding visualization file * removing frequency print statements * integrated macvo into robot launch, now working * fixing issue with timing if the subscibers are initialized too soon * adding docs for mac vo * adding camera param server and mac-vo docs * Bump version to 1.1.0 for new mac-vo feature * Update isaac to 4.5.0; make sure the ros_ws download URL is version-specific * Parameterize isaac sim version in docker * Add some to robot docker * Remove traj debug from default rviz * Add MACVO to perception * Update with option and docs to enable/disable MACVO * Set USE_MACVO to false by default for now * Fix dockerfile build https://stackoverflow.com/a/56748289 --------- Co-authored-by: Andrew Jong <[email protected]>
1 parent 9dce5cc commit c255c58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1634
-84
lines changed

.env

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
# This top-level .env file under AirStack/ defines variables that are propagated through docker-compose.yaml
12
PROJECT_NAME="airstack"
2-
PROJECT_VERSION="1.0.5"
3+
PROJECT_VERSION="1.1.0"
34
# can replace with your docker hub username
45
PROJECT_DOCKER_REGISTRY="airlab-storage.andrew.cmu.edu:5001/shared"
56
DEFAULT_ISAAC_SCENE="omniverse://airlab-storage.andrew.cmu.edu:8443/Projects/AirStack/fire_academy.scene.usd"
67
PLAY_SIM_ON_START="true"
8+
# the file under robot/docker/ that contains the robot's environment variables
9+
ROBOT_ENV_FILE_NAME="robot.env"

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@
77
[submodule "ground_control_station/ros_ws/src/ros-gst-bridge"]
88
path = ground_control_station/ros_ws/src/ros-gst-bridge
99
url = https://github.com/BrettRD/ros-gst-bridge.git
10+
[submodule "robot/ros_ws/src/autonomy/2_perception/macvo/macvo/src"]
11+
path = robot/ros_ws/src/autonomy/2_perception/macvo/macvo/src
12+
url = https://github.com/MAC-VO/MAC-VO.git
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
# Project Configuration
22

33
The project as a whole can be configured using the `.env` file under the project root.
4-
The variables in the `.env` file gets populated into the root `docker-compose.yml`.
4+
The variables in the `.env` file get propagated into the `docker-compose.yml` files.
5+
6+
7+
The top-level env file is reproduced below:
8+
```bash
9+
--8<-- ".env"
10+
```
11+
12+

docs/robot/common_topics.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

docs/robot/configuration/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Configuration
2+

docs/robot/index.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,48 @@
11
# Robot
22

3+
## Directory Structure
4+
Underneath `AirStack/robot`, there are these directories:
5+
- `docker/`: Contains files related to building and launching the robot Docker container.
6+
- `installation/`: Contains files related to installing the robot software on a physical robot (TODO).
7+
- `ros_ws/`: Contains the ROS 2 workspace for the robot.
8+
39
## Launch Structure
4-
Each high-level module has a `*_bringup` package that contains the launch files for that module. The launch files are located in the `launch` directory of the `*_bringup` package. The launch files are named `*.launch.(xml/yaml/py)` and can be launched with `ros2 launch <module_name>_bringup <module_name>.launch.(xml/yaml/py)`.
10+
Each high-level module under `ros_ws/` has a `[module]_bringup` package that contains the launch files for that module. The launch files are located in the `launch` directory of the `[module]_bringup` package. The launch files are named `*.launch.(xml/yaml/py)` and can be launched with `ros2 launch <module_name>_bringup <module_name>.launch.(xml/yaml/py)`.
11+
12+
At a high level, the launch files are organized as follows:
13+
14+
15+
```
16+
- robot_bringup/: robot.launch.xml
17+
- autonomy_bringup/: autonomy.launch.xml
18+
- interface_bringup/: interface.launch.xml
19+
- sensors_bringup/: sensors.launch.xml
20+
- perception_bringup/: perception.launch.xml
21+
- local_bringup/: local.launch.xml
22+
- global_bringup/: global.launch.xml
23+
- behavior_bringup/: behavior.launch.xml
24+
```
25+
26+
## Configuration
27+
28+
### Desktop vs Jetson
29+
If you look at the `robot/docker/docker-compose.yaml` file, you'll see it contains two services. `robot` is meant for x86-64 desktop development whereas `robot_l4t` is meant to run on NVIDIA Jetson devices. Both extend a base service in `robot/docker/robot-base-docker-compose.yaml`.
30+
31+
### Environment Variables
32+
Environment variables are used to configure the robot Docker container. The top level `AirStack/.env` file points to a `ROBOT_ENV_FILE_NAME` (default: `robot.env`), that in turn is used to load environment variables for the robot Docker container. The file that `ROBOT_ENV_FILE_NAME` points to gets added into the container under `robot/docker/robot-base-docker-compose.yaml`.
33+
34+
The environment variables can be used to trigger nodes to launch. For example, the `USE_MACVO` environmental variable is checked by `perception.launch.xml` to determine whether to launch the `macvo` node.
35+
36+
The file `robot.env` is reproduced below:
37+
```bash
38+
--8<-- "robot/docker/robot.env"
39+
```
40+
41+
## Common Topics
42+
| Topic | Type | Description |
43+
| -------------------------------| ------------------| ---------------------------------------------------------------------------------------------------------------------------|
44+
| `/$ROBOT_NAME/odometry` | [nav_msgs/Odometry](https://docs.ros.org/en/rolling/p/nav_msgs/interfaces/msg/Odometry.html) | Best estimate of robot odometry
45+
| `/$ROBOT_NAME/global_plan` | [nav_msgs/Path](https://docs.ros.org/en/rolling/p/nav_msgs/interfaces/msg/Path.html) | Current target global trajectory for the robot to follow. See [global planning](4_global/planning.md) for more details.
46+
47+
### Rough System Diagram
48+
![AirStack System Diagram](airstack_system_diagram.png)

mkdocs.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ nav:
5656
- docs/development/frame_conventions.md
5757
- Robot:
5858
- docs/robot/index.md
59-
- docs/robot/common_topics.md
6059
- Autonomy Modules:
6160
- Robot Interface:
6261
- docs/robot/autonomy/0_interface/index.md
@@ -130,7 +129,7 @@ theme:
130129
- navigation.indexes
131130
- navigation.path
132131
- navigation.tabs
133-
- navigation.expand
132+
# - navigation.expand
134133
- navigation.footer
135134
- navigation.top
136135
- navigation.sections

robot/docker/Dockerfile.robot

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
3838
RUN sudo add-apt-repository universe \
3939
&& curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg \
4040
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null \
41-
&& apt-get update && apt-get install -y --no-install-recommends \
41+
&& apt-get update && apt upgrade -y && apt-get install -y --no-install-recommends \
4242
ros-humble-desktop \
4343
python3-argcomplete \
4444
&& rm -rf /var/lib/apt/lists/*
@@ -63,6 +63,7 @@ RUN apt update && apt install -y \
6363
cmake build-essential \
6464
less htop jq \
6565
python3-pip \
66+
python3-rosdep \
6667
tmux \
6768
gdb
6869

@@ -78,16 +79,16 @@ RUN apt update -y && apt install -y \
7879
ros-humble-domain-bridge \
7980
libcgal-dev \
8081
python3-colcon-common-extensions
81-
RUN /opt/ros/humble/lib/mavros/install_geographiclib_datasets.sh
8282

83+
RUN /opt/ros/humble/lib/mavros/install_geographiclib_datasets.sh
8384

8485
# Install Python dependencies
8586
RUN pip3 install \
8687
empy \
8788
future \
8889
lxml \
89-
matplotlib \
90-
numpy \
90+
matplotlib==3.8.4 \
91+
numpy==1.24.0 \
9192
pkgconfig \
9293
psutil \
9394
pygments \
@@ -98,8 +99,22 @@ RUN pip3 install \
9899
setuptools \
99100
six \
100101
toml \
101-
scipy
102-
102+
scipy \
103+
torch \
104+
torchvision \
105+
pypose \
106+
rich \
107+
tqdm \
108+
pillow \
109+
flow_vis \
110+
h5py \
111+
evo \
112+
tabulate \
113+
einops \
114+
timm==0.9.12 \
115+
rerun-sdk==0.17 \
116+
yacs \
117+
wandb
103118

104119
# Override install newer openvdb 9.1.0 for compatibility with Ubuntu 22.04 https://bugs.launchpad.net/bugs/1970108
105120
RUN apt remove -y libopenvdb*; \
@@ -124,18 +139,29 @@ EXPOSE 22
124139
ARG REAL_ROBOT=false
125140
RUN if [ "$REAL_ROBOT" = "true" ]; then \
126141
# Put commands here that should run for the real robot but not the sim
127-
128142
echo "REAL_ROBOT is true"; \
129143
apt-get update && apt-get install -y libimath-dev; \
130144
else \
131145
# Put commands here that should be run for the sim but not the real robot
132-
133146
echo "REAL_ROBOT is false"; \
134147
fi
135148

149+
# Downloading model weights for MACVO
150+
WORKDIR /root/model_weights
151+
RUN wget -r "https://github.com/MAC-VO/MAC-VO/releases/download/model/MACVO_FrontendCov.pth" && \
152+
mv /root/model_weights/github.com/MAC-VO/MAC-VO/releases/download/model/MACVO_FrontendCov.pth /root/model_weights/MACVO_FrontendCov.pth && \
153+
rm -rf /root/model_weights/github.com
154+
155+
WORKDIR /root/ros_ws
136156
# Cleanup. Prevent people accidentally doing git commits as root in Docker
137157
RUN apt purge git -y \
138158
&& apt autoremove -y \
139159
&& apt clean -y \
140160
&& rm -rf /var/lib/apt/lists/*
141161

162+
# Install colcon, seems to be getting removed
163+
RUN pip install -U colcon-common-extensions
164+
165+
# Fixes for MACVO Integration
166+
RUN pip install huggingface_hub
167+
RUN pip uninstall matplotlib -y

robot/docker/robot-base-docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ services:
1010
environment:
1111
- DISPLAY
1212
- QT_X11_NO_MITSHM=1
13+
env_file:
14+
- ${ROBOT_ENV_FILE_NAME}
1315
deploy:
1416
# let it use the GPU
1517
resources:

robot/docker/robot.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# These become environment variables in the robot container
2+
USE_MACVO="false"
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
# Camera Parameter Server
3+
4+
## Summary
5+
6+
The camera parameter server was designed to eliminate the need for multiple nodes to subscribe to each camera individually, reducing unnecessary subscribers and callbacks. Its sole purpose is to listen to the camera info topics, store relevant information about the cameras, and provide it on demand for other nodes to query.
7+
8+
## Configuration
9+
10+
The camera parameter server is currently configurable through a non-ROS configuration file. This file allows users to define a list of cameras, specifying their types and topic names. At the top level of the configuration, a base link name is provided to indicate the `tf` name for the robot's center. Additionally, a parameter called `camera_list` contains a list of dictionaries, with each dictionary representing an individual camera. Currently, two camera types are supported: monocular and stereo.
11+
12+
## Parameters
13+
14+
Below are the parameters needed for the meta level camera parameter server configuration, as well as the camera fields needed to specify individual camera types.
15+
16+
### Meta Level Parameters
17+
18+
| <div style="width:220px">Parameter</div> | Description
19+
|----------------------------|---------------------------------------------------------------
20+
| `base_link_frame_id` | The frame name of the base link, or center frame of the robot|
21+
| `camera_list` | A list of dictionaries that define each camera of the system|
22+
23+
### Monocular Camera Parameters
24+
25+
| <div style="width:220px">Parameter</div> | Description
26+
|----------------------------|---------------------------------------------------------------
27+
| `camera_name` | The name of the camera|
28+
| `camera_type` | The type of camera, for monocular being `mono` |
29+
| `camera_info_sub_topic` | The info topic name for the camera, normally `camera_info`|
30+
| `camera_frame_id` | The frame name of the camera to find its tf |
31+
32+
### Stereo Camera Parameters
33+
34+
| <div style="width:220px">Parameter</div> | Description
35+
|----------------------------|---------------------------------------------------------------
36+
| `camera_name` | The name of the camera|
37+
| `camera_type` | The type of camera, for stereo being `stereo` |
38+
| `camera_info_sub_topic` | The info topic name for the camera, normally `camera_info`|
39+
| `left_camera_frame_id` | The frame name of the left camera for find its tf |
40+
| `right_camera_frame_id` | The frame name of the right camera to find its tf |
41+
42+
## Services
43+
| <div style="width:220px">Parameter</div> | Type | Description
44+
|----------------------------|----------------------------------------|-----------------------|
45+
| `~/get_camera_params` | sensor_interfaces/GetCameraParams | The service to get info about the desired camera. This provides camera intrinsics, transform frame ids, and baseline if the camera type is a stereo|
46+
47+
## Subscriptions
48+
| <div style="width:220px">Parameter</div> | Type | Description
49+
|----------------------------|----------------------------------------|-----------------------|
50+
| `tf/` | tfMessage | Listens for the tf for the specified cameras |
51+
| `~/camera_info` | sensor_msgs/CameraInfo | Listens for the info for specified cameras|

robot/ros_ws/src/autonomy/1_sensors/camera_param_server/camera_param_server/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)