Sphero: getting real time location data to stop sphero (android) -


i trying build android application sphero need stop sphero in zones of room , trying locatordata using devicemessenger.asyncdatalistener.

i have noticed, impossible tell while still rolling , stop when in set of coordinates, because data arrives great delay. stops farther , can see coordinates increasing delay on screen. know communication asynchronous , somehow losing data during communication thought giving him window around coordinates want him able stop him more or less in zone, doesn't works decently.

for now, solution i've come send roll command, calculate amount of time needs roll coordinates based on velocity , send delayed stop command, don't solution , don't think it's going work correctly in long run, when implement features need. have suggestions locatordata , how use in case?

i have used 'locatordata' before , trying possible. there couple ways can go accomplishing it.

the great delay experiencing not communication delay, fact locator sensor updates 10 times second (10hz). however, should still more enough time work within constraints of stopping ball within boundary. factor is, have thought ball needs 1-2 feet come stop? depends on speed ball traveling when send stop rolling command.

one way cab accomplish goal driving ball @ slower speed. if drive @ 50% power instead of 100% results should more accurate. since, time delay , stop delay have less impact on accuracy.

another way accomplish doing predictive algorithm. using 'locatordata', know ball (x, y), , know velocity in traveling (vx, vy) can predict going in future. therefore, can send stop command in advance when algorithm determines ball @ destination in 1-2 seconds.

you might want configurelocator command well, since can make starting point of ball (x=0, y=0).

i hope information helps!


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -