update_code.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. # Copyright: 2016-2020 www.corvin.cn
  3. # Author: corvin
  4. # Description: 用来更新panda代码,保持代码与服务器上最新代码同步.
  5. # 更新好代码后,直接编译所有代码.
  6. # History:
  7. # 20200717:init this code.
  8. # 20200724:在命令执行完后增加判断命令执行是否成功.
  9. #定义各种终端中字符使用的颜色
  10. green="\e[32;1m"
  11. red="\e[31m"
  12. normal="\e[0m"
  13. echo -e "\n"
  14. echo -e "${green}>>> 1: 开始从服务器更新代码${normal}"
  15. git pull origin master
  16. if [ $? -eq 0 ];then
  17. echo -e "${green}更新代码完成,准备编译代码${normal}"
  18. else
  19. echo -e "${red}从服务器更新代码时,发送错误,检查网络连接${normal}"
  20. exit -1
  21. fi
  22. echo -e "\n"
  23. sleep 3
  24. echo -e "${green}>>> 2: 开始编译代码${normal}"
  25. catkin_make
  26. if [ $? -eq 0 ];then
  27. echo -e "${green}编译代码完成,现在可以运行代码${normal}"
  28. else
  29. echo -e "${red}编译代码发生错误,请检查代码${normal}"
  30. exit -2
  31. fi
  32. echo -e "\n"
  33. source devel/setup.bash
  34. echo -e "${green}>>> 3: 输入以下命令启动小车${normal}"
  35. echo -e "\n"
  36. echo -e "${green}roslaunch robot_bringup robot_bringup.launch${normal}"
  37. echo -e "\n"
  38. exit 0