A tool for slam pose visualizing via ADB stream base on pypangolin and pyopenGL.
Suppose you have your VO / VIO / SLAM algorithm running online and printing realtime position and quaternion (Twc). You can use this tool to visualize the realtime camera pose.
First, compile official Pangolin python lib.
# Get Pangolin
cd ~/your_fav_code_directory
git clone --recursive https://github.com/stevenlovegrove/Pangolin.git
cd Pangolin
# Install dependencies (as described above, or your preferred method)
./scripts/install_prerequisites.sh recommended
# Configure and build
cmake -B build
cmake --build build
# GIVEME THE PYTHON STUFF!!!! (Check the output to verify selected python version)
cmake --build build -t pypangolin_pip_install
sudo make install
After that, you could run the following script in python to verify Pangolin lib is installed.
import pangolin
Then you could run our script.
cd ~/your_fav_code_directory
git clone https://github.com/wangyendt/adbSlamPoseVisualizer
cd adbSlamPoseVisualizer
python run_me.py # run example
In your script, define a handler to handle each line of your logcat to extract the required pose and quaternion, a.k.a Twc. If you are not familiar with the procedure, you can call reader.help()
to show an example code.
from DataReader import DataReader
from Visualizer import Visualizer
def handler(line: str) -> List[float]:
if line and 'Twc' in line:
data = [float(d) for d in re.findall(r'Twc:(.*)', line)[0].split(',')]
return data
else:
return []
reader = DataReader()
reader.register_online_reader(handler)
visualizer = Visualizer(reader)
visualizer.run()
If you have a log file, you can use this offline version. The data format should be like:
timestamp, pos_x, pos_y, pos_z, quat_w, quat_x, quat_y, quat_z
Make sure the delimiter to be either comma or space. And quaternion uses Hamiton convention.
from DataReader import DataReader
from Visualizer import Visualizer
reader = DataReader()
reader.register_offline_reader('example/data.csv')
visualizer = Visualizer(reader)
visualizer.run()
MIT License
Copyright (c) 2022 Ye Wang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
(To be added)
Thanks to the following repo: