Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voxel grid construction #3209

Merged
merged 9 commits into from
Dec 16, 2020
Merged

Voxel grid construction #3209

merged 9 commits into from
Dec 16, 2020

Conversation

saihv
Copy link
Contributor

@saihv saihv commented Dec 12, 2020

About

This PR introduces a feature that constructs ground truth voxel grids of the world directly from Unreal Engine. The voxel grids are stored in a binvox format which can then be converted by the user into an octomap .bt or any other relevant, desired format. Subsequently, these voxel grids/octomaps can be used within mapping/planning.

The logic for constructing the voxel grid is in WorldSimApi.cpp->createVoxelGrid(). For now, the assumption is that the voxel grid is a cube - and the API call is:

createVoxelGrid(self, position, x, y, z, res, of)

position (Vector3r): Global position around which voxel grid is centered in m
x, y, z (float): Size of each voxel grid dimension in m
res (float): Resolution of voxel grid in m
of (str): Name of output file to save voxel grid as

How Has This Been Tested?

Simple test script:

import airsim
c = airsim.VehicleClient()
center = a.Vector3r(0, 0, 0)
c.createVoxelGrid(center, 100, 100, 100, 0.5, "map.binvox")

viewvox is a nifty little utility to then visualize the created binvox file. Similarly, binvox2bt can convert the binvox to an octomap file.

Example voxel grid in Blocks:

image

Copy link
Contributor

@rajat2004 rajat2004 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, looks pretty awesome

Unreal/Plugins/AirSim/Source/WorldSimApi.cpp Show resolved Hide resolved
Unreal/Plugins/AirSim/Source/WorldSimApi.cpp Outdated Show resolved Hide resolved
@saihv
Copy link
Contributor Author

saihv commented Dec 12, 2020

@jonyMarino @zimmy87 Any idea why the azure CI pipelines are not getting triggered for PRs?

@rajat2004
Copy link
Contributor

Yup, fixing the CI would be a big help, there's an open PR to add Gtihub Actions also, to replace Travis - #3180

Copy link
Contributor

@rajat2004 rajat2004 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small nitpicks

Unreal/Plugins/AirSim/Source/WorldSimApi.cpp Outdated Show resolved Hide resolved
Unreal/Plugins/AirSim/Source/WorldSimApi.cpp Outdated Show resolved Hide resolved
Unreal/Plugins/AirSim/Source/WorldSimApi.cpp Outdated Show resolved Hide resolved
@rajat2004
Copy link
Contributor

Seems like Azure Pipelines is active now, from the latest commit checks
Though Windows build has failed

@saihv
Copy link
Contributor Author

saihv commented Dec 15, 2020

It's the Windows container initialization that's failing during CI.

@jonyMarino Just a heads up

2020-12-14T22:53:40.8901202Z 
##[section]Starting: Initialize containers
2020-12-14T22:53:41.0464982Z 
##[command]C:\Program Files\Docker\docker.EXE version --format '{{.Server.APIVersion}}'
2020-12-14T22:53:42.6313274Z error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/version: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.
2020-12-14T22:53:42.6315842Z '
2020-12-14T22:53:42.8171413Z 
##[error]Exit code 1 returned from process: file name 'C:\Program Files\Docker\docker.EXE', arguments 'version --format '{{.Server.APIVersion}}''.
2020-12-14T22:53:42.8190394Z 
##[section]Finishing: Initialize containers

@jonyMarino jonyMarino closed this Dec 15, 2020
@jonyMarino jonyMarino reopened this Dec 15, 2020
@jonyMarino
Copy link
Collaborator

jonyMarino commented Dec 15, 2020

Hi @saihv, I do not know if you get a notification with the CI results.

@saihv
Copy link
Contributor Author

saihv commented Dec 15, 2020

@jonyMarino Thanks for re-enabling CI - will fix the Unity build shortly.

EDIT: fixed

@jonyMarino
Copy link
Collaborator

jonyMarino commented Dec 16, 2020

Thank @rajat2004. This came from his work with GitHub Actions (#3180). We still see what happens with Azure pipelines.
Thanks for the fixes!

Copy link
Contributor

@zimmy87 zimmy87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this locally and it works for me. Only comment is function naming-related.

PythonClient/airsim/client.py Outdated Show resolved Hide resolved
@zimmy87 zimmy87 merged commit aa61eb5 into microsoft:master Dec 16, 2020
Copy link
Contributor

@rajat2004 rajat2004 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit late now, just pointing it out so that it doesn't get forgotten, maybe will add it in a new PR (along with some doc updates)


Args:
position (Vector3r): Position around which voxel grid is centered in m
x, y, z (float): Size of each voxel grid dimension in m
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be int, not float, from the method arguments defined in C++

@GuangyaoSHI
Copy link

About

This PR introduces a feature that constructs ground truth voxel grids of the world directly from Unreal Engine. The voxel grids are stored in a binvox format which can then be converted by the user into an octomap .bt or any other relevant, desired format. Subsequently, these voxel grids/octomaps can be used within mapping/planning.

The logic for constructing the voxel grid is in WorldSimApi.cpp->createVoxelGrid(). For now, the assumption is that the voxel grid is a cube - and the API call is:

createVoxelGrid(self, position, x, y, z, res, of)

position (Vector3r): Global position around which voxel grid is centered in m
x, y, z (float): Size of each voxel grid dimension in m
res (float): Resolution of voxel grid in m
of (str): Name of output file to save voxel grid as

How Has This Been Tested?

Simple test script:

import airsim
c = airsim.VehicleClient()
center = a.Vector3r(0, 0, 0)
c.createVoxelGrid(center, 100, 100, 100, 0.5, "map.binvox")

viewvox is a nifty little utility to then visualize the created binvox file. Similarly, binvox2bt can convert the binvox to an octomap file.

Example voxel grid in Blocks:

image

Thank you for your work. I went over the C++ code. I think here x, y, z are not the the size of one voxel but the overall size of all voxels because I notice that you use x/res to compute number of cells.

@zhudelong
Copy link

Very nice work! Can the voxel grid also model the objects that do not have an entity inside the world model, e.g., leaves?

@Leon-Redfield
Copy link

Hi! I'm trying to get the global map in the format of PointCloud, and I tried to use this api simcreatevoxelGrid() but it seems that it doesn't work well for irregular objects such as trees with leaves. Is there any api or plan to add an api which models the whole part of the objects?

@Anonymous-N
Copy link

hi! Is there any way to get the semantic information of a voxel?thank you

@kingchou007
Copy link

I was wondering how can I get the position of the block.

@kingchou007
Copy link

I was wondering how can I get the position of the block.

such as the position information of obstacles(x, y)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants