A ROS driver for the Insta360 X2 camera. This driver is tested on Ubuntu 20.04 with ROS Noetic.
cd ~/catkin_ws/src
git clone https://github.com/ai4ce/insta360_ros_driver
cd ..
Then, the Insta360 libraries need to installed as follows:
- add the header
camera
andstream
header files inside theinclude
- add the
libCameraSDK.so
library under thelib
directory.
Afterwards, install the other required dependencies and build
rosdep install --from-paths src --ignore-src -r -y
catkin build
The camera natively records in YUV format. The conversion to BGR/RGB is CPU-intensive, so this is done in post processing. To use this driver, use the following commands to record data and then process them.
First, access needs to be granted to the USB port. A script is created that automatically searches for the Insta360 camera and grants it permission.
source devel/setup.bash
rosrun insta360_ros_driver setup.sh
Use the following to start recording. Recordings are saved as bag files under the bag_raw
directory.
source devel/setup.bash
roslaunch insta360_ros_driver record.launch
The raw YUV image appears as shown below
After recording, the following commands process all the commands in the bag_raw
directory and save them in the bag_processed
directory. The processing involves the folowing steps:
- Conversion from YUV to BGR
- Image splitting and rotation
- Image undistortion
- Compression into JPEG
roslaunch insta360_ros_driver process.launch
The processed image appears as shown below
It is also possible to view the output of the camera live. This is useful since the raw bag files may be large in size, so doing the processing live can save on space. However, there is a higher chance of image artifacts appearing since this is computationally expensive.
roslaunch insta360_ros_driver live_preview.launch
Undistortion can also be added to the live_preview, at the cost of additional computational load.