Skip to content

Commit

Permalink
Revert "Disable cameras after fetching images, projection matrix (mic…
Browse files Browse the repository at this point in the history
…rosoft#2881)"

Running the Image API continuously seems to trigger exceptions

This reverts commit ba4be15.
  • Loading branch information
rajat2004 committed Oct 7, 2020
1 parent 05a9625 commit ed94729
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 73 deletions.
61 changes: 0 additions & 61 deletions PythonClient/multirotor/high_res_camera.py

This file was deleted.

15 changes: 7 additions & 8 deletions Unreal/Plugins/AirSim/Source/PIPCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ void APIPCamera::BeginPlay()

msr::airlib::ProjectionMatrix APIPCamera::getProjectionMatrix(const APIPCamera::ImageType image_type) const
{
msr::airlib::ProjectionMatrix mat;

//TODO: avoid the need to override const cast here
const_cast<APIPCamera*>(this)->setCameraTypeEnabled(image_type, true);
const USceneCaptureComponent2D* capture = const_cast<APIPCamera*>(this)->getCaptureComponent(image_type, false);
Expand Down Expand Up @@ -163,17 +161,18 @@ msr::airlib::ProjectionMatrix APIPCamera::getProjectionMatrix(const APIPCamera::
FMatrix projMatTransposeInAirSim = coordinateChangeTranspose * proj_mat_transpose;

//Copy the result to an airlib::ProjectionMatrix while taking transpose.
msr::airlib::ProjectionMatrix mat;
for (auto row = 0; row < 4; ++row)
for (auto col = 0; col < 4; ++col)
mat.matrix[col][row] = projMatTransposeInAirSim.M[row][col];

return mat;
}
else
else {
msr::airlib::ProjectionMatrix mat;
mat.setTo(Utils::nan<float>());

// Disable camera after our work is done
const_cast<APIPCamera*>(this)->setCameraTypeEnabled(image_type, false);

return mat;
return mat;
}
}

void APIPCamera::Tick(float DeltaTime)
Expand Down
4 changes: 0 additions & 4 deletions Unreal/Plugins/AirSim/Source/UnrealImageCapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ void UnrealImageCapture::getSceneCaptureImage(const std::vector<msr::airlib::Ima
response.width = render_results[i]->width;
response.height = render_results[i]->height;
response.image_type = request.image_type;

// Disable camera after fetching images
APIPCamera* camera = cameras_->at(request.camera_name);
camera->setCameraTypeEnabled(request.image_type, false);
}

}
Expand Down

0 comments on commit ed94729

Please sign in to comment.