Skip to content

Commit

Permalink
docs Arena.jl plotPointClouds example (#1011)
Browse files Browse the repository at this point in the history
  • Loading branch information
dehann authored Feb 21, 2024
1 parent 3934f85 commit 80db69d
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 11 deletions.
57 changes: 56 additions & 1 deletion docs/src/concepts/arena_visualizations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,62 @@

## Introduction

Over time, Caesar.jl/Arena.jl has used at various different 3D visualization technologies. Currently work is underway to better standardize within the Julia ecosystem, with the 4th generation of Arena.jl -- note that this is work in progress. Information about legacy generations is included below.
Over time, Caesar.jl/Arena.jl has used at various different 3D visualization technologies.

### Arena.jl Visualization

#### [Plotting a PointCloud](@id viz_pointcloud)

Visualization support for point clouds is available through Arena and Caesar. The follow example shows some of the basics:

```julia
using Arena
using Caesar
using Downloads
using DelimitedFiles
using LasIO
using Test

##

function downloadTestData(datafile, url)
if 0 === Base.filesize(datafile)
Base.mkpath(dirname(datafile))
@info "Downloading $url"
Downloads.download(url, datafile)
end
return datafile
end

testdatafolder = joinpath(tempdir(), "caesar", "testdata") # "/tmp/caesar/testdata/"

lidar_terr1_file = joinpath(testdatafolder,"lidar","simpleICP","terrestrial_lidar1.xyz")
if !isfile(lidar_terr1_file)
lidar_terr1_url = "https://github.com/JuliaRobotics/CaesarTestData.jl/raw/main/data/lidar/simpleICP/terrestrial_lidar1.xyz"
downloadTestData(lidar_terr1_file,lidar_terr1_url)
end

# load the data to memory
X_fix = readdlm(lidar_terr1_file, Float32)
# convert data to PCL types
pc_fix = Caesar._PCL.PointCloud(X_fix);


pl = Arena.plotPointCloud(pc_fix)

```

This should result in a plot similar to:

```@raw html
<p align="center">
<img src="https://github.com/JuliaRobotics/Arena.jl/assets/6412556/7679c346-fbeb-4d84-b20d-13bd589f3338" width="800" border="0" />
</p>
```


!!! note
24Q1: Currently work is underway to better standardize within the Julia ecosystem, with the 4th generation of Arena.jl -- note that this is work in progress. Information about legacy generations is included below.

For more formal visualization support, contact [www.NavAbility.io](http://www.navability.io) via email or slack.
## 4th Generation Dev Scripts using Makie.jl
Expand Down
26 changes: 16 additions & 10 deletions test/pcl/testPointCloud2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,16 @@ end
testdatafolder = joinpath(tempdir(), "caesar", "testdata") # "/tmp/caesar/testdata/"

radarpclfile = joinpath( testdatafolder,"radar", "convertedRadar", "_PCLPointCloud2_15776.dat")
radarpcl_url = "https://github.com/JuliaRobotics/CaesarTestData.jl/raw/main/data/radar/convertedRadar/_PCLPointCloud2_15776.dat"
downloadTestData(radarpclfile,radarpcl_url)
if !isfile(radarpclfile)
radarpcl_url = "https://github.com/JuliaRobotics/CaesarTestData.jl/raw/main/data/radar/convertedRadar/_PCLPointCloud2_15776.dat"
downloadTestData(radarpclfile,radarpcl_url)
end

pandarfile = joinpath(testdatafolder,"lidar","simpleICP","_pandar_PCLPointCloud2.jldat")
pandar_url = "https://github.com/JuliaRobotics/CaesarTestData.jl/raw/main/data/lidar/pandar/_pandar_PCLPointCloud2.jldat"
downloadTestData(pandarfile,pandar_url)

if !isfile(pandarfile)
pandar_url = "https://github.com/JuliaRobotics/CaesarTestData.jl/raw/main/data/lidar/pandar/_pandar_PCLPointCloud2.jldat"
downloadTestData(pandarfile,pandar_url)
end

##
@testset "test Caesar._PCL.PCLPointCloud2 to Caesar._PCL.PointCloud converter." begin
Expand Down Expand Up @@ -252,13 +255,16 @@ end
##

lidar_terr1_file = joinpath(testdatafolder,"lidar","simpleICP","terrestrial_lidar1.xyz")
lidar_terr1_url = "https://github.com/JuliaRobotics/CaesarTestData.jl/raw/main/data/lidar/simpleICP/terrestrial_lidar1.xyz"
downloadTestData(lidar_terr1_file,lidar_terr1_url)
if !isfile(lidar_terr1_file)
lidar_terr1_url = "https://github.com/JuliaRobotics/CaesarTestData.jl/raw/main/data/lidar/simpleICP/terrestrial_lidar1.xyz"
downloadTestData(lidar_terr1_file,lidar_terr1_url)
end

lidar_terr2_file = joinpath(testdatafolder,"lidar","simpleICP","terrestrial_lidar2.xyz")
lidar_terr2_url = "https://github.com/JuliaRobotics/CaesarTestData.jl/raw/main/data/lidar/simpleICP/terrestrial_lidar2.xyz"
downloadTestData(lidar_terr2_file,lidar_terr2_url)

if !isfile(lidar_terr2_file)
lidar_terr2_url = "https://github.com/JuliaRobotics/CaesarTestData.jl/raw/main/data/lidar/simpleICP/terrestrial_lidar2.xyz"
downloadTestData(lidar_terr2_file,lidar_terr2_url)
end

# load the data to memory
X_fix = readdlm(lidar_terr1_file, Float32)
Expand Down

0 comments on commit 80db69d

Please sign in to comment.