|
| 1 | +## Additional aliases and commands to use the robot |
| 2 | + |
| 3 | +getParentDir () { |
| 4 | + SOURCE="${1}" |
| 5 | + while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink |
| 6 | + DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" |
| 7 | + SOURCE="$(readlink "$SOURCE")" |
| 8 | + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located |
| 9 | + done |
| 10 | + DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )" |
| 11 | +} |
| 12 | + |
| 13 | +getParentDir "${BASH_SOURCE[0]}" |
| 14 | + |
| 15 | +# The directory where this script is |
| 16 | +export ADDITIONAL_COMMANDS_DIR="$DIR" |
| 17 | + |
| 18 | + |
| 19 | +#Robots Configuration settings |
| 20 | +alias robotsConfigurationInstaller='bash ${ADDITIONAL_COMMANDS_DIR}/installRobotsConfiguration.sh' |
| 21 | +export ROBOTS_CONFIGURATION_DIR=${ROBOTOLOGY_SUPERBUILD_SOURCE_DIR}/src/robots-configuration/${YARP_ROBOT_NAME} |
| 22 | +alias gotoRobotsConfigurationFolder='cd $ROBOTS_CONFIGURATION_DIR' |
| 23 | + |
| 24 | +#Automatic Joypad configuration |
| 25 | +alias connectToJoypad='sudo expect ${ADDITIONAL_COMMANDS_DIR}/bluetoothConnect.sh 28:9A:4B:08:E1:1B' |
| 26 | + |
| 27 | +# Go to DCM folder |
| 28 | +alias dcmFolder='cd ${ROBOTOLOGY_SUPERBUILD_SOURCE_DIR}/src/walking-controllers/src/WalkingModule/app/robots/${YARP_ROBOT_NAME}' |
| 29 | + |
| 30 | +# Go to the corresponding build folder in the superbuild |
| 31 | +alias goToBuildSuperbuild='cd ../../build/src/${PWD##*/}' |
| 32 | + |
| 33 | +## Alias for running a diff between the source and the install of the configuration files |
| 34 | +alias configurationSourceInstallDiff='bash ${ADDITIONAL_COMMANDS_DIR}/checkConfigurationFiles.sh' |
| 35 | + |
| 36 | +alias test-speaker='speaker-test -t wav -c 1' |
| 37 | + |
| 38 | +# Test if the microphone is working |
| 39 | +test-microphone() { |
| 40 | + arecord -vvv -f dat /dev/null |
| 41 | +} |
| 42 | + |
| 43 | +GREEN='\033[0;32m' |
| 44 | +NC='\033[0m' # No Color |
| 45 | +## Alias for displaying info messages about the other aliases |
| 46 | +alias helpRobot='echo -e "Here some useful commands: |
| 47 | +${GREEN}robotsConfigurationInstaller${NC} Takes care of installing the robot configuration files from any folder. |
| 48 | +${GREEN}gotoRobotsConfigurationFolder${NC} Go to the source folder of the robot configuration files. |
| 49 | +${GREEN}configurationSourceInstallDiff${NC} Performs a diff between the source and install configuration files. If there is no difference, it prints nothing. |
| 50 | +${GREEN}connectToJoypad${NC} To reconnect the bluetooth connection of the robot joypad. |
| 51 | +${GREEN}test-speaker${NC} Test if the speaker is working. |
| 52 | +${GREEN}test-microphone${NC} Test if the micorphone is working. |
| 53 | +${GREEN}dcmFolder${NC} Go to the robot walking configuration files. |
| 54 | +${GREEN}goToBuildSuperbuild${NC} Go to the corresponding build folder of the robotology superbuild."' |
| 55 | + |
| 56 | +if [ "$PS1" ]; then |
| 57 | + echo -e "Type ${GREEN}helpRobot${NC} for a list of useful commands." |
| 58 | +fi |
| 59 | + |
0 commit comments