Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: MotionCal - Windows

  1. #1
    Junior Member
    Join Date
    Sep 2020
    Posts
    5

    MotionCal - Windows

    Hi, I'm using MotionCal - Windows and its great so far, but I would like to know will it calculate cal info for the accelerometer and gyro?
    Thanks
    kvr

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    12,404
    According to code here :: github.com/PaulStoffregen/NXPMotionSense/blob/master/NXPMotionSense.h#L54

    It loads related calibration data for all three sensors from EEPROM where saved during calibration:
    Code:
    void readMotionSensor(float& ax, float& ay, float& az, float& gx, float& gy, float& gz, float& mx, float& my, float& mz) {
    		if (!newdata) update();
    		newdata = 0;
    		ax = (float)accel_mag_raw[0] * G_PER_COUNT - cal[0];
    		ay = (float)accel_mag_raw[1] * G_PER_COUNT - cal[1];
    		az = (float)accel_mag_raw[2] * G_PER_COUNT - cal[2];
    		gx = (float)gyro_raw[0] * DEG_PER_SEC_PER_COUNT - cal[3];
    		gy = (float)gyro_raw[1] * DEG_PER_SEC_PER_COUNT - cal[4];
    		gz = (float)gyro_raw[2] * DEG_PER_SEC_PER_COUNT - cal[5];
    		float x = (float)accel_mag_raw[3] * UT_PER_COUNT - cal[6];
    		float y = (float)accel_mag_raw[4] * UT_PER_COUNT - cal[7];
    		float z = (float)accel_mag_raw[5] * UT_PER_COUNT - cal[8];

  3. #3
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    5,621
    While the MotionSense library loads the cal data for the accel and gyro I don't believe its ever been updated to do accelerometer calibration. See this PR in the MotionCal Library: Missing ability to calibrate gyroscope & accelerometer #2

  4. #4
    Junior Member
    Join Date
    Sep 2020
    Posts
    5
    Thanks for your comments. When I print out the data sent from MotionCal - Windows app, as its sending it to the micro, it always sends out zeros for accel and gyro cal data, or is there something I'm missing?
    Also MotionCal displays mag hard and soft iron offsets as you are rotating the device, but again there seems to be no info for accel or gyro?
    Thanks

  5. #5
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,750
    Quote Originally Posted by kvr View Post
    it always sends out zeros for accel and gyro cal data, or is there something I'm missing?
    It's not you, it's me. I never got around to adding accelerometer and gyro offset calibration. Odds are very slim I'll ever work on MotionCal again. But the source code is on github if you or anyone else wants to dive in and create a new version with more features.

  6. #6
    Junior Member
    Join Date
    Sep 2020
    Posts
    5
    ok, thanks for your help Paul.

  7. #7
    Junior Member
    Join Date
    Sep 2020
    Posts
    5
    Hi Paul, I was actually looking through the source code to MotionCal - Windows, and are you able to quickly give me a quick startup guide, because I not at all familiar with the IDE's or compilers used to do Windows, or other programming. What I got from the source was you use wxWidgets?

    Thanks
    kvr

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    22,750
    I have always created the Windows version of MotionCal (and all other software I publish for Windows) by cross compiling from Linux. If you want to do it the way I've always done, you'll need Ubuntu 18.04.

    To install the MinGW cross compiler on Ubuntu 18.04, use this command:

    Code:
    sudo apt-get install gcc-mingw-w64 g++-mingw-w64
    Then you'll need to download wxWidgets 3.1.0 source code (download "wxWidgets-3.1.0.tar.bz2", which is the full source - do *not* download any of the wxMSW files). Newer versions should also work, but I have not tested. Best to get 3.1.0 and build on Ubuntu 18.04 so you're using the exact same environment. I haven't worked on MotionCal for a long time, and I do not expect to do any more work on it.

    Extract with this command:

    Code:
    tar -xvf wxWidgets-3.1.0.tar.bz2
    In the extracted source, I ran these commands:

    Code:
    ./configure --prefix=/home/paul/wxwidgets/3.1.0.mingw-opengl --with-opengl --host=i686-w64-mingw32 --build=i686-w64-mingw32 --disable-shared --disable-compat28
    make -j 12
    make install
    You might wish to edit the prefix folder for your own username. The "host" and "build" options are the key ingredient which means you're cross compiling wxWidgets to create a library to link into Windows programs. Without those it will auto-detect your system and build for Linux.

    Once wxWidgets is compiled and installed, you can build MotionCal. Edit the Makefile to select the Windows build. Also edit the pathname to wxWidgets, if you chose a different location to install the compiled wxWidgets.

    Then just run "make". If everything works, you'll end up with a compiled .exe file, which you would copy to a Windows computer to actually run.

    If any of these steps fail, I'm afraid the process of figuring out what's wrong from the usually-unhelpful compiler errors can be a long and difficult path.

    I have no idea how this might be done actually on Windows. I use Linux for almost everything and occasionally Macintosh for video. Other than testing the Windows version of software I write, I pretty much never actually use Windows, so I really can't help with any Windows specific problems.
    Last edited by PaulStoffregen; 10-05-2020 at 09:26 PM. Reason: added a few missing steps and direct link to the 3.1.0 version ;)

  9. #9
    Junior Member
    Join Date
    Sep 2020
    Posts
    5
    Great info Peter, thanks for taking the time. I do all my work in Windows, so I think I'll jump right in the deep end and try to set up for Windows and go from there.

    Thanks again.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •