Skip to content

SuperFCR/rpg_esim

 
 

Repository files navigation

ESIM: an Open Event Camera Simulator

This repository contains the source code for the improved ESIM event camera simulator used in Greate-NeRF Project Page arXiv Code Dataset. In particular, we incorporate the following changes:

  1. Event simulation model
    • Improve the overall event simulation accuracy by accounting for additional edge cases
    • Improve the refractory period model by explicitly resetting the pixel reference intensity and timestamp at the end of the refractory period
    • Desynchronize initial event generation across pixels by randomly initializing pixel reference timestamps
    • Model junction leakage, which increases the rate of ON events and decreases the rate of OFF events
    • Modify the pixel-to-pixel contrast threshold variation model to be time-independent
    • Merge feature/color branch to support color event cameras
  2. Rendering engine
    • Support Blender as a rendering engine specially for blender 3.4~3.6 and 4.0.
  3. Camera trajectory
    • Circumvent singularities in interpolating quaternion orientations by supporting rotation vector/angle-axis orientation representation in the trajectory CSV for interpolation
  4. Miscellaneous
    • Fix various bugs & installation errors

If you use this improved version of ESIM for your work, please cite:

Template
@inproceedings{low2023_robust-e-nerf,
  title = {Robust e-NeRF: NeRF from Sparse & Noisy Events under Non-Uniform Motion},
  author = {Low, Weng Fei and Lee, Gim Hee},
  booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
  year = {2023}
}
@inproceedings{rebecq18_esim,
  author = {Henri Rebecq and Daniel Gehrig and Davide Scaramuzza},
  title = {{ESIM}: an Open Event Camera Simulator},
  journal = {Conf. on Robotics Learning (CoRL)},
  year = 2018
}

Installation

The following installation steps were tested on Ubuntu 20.04 and 22.04 with GTX4060Ti 16GB , GTX 4090, RTX 3090 and RTX A6000 GPUs.

ROS Installation

We highly recommend you to install according to the ROS Wiki,and here is a one-click concise Chinese method if you don't want to spend much time in it.

 wget http://fishros.com/install -O fishros && . fishros

This is a powerful tool that supports:

  • One-click installation: ROS (supports ROS and ROS2, Raspberry Pi Jetson), VsCode (supports amd64 and arm64), github desktop version, nodejs development environment

  • One-click configuration: rosdep (fast and easy to use), ROS environment (quickly update ROS environment settings, automatically generate environment selection), system source (change system source, support full version of Ubuntu system), Docker (support amd64 and arm64), cartographer, WeChat client

ESIM

We recommend creating a new Catkin workspace specifically for ESIM. We name the workspace as esim_ws and place it under the home directory, as follows :

mkdir -p ~/esim_ws/src

Clone this repository into the source space of the workspace with:

cd ~/esim_ws/src
git clone https://github.com/SuperFCR/rpg_esim.git

We also recommend using Conda to set up an environment with the appropriate dependencies for running ESIM, as follows:

  1. Install Mamba, an improved re-implementation of Conda, according to the official instructions
  2. Create the esim environment with:
    mamba env create -f rpg_esim/environment.yml
  3. Activate the environment and initialize rosdep with:
    conda activate esim
    rosdep init
    rosdep update

Initialize and configure the workspace with:

catkin init
catkin config --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo
vcs-import < rpg_esim/dependencies.yaml

cd ze_oss
touch imp_3rdparty_cuda_toolkit/CATKIN_IGNORE \
      imp_app_pangolin_example/CATKIN_IGNORE \
      imp_benchmark_aligned_allocator/CATKIN_IGNORE \
      imp_bridge_pangolin/CATKIN_IGNORE \
      imp_cu_core/CATKIN_IGNORE \
      imp_cu_correspondence/CATKIN_IGNORE \
      imp_cu_imgproc/CATKIN_IGNORE \
      imp_ros_rof_denoising/CATKIN_IGNORE \
      imp_tools_cmd/CATKIN_IGNORE \
      ze_data_provider/CATKIN_IGNORE \
      ze_geometry/CATKIN_IGNORE \
      ze_imu/CATKIN_IGNORE \
      ze_trajectory_analysis/CATKIN_IGNORE

We set -DCMAKE_BUILD_TYPE=RelWithDebInfo, instead of -DCMAKE_BUILD_TYPE=Release, to preserve the ease of debugging while still enabling code optimization during compilation.

Build the esim_ros package with:

catkin build esim_ros

Lastly, add the following alias to your .bashrc file for activating the esim Conda environment and sourcing the ROS environment setup files:

alias cae='conda activate esim; source ~/esim_ws/devel/setup.bash'

The installation steps described above were consolidated from the following sources, with some modifications:

  1. https://github.com/uzh-rpg/rpg_esim/wiki/Installation
  2. https://github.com/uzh-rpg/rpg_esim/wiki/Installation-(ROS-Melodic)
  3. https://robostack.github.io/GettingStarted.html

Blender

To use Blender as the rendering engine, we require Blender as a Python module being installed in a separate blender Conda environment with a compatible Python version and PyZMQ also installed.

We provide a Python wheel for Blender 3.4 and 4.0.3 at this link, which is compiled with CUDA Toolkit 11.3 and NVIDIA OptiX 7.3.0 support (requires NVIDIA R465.84 driver or newer), for Linux and Python 3.10. The blender environment may be created with all the necessary dependencies, including this wheel, with the following:

conda env create -f rpg_esim/blender_environment.yml
conda env create -f rpg_esim/blender_environment_4_0.yml

Alternatively, build Blender as a Python module from source, according to the official instructions, and install it via pip in the blender environment.

Using Blender as the Rendering Engine

Configuration Options

Configuration options for the Blender rendering engine are detailed at the top of blender_renderer.cpp of the imp_blender_renderer ROS package. Note that with N GPUs, the valid blender_render_device_type and blender_render_device_id combinations are as follows:

blender_render_device_type blender_render_device_id
0 (CPU) N
1 (CUDA) 0 to N-1
2 (OptiX) N+1 to 2N

A sample usage is provided in cfg/blender.conf of the esim_ros package.

Training Dataset Making

Running ESIM with Blender

First, start the Blender rendering server on a given port (e.g. 5555) with:

cae
roscd imp_blender_renderer
conda activate blender_4_0
python scripts/blender_bridge.py --port 5555

Then, run ESIM under a given configuration (e.g. cfg/blender.conf) in another terminal with:

cae
roscd esim_ros
roslaunch esim_ros esim.launch config:=cfg/blender.conf

To visualize the output of the simulator, you can open rviz (from a new terminal) as follows:

cae
roscd esim_visualization
rviz -d cfg/esim.rviz

You can also open rqt for more visualizations, as follows:

cae
roscd esim_visualization
rqt --perspective-file cfg/esim.perspective

Please refer to the ESIM wiki for further details on the usage of other rendering engines.

Test Set Making

if your want to generate the test of val dataset using blender 3.4 , you can use the code below:

conda activate blender
python <your_file_path>/bpy_render_views.py

if your want to generate the test of val dataset using blender 4.0 , you can use the code below:

conda activate blender_$_0
python <your_file_path>/bpy_render_views.py

NOTE:Set the blender file path and render path is necessary, and I strongly recommend using bash instead of compiling in blender software, because this may cause the software to crash

About

ESIM: an Open Event Camera Simulator

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 48.4%
  • C 46.7%
  • Python 2.9%
  • CMake 1.5%
  • GLSL 0.5%