Motion_example_async - not correct output

28 views
Skip to first unread message

Maria Magica

unread,
Jun 19, 2015, 9:48:27 AM6/19/15
to libfre...@googlegroups.com
I am running the example motion_example_async and I get the following weird output. Any clues?
Untitled.png

Merrill

unread,
Jul 7, 2015, 2:39:08 PM7/7/15
to libfre...@googlegroups.com, magic...@gmail.com
Hi Maria,

Sorry for the slow reply here.  For some reason the new post notifier was sent to my spam folder instead of my regular email box like it usually does.  If for some reason you don't get a fast response here in the future you can contact me directly at merrill.roller AT hillcrestlabs.com (the same goes for anybody else viewing these forums).

Based on the DataModeControlV2Response message, it looks like the device is being asked to go into Format Select = 1 and FF4 = 1 (Inclination).  Did you modify the default motion_example_async file?  I believe the default example file sets FormatSelect = 0 and FF1 = 1 and FF0 = 1 (Pointer and Linear Acceleration).

The settings you chose for Inclination should work fine, but you will need to add some different print functions to see the data.  If you look at Line 225, the example uses the utility function called freesace_util_getAcceleration to pull out the acceleration data from the MotionEngine Output message and then prints it on line 227.  When you change it to Inclination, there is acceleration data to print so it just spits out 0's.  Here is what you would need to add to get Inclination printed to the screen.  Or, you can skip the printing and just use the data in your own application.  I also attached a modified motion_example_async.c file that I tested and successfully prints out the Inclination data for the FSM-9.

// Look for Inclination messages instead of Acceleration
if (message->messageType == FREESPACE_MESSAGE_MOTIONENGINEOUTPUT) {
              rc = freespace_util_getInclination(&(message->motionEngineOutput), &inc);
              if (rc == 0) {
                   printf ("X: % 6.2f, Y: % 6.2f, Z: % 6.2f\n", inc.x, inc.y, inc.z);
              }
        } else if (message != 0) {
             freespace_printMessage(stdout, message);
}


Thanks,
-Merrill
motion_example_async.c

Maria Magica

unread,
Jul 10, 2015, 9:30:05 AM7/10/15
to libfre...@googlegroups.com
Thank you for your reply.I had already solved the problem :) 
Reply all
Reply to author
Forward
0 new messages