Monday, September 24, 2012

Enable stdout and stderr for debugging Android?



$ adb shell stop
$ adb shell setprop log.redirect-stdio true
$ adb shell start

It is often a pain to output to the terminal using C++ on Android. Here is the best solution I came across!

Source: http://stackoverflow.com/questions/8870174/is-stdcout-usable-in-android-ndk

I/stdout  ( 7105): Saved 5 data points to input:
I/stdout  ( 7105):     0.162692 -0.85557 0.94647
I/stdout  ( 7105):     0.0343666 0.713827 -0.191865
I/stdout  ( 7105):     0.42557 -0.339379 -0.858582
I/stdout  ( 7105):     -0.289159 -0.268988 -0.126301
I/stdout  ( 7105):     0.64959 0.285136 -0.438644
I/stdout  ( 7105): size:5
I/stdout  ( 7105): Transformed 5 data points:
I/stdout  ( 7105):     0.862692 -0.85557 0.94647
I/stdout  ( 7105):     0.734367 0.713827 -0.191865
I/stdout  ( 7105):     1.12557 -0.339379 -0.858582
I/stdout  ( 7105):     0.410841 -0.268988 -0.126301
I/stdout  ( 7105):     1.34959 0.285136 -0.438644
I/stdout  ( 7105): has converged:1 score: 1.28964e-13
I/stdout  ( 7105):            1  2.38419e-07  1.93715e-07          0.7
I/stdout  ( 7105):   2.5332e-07            1 -2.19792e-07  -1.2368e-07
I/stdout  ( 7105): -7.45059e-08 -3.68804e-07     0.999999 -1.38581e-07
I/stdout  ( 7105):            0            0            0            1

P.S. Now Iterative Closest Point (ICP) algorithm is running on Android properly! Slow but it works! :) 3D reconstruction on Android is coming up next!



-ray

1 comment:

  1. Hey Raymond Lo..
    please let me know some information from you.
    I need to run kinect from android and give the motion gestures to arduino motors.How could i possibly achieve it. I have android programming experience and no experience in Kinect programming.I want to use my mobile as processor and send this signal to arduino.
    Thanking you.

    ReplyDelete