Skip to content

Commit

Permalink
update so that the package can find ros libg2o
Browse files Browse the repository at this point in the history
  • Loading branch information
koide3 committed Oct 18, 2018
1 parent 5e0e0cf commit 027cfd2
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 33 deletions.
36 changes: 21 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,20 +65,6 @@ All the parameters are listed in *launch/hdl_graph_slam.launch* as ros params.
- g2o
- suitesparse

Note that ***hdl_graph_slam*** cannot be built with older g2o libraries (such as ros-indigo-libg2o). ~~Install the latest g2o:~~
The latest g2o causes segfault. Use commit *a48ff8c42136f18fbe215b02bfeca48fa0c67507* instead of the latest one:

```bash
sudo apt-get install libsuitesparse-dev
git clone https://github.com/RainerKuemmerle/g2o.git
cd g2o
git checkout a48ff8c42136f18fbe215b02bfeca48fa0c67507
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=RELEASE
make -j8
sudo make install
```

The following ROS packages are required:
- geodesy
- nmea_msgs
Expand All @@ -88,12 +74,27 @@ The following ROS packages are required:
# for indigo
sudo apt-get install ros-indigo-geodesy ros-indigo-pcl_ros ros-indigo-nmea-msgs
# for kinetic
sudo apt-get install ros-kinetic-geodesy ros-kinetic-pcl_ros ros-kinetic-nmea-msgs
sudo apt-get install ros-kinetic-geodesy ros-kinetic-pcl_ros ros-kinetic-nmea-msgs ros-kinetic-libg2o

cd catkin_ws/src
git clone https://github.com/koide3/ndt_omp.git
```

In case use are using ros indigo, note that ***hdl_graph_slam*** cannot be built with ros-indigo-libg2o. ~~Install the latest g2o:~~
The latest g2o causes segfault. Use commit *a48ff8c42136f18fbe215b02bfeca48fa0c67507* instead of the latest one:

```bash
sudo apt-get install libsuitesparse-dev
git clone https://github.com/RainerKuemmerle/g2o.git
cd g2o
git checkout a48ff8c42136f18fbe215b02bfeca48fa0c67507
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=RELEASE
make -j8
sudo make install
```


**[optional]** *bag_player.py* script requires ProgressBar2.
```bash
sudo pip install ProgressBar2
Expand Down Expand Up @@ -172,6 +173,11 @@ rosrun hdl_graph_slam bag_player.py dataset-2.bag

<img src="imgs/ford1.png" height="200pix"/> <img src="imgs/ford2.png" height="200pix"/> <img src="imgs/ford3.png" height="200pix"/>


## Adapt the package to a new sensor



## Common Problems

### hdl_graph_slam_nodelet causes memory error
Expand Down
3 changes: 3 additions & 0 deletions cmake/FindG2O.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ FIND_PATH(G2O_INCLUDE_DIR g2o/core/base_vertex.h
/opt/local/include
/sw/local/include
/sw/include
/opt/ros/$ENV{ROS_DISTRO}/include
NO_DEFAULT_PATH
)

Expand All @@ -25,6 +26,7 @@ MACRO(FIND_G2O_LIBRARY MYLIBRARY MYLIBRARYNAME)
${G2O_ROOT}/lib
$ENV{G2O_ROOT}/lib/Debug
$ENV{G2O_ROOT}/lib
/opt/ros/$ENV{ROS_DISTRO}/lib
NO_DEFAULT_PATH
)

Expand All @@ -49,6 +51,7 @@ MACRO(FIND_G2O_LIBRARY MYLIBRARY MYLIBRARYNAME)
${G2O_ROOT}/lib
$ENV{G2O_ROOT}/lib/Release
$ENV{G2O_ROOT}/lib
/opt/ros/$ENV{ROS_DISTRO}/lib
NO_DEFAULT_PATH
)

Expand Down
25 changes: 7 additions & 18 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,34 +1,23 @@
FROM ros:kinetic

RUN apt-get update
RUN apt-get update
RUN apt-get install -y
RUN apt-get install -y wget nano build-essential
RUN apt-get install -y ros-kinetic-geodesy ros-kinetic-pcl-ros ros-kinetic-nmea-msgs


WORKDIR /root
RUN git clone https://github.com/koide3/g2o.git
WORKDIR /root/g2o
RUN git checkout hdl_graph_slam
WORKDIR /root/g2o/build
RUN mkdir build
RUN cmake .. -DCMAKE_BUILD_TYPE=RELEASE
RUN make -j$(grep -c ^processor /proc/cpuinfo)
RUN make install
RUN apt-get install -y python-pip
RUN apt-get install -y ros-kinetic-geodesy ros-kinetic-pcl-ros ros-kinetic-nmea-msgs ros-kinetic-rviz ros-kinetic-tf-conversions
RUN apt-get install -y ros-kinetic-libg2o

RUN echo te
RUN mkdir -p /root/catkin_ws/src
WORKDIR /root/catkin_ws/src
RUN /bin/bash -c '. /opt/ros/kinetic/setup.bash; catkin_init_workspace'
RUN git clone https://github.com/koide3/ndt_omp.git
RUN git clone https://github.com/koide3/hdl_graph_slam.git

RUN apt-get install -y python-pip
RUN apt-get install -y ros-kinetic-rviz
RUN apt-get install -y ros-kinetic-tf-conversions

WORKDIR /root/catkin_ws
RUN /bin/bash -c '. /opt/ros/kinetic/setup.bash; catkin_make'
RUN sed -i "6i source \"/root/catkin_ws/devel/setup.bash\"" /ros_entrypoint.sh
# RUN /bin/bash -c '. /opt/ros/kinetic/setup.bash; catkin_make'
# RUN sed -i "6i source \"/root/catkin_ws/devel/setup.bash\"" /ros_entrypoint.sh

WORKDIR /

Expand Down
3 changes: 3 additions & 0 deletions launch/hdl_graph_slam_400.launch
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<arg name="enable_floor_detection" default="true" />
<arg name="enable_gps" default="false" />

<!-- transformation between lidar and base_link -->
<node pkg="tf" type="static_transform_publisher" name="lidar2base_publisher" args="0 0 0 0 0 0 base_link velodyne 10" />

<!-- in case you use velodyne_driver, comment out the following line -->
<node pkg="nodelet" type="nodelet" name="$(arg nodelet_manager)" args="manager" output="screen"/>

Expand Down
3 changes: 3 additions & 0 deletions launch/hdl_graph_slam_ford.launch
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<arg name="enable_floor_detection" default="true" />
<arg name="enable_gps" default="true" />

<!-- transformation between lidar and base_link -->
<node pkg="tf" type="static_transform_publisher" name="lidar2base_publisher" args="0 0 0 0 0 0 base_link velodyne 10" />

<!-- in case you use velodyne_driver, comment out the following line -->
<node pkg="nodelet" type="nodelet" name="$(arg nodelet_manager)" args="manager" output="screen"/>

Expand Down

0 comments on commit 027cfd2

Please sign in to comment.