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

Set rendering sensor pose #439

Merged
merged 2 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/BoundingBoxCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ bool BoundingBoxCameraSensor::CreateCamera()
this->dataPtr->boundingboxCamera->SetVisibilityMask(
sdfCamera->VisibilityMask());
this->dataPtr->boundingboxCamera->SetBoundingBoxType(this->dataPtr->type);
this->dataPtr->boundingboxCamera->SetLocalPose(this->Pose());

// Add the camera to the scene
this->Scene()->RootVisual()->AddChild(this->dataPtr->rgbCamera);
Expand Down
4 changes: 1 addition & 3 deletions src/CameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ bool CameraSensor::CreateCamera()
this->dataPtr->camera->SetNearClipPlane(cameraSdf->NearClip());
this->dataPtr->camera->SetFarClipPlane(cameraSdf->FarClip());
this->dataPtr->camera->SetVisibilityMask(cameraSdf->VisibilityMask());
this->dataPtr->camera->SetLocalPose(this->Pose());
this->AddSensor(this->dataPtr->camera);

const std::map<SensorNoiseType, sdf::Noise> noises = {
Expand Down Expand Up @@ -453,9 +454,6 @@ bool CameraSensor::Update(const std::chrono::steady_clock::duration &_now)

std::lock_guard<std::mutex> lock(this->dataPtr->mutex);

// move the camera to the current pose
this->dataPtr->camera->SetLocalPose(this->Pose());

if (this->HasInfoConnections())
{
// publish the camera info message
Expand Down
2 changes: 1 addition & 1 deletion src/DepthCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ bool DepthCameraSensor::CreateCamera()
this->dataPtr->depthCamera->SetFarClipPlane(far);
this->dataPtr->depthCamera->SetVisibilityMask(
cameraSdf->VisibilityMask());

this->dataPtr->depthCamera->SetLocalPose(this->Pose());
this->AddSensor(this->dataPtr->depthCamera);

const std::map<SensorNoiseType, sdf::Noise> noises = {
Expand Down
4 changes: 1 addition & 3 deletions src/GpuLidarSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,6 @@ bool GpuLidarSensor::CreateLidar()
return false;
}

this->dataPtr->gpuRays->SetWorldPosition(this->Pose().Pos());
this->dataPtr->gpuRays->SetWorldRotation(this->Pose().Rot());

this->dataPtr->gpuRays->SetNearClipPlane(this->RangeMin());
this->dataPtr->gpuRays->SetFarClipPlane(this->RangeMax());

Expand All @@ -214,6 +211,7 @@ bool GpuLidarSensor::CreateLidar()
this->dataPtr->gpuRays->SetRayCount(this->RayCount());
this->dataPtr->gpuRays->SetVerticalRayCount(
this->VerticalRayCount());
this->dataPtr->gpuRays->SetLocalPose(this->Pose());

this->Scene()->RootVisual()->AddChild(
this->dataPtr->gpuRays);
Expand Down
1 change: 1 addition & 0 deletions src/RgbdCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ bool RgbdCameraSensor::CreateCameras()
}

this->dataPtr->depthCamera->SetVisibilityMask(cameraSdf->VisibilityMask());
this->dataPtr->depthCamera->SetLocalPose(this->Pose());

this->AddSensor(this->dataPtr->depthCamera);

Expand Down
1 change: 1 addition & 0 deletions src/SegmentationCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ bool SegmentationCameraSensor::CreateCamera()
this->dataPtr->camera->SetFarClipPlane(sdfCamera->FarClip());
this->dataPtr->camera->SetAspectRatio(aspectRatio);
this->dataPtr->camera->SetHFOV(angle);
this->dataPtr->camera->SetLocalPose(this->Pose());

// Add the camera to the scene
this->Scene()->RootVisual()->AddChild(this->dataPtr->camera);
Expand Down
2 changes: 1 addition & 1 deletion src/ThermalCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ bool ThermalCameraSensor::CreateCamera()
this->dataPtr->thermalCamera->SetMinTemperature(this->dataPtr->minTemp);
this->dataPtr->thermalCamera->SetMaxTemperature(this->dataPtr->maxTemp);
this->dataPtr->thermalCamera->SetLinearResolution(this->dataPtr->resolution);

this->dataPtr->thermalCamera->SetLocalPose(this->Pose());
this->AddSensor(this->dataPtr->thermalCamera);

const std::map<SensorNoiseType, sdf::Noise> noises = {
Expand Down
4 changes: 1 addition & 3 deletions src/WideAngleCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ bool WideAngleCameraSensor::CreateCamera()
this->dataPtr->camera->SetNearClipPlane(cameraSdf->NearClip());
this->dataPtr->camera->SetFarClipPlane(cameraSdf->FarClip());
this->dataPtr->camera->SetVisibilityMask(cameraSdf->VisibilityMask());
this->dataPtr->camera->SetLocalPose(this->Pose());

rendering::CameraLens lens;
std::string lensType = cameraSdf->LensType();
Expand Down Expand Up @@ -413,9 +414,6 @@ bool WideAngleCameraSensor::Update(
return false;
}

// move the camera to the current pose
this->dataPtr->camera->SetLocalPose(this->Pose());

// render only if necessary
if (!this->dataPtr->pub.HasConnections() &&
this->dataPtr->imageEvent.ConnectionCount() <= 0 &&
Expand Down