minimu9-ahrs
minimu9-ahrs copied to clipboard
Altimu 10v5 support
Hi
For my project I needed to adapt your code to use with AltiMU10. I've also set up lps25h and made minor pacer improvements. It's tested and 100% working, thus this PR is not a clean one (changed hardcodes, and set up default device to altimu) As I've found no easy option to add another device, feel free to use and/or adapt my code to your project if you think it's worth it
Best regards and thanks for amazing project, it saved me a lot of programming and provided my high altitude balloon with accurate measurements :)
Yes, I can't accept this as-is because of how much it changes/breaks the software for existing users, but thank you anyway for making the pull request. Someone will probably find it useful. I'll keep this open as a reminder that maybe I should make it easier to add more devices and read data from them.
@Glorf - I also need to be able to determine the altitude with the altimu, so this would be awesome. I'm having trouble building it though.
I first built the upstream minimu9-ahrs by @DavidEGrayson and that works. So I've got all dependencies for building it, and running it works great.
I then cloned your fork @Glorf and tried building that, but I run into the errors I pasted below.
I'm trying building it on a raspi zero running an fully updated Raspbian Buster and I installed the following dependencies:
sudo apt install -y libi2c-dev libeigen3-dev libboost-program-options-dev
$ make
g++ -I. -I/usr/include/eigen3 -Wall -std=gnu++11 -O2 -MD -MP vector.h -o vector.h.gch
g++ -I. -I/usr/include/eigen3 -Wall -std=gnu++11 -O2 -MD -MP -c -o minimu9-ahrs.o minimu9-ahrs.cpp
g++ -I. -I/usr/include/eigen3 -Wall -std=gnu++11 -O2 -MD -MP -c -o lsm303.o lsm303.cpp
g++ -I. -I/usr/include/eigen3 -Wall -std=gnu++11 -O2 -MD -MP -c -o lps25h.o lps25h.cpp
g++ -I. -I/usr/include/eigen3 -Wall -std=gnu++11 -O2 -MD -MP -c -o minimu9.o minimu9.cpp
g++ -I. -I/usr/include/eigen3 -Wall -std=gnu++11 -O2 -MD -MP -c -o lsm6.o lsm6.cpp
g++ -I. -I/usr/include/eigen3 -Wall -std=gnu++11 -O2 -MD -MP -c -o prog_options.o prog_options.cpp
g++ -I. -I/usr/include/eigen3 -Wall -std=gnu++11 -O2 -MD -MP -c -o i2c_bus.o i2c_bus.cpp
i2c_bus.cpp: In member function 'void i2c_bus::write_byte_and_read(uint8_t, uint8_t, uint8_t*, size_t)':
i2c_bus.cpp:80:38: error: invalid use of incomplete type 'struct i2c_msg'
{ address, 0, 1, (typeof(i2c_msg().buf)) &command },
^
In file included from i2c_bus.cpp:8:
/usr/include/linux/i2c-dev.h:66:9: note: forward declaration of 'struct i2c_msg'
struct i2c_msg *msgs; /* pointers to i2c_msgs */
^~~~~~~
i2c_bus.cpp:81:16: error: 'I2C_M_RD' was not declared in this scope
{ address, I2C_M_RD, (typeof(i2c_msg().len)) size, (typeof(i2c_msg().buf)) data },
^~~~~~~~
i2c_bus.cpp:81:16: note: suggested alternative: 'I2C_RDWR'
{ address, I2C_M_RD, (typeof(i2c_msg().len)) size, (typeof(i2c_msg().buf)) data },
^~~~~~~~
I2C_RDWR
i2c_bus.cpp:81:42: error: invalid use of incomplete type 'struct i2c_msg'
{ address, I2C_M_RD, (typeof(i2c_msg().len)) size, (typeof(i2c_msg().buf)) data },
^
In file included from i2c_bus.cpp:8:
/usr/include/linux/i2c-dev.h:66:9: note: forward declaration of 'struct i2c_msg'
struct i2c_msg *msgs; /* pointers to i2c_msgs */
^~~~~~~
i2c_bus.cpp:81:72: error: invalid use of incomplete type 'struct i2c_msg'
{ address, I2C_M_RD, (typeof(i2c_msg().len)) size, (typeof(i2c_msg().buf)) data },
^
In file included from i2c_bus.cpp:8:
/usr/include/linux/i2c-dev.h:66:9: note: forward declaration of 'struct i2c_msg'
struct i2c_msg *msgs; /* pointers to i2c_msgs */
^~~~~~~
i2c_bus.cpp:79:11: error: elements of array 'i2c_msg messages [2]' have incomplete type
i2c_msg messages[2] = {
^~~~~~~~
i2c_bus.cpp:79:11: error: storage size of 'messages' isn't known
i2c_bus.cpp:85:16: error: 'ioctl' was not declared in this scope
int result = ioctl(fd, I2C_RDWR, &ioctl_data);
^~~~~
i2c_bus.cpp: In member function 'void i2c_bus::write(uint8_t, const uint8_t*, size_t)':
i2c_bus.cpp:96:35: error: invalid use of incomplete type 'struct i2c_msg'
{ address, 0, (typeof(i2c_msg().len)) size, (typeof(i2c_msg().buf)) data }
^
In file included from i2c_bus.cpp:8:
/usr/include/linux/i2c-dev.h:66:9: note: forward declaration of 'struct i2c_msg'
struct i2c_msg *msgs; /* pointers to i2c_msgs */
^~~~~~~
i2c_bus.cpp:96:65: error: invalid use of incomplete type 'struct i2c_msg'
{ address, 0, (typeof(i2c_msg().len)) size, (typeof(i2c_msg().buf)) data }
^
In file included from i2c_bus.cpp:8:
/usr/include/linux/i2c-dev.h:66:9: note: forward declaration of 'struct i2c_msg'
struct i2c_msg *msgs; /* pointers to i2c_msgs */
^~~~~~~
i2c_bus.cpp:95:11: error: elements of array 'i2c_msg messages [1]' have incomplete type
i2c_msg messages[1] = {
^~~~~~~~
i2c_bus.cpp:95:11: error: storage size of 'messages' isn't known
i2c_bus.cpp:100:16: error: 'ioctl' was not declared in this scope
int result = ioctl(fd, I2C_RDWR, &ioctl_data);
^~~~~
i2c_bus.cpp: In member function 'int i2c_bus::try_write_byte_and_read(uint8_t, uint8_t, uint8_t*, size_t)':
i2c_bus.cpp:112:38: error: invalid use of incomplete type 'struct i2c_msg'
{ address, 0, 1, (typeof(i2c_msg().buf))&byte },
^
In file included from i2c_bus.cpp:8:
/usr/include/linux/i2c-dev.h:66:9: note: forward declaration of 'struct i2c_msg'
struct i2c_msg *msgs; /* pointers to i2c_msgs */
^~~~~~~
i2c_bus.cpp:113:16: error: 'I2C_M_RD' was not declared in this scope
{ address, I2C_M_RD, (typeof(i2c_msg().len))size, (typeof(i2c_msg().buf))data },
^~~~~~~~
i2c_bus.cpp:113:16: note: suggested alternative: 'I2C_RDWR'
{ address, I2C_M_RD, (typeof(i2c_msg().len))size, (typeof(i2c_msg().buf))data },
^~~~~~~~
I2C_RDWR
i2c_bus.cpp:113:42: error: invalid use of incomplete type 'struct i2c_msg'
{ address, I2C_M_RD, (typeof(i2c_msg().len))size, (typeof(i2c_msg().buf))data },
^
In file included from i2c_bus.cpp:8:
/usr/include/linux/i2c-dev.h:66:9: note: forward declaration of 'struct i2c_msg'
struct i2c_msg *msgs; /* pointers to i2c_msgs */
^~~~~~~
i2c_bus.cpp:113:71: error: invalid use of incomplete type 'struct i2c_msg'
{ address, I2C_M_RD, (typeof(i2c_msg().len))size, (typeof(i2c_msg().buf))data },
^
In file included from i2c_bus.cpp:8:
/usr/include/linux/i2c-dev.h:66:9: note: forward declaration of 'struct i2c_msg'
struct i2c_msg *msgs; /* pointers to i2c_msgs */
^~~~~~~
i2c_bus.cpp:111:11: error: elements of array 'i2c_msg messages [2]' have incomplete type
i2c_msg messages[2] = {
^~~~~~~~
i2c_bus.cpp:111:11: error: storage size of 'messages' isn't known
i2c_bus.cpp:117:16: error: 'ioctl' was not declared in this scope
int result = ioctl(fd, I2C_RDWR, &ioctl_data);
^~~~~
make: *** [<builtin>: i2c_bus.o] Error 1
Hi, @kramer65 , good to hear that my changes might be of use Honestly, after the initial commit, I didn't keep these changes upstream with @DavidEGrayson repo, so the code might be somewhat obsolete The exact problem you have might be related to the recent commit in the upstream repo: https://github.com/DavidEGrayson/minimu9-ahrs/commit/c42cca6c225d47def454c41542accd36ded454da I suggest applying these changes on top of mine and trying if it works.