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

Add GPS / NavSat sensor to sdf9 #453

Merged
merged 8 commits into from
Aug 14, 2021
Merged

Add GPS / NavSat sensor to sdf9 #453

merged 8 commits into from
Aug 14, 2021

Conversation

Dotrar
Copy link
Contributor

@Dotrar Dotrar commented Dec 30, 2020

Here is a basic GPS implementation built on SDF10

this is related to the following issue: gazebosim/gz-sensors#23 as the GPS sensor will need an SDFormat to go with it.

I copied / got inspired by the code in the imu and altimeter sensors, but I only made a single noise component for both position and velocity.

Hope this suits. I couldn't find a way to squash all of my commits into the 1 result. But if this is accepted then it can just be squashed at merge.

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution! This is going in a good direction, but the API needs to be updated to match the XML spec.

Also, please also add a test for the GPS to test/integration/link_dom.cc, similar to the IMU tests there. This should cover the code path from XML to C++.

https://github.com/osrf/sdformat/blob/f6e029bc88d2ca6c2586fc88dddc0c21f0798f03/test/integration/link_dom.cc#L388-L445

include/sdf/Gps.hh Outdated Show resolved Hide resolved
include/sdf/Gps.hh Outdated Show resolved Hide resolved
@Dotrar
Copy link
Contributor Author

Dotrar commented Dec 30, 2020

I seem to have broken the DCO by using the github auto-edit feature, but each of the commits should be signed off.
my git log:

commit 26296f04edde7443e24c171c8c02e0f04db70c72 (HEAD -> gps_sensor_sdf10, origin/gps_sensor_sdf10)
Author: Dre Westcook <[email protected]>
Date:   Thu Dec 31 10:14:12 2020 +1100

    fixed lints
    
    Signed-off-by: Dre Westcook <[email protected]>

commit b5501938eb38e6d392a5dccc17908074d2e55d61
Author: Dre Westcook <[email protected]>
Date:   Thu Dec 31 09:23:52 2020 +1100

    changed gps to follow spec
    
    Signed-off-by: Dre Westcook <[email protected]>

commit 6599658c77bb818715079d069c16a51346e432af
Author: Dre West <[email protected]>
Date:   Thu Dec 31 08:38:53 2020 +1100

    Update include/sdf/Gps.hh
    
    Co-authored-by: Louise Poubel <[email protected]>
    Signed-off-by: Dre Westcook <[email protected]>

commit 0e54367ab6f874373bac239d3553068f2cac7781
Author: Alejandro Hernández Cordero <[email protected]>
Date:   Tue Dec 29 00:22:16 2020 +0100

    Added render_order to material (#446)
    
    Signed-off-by: ahcorde <[email protected]>

commit 8623a03459644429ebcb45c5df8357073dbd5e08
Author: Dre Westcook <[email protected]>
Date:   Tue Dec 29 10:54:46 2020 +1100

    Add GPS into SDFormat.
    
    Signed-off-by: Dre Westcook <[email protected]>

commit 7dbf12136f01c70470a41255618dd08937e7bfad (tag: sdformat10_10.1.0)
Author: Nate Koenig <[email protected]>
Date:   Tue Dec 15 13:59:31 2020 -0800

    Prepare for 10.1.0 (#442)
    
    Signed-off-by: Nate Koenig <[email protected]>
    
    Co-authored-by: Nate Koenig <[email protected]>

@codecov-io
Copy link

codecov-io commented Dec 30, 2020

Codecov Report

Merging #453 (29e9cae) into sdf10 (d33b4ae) will increase coverage by 0.02%.
The diff coverage is 90.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##            sdf10     #453      +/-   ##
==========================================
+ Coverage   87.78%   87.81%   +0.02%     
==========================================
  Files          62       63       +1     
  Lines        9577     9672      +95     
==========================================
+ Hits         8407     8493      +86     
- Misses       1170     1179       +9     
Impacted Files Coverage Δ
src/Sensor.cc 80.68% <60.00%> (-1.39%) ⬇️
src/SatNav.cc 96.34% <96.34%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d33b4ae...2beecde. Read the comment docs.

@mjcarroll
Copy link
Contributor

How would you feel about changing this to be something like NavSat, as it is more generic. GPS is the American variant of a Satellite Navigation system, and chips that use multiple variants (Glonass, Galileo, Compass) are becoming widely available

@chapulina
Copy link
Contributor

How would you feel about changing this to be something like NavSat

We could add NavSat and keep supporting GPS for a while as legacy, like we're doing for the ray sensors:

https://github.com/osrf/sdformat/blob/cd2ad01d709e754bfdd63b76eb5ffb714cf679a3/sdf/1.7/sensor.sdf#L33

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

I just have minor comments, this is looking good to me.

What do you think of the NavSat idea, @Dotrar ? You'd need to change the new class to sdf::NavSat, as well as the enum... As a reference, see how lidar / ray sensors are implemented.

src/Gps.cc Outdated Show resolved Hide resolved
src/Gps.cc Outdated Show resolved Hide resolved
src/Gps.cc Outdated Show resolved Hide resolved
@Dotrar
Copy link
Contributor Author

Dotrar commented Jan 13, 2021

I just have minor comments, this is looking good to me.

What do you think of the NavSat idea, @Dotrar ? You'd need to change the new class to sdf::NavSat, as well as the enum... As a reference, see how lidar / ray sensors are implemented.

Yeah no worries; I'll see if i can track down all references and change it to NavSat

should it be as easy as a s/Gps/NavSat/g ? also I'll put in those other changes soon.

@chapulina
Copy link
Contributor

should it be as easy as a s/Gps/NavSat/g ?

Thanks! You may also need some s/GPS/NAVSAT/g and s/gps/navSat/g. And git mv Gps NavSat.

@chapulina
Copy link
Contributor

Hi @Dotrar , are you planning to follow up on the NavSat idea? Thanks!

@Dotrar
Copy link
Contributor Author

Dotrar commented Feb 7, 2021

Hi @Dotrar , are you planning to follow up on the NavSat idea? Thanks!

yes, Sorry I'm being a little slow here, all sorts of stuff going on; I'll make sure I get this done soon.

@Dotrar
Copy link
Contributor Author

Dotrar commented Feb 9, 2021

Hey @chapulina ;

I've changed GPS to SATNAV, but I'm not sure if I went too far with changing stuff like the enum in Sensor.hh

https://github.com/osrf/sdformat/blob/master/include/sdf/Sensor.hh#L72

do you want to see if I've got this right? I did try to copy the ray/lidar example but I don't know if that includes in the enum, as there isn't a RAY in the enum.

also I think I've buggered up the commit log a little when I committed without signing then went back trying to sign previous commits; do you mind if I nuke this PR and write it all into a new one? or is this recoverable/not a huge drama?

@Dotrar Dotrar requested a review from chapulina February 9, 2021 09:48
@chapulina chapulina removed the 🏢 edifice Ignition Edifice label Mar 12, 2021
@chapulina chapulina requested a review from adlarkin March 15, 2021 18:56
Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

Thank you for iterating! This is looking good!

I've changed GPS to SATNAV

Would it be possible to use NAVSAT everywhere instead of SATNAV?

I did try to copy the ray/lidar example but I don't know if that includes in the enum, as there isn't a RAY in the enum.

I think that one predated the enum, so we never added it. For GPS, let's keep it there for backwards compatibility. We can remove it in a future version.

do you mind if I nuke this PR and write it all into a new one? or is this recoverable/not a huge drama?

I'm fine with creating a new PR. This should be recoverable though. Try rebasing your branch onto sdf10 and make sure the signature is in every commit's comment. Alternatively, you can squash all commits into one and only sign that one.


I think we should add a navsat.sdf file too, which is a copy of gps. Like we have both ray.sdf and lidar.sdf.

include/sdf/CMakeLists.txt Outdated Show resolved Hide resolved
include/sdf/Sensor.hh Outdated Show resolved Hide resolved
src/CMakeLists.txt Outdated Show resolved Hide resolved
src/SatNav.cc Outdated Show resolved Hide resolved
src/Sensor.cc Outdated Show resolved Hide resolved
@adlarkin
Copy link
Contributor

@chapulina and @scpeters: I have addressed the latest review comments, and believe that this is ready for final review!

Would it be possible to use NAVSAT everywhere instead of SATNAV?

Done in b128c9c. Some files had to be re-named, so apologies if it's a bit of a pain to review these changes 😬

I think we should add a navsat.sdf file too, which is a copy of gps.sdf. Like we have both ray.sdf and lidar.sdf.

I added this in b128c9c. I also updated sensors.sdf to note that gps is now deprecated in favor of navsat. If there are any other documentation files that need to be updated, let me know!


Regarding DCO: once final reviews are done and this PR has been approved, I can try to fix the Git history so that DCO will pass.

@adlarkin adlarkin requested review from scpeters and chapulina June 14, 2021 23:12
@azeey
Copy link
Collaborator

azeey commented Jun 15, 2021

Can I ask why Navsat is preferred over Satnav? The latter seems more generic to me.

@adlarkin
Copy link
Contributor

Can I ask why Navsat is preferred over Satnav? The latter seems more generic to me.

I think the original motivation came from #453 (comment). Maybe @mjcarroll or @chapulina can give their thoughts?

@chapulina
Copy link
Contributor

Can I ask why Navsat is preferred over Satnav? The latter seems more generic to me.

Good question, Satellite Navigation refers to the navigation system, while to me "Navigation Satellite" seems to refer to the specific device, i.e. sensor, being used.

But what motivated my original request was the equivalent ROS message sensor_msgs/NavSatFix. ROS messages are widely used and usually receive a lot of scrutiny (like the recent API review) so I think it's usually a good idea to follow their patterns unless we have a good reason not to.

That said, I don't feel too strongly about this after giving it more thought. If there's enough interest in keeping SatNav I'm ok with that.

@azeey
Copy link
Collaborator

azeey commented Jun 25, 2021

Ah, I didn't know about sensor_msgs/NavSatFix. It makes sense to use NavSat then since there's a precedent.

@mjcarroll
Copy link
Contributor

That said, I don't feel too strongly about this after giving it more thought. If there's enough interest in keeping SatNav I'm ok with that.

If it helps at all, NAVSAT was the precursor to GPS https://en.wikipedia.org/wiki/Transit_(satellite)

Copy link
Collaborator

@azeey azeey left a comment

Choose a reason for hiding this comment

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

The code looks good. I think it can go into sdf9 though.

src/Sensor_TEST.cc Show resolved Hide resolved
Dre Westcook and others added 8 commits August 13, 2021 16:33
@chapulina chapulina changed the base branch from sdf10 to sdf9 August 13, 2021 23:35
@chapulina chapulina changed the title Add GPS sensor to SDF10 Add GPS sensor to sdf9 Aug 13, 2021
@chapulina chapulina added 🏰 citadel Ignition Citadel and removed 🔮 dome Ignition Dome labels Aug 13, 2021
Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

Rebased to sdf9, LGTM!

@chapulina chapulina enabled auto-merge (squash) August 13, 2021 23:38
@chapulina chapulina merged commit b889d93 into gazebosim:sdf9 Aug 14, 2021
@chapulina chapulina changed the title Add GPS sensor to sdf9 Add GPS / NavSat sensor to sdf9 Dec 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants