mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-08 17:08:28 -04:00
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.
This commit is contained in:
parent
8a71fdf092
commit
04a8377462
33
Tools/Linux_HAL_Essentials/sensor-select.sh
Executable file
33
Tools/Linux_HAL_Essentials/sensor-select.sh
Executable file
@ -0,0 +1,33 @@
|
||||
#!/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
|
||||
|
Loading…
Reference in New Issue
Block a user