[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orekit Developers] Status of the Android application -- 2



Hi Alexis,

I'm Pascal from the Orekit team.


Le 10/08/2011 14:09, Alexis ROBERT a écrit :
Hi,

I've just published a new snapshot on the forge, available here :
https://www.orekit.org/forge/attachments/download/56/orekit-20110810.apk

It should now handle Frame conversion as well as Orbit conversion
(with TLE support).
I've tested this last snapshot, and it looks fine to me, you're doing an impressive job.
About the changes since the last snapshot :

* All the work is now being done in a background worker thread with a
ProgressDialog. It means you will not have your UI becoming
unresponsive with a black screen and a "Application non responsive"
dialog as soon as you hit the "Compute" button, but you'll have a
dialog telling you that it's "Working ..."
That's a good point.
Just a word about how I did this. The main problem of having a
ProgressDialog with a background worker thread is handling rotation.
In fact as soon as you rotate, Android will remove the current
instance of your Activity (Activity is the Android term for a window)
and will recreate it with the new orientation. It means that if you
have a worker thread, your thread will continue to work but is not
attached to the new activity so :
   1. As you're not be able to know you have a worker thread currently
working, the new Activity creates a new worker thread and you'll end
up with a bunch of worker threads in parallel if you rotate multiple
times
   2. When any worker thread which is attached to a removed Activity
finishes his work, he pushes the result to the removed Activity and
not to the new one
   3. When any worker thread which is attached to a removed Activity
finishes his work, it will try to close a ProgressDialog which is
unattached to a screen so your application will crash.

The idea is to make the Thread instance as a static member and update
the thread's "instance" member as soon as you create an activity (as
well as some other stuff for the ProgressDialog, because it needs to
be recreated with the new Activity). This is the purpose of the class
ProgressAsyncTask which extends AsyncTask (which is a class present in
the Android API which is here to help executing tasks in background)
but takes care of all the ProgressDialog stuff. Basically, if you use
ProgressAsyncTask, you'll just need 2 lines in your onCreate() method
to add a ProgressDialog with all the rotation handling part :)
I don't get used to Android (I have no smartphone, no tablet ...), I just run the app in the emulator on my Linux desktop and I can't test the rotating use case this way (I let this task to Luc with his tablet), but I trust you :)
* I also catch the exceptions Orekit returns me and output an
AlertDialog so the user can know what's going on instead of having a
"Force close" dialog, that means the application should be far more
stable now (or at least looks to be :) )

Although, I'm sure I'm doing things wrong, but I have some problems
with Orekit throwing exceptions it doesn't claim to throw. For
instance in the Android application if you make an incorrectly
formatted TLE, Orekit will return a
java.lang.StringIndexOutOfBoundsException which will be never catched
and so the application crashes. I also have an other example of a
conversion from a Cartesian orbit with all coordinates set to 0 to a
Keplerian orbit (with a
org.apache.commons.math.exception.MathArithmeticException: zero norm
-- coming from Vector3D.angle).

The uncaught exceptions are unchecked RunTimeException, so you'll have to also catch Exception at the end of the try/catch, not only those declared by Orekit, this avoids the Force Close dialog (I've tested on a bad TLE, it ends with an Error Dialog and you can go back to the app).
* I've tweaked the fields which require to enter double value to show
a numerical keypad (if you use a virtual keyboard) instead of the full
alphabetical keyboard, which could save some time entering the values.
OK (it looks better after I changed from Japan in the Settings ...).
Some double values can be pretty huge (the Central Coefficient Attraction for the Earth is about 4.e+14), is there a way to access some scientific notation ?
* Also, I don't know what you think of them but I'm not very proud of
the dialogs for entering the orbit details
(cartesian/keplerian/circular/equinoctial/except TLE). I think asking
them as a list is not very great and having a standard tabular form
could be better to type the orbit details faster (like the Frame
conversion dialog with the position/velocity entries), but that's my
taste :)
Your taste seems good, it deserves a try :)
* By default, there is some TLE data when you want to enter the
details of a TLE orbit, but that's temporary, it's just because
entering a TLE orbit by hand on the virtual keyboard is *very*
annoying. (it's the ISS orbit data I found on celestrak :) ). A known
issue is that when you rotate, you'll have the same sample TLE data
again, that's because I put this hack a line too far on
TLESelector.java :)
Yes, TLE format is a nightmare.
In a sense, it is not a bad idea to have a kind of guideline to enter it, maybe a line by line, field by field entries with some format control, is it possible ?
If you have any comments, suggestions or questions, I'll be happy to
answer them :)

Have a nice day,

Alexis

Thank you
and have a nice day too.

Pascal

--

--------------------------------------------------------------------

The Orekit team can provide on-call support and training sessions on

the Orekit library. Send a message to orekit@c-s.fr for information

--------------------------------------------------------------------