ardupilot/Tools/Linux_HAL_Essentials/sensor-select.sh
Victor Mayoral Vilches 04a8377462 Tools: Change sensor configurations easily.
This shell script allows to change the sensor configuration
(for now just supports IMU changes) so that the autopilot is
compiled for different combinations of sensors. This has probed
to be useful with Linux-based boards (e.g.: PXF, Erle-board)
that include serveral, different sensors for each kind.
2014-08-19 10:08:16 +10:00

34 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# This script allows you to select which sensors you can use. For now it's resctricted to IMU use
# Coded by Víctor Mayoral Vilches <victor@erlerobot.com>
IMU_CONFIG=$(grep -A 5 "#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_PXF || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_ERLE" ../../libraries/AP_HAL/AP_HAL_Boards.h| grep HAL_INS_DEFAULT)
echo "Current setup is: "$IMU_CONFIG
if [ $# -eq 0 ]
then
echo "No arguments supplied. Please provide one of the following sensors: mpu6000, mpu9250, lsm9ds0"
echo " Usage: source sensor-select.sh <sensor> "
return 0
fi
if [ $1 == "mpu6000" ]
then
sed -i "s/$IMU_CONFIG/#define HAL_INS_DEFAULT HAL_INS_MPU6000/g" ../../libraries/AP_HAL/AP_HAL_Boards.h
echo "MPU6000 selected"
elif [ $1 == "mpu9250" ]
then
sed -i "s/$IMU_CONFIG/#define HAL_INS_DEFAULT HAL_INS_MPU9250/g" ../../libraries/AP_HAL/AP_HAL_Boards.h
echo "MPU9250 selected"
elif [ $1 == "lsm9ds0" ]
then
sed -i "s/$IMU_CONFIG/#define HAL_INS_DEFAULT HAL_INS_LSM9DS0/g" ../../libraries/AP_HAL/AP_HAL_Boards.h
echo "LSM9DS0 selected"
else
echo "Sensor supplied invaled. Please provide one of the following sensors: mpu6000, mpu9250, lsm9ds0"
echo " Usage: source sensor-select.sh <sensor> "
return 0
fi