The official repository for <Leveraging 3D Reconstruction for Mechanical Search on Cluttered Shelves> (Seungyeon Kim*, Young Hun Kim*, Yonghyeon Lee, and Frank C. Park, CoRL 2023).
This paper introduces a novel framework for finding and grasping a target object using a standard gripper on cluttered shelves, employing pushing and pick and-place actions.
Figure 1: An example trajectory of mechanical search. Each column shows the camera input and action selection at each time step. In the simulation, surrounding objects are blue and the target object is red.
The project is developed under a standard PyTorch environment.
- python 3.9
- pybullet 3.2.3
- pytorch
- matplotlib
- Open3D
- opencv-python
- dominate
- h5py
- pysimplegui
- urdfpy (np.float)
Warining: If you get error "ImportError: cannot import name 'gcd' from 'fractions'", you can solve it by running
conda install -c conda-forge networkx=2.5
.
Warining: If you get error "AttributeError: module 'numpy' has no attribute 'float'", you have to manually revise the code: change
np.float
tofloat
inurdf.py
.
Pre-trained models should be stored in pretrained/
. The pre-trained models are already provided in this repository. After set up, the pretrained/
directory should be follows.
pretrained
├── segmentation_config
│ └── pretrained
│ ├── segmentation_config.yml
│ └── model_best.pkl
├── sqpdnet_config
│ └── pretrained
│ ├── sqpdnet_2d_motion_only_config.yml
│ └── model_best.pkl
└── recognition_config
└── pretrained
├── recognition_config.yml
└── model_best.pkl
The control script in PyBullet simulator is as follows:
python control.py --config configs/control_objects_{X}_config.yml
X
is either2
,4
,6
or8
.--enable_gui
specifies whether PyBullet UI is on or off. The value should beTrue
orFalse
.--device
specifies an GPU number to use.- By changing the
idx
value in the config file, you can see the mechanical search in other scenes.idx
is an integer between 1 and 50. - The experimental results will be saved in
save_dir
in the config file.
Warining: Since the computation speeds of PyBullet are different on Linux and Windows, the experiment results are also different (especially behaves strangely when running on Windows). It is recommended to run the code on Linux.
The script for generating scenes in PyBullet simulator is as follows:
python spawn.py --config configs/spawn_config.yml
--enable_gui
specifies whether PyBullet UI is on or off. The value should beTrue
orFalse
.- You can change the number of objects by changing the
num_objects
value in the config file. - The scenes will be saved in
save_dir
in the config file.
The script for replaying experimental results in PyBullet simulator is as follows:
python replay_episode.py --config configs/replay_episode_config.yml
- You can see other meachanical search results by changing the
exp_name
value in the config file. The value should be the name of a result folder generated from control scripts (i.e.,control.py
). - A PyBullet
mp4
video and apkl
file for Blender video will be saved invideo_dir
andsave_dir
in the config file, respectively.
Warining: If you get error "PyBullet unrecognized option 'preset'", you can solve it by running
conda update ffmpeg
.
Example result PyBullet mp4
video is as follows:
The Blender rendering code is slightly modified from pybullet-blender-recorder. This is tested on Blender 4.0
.
-
Install the blender plugin from pybullet-blender-recorder. The
pyBulletSimImporter.py
is inpybullet_blender
folder. -
After running
replay_episode.py
, you can obtain apkl
file (e.g.,demo.pkl
). In theAnimation
tab on the side bar in Blender, click on[Import simulation]
and navigate to thepkl
file you want to import. -
(Optional) You may use a template for Blender: test.blend.
-
(Optional) If you use the template
test.blend
and replace the data with anotherpkl
file, setTarget
toshelf_for_blender_2_shelf_bottom_4
inTrack To
ofConstraints
ofCamera_L
andCamera_X
. -
Execute
Render > Render Anitaion
. Set the save folder before execution. -
In the saved folder above, run the following codes in the terminal:
ffmpeg -framerate 30 -pattern_type glob -i '*_L.png' -c:v libx264 -pix_fmt yuv420p out_L.mp4
ffmpeg -framerate 30 -pattern_type glob -i '*_R.png' -c:v libx264 -pix_fmt yuv420p out_R.mp4
ffmpeg -framerate 30 -pattern_type glob -i '*_X.png' -c:v libx264 -pix_fmt yuv420p out_X.mp4
Example Blender mp4
videos taken from various angles are as follows:
If you found this repository useful in your research, please consider citing:
@inproceedings{kim2023leveraging,
title={Leveraging 3D Reconstruction for Mechanical Search on Cluttered Shelves},
author={Kim, Seungyeon and Kim, Young Hun and Lee, Yonghyeon and Park, Frank C},
booktitle={Conference on Robot Learning},
pages={822--848},
year={2023},
organization={PMLR}
}