Thanks Frank M for developing such a wonderful command line tool for bno055 calibration data. It was hard to find a tool that would do this on Raspberry Pi as most of the stuff on web talks about Arduino code.
I took your tool and created a shell script that someone can add to their .bashrc file so as soon as the Raspberry Pi starts, it will execute that script and load previously saved calibration data and you will not have to mess around with calibrating the sensor every time you restart your RPi.
Note: first time I ran the tool to load the file I did not realize I had to change the mode to config before the sensor will allow you to do that so I received errors while loading but after I changed the mode correctly things worked really well.
Assumption here is - you have used the Adafruit Webgl_Demo tool and calibrated your sensor at least one time. After you have initial calibration done with all statuses [system, gyro, accel and mag] showing status=3 in webgl demo tool, you can use the following command to save file one time:
./getbno055 -w ./bno055.cal
after the file is created with name bno055.cal use the following script to load it anytime after that.
To execute the script simply run [assuming the script filename you saved it as is loadcal_bno055.sh]:
. loadcal_bno055.sh [this will ask you to hit any key at every step]
you can run it in fully silent mode with no user interaction by doing this:
. loadcal_bno055.sh silent
you can even add it to your .bashrc file if you wish. The script was tested on RPi4 running Ubuntu 20.04.
Note: You may want to change the folder below to your folder where you have installed the tool. Or you can make this argument for shell script
====================================================================
silentmode=false
if [[ "$1" == silent ]]
then
echo "silent"
silentmode=true
else
echo "user interaction mode"
fi
cd ~/dev/ros2/bno055_python/bno055_cmdline/pi-bno055
./getbno055 -a 0x28 -t inf -v
if [ "$silentmode" = false ] ; then
read -n1 -r -p "Press any key to continue..." key
fi
./getbno055 -m config
if [ "$silentmode" = false ] ; then
read -n1 -r -p "Changed mode to Config, Press any key to continue..." key
fi
./getbno055 -l ./bno055.cal
if [ "$silentmode" = false ] ; then
read -n1 -r -p "Loaded saved calibration offsets successfully. Press any key to continue..." key
fi
./getbno055 -m ndof
if [ "$silentmode" = false ] ; then
read -n1 -r -p "Switched back to operation mode. Press any key to continue..." key
fi
./getbno055 -a 0x28 -t inf -v
if [ "$silentmode" = false ] ; then
read -n1 -r -p "See latest calibration status after load above. Press any key to exit..." key
fi
cd ~
====================================================================