mirror of
https://github.com/introlab/rtabmap_ros.git
synced 2026-10-03 16:27:46 +08:00
Added docker examples. rtabmapviz: Fixed empty cloud warnings when not subscribing to any topics.
This commit is contained in:
@@ -47,36 +47,7 @@ $ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ros/kinetic/lib/x86_64-linux-gnu
|
||||
|
||||
### Docker
|
||||
|
||||
* Install rtabmap inside an official ros docker image (example with melodic):
|
||||
```bash
|
||||
$ docker pull ros:melodic-perception
|
||||
$ docker run -it --rm --name=ros-melodic-rtabmap ros:melodic-perception
|
||||
|
||||
# Indide the container:
|
||||
$ apt update && apt install -y ros-melodic-rtabmap-ros && echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
|
||||
|
||||
# Before exiting the container, commit from another terminal on host:
|
||||
$ docker commit ros-melodic-rtabmap ros:melodic-rtabmap
|
||||
# exit container...
|
||||
```
|
||||
* Note that we could build rtabmap from source in the container if we want latest version, following instructions below. Just make sure to do "`echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc`" in the container so that the following example can still work as is.
|
||||
|
||||
* The following example show to launch a camera on host computer and run our pre-built rtabmap container. All examples from [RGB-D tutorial](http://wiki.ros.org/rtabmap_ros/Tutorials/HandHeldMapping) and [stereo tutorial](http://wiki.ros.org/rtabmap_ros/Tutorials/StereoHandHeldMapping) should work using rtabmap from the container instead. Launch camera on host computer (set ROS_IP as the IP used for docker):
|
||||
```bash
|
||||
$ export ROS_IP=172.17.0.1 && roslaunch openni2_launch openni2.launch depth_registration:=true
|
||||
# In another terminal, launch rtabmapviz or RVIZ. We do visualization
|
||||
# on host computer to avoid GPU problems with the container:
|
||||
$ export ROS_NAMESPACE=rtabmap && rosrun rtabmap_ros rtabmapviz _frame_id:=camera_link
|
||||
```
|
||||
|
||||
* Launch rtabmap from inside the container, saving the database on host `~/.ros/rtabmap.db`:
|
||||
```bash
|
||||
$ docker run -it --rm \
|
||||
--env ROS_MASTER_URI=http://172.17.0.1:11311 --env ROS_IP=172.17.0.2 \
|
||||
-v ~/.ros:/root \
|
||||
ros:melodic-rtabmap \
|
||||
roslaunch rtabmap_ros rtabmap.launch rtabmapviz:=false database_path:=/root/rtabmap.db rtabmap_args:="--delete_db_on_start"
|
||||
```
|
||||
* Go to [docker](https://github.com/introlab/rtabmap_ros/tree/master/docker) directory for an example.
|
||||
|
||||
|
||||
## Build from source
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
### Docker
|
||||
|
||||
* Create rtabmap image (example with melodic) from this Dockerfile:
|
||||
```dockerfile
|
||||
FROM ros:melodic-perception
|
||||
# install rtabmap packages
|
||||
RUN apt-get update && apt-get install -y \
|
||||
ros-melodic-rtabmap \
|
||||
ros-melodic-rtabmap-ros \
|
||||
&& rm -rf /var/lib/apt/lists/
|
||||
```
|
||||
* To build an image with latest rtabmap version from source, use Dockerfile inside one of the `latest` subdirectories.
|
||||
|
||||
* Build it:
|
||||
```bash
|
||||
$ docker build --tag ros:rtabmap .
|
||||
```
|
||||
|
||||
* The following example show to launch a camera on host computer and run our pre-built rtabmap container. All examples from [RGB-D tutorial](http://wiki.ros.org/rtabmap_ros/Tutorials/HandHeldMapping) and [stereo tutorial](http://wiki.ros.org/rtabmap_ros/Tutorials/StereoHandHeldMapping) should work using rtabmap from the container instead. Launch camera on host computer (set ROS_IP as the IP used for docker):
|
||||
```bash
|
||||
$ export ROS_IP=172.17.0.1 && roslaunch openni2_launch openni2.launch depth_registration:=true
|
||||
# In another terminal, launch rtabmapviz or RVIZ. We do visualization
|
||||
# on host computer to avoid GPU problems with the container:
|
||||
$ export ROS_NAMESPACE=rtabmap && rosrun rtabmap_ros rtabmapviz _frame_id:=camera_link
|
||||
```
|
||||
|
||||
* Launch rtabmap from inside the container, saving the database on host `~/.ros/rtabmap.db`:
|
||||
```bash
|
||||
$ docker run -it --rm \
|
||||
--env ROS_MASTER_URI=http://172.17.0.1:11311 --env ROS_IP=172.17.0.2 \
|
||||
-v ~/.ros:/root \
|
||||
ros:rtabmap \
|
||||
roslaunch rtabmap_ros rtabmap.launch rtabmapviz:=false database_path:=/root/rtabmap.db rtabmap_args:="--delete_db_on_start"
|
||||
```
|
||||
@@ -0,0 +1,6 @@
|
||||
FROM ros:melodic-perception
|
||||
# install rtabmap packages
|
||||
RUN apt-get update && apt-get install -y \
|
||||
ros-melodic-rtabmap \
|
||||
ros-melodic-rtabmap-ros \
|
||||
&& rm -rf /var/lib/apt/lists/
|
||||
@@ -0,0 +1,33 @@
|
||||
FROM ros:melodic-perception
|
||||
# install rtabmap packages
|
||||
RUN apt-get update && apt-get install -y \
|
||||
ros-melodic-rtabmap-ros \
|
||||
&& apt-get remove -y \
|
||||
ros-melodic-rtabmap \
|
||||
&& rm -rf /var/lib/apt/lists/
|
||||
|
||||
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
|
||||
|
||||
WORKDIR /root/
|
||||
|
||||
RUN git clone https://github.com/introlab/rtabmap.git
|
||||
|
||||
# Build RTAB-Map project
|
||||
RUN source /ros_entrypoint.sh && \
|
||||
cd rtabmap/build && \
|
||||
cmake .. && \
|
||||
make -j$(nproc) && \
|
||||
make install && \
|
||||
cd ../.. && \
|
||||
rm -rf rtabmap && \
|
||||
ldconfig
|
||||
|
||||
RUN source /ros_entrypoint.sh && \
|
||||
mkdir -p catkin_ws/src && \
|
||||
cd catkin_ws/src && \
|
||||
catkin_init_workspace && \
|
||||
git clone https://github.com/introlab/rtabmap_ros.git && \
|
||||
cd .. && \
|
||||
catkin_make -DCMAKE_INSTALL_PREFIX=/opt/ros/melodic install && \
|
||||
cd && \
|
||||
rm -rf catkin_ws
|
||||
+2
-2
@@ -937,8 +937,8 @@ void GuiWrapper::commonOdomCallback(
|
||||
return;
|
||||
}
|
||||
|
||||
cv::Mat rgb = cv::Mat::zeros(2,1,CV_8UC1);
|
||||
cv::Mat depth = cv::Mat::zeros(2,1,CV_16UC1);
|
||||
cv::Mat rgb;
|
||||
cv::Mat depth;
|
||||
CameraModel model(
|
||||
1,
|
||||
1,
|
||||
|
||||
Reference in New Issue
Block a user