Skip to content

Replace calls to Getlement with FindElement in examples#508

Merged
ahcorde merged 1 commit intogazebosim:mainfrom
Rnishu:replace-get-element-calls
Mar 24, 2025
Merged

Replace calls to Getlement with FindElement in examples#508
ahcorde merged 1 commit intogazebosim:mainfrom
Rnishu:replace-get-element-calls

Conversation

@Rnishu
Copy link
Contributor

@Rnishu Rnishu commented Mar 21, 2025

🦟 Bug fix

Fixes #502

Summary

Replaced calls to GetElement with FindElement in examples


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

Choose a reason for hiding this comment

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

you should check here if customElem is different to nullptr

Suggested change
auto customElem = _sdf.Element()->FindElement("gz:odometer");
auto customElem = _sdf.Element()->FindElement("gz:odometer");
if (customElem)
{

same below

Copy link
Contributor

Choose a reason for hiding this comment

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

actually there is a HasElement("gz:odometer") check above already so should be fine. Same for the one below.

@github-project-automation github-project-automation bot moved this from Inbox to In review in Core development Mar 21, 2025
@iche033
Copy link
Contributor

iche033 commented Mar 21, 2025

please fix DCO. Yu can find info here on how to fix DCO here: https://github.com/gazebosim/gz-sensors/pull/508/checks?check_run_id=39152245654

I'll wait until that's fixed before merging.

…dometer.cc

Signed-off-by: Nishu <nishanthravichandran12@gmail.com>
@Rnishu Rnishu force-pushed the replace-get-element-calls branch from daa1891 to 879686d Compare March 22, 2025 04:17
@iche033 iche033 requested a review from ahcorde March 24, 2025 20:09
@ahcorde ahcorde merged commit 28982a1 into gazebosim:main Mar 24, 2025
10 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Core development Mar 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants