PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/val_common/scripts/setup2.sh

https://gitlab.com/whrl/space_robotics_challenge
Shell | 140 lines | 94 code | 17 blank | 29 comment | 6 complexity | 0e177332b6ca5ba5440ca60264707194 MD5 | raw file
  1. #!/bin/bash
  2. ## Usage: bash setup2.sh
  3. ## Author: sumanth
  4. ## Purpose: setups the system for ihmc controllers
  5. ##
  6. ## Options:
  7. ## none
  8. ##
  9. #check if the workspace is already set
  10. # setup the workspace
  11. echo "$(tput setaf 1)Select JDK 8 in the following options$(tput sgr0)"
  12. sudo update-alternatives --config java
  13. sudo update-alternatives --config javac
  14. echo "$(tput setaf 1)check the workspace$(tput sgr0)"
  15. if [ -d $"/home/$USER/catkin_ws" ]; then
  16. WORKSPACE="catkin_ws"
  17. echo "$(tput setaf 1)found workspace catkin_ws$(tput sgr0)"
  18. elif [ -d $"/home/$USER/indigo_ws" ]; then
  19. WORKSPACE="indigo_ws"
  20. echo "$(tput setaf 1)found workspace indigo_ws$(tput sgr0)"
  21. else
  22. "$(tput setaf 1)no workspace found setting up indigo_ws$(tput sgr0)"
  23. WORKSPACE="indigo_ws"
  24. mkdir -p ~/indigo_ws/src && cd ~/indigo_ws/src
  25. catkin_init_workspace
  26. cd ~/indigo_ws
  27. catkin_make
  28. fi
  29. echo "$(tput setaf 1)downloading gazebo models$(tput sgr0)"
  30. wget -P /tmp/ https://bitbucket.org/osrf/gazebo_models/get/default.tar.gz
  31. mkdir -p $HOME/.gazebo/models
  32. tar -xvf /tmp/default.tar.gz -C $HOME/.gazebo/models --strip 1
  33. rm /tmp/default.tar.gz
  34. #echo "$(tput setaf 1)Pre-build ihmc_ros_java_adapter$(tput sgr0)"
  35. #source /opt/nasa/indigo/setup.bash
  36. #roslaunch ihmc_valkyrie_ros valkyrie_warmup_gradle_cache.launch
  37. echo "$(tput setaf 1)clone the whole ihmc repo$(tput sgr0)"
  38. sudo apt-get install -y git
  39. cd ~ && git clone https://github.com/ihmcrobotics/ihmc-open-robotics-software.git
  40. #update and source bashrc
  41. #Environment Variables
  42. echo "$(tput setaf 1)updating env variables for java$(tput sgr0)"
  43. echo 'export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64' >> ~/.bashrc
  44. echo 'export IS_GAZEBO=true' >> ~/.bashrc
  45. echo "export IHMC_SOURCE_LOCATION=$HOME/ihmc-open-robotics-software" >> ~/.bashrc
  46. source $HOME/.bashrc
  47. #sourcing desn't set the env variables for unknown reason. This is a workaround
  48. export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
  49. export IHMC_SOURCE_LOCATION=$HOME/ihmc-open-robotics-software
  50. # ihmc-open-robotics-software
  51. echo "$(tput setaf 1)compile the ihmc repo$(tput sgr0)"
  52. cd ihmc-open-robotics-software
  53. git stash
  54. git pull
  55. git checkout origin/0.9-support
  56. ./gradlew
  57. ./gradlew deployLocal
  58. # create the folder for repos
  59. mkdir ~/$WORKSPACE/src/ihmc_repos
  60. cd ~/$WORKSPACE/src/ihmc_repos/
  61. # clone the ihmc repos
  62. echo "$(tput setaf 1)cloning the required ihmc repos$(tput sgr0)"
  63. git clone https://github.com/ihmcrobotics/ihmc-ros-control.git
  64. git clone https://github.com/ihmcrobotics/ihmc_ros_core.git
  65. cd ihmc_ros_core
  66. git checkout 0.9.0
  67. echo "$(tput setaf 1)checking and installing and missing ros dependecies$(tput sgr0)"
  68. # TODO:this shoould be done with rosdep
  69. sudo apt-get install -y ruby ros-indigo-pcl-ros ros-indigo-pcl-conversions ros-indigo-moveit ros-indigo-trac-ik \
  70. ros-indigo-footstep-planner ros-indigo-humanoid-localization ros-indigo-multisense-ros ros-indigo-laser-assembler \
  71. ros-indigo-robot-self-filter ros-indigo-tf2-geometry-msgs ros-indigo-joint-state-publisher ros-indigo-octomap-server \
  72. ros-indigo-octomap ros-indigo-octomap-server ros-indigo-joint-trajectory-controller ros-indigo-joint-state-controller ros-indigo-position-controllers
  73. #TODO: this to account for the fix in humanoid navigation package
  74. #so, we clone the fixed repo
  75. if [ -d $"/home/$USER/$WORKSPACE/src/humanoid_navigation" ]; then
  76. echo "$(tput setaf 1)updating the humanoid_navigation package$(tput sgr0)"
  77. cd ~/$WORKSPACE/src/humanoid_navigation
  78. git checkout indigo-devel
  79. git pull
  80. cd ~/$WORKSPACE
  81. catkin_make
  82. else
  83. echo "$(tput setaf 1)no humanoid_navigation repo found, clonning it$(tput sgr0)"
  84. git clone https://github.com/ninja777/humanoid_navigation.git ~/$WORKSPACE/src/humanoid_navigation
  85. cd ~/$WORKSPACE/src/humanoid_navigation
  86. git checkout indigo-devel
  87. cd ~/$WORKSPACE
  88. catkin_make
  89. fi
  90. # update the src repo
  91. if [ -d $"/home/$USER/$WORKSPACE/src/space_robotics_challenge" ]; then
  92. echo "$(tput setaf 1)updating the repo$(tput sgr0)"
  93. cd $HOME/$WORKSPACE/src/space_robotics_challenge
  94. git stash
  95. git pull
  96. git checkout master
  97. git submodule update --init --recursive
  98. cd $HOME/$WORKSPACE
  99. # catkin_make
  100. else
  101. echo "$(tput setaf 1)no src repo found, clonning it$(tput sgr0)"
  102. git clone https://gitlab.com/whrl/space_robotics_challenge.git $HOME/$WORKSPACE/src/space_robotics_challenge
  103. cd $HOME/$WORKSPACE/src/space_robotics_challenge
  104. git submodule update --init --recursive
  105. cd $HOME/$WORKSPACE
  106. # catkin_make
  107. fi
  108. # modify the build.gradle and common.launch
  109. echo "$(tput setaf 1)patch the build.gradle and common.launch$(tput sgr0)"
  110. cd ~/$WORKSPACE/src/ihmc_repos/ihmc_ros_core/
  111. git apply ~/$WORKSPACE/src/space_robotics_challenge/val_common/patches/ihmc_ros_core.patch
  112. #echo "$(tput setaf 1)compiling the catkin_workspace$(tput sgr0)"
  113. #cd ~/$WORKSPACE
  114. #catkin_make
  115. echo "$(tput setaf 1)testing the setup......$(tput sgr0)"
  116. echo "$(tput setaf 1)launching valkyire with controllers...$(tput sgr0)"
  117. source /opt/nasa/indigo/setup.bash
  118. cd $HOME/$WORKSPACE
  119. rm -rf devel/ build/
  120. catkin_make
  121. source devel/setup.bash
  122. echo "$(tput setaf 1)everything is setup sucessfully, launching final1.launch$(tput sgr0)"
  123. roslaunch val_bringup final1.launch init:='false'