Skip to content

Commit

Permalink
[jsk_unitree_startup] Add imageai.sh which is running on default unit…
Browse files Browse the repository at this point in the history
…ree pro
  • Loading branch information
iory committed Aug 5, 2022
1 parent 585d476 commit f8e3778
Showing 1 changed file with 72 additions and 0 deletions.
72 changes: 72 additions & 0 deletions jsk_unitree_robot/jsk_unitree_startup/autostart/imageai.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash
Nano1="192.168.123.13" ## SecNanoRight(1-2)
Nano2="192.168.123.14" ## SecNanoLeft(3-4)
Nano3="192.168.123.15" ## MasterNano(5)
eval echo "[imageai] starting ... " $toStartlog

mLRootPATH="/home/unitree/Unitree/autostart/imageai/"
updatePackagePATH="/home/unitree/mLComSystemFrame.tar.gz"

echo -e "\e[1;32m**** 1. Check if the program needs to be updated ? ****\e[0m"
checkIFUpdate(){
if [ -f "$updatePackagePATH" ];then
echo -e "\e[1;32m The update file exists, it will be updating soon ...\e[0m"
tar -zxvf $updatePackagePATH -C $mLRootPATH > /dev/null; sleep 1
rm -rf $updatePackagePATH
echo -e "\e[1;32m Updating Success.\e[0m"
else
echo -e "\e[1;31m NO Need to update!\e[0m"
fi
}

checkIFUpdate
# dd=$?

#declare -i lossNano1=-1
#declare -i lossNano2=-1
#declare -i lossNano3=-1

#echo -e "\e[1;32m**** 2. Check if all Nano'IP Address is OK ? ****\e[0m"

#until (( lossNano1 + lossNano2 + lossNano3 == 0 ))
#do
# lossNano1=`ping -c 2 -w 2 $Nano1 | grep loss | awk '{print $6}' | awk -F "%" '{print $1}'`
# echo $lossNano1
#
# lossNano2=`ping -c 2 -w 2 $Nano2 | grep loss | awk '{print $6}' | awk -F "%" '{print $1}'`
# echo $lossNano2
#
# lossNano3=`ping -c 2 -w 2 $Nano3 | grep loss | awk '{print $6}' | awk -F "%" '{print $1}'`
# echo $lossNano3
# #sleep 10
#done

#echo " IP is Right!"

## GET PC's Address
localIPAddr=`ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6| head -n 1 | awk '{print $2}'|tr -d "addr:"`
echo "Local Address: "$localIPAddr

echo -e "\e[1;32m**** 2. Start Main Application ... ****\e[0m"
if [ $localIPAddr == $Nano3 ];then
echo " MasterNano"
############### MasterNano doing things!!!!
gnome-terminal -- bash -c "export GST_PLUGIN_PATH=/home/unitree/Unitree/autostart/imageai/mLComSystemFrame/ThirdParty/webSinkPipe/build; cd $mLRootPATH/mLComSystemFrame/bin; ./mqttControlNode ../config/mqMNConfig.yaml; exec bash"
gnome-terminal -- bash -c "export GST_PLUGIN_PATH=/home/unitree/Unitree/autostart/imageai/mLComSystemFrame/ThirdParty/webSinkPipe/build; cd $mLRootPATH/mLComSystemFrame/pyScripts; python3 live_human_pose.py; exec bash"

elif [ $localIPAddr == $Nano2 ];then
echo " SecNanoLeft"
############### SecNanoLeft(3-4) doing things!!!!
gnome-terminal -- bash -c "export GST_PLUGIN_PATH=/home/unitree/Unitree/autostart/imageai/mLComSystemFrame/ThirdParty/webSinkPipe/build; cd $mLRootPATH/mLComSystemFrame/bin; ./mqttControlNode ../config/mqSNNLConfig.yaml; exec bash"
gnome-terminal -- bash -c "export GST_PLUGIN_PATH=/home/unitree/Unitree/autostart/imageai/mLComSystemFrame/ThirdParty/webSinkPipe/build; cd $mLRootPATH/mLComSystemFrame/bin; ./mqttControlNode ../config/mqSNNLConfig.yaml 1; exec bash"

elif [ $localIPAddr == $Nano1 ];then
echo " SecNanoRight"
############### SecNanoRight(1-2) doing things!!!!
gnome-terminal -- bash -c "export GST_PLUGIN_PATH=/home/unitree/Unitree/autostart/imageai/mLComSystemFrame/ThirdParty/webSinkPipe/build; cd $mLRootPATH/mLComSystemFrame/bin; ./mqttControlNode ../config/mqSNNRConfig.yaml; exec bash"
gnome-terminal -- bash -c "export GST_PLUGIN_PATH=/home/unitree/Unitree/autostart/imageai/mLComSystemFrame/ThirdParty/webSinkPipe/build; cd $mLRootPATH/mLComSystemFrame/bin; ./mqttControlNode ../config/mqSNNRConfig.yaml 1; exec bash"
else
echo " Not Found $localIPAddr in IP-Clump!"
fi

echo " EveryThing is done!"

0 comments on commit f8e3778

Please sign in to comment.