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

Fix <ignition_frame_id> not working for GpuLidarSensor #218

Merged
merged 3 commits into from
Apr 19, 2022
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
2 changes: 1 addition & 1 deletion src/ForceTorqueSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ bool ForceTorqueSensor::Update(const std::chrono::steady_clock::duration &_now)
*msg.mutable_header()->mutable_stamp() = msgs::Convert(_now);
auto frame = msg.mutable_header()->add_data();
frame->set_key("frame_id");
frame->add_value(this->Name());
frame->add_value(this->FrameId());

msgs::Set(msg.mutable_force(), measuredForce);
msgs::Set(msg.mutable_torque(), measuredTorque);
Expand Down
13 changes: 13 additions & 0 deletions src/GpuLidarSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,19 @@ bool GpuLidarSensor::Update(const std::chrono::steady_clock::duration &_now)
// Set the time stamp
*this->dataPtr->pointMsg.mutable_header()->mutable_stamp() =
msgs::Convert(_now);
// Set frame_id
for (auto i = 0;
i < this->dataPtr->pointMsg.mutable_header()->data_size();
++i)
{
if (this->dataPtr->pointMsg.mutable_header()->data(i).key() == "frame_id"
Copy link
Contributor

Choose a reason for hiding this comment

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

Style nits.

The linter is complaining here:

  /github/workspace/src/GpuLidarSensor.cc:260:  Lines should be <= 80 characters long  [whitespace/line_length] [2]
  /github/workspace/src/GpuLidarSensor.cc:264:  Lines should be <= 80 characters long  [whitespace/line_length] [2]

Also, please put the { in a new line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lint is now happy but not so sure about the formating

&& this->dataPtr->pointMsg.mutable_header()->data(i).value_size() > 0)
{
this->dataPtr->pointMsg.mutable_header()->mutable_data(i)->set_value(
0,
this->FrameId());
}
}

this->dataPtr->FillPointCloudMsg(this->laserBuffer);

Expand Down
2 changes: 1 addition & 1 deletion src/SegmentationCameraSensor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ bool SegmentationCameraSensor::Update(
*stamp = msgs::Convert(_now);
auto frame = this->dataPtr->coloredMapMsg.mutable_header()->add_data();
frame->set_key("frame_id");
frame->add_value(this->Name());
frame->add_value(this->FrameId());

this->dataPtr->labelsMapMsg.CopyFrom(this->dataPtr->coloredMapMsg);

Expand Down