ROS-Mobile / ROS-Mobile-Android

Visualization and controlling application for Android
472 stars 150 forks source link

Location: a widget to publish phone's location to ROS #99

Open graiola opened 1 year ago

graiola commented 1 year ago

Add a widget to publish the phone's coordinates to ROS.

It needs testing and a good code review because I am not an android developer :P

It would solve #98 and #79

nicostudt commented 1 year ago

Thing to discuss: Should the LocationProvider still be running, if the App isnt connected to any Ros Master?

graiola commented 1 year ago

I left you some comments on the code. I'll try it in the next days. So far - good work! Thank you for making this PR

Thank you! :)

Thing to discuss: Should the LocationProvider still be running, if the App isnt connected to any Ros Master?

Actually there is a problem with that: the publisher stops when the phone locks. It would be nice to have the publisher running in the background even if the phone locks. I was thinking to embed the locationManager into a Service but if you have a better idea please let me know.

I will work on the changes in the next days. Thank you again for your amazing work and suggestions.

graiola commented 1 year ago

I made other two branches to test the new google API for the fused location and to test foreground services with the LocationManager. I did not find a way to keep the publisher running when the phone screen gets locked, so I am forcing the screen to stay awake while using the app.

Here are the branches:

https://github.com/graiola/ROS-Mobile-Android/tree/fused

https://github.com/graiola/ROS-Mobile-Android/tree/service

I think the fused method is better because requires way less code to get the current location, moreover it has a way to define the publishing interval.