Skip to content

Commit

Permalink
Fix odometer example
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Jul 7, 2022
1 parent cb7991a commit 49cf642
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions examples/custom_sensor/Odometer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,16 @@ bool Odometer::Load(const sdf::Sensor &_sdf)
// Advertise topic where data will be published
this->pub = this->node.Advertise<gz::msgs::Double>(this->Topic());

if (_sdf->HasAttribute("gz:odometer"))
{
// Load custom sensor params
auto customElem = _sdf.Element()->GetElement("gz:odometer");
}
else
if (!_sdf.Element()->HasElement("gz:odometer"))
{
gzdbg << "No custom configuration for [" << this->Topic() << "]"
<< std::endl;
return true;
}

// Load custom sensor params
auto customElem = _sdf.Element()->GetElement("gz:odometer");

if (!customElem->HasElement("noise"))
{
gzdbg << "No noise for [" << this->Topic() << "]" << std::endl;
Expand Down

0 comments on commit 49cf642

Please sign in to comment.