# Description: 用来更新minibot代码,保持代码与服务器上最新代码同步. # 首先将本地所做修改给还原,然后更新代码后,直接编译所有代码. # Author: corvin # History: # 20220706:init this code. #定义各种终端中字符使用的颜色 green="\e[32;1m" red="\e[31m" normal="\e[0m" echo -e "\n" echo -e "${green}>>> 1: 开始从服务器更新代码${normal}" git reset --hard origin/master git pull origin master if [ $? -eq 0 ];then echo -e "${green}更新代码完成,准备编译代码...${normal}" else echo -e "${red}从服务器更新代码时,发生错误,检查网络连接${normal}" exit -1 fi echo -e "\n" sleep 3 echo -e "${green}>>> 2: 开始编译代码${normal}" rm -rf ~/.ros/log/ catkin_make if [ $? -eq 0 ];then source ~/ros_minibot_ws/devel/setup.bash echo -e "${green}>>> 编译ROS代码完成,现在编译oled屏幕代码...${normal}" else echo -e "${red}编译代码发生错误,请检查代码${normal}" exit -2 fi echo -e "\n" cd src/oled_screen/build/ rm -rf * cmake .. make cd ../ echo -e "\n" echo -e "${green}>>> 需要输入密码配置oled屏幕启动服务...${normal}" sudo cp *.service /usr/lib/systemd/system/ echo -e "\n" echo -e "${green}>>> 全部代码都已编译配置完成,下面开始使用小车...${normal}" echo -e "\n" echo -e "${green}>>> 输入以下命令启动小车${normal}" echo -e "\n" echo -e "${green} roslaunch robot_bringup robot_bringup.launch${normal}" echo -e "\n" echo -e "${green}>>> 输入以下命令遥控小车${normal}" echo -e "\n" echo -e "${green} rosrun control_robot control_robot.py${normal}" echo -e "\n" echo -e "${green}>>> 输入以下命令打开摄像头${normal}" echo -e "\n" echo -e "${green} rqt_image_view${normal}" echo -e "\n" exit 0