MotionCal - Windows

Status
Not open for further replies.

kvr

Member
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
 
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];
 
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
 
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.
 
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
 
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:
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.
 
Status
Not open for further replies.
Back
Top