Skip to content

Commit 3300e8e

Browse files
committed
style: add progress bar to indicate time and reorganize file to src.
progress bar: clearly know the progress during running. update README as well.
1 parent 7327089 commit 3300e8e

File tree

5 files changed

+3271
-13
lines changed

5 files changed

+3271
-13
lines changed

CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ endif()
1313

1414
add_subdirectory(ufomap)
1515
include_directories(${CMAKE_SOURCE_DIR}/ufomap)
16-
# add_subdirectory(src)
1716

18-
add_executable(dufomap_run dufomap.cpp)
17+
add_executable(dufomap_run src/dufomap.cpp)
1918
set_target_properties(dufomap_run
2019
PROPERTIES
2120
VERSION ${PROJECT_VERSION}
@@ -48,4 +47,4 @@ target_compile_options(dufomap_run
4847

4948
# -Wshadow
5049
# -march=native
51-
)
50+
)

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ cmake -B build -D CMAKE_CXX_COMPILER=g++-10 && cmake --build build
3737
Prepare Data: Teaser data (KITTI 00: 384.4Mb) can be downloaded via follow commands, more data detail can be found in the [dataset section](https://github.com/KTH-RPL/DynamicMap_Benchmark?tab=readme-ov-file#dataset--scripts) or format your own dataset follow [custom dataset section](https://github.com/KTH-RPL/DynamicMap_Benchmark/blob/master/scripts/README.md#custom-dataset).
3838

3939
```bash
40-
wget https://zenodo.org/records/8160051/files/00.zip
41-
unzip 00.zip -d data
40+
wget https://zenodo.org/records/8160051/files/00.zip -p data
41+
unzip data/00.zip -d data
4242
```
4343

4444
Run:
@@ -60,9 +60,8 @@ Please reference to [DynamicMap_Benchmark](https://github.com/KTH-RPL/DynamicMap
6060

6161
Thanks to HKUST Ramlab's members: Bowen Yang, Lu Gan, Mingkai Tang, and Yingbing Chen, who help collect additional datasets.
6262

63-
This work was partially supported by the Wallenberg AI, Autonomous Systems and Software Program ([WASP](https://wasp-sweden.org/)) funded by the Knut and Alice Wallenberg Foundation
63+
This work was partially supported by the Wallenberg AI, Autonomous Systems and Software Program ([WASP](https://wasp-sweden.org/)) funded by the Knut and Alice Wallenberg Foundation including the WASP NEST PerCorSo.
6464

65-
The original DUFOMap code is from the fork repo: [UnknownFreeOccupied/ufomap/tree/dufomap](https://github.com/UnknownFreeOccupied/ufomap/tree/dufomap).
6665
Feel free to explore below projects that use [ufomap](https://github.com/UnknownFreeOccupied/ufomap) (attach code links as follows):
6766
- [RA-L'24 DUFOMap, Dynamic Awareness]()
6867
- [RA-L'23 SLICT, SLAM](https://github.com/brytsknguyen/slict)

dufomap.cpp renamed to src/dufomap.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
// TOML
1616
#include "toml.hpp"
17+
#include "indicators.hpp"
1718

1819
// STL
1920
#include <cstdio>
@@ -365,7 +366,20 @@ int main(int argc, char* argv[])
365366
ufo::PointCloudColor cloud_acc;
366367

367368
std::cout << "[LOG] Step 2: Starting Processing data from: " << path << '\n';
369+
indicators::show_console_cursor(false);
370+
indicators::BlockProgressBar bar{
371+
indicators::option::BarWidth{50},
372+
indicators::option::Start{"["},
373+
indicators::option::End{"]"},
374+
indicators::option::PrefixText{"[LOG] Running dufomap "},
375+
indicators::option::ForegroundColor{indicators::Color::white},
376+
indicators::option::ShowElapsedTime{true},
377+
indicators::option::ShowRemainingTime{true},
378+
indicators::option::FontStyles{std::vector<indicators::FontStyle>{indicators::FontStyle::bold}}
379+
};
380+
368381
for (std::size_t i{}; std::string filename : pcds) {
382+
bar.set_progress(100 * i / pcds.size());
369383
++i;
370384
timing.setTag("Total " + std::to_string(i) + " of " + std::to_string(pcds.size()) +
371385
" (" + std::to_string(100 * i / pcds.size()) + "%)");
@@ -386,7 +400,9 @@ int main(int argc, char* argv[])
386400
timing.print(true, true, 2, 4);
387401
}
388402
}
389-
403+
indicators::show_console_cursor(true);
404+
std::cout << "\033[0m\n[LOG] Step 3: Finished Processing data. Start saving map... " << std::endl;
405+
// bar.is_completed();
390406
if (!config.propagate) {
391407
timing[3].start("Propagate");
392408
map.propagateModified();
@@ -403,12 +419,8 @@ int main(int argc, char* argv[])
403419
ufo::PointCloudColor cloud_static;
404420

405421
for (auto& p : cloud_acc) {
406-
if (!map.seenFree(p)){
407-
// NOTE: change to white color, comment if you want to keep the original color
408-
if (static_cast<ufo::Color&>(p) == ufo::Color{0, 0, 0})
409-
static_cast<ufo::Color&>(p) = ufo::Color{255, 255, 255};
422+
if (!map.seenFree(p))
410423
cloud_static.push_back(p);
411-
}
412424
}
413425

414426
timing[5].stop();

0 commit comments

Comments
 (0)