-
Notifications
You must be signed in to change notification settings - Fork 158
Location: a widget to publish phone's location to ROS #99
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | ||
| <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/> | ||
| <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" /> | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With a newer Android version you actually have to include the permission for coarse location as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed that in the last commit
| message.setLatitude(latitude); | ||
| message.setLongitude(longitude); | ||
| message.setAltitude(altitude); | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider to include the position_covariance as well to enable the user to use this widget in conjunction with fused odometry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to check how to get these info
| final boolean networkEnabled = locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER); | ||
|
|
||
| if(gpsEnabled) | ||
| locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListenerGps); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it would be nice, if the user can control the minimum distance/time via widget parameters to reduce the drain on the device battery.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the fused provider it is slightly different. I will try to export these parameters in the widget if we decide to keep this version using the LocationManager.
| //this.publishRate = 20f; | ||
| this.text = "Publish phone's location to ROS"; | ||
| this.rotation = 0; | ||
| this.buttonPressed = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this something the user should control via parameters from the config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Text and rotation can be changed by the user
|
Thing to discuss: |
Thank you! :)
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 I will work on the changes in the next days. Thank you again for your amazing work and suggestions. |
|
I made other two branches to test the new google API for the fused location and to test foreground services with the 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. |
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