setup_env.sh 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/bash
  2. # Copyright: 2016-2019 ROS小课堂 www.corvin.cn
  3. # Author: corvin
  4. # Description:该脚本是为了编译工作去软件包,并配置环境变量到.bahsrc.
  5. # History:
  6. # 20181226:Initial this bash file.
  7. # 20190122:新增在运行前需要安装的一些必要软件包.
  8. red="\e[31m"
  9. normal="\e[0m"
  10. CURRENT_PATH=$(dirname $(readlink -f "$0"))
  11. WS_PATH=${CURRENT_PATH%scripts}
  12. # first install necessary packages
  13. sudo apt update
  14. while [ $? -ne 0 ]
  15. do
  16. echo -e "{red}Can't update source list, will retry...{noraml}\n"
  17. sleep 3
  18. sudo apt update
  19. done
  20. sudo apt -y upgrade
  21. sudo apt install -y ros-kinetic-moveit-msgs ros-kinetic-moveit-core \
  22. ros-kinetic-moveit-ros-perception ros-kinetic-moveit-ros-planning-interface \
  23. ros-kinetic-moveit
  24. sudo apt-get -y autoremove
  25. # second catkin_make worksapce
  26. cd $WS_PATH/ros_code/
  27. catkin_make
  28. # third set workspace env to .bashrc
  29. source devel/setup.bash
  30. echo "#config arduino_robot_arm env" >>~/.bashrc
  31. echo "source ${WS_PATH}ros_code/devel/setup.bash" >> ~/.bashrc
  32. exit 0