Skip to content

Commit

Permalink
move to github
Browse files Browse the repository at this point in the history
  • Loading branch information
atenpas committed May 23, 2017
1 parent fba538b commit 15a1e72
Show file tree
Hide file tree
Showing 85 changed files with 115,892 additions and 0 deletions.
252 changes: 252 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,252 @@
cmake_minimum_required(VERSION 2.8.3)
project(gpd)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS cmake_modules eigen_conversions geometry_msgs message_generation roscpp
sensor_msgs std_msgs)

# PCL
find_package(PCL REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

# OpenCV
find_package(OpenCV)

find_library(GENERATOR_LIB grasp_candidates_generator)
# include_directories(${GENERATOR_LIB_INCLUDE_DIRS})

# CAFFE
IF(NOT EXISTS ${CAFFE_DIR})
SET(CAFFE_DIR "$ENV{CAFFE_DIR}")
SET(CAFFE_DIR "/home/andreas/software/caffe/build")
ENDIF()
MESSAGE("CAFFE_DIR: " ${CAFFE_DIR})
find_package(Caffe)
include_directories(${Caffe_INCLUDE_DIRS})
add_definitions(${Caffe_DEFINITIONS})

## Set compiler optimization flags
set(CMAKE_CXX_FLAGS "-DNDEBUG -O3 -fopenmp -flto -Wno-deprecated -Wenum-compare")
# set(CMAKE_CXX_FLAGS "-DNDEBUG -O3 -fopenmp -flto -mavx -mfma -Wno-deprecated -Wenum-compare")

## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
## See http://ros.org/doc/api/catkin/html/user_guide/setup_dot_py.html
# catkin_python_setup()

################################################
## Declare ROS messages, services and actions ##
################################################

## To declare and build messages, services or actions from within this
## package, follow these steps:
## * Let MSG_DEP_SET be the set of packages whose message types you use in
## your messages/services/actions (e.g. std_msgs, actionlib_msgs, ...).
## * In the file package.xml:
## * add a build_depend tag for "message_generation"
## * add a build_depend and a run_depend tag for each package in MSG_DEP_SET
## * If MSG_DEP_SET isn't empty the following dependency has been pulled in
## but can be declared for certainty nonetheless:
## * add a run_depend tag for "message_runtime"
## * In this file (CMakeLists.txt):
## * add "message_generation" and every package in MSG_DEP_SET to
## find_package(catkin REQUIRED COMPONENTS ...)
## * add "message_runtime" and every package in MSG_DEP_SET to
## catkin_package(CATKIN_DEPENDS ...)
## * uncomment the add_*_files sections below as needed
## and list every .msg/.srv/.action file to be processed
## * uncomment the generate_messages entry below
## * add every package in MSG_DEP_SET to generate_messages(DEPENDENCIES ...)

## Generate messages in the 'msg' folder
add_message_files(FILES CloudIndexed.msg CloudSamples.msg CloudSources.msg GraspConfig.msg GraspConfigList.msg
SamplesMsg.msg)

## Generate services in the 'srv' folder
# add_service_files(
# FILES
# Service1.srv
# Service2.srv
# )

## Generate actions in the 'action' folder
# add_action_files(
# FILES
# Action1.action
# Action2.action
# )

## Generate added messages and services with any dependencies listed here
generate_messages(DEPENDENCIES geometry_msgs sensor_msgs std_msgs)

################################################
## Declare ROS dynamic reconfigure parameters ##
################################################

## To declare and build dynamic reconfigure parameters within this
## package, follow these steps:
## * In the file package.xml:
## * add a build_depend and a run_depend tag for "dynamic_reconfigure"
## * In this file (CMakeLists.txt):
## * add "dynamic_reconfigure" to
## find_package(catkin REQUIRED COMPONENTS ...)
## * uncomment the "generate_dynamic_reconfigure_options" section below
## and list every .cfg file to be processed

## Generate dynamic reconfigure parameters in the 'cfg' folder
# generate_dynamic_reconfigure_options(
# cfg/DynReconf1.cfg
# cfg/DynReconf2.cfg
# )

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES grasp_candidates_classifier
# CATKIN_DEPENDS other_catkin_pkg
# DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(include ${catkin_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})

## Declare a C++ library
add_library(${PROJECT_NAME}_caffe_classifier src/${PROJECT_NAME}/caffe_classifier.cpp)
add_library(${PROJECT_NAME}_clustering src/${PROJECT_NAME}/clustering.cpp)
add_library(${PROJECT_NAME}_data_generator src/${PROJECT_NAME}/data_generator.cpp)
add_library(${PROJECT_NAME}_grasp_detector src/${PROJECT_NAME}/grasp_detector.cpp)
add_library(${PROJECT_NAME}_learning src/${PROJECT_NAME}/learning.cpp)
add_library(${PROJECT_NAME}_sequential_importance_sampling src/${PROJECT_NAME}/sequential_importance_sampling.cpp)
add_library(${PROJECT_NAME}_grasp_image src/${PROJECT_NAME}/grasp_image.cpp)
add_library(${PROJECT_NAME}_grasp_image_15_channels src/${PROJECT_NAME}/grasp_image_15_channels.cpp)

## Add cmake target dependencies of the library
## as an example, code may need to be generated before libraries
## either from message generation or dynamic reconfigure
# add_dependencies(grasp_candidates_classifier ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Declare C++ executables
add_executable(${PROJECT_NAME}_detect_grasps src/nodes/grasp_detection_node.cpp)
add_executable(${PROJECT_NAME}_generate_candidates src/nodes/generate_candidates.cpp)
add_executable(${PROJECT_NAME}_create_grasp_images src/nodes/create_grasp_images.cpp)
add_executable(${PROJECT_NAME}_create_training_data src/nodes/create_training_data.cpp)
add_executable(${PROJECT_NAME}_classify_candidates src/nodes/classify_candidates.cpp)
add_executable(${PROJECT_NAME}_test_occlusion src/tests/test_occlusion.cpp)


## Add cmake target dependencies of the executable
## same as for the library above
# add_dependencies(grasp_candidates_classifier_node ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

## Specify libraries to link a library or executable target against
target_link_libraries(${PROJECT_NAME}_caffe_classifier
${Caffe_LIBRARIES}
${OpenCV_LIBRARIES})

target_link_libraries(${PROJECT_NAME}_clustering
${GENERATOR_LIB})

target_link_libraries(${PROJECT_NAME}_create_grasp_images
${PROJECT_NAME}_learning
${GENERATOR_LIB}
${catkin_LIBRARIES}
${PCL_LIBRARIES})

target_link_libraries(${PROJECT_NAME}_create_training_data
${PROJECT_NAME}_data_generator)

target_link_libraries(${PROJECT_NAME}_data_generator
${PROJECT_NAME}_learning
${GENERATOR_LIB}
${Caffe_LIBRARIES}
${catkin_LIBRARIES}
${PCL_LIBRARIES})

target_link_libraries(${PROJECT_NAME}_generate_candidates
${GENERATOR_LIB}
${catkin_LIBRARIES}
${PCL_LIBRARIES})

target_link_libraries(${PROJECT_NAME}_classify_candidates
${PROJECT_NAME}_grasp_detector
${PROJECT_NAME}_sequential_importance_sampling
${GENERATOR_LIB}
${catkin_LIBRARIES}
${PCL_LIBRARIES})

target_link_libraries(${PROJECT_NAME}_grasp_detector
${PROJECT_NAME}_caffe_classifier
${PROJECT_NAME}_clustering
${PROJECT_NAME}_learning
${GENERATOR_LIB}
${catkin_LIBRARIES}
${Caffe_LIBRARIES})

target_link_libraries(${PROJECT_NAME}_grasp_image
${OpenCV_LIBRARIES})

target_link_libraries(${PROJECT_NAME}_grasp_image_15_channels
${PROJECT_NAME}_grasp_image)

target_link_libraries(${PROJECT_NAME}_learning
${PROJECT_NAME}_grasp_image_15_channels
${GENERATOR_LIB})

target_link_libraries(${PROJECT_NAME}_detect_grasps
${PROJECT_NAME}_grasp_detector
${PROJECT_NAME}_sequential_importance_sampling
${GENERATOR_LIB}
${PCL_LIBRARIES})

target_link_libraries(${PROJECT_NAME}_sequential_importance_sampling
${PROJECT_NAME}_grasp_detector)

target_link_libraries(${PROJECT_NAME}_test_occlusion
${PROJECT_NAME}_learning
${GENERATOR_LIB}
${catkin_LIBRARIES}
${Caffe_LIBRARIES})

target_link_libraries(${PROJECT_NAME}_learning
${GENERATOR_LIB}
${catkin_LIBRARIES}
${Caffe_LIBRARIES})


# Rename targets to simplify their names.
set_target_properties(${PROJECT_NAME}_detect_grasps
PROPERTIES OUTPUT_NAME detect_grasps
PREFIX "")

set_target_properties(${PROJECT_NAME}_classify_candidates
PROPERTIES OUTPUT_NAME classify_candidates
PREFIX "")

set_target_properties(${PROJECT_NAME}_create_grasp_images
PROPERTIES OUTPUT_NAME create_grasp_images
PREFIX "")

set_target_properties(${PROJECT_NAME}_create_training_data
PROPERTIES OUTPUT_NAME create_training_data
PREFIX "")

set_target_properties(${PROJECT_NAME}_test_occlusion
PROPERTIES OUTPUT_NAME test_occlusion
PREFIX "")
120 changes: 120 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Grasp Pose Detection (GPD)

* **Author:** Andreas ten Pas ([email protected])
* **Version:** 1.0.0
* **Author's website:** [http://www.ccs.neu.edu/home/atp/](http://www.ccs.neu.edu/home/atp/)
* **License:** BSD


## 1) Overview

This package detects 6-DOF grasp poses for a 2-finger grasp (e.g. a parallel jaw gripper) in 3D point clouds.

<!-- <img src="readme/examples.png" alt="" style="width: 400px;"/> -->

Grasp pose detection consists of three steps: sampling a large number of grasp candidates, classifying these candidates
as viable grasps or not, and clustering viable grasps which are geometrically similar.

The reference for this package is: [High precision grasp pose detection in dense clutter](http://arxiv.org/abs/1603.01564).

### Baxter Demo

<!--[![Baxter Demo](readme/baxter.png)](https://www.youtube.com/watch?v=p4JXpZVxr48 "Baxter Demo - click to watch")-->
tbd: insert video


### UR5 Demo

tbd: insert video


## 2) Requirements

1. [PCL 1.7 or later](http://pointclouds.org/)
2. [Eigen 3.0 or later](https://eigen.tuxfamily.org)
3. [ROS Indigo](http://wiki.ros.org/indigo)
4. [Caffe](http://caffe.berkeleyvision.org/)


## 3) Prerequisites

The following instructions have been tested on **Ubuntu 14.04**. Similar instructions should work for other Linux
distributions that support ROS.

1. Install Caffe [(Instructions)](http://caffe.berkeleyvision.org/installation.html). Follow the *CMake Build*
instructions. **Notice:** Due to a conflict between the Boost version required by Caffe (1.55) and the one installed as
a dependency with the Debian package for ROS Indigo (1.54), you need to checkout an older version of Caffe that worked
with Boost 1.54. So, when you clone Caffe, please use the command below instead.

```
git clone https://github.com/BVLC/caffe.git && cd caffe && git checkout 923e7e8b6337f610115ae28859408bc392d13136
```

2. Install ROS Indigo [(Instructions)](http://wiki.ros.org/indigo/Installation/Ubuntu).

3. Clone the [grasp_pose_generator](https://github.ccs.neu.edu/atp/gpg) repository into some folder:

```
$ cd <location_of_your_workspace>
$ git clone https://github.ccs.neu.edu/atp/gpg.git
```

4. Build and install the *grasp_pose_generator*:

```
$ cd gpg
$ mkdir build && cd build
$ cmake ..
$ make
$ sudo make install
```


## 4) Compilation

1. Clone this repository.

```
$ cd <location_of_your_workspace/src>
$ git clone https://github.ccs.neu.edu/atp/gpd.git
```

2. Build your catkin workspace.

```
$ cd <location_of_your_workspace>
$ catkin_make
```


## 5) Generate Grasp Candidates for a Point Cloud File

Launch the grasp pose detection on an example point cloud:

```
roslaunch gpd tutorial0.launch
```
Within the GUI that appears, press r to center the view, and q to quit the GUI and load the next visualization.
The output should look similar to the screenshot shown below.

![rviz screenshot](readme/file.png "Grasps visualized in PCL")


## 6) Tutorials

1. [Detect Grasps With an RGBD camera](https://github.ccs.neu.edu/atp/gpd/blob/master/tutorials/tutorial_1_grasps_camera.md)
2. [Detect Grasps on a Specific Object](https://github.ccs.neu.edu/atp/gpd/blob/master/tutorials/tutorial_2_grasp_select.md)


## 7) Parameters

Brief explanations of parameters are given in *launch/classify_candidates_file_15_channels.launch* for using PCD files.
For use on a robot, see *launch/ur5_15_channels.launch*.


## 8) Citation

If you like this package and use it in your own work, please cite our paper ([arXiv](http://arxiv.org/abs/1603.01564)):

[1] Marcus Gualtieri, Andreas ten Pas, Kate Saenko, Robert Platt. **High precision grasp pose detection in dense clutter.** IROS 2016. 598-605.

Loading

0 comments on commit 15a1e72

Please sign in to comment.