first commit, 去掉大文件后新建的git库,和老库的提交17ce6ae一样

This commit is contained in:
tangchao0503
2025-07-30 17:58:30 +08:00
commit e7fd2a7e83
14 changed files with 595 additions and 0 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
*.swp
Logs/
XIMEA_Linux_SP.tgz
package/

231
CreateEnvironment.sh Normal file
View File

@ -0,0 +1,231 @@
sudo mkdir /home/300tc
sudo mkdir /home/300tc/projects_source
sudo mkdir /home/300tc/projects
sudo mkdir /home/300tc/library_source
sudo mkdir /home/300tc/library
cd /home/300tc
systemctl disable networking.service
#timedatectl | grep Time
timedatectl set-timezone "Asia/Shanghai"
#
sudo mv /etc/apt/sources.list /etc/apt/sources.list.back
sudo cp /home/pi/tc_ShellScripts/sources.list /etc/apt/sources.list
sudo apt update
sudo apt-get -y install build-essential
sudo apt -y install gdb
sudo apt-get -y install cron
sudo apt install -y network-manager
sudo apt -y install usbutils#lsusb
# iotop
sudo apt install iotop
# cmake
sudo apt -y remove cmake
sudo apt -y install openssl
sudo apt -y install libssl-dev
cd /home/300tc/library_source
# Installation Mode 1
#sudo wget http://www.cmake.org/files/v3.17/cmake-3.17.3.tar.gz
#sudo tar -xf cmake-3.17.3.tar.gz
#cd cmake-3.17.3
#sudo ./configure
#sudo make -j5
# Installation Mode 2
sudo wget -P /home/300tc/library_source http://172.16.0.251/tangchao/cmake_binary.tar.bz2
tar -jxvf cmake_binary.tar.bz2
cd cmake-3.17.3
sudo make install
sudo ln -sf /usr/local/bin/cmake /usr/bin/cmake
# udpClient
cd /home/300tc/projects_source
git clone http://172.16.0.230:3000/tangchao0503/udpClient.git
sudo mkdir /home/300tc/projects/udpClient
cd /home/300tc/projects/udpClient
sudo cmake /home/300tc/projects_source/udpClient
sudo make
# create_ap
cd /home/300tc/library_source
#sudo git clone https://github.com/oblique/create_ap.git
sudo git clone http://172.16.0.230:3000/tangchao0503/create_ap.git
cd create_ap
sudo make install
sudo apt-get -y install util-linux procps hostapd iproute2 iw haveged dnsmasq iptables
sudo sed -i 's/NO_VIRT=.*/NO_VIRT=1/g' /etc/create_ap.conf
sudo sed -i 's/SSID=.*/SSID=300tc/g' /etc/create_ap.conf
sudo sed -i 's/PASSPHRASE=.*/PASSPHRASE=123456789/g' /etc/create_ap.conf
sudo sed -i 's/GATEWAY=.*/GATEWAY=192.168.191.1/g' /etc/create_ap.conf
sudo systemctl enable create_ap.service
# create eth1 in order to OS identification the network interface
cp /etc/network/interfaces.d/eth0 /etc/network/interfaces.d/eth1
sudo sed -i 's/auto eth0.*/auto eth1/g' /etc/network/interfaces.d/eth1
sudo sed -i 's/allow-hotplug eth0.*/allow-hotplug eth1/g' /etc/network/interfaces.d/eth1
sudo sed -i 's/iface eth0 inet dhcp.*/iface eth1 inet dhcp/g' /etc/network/interfaces.d/eth1
# dhcp
sudo apt install -y isc-dhcp-server
sudo sed -i 's/INTERFACESv4=""*/INTERFACESv4="eth0"/g' /etc/default/isc-dhcp-server
sudo sed -i '35a # tc add\
subnet 192.168.1.0 netmask 255.255.255.0 {\
option routers 192.168.1.1;\
option subnet-mask 255.255.255.0;\
option domain-search "tecmint.lan";\
option domain-name-servers 192.168.1.1;\
range 192.168.1.10 192.168.1.100;\
range 192.168.1.110 192.168.1.200;\
}\
' /etc/dhcp/dhcpd.conf
sudo systemctl start isc-dhcp-server.service
sudo systemctl enable isc-dhcp-server.service
# static ip
cp /etc/network/interfaces.d/eth0 /etc/network/interfaces.d/eth0.backup
sudo sed -i '1i # tc add\
allow-hotplug eth0\
iface eth0 inet static\
address 192.168.1.1\
netmask 255.255.255.0\
gateway 192.168.1.1\
dns-nameservers 192.168.1.1' /etc/network/interfaces.d/eth0
sed -i '8,10d' /etc/network/interfaces.d/eth0
# filebrew
cd /home/pi/tc_ShellScripts
git clone http://172.16.0.230/r/computer/install.git
sudo cp -r ./install/nanopiM4/filebrew64 /root/filebrew
sudo cp ./install/nanopiM4/12-mybase.rules /etc/udev/rules.d/
chmod +x /root/filebrew/filebrowser
sudo sed -i '$ i\sudo /root/filebrew/filebrowser -d /root/filebrew/filebrowser.db &' /etc/rc.local
sudo rm -r install/
# installXimeaDriver
cd /home/300tc/library_source
sudo wget http://172.16.0.251/XIMEA_Linux_SP.tgz
sudo tar -xzf XIMEA_Linux_SP.tgz
cd package
sudo ./install &> /home/pi/installXimeaDriver.log
# sudo /opt/XIMEA/bin/xiSample
# sudo gpio readall
# sudo gpio mode 10 out
# sudo gpio write 10 1
# sudo gpio write 10 0
sudo sed -i '$ i\sudo gpio mode 10 out' /etc/rc.local
sudo sed -i '$ i\echo 0 > /sys/module/usbcore/parameters/usbfs_memory_mb # ximea' /etc/rc.local
sudo mkdir /media/nvme
sudo sed -i '$ i\sudo mount /dev/nvme0n1p1 /media/nvme' /etc/rc.local
sudo sed -i '$ i\sudo /home/pi/tc_ShellScripts/monitorMemory_while.sh &' /etc/rc.local
sudo sed -i '$ i\echo "0" > /media/nvme/300TC/config/timesyncfromdji' /etc/rc.local
sudo sed -i '$ i\/home/pi/tc_ShellScripts/finger_daemon.sh &' /etc/rc.local
# install qt5
sudo apt-get -y install qtbase5-dev qtchooser
qt5-qmake qtbase5-dev-tools
sudo apt-get -y install libqt5serialport5-dev libudev-dev #在qt5.6之前是没有qeserialport模块的要想使用该模块必须自己添加。
# ximeaControlDll
cd /home/300tc/library_source
sudo git clone http://172.16.0.230:3000/tangchao0503/ximeaControlDll.git
sudo mkdir /home/300tc/library/ximeaControlDll
cd /home/300tc/library/ximeaControlDll
sudo cmake /home/300tc/library_source/ximeaControlDll
sudo make
sudo cp -r /home/300tc/library_source/ximeaControlDll/Header_Files /home/300tc/library/ximeaControlDll/Header_Files
path=$(pwd)
path=${path}"/libirisXimeaImager.so"
#sudo ln -sv /home/pi/tc_projects/ximeaControlDll/build/libirisXimeaImager.so /usr/lib/libirisXimeaImager.so
sudo ln -sv $path /usr/lib/libirisXimeaImager.so
# libconfig
cd /home/300tc/library_source
sudo wget http://172.16.0.251/libconfig-1.7.3.tar.gz
sudo tar -xzvf libconfig-1.7.3.tar.gz
cd libconfig-1.7.3/
sudo ./configure
sudo make
#make check
sudo make install
# ximeaAirborneSystem
cd /home/300tc/projects_source
sudo git clone http://172.16.0.230:3000/tangchao0503/ximeaAirborneSystem.git
sudo mkdir /home/300tc/projects/ximeaAirborneSystem
cd /home/300tc/projects/ximeaAirborneSystem
sudo cmake /home/300tc/projects_source/ximeaAirborneSystem
sudo make
# ffmpeg
sudo apt-get -y install nasm
sudo apt-get -y install libx264-dev
sudo apt-get -y install libfdk-aac-dev
sudo apt-get -y install libopus-dev
sudo apt-get -y install libdav1d-dev
cd /home/300tc/library_source
sudo mkdir /home/300tc/library/ffmpeg_build
# Installation Mode 1
#sudo wget https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
#sudo tar -xvf ffmpeg-snapshot.tar.bz2
#cd ffmpeg
#sudo ./configure --enable-shared --enable-gpl --disable-yasm --enable-libx264 --disable-libx265 --prefix=/home/300tc/library/ffmpeg_build
#sudo make -j5
# Installation Mode 2
sudo wget -P /home/300tc/library_source http://172.16.0.251/tangchao/ffmpeg_binary.tar.bz2
tar -jxvf ffmpeg_binary.tar.bz2
cd ffmpeg
sudo make install
sudo sed -i '$a\/home/300tc/library/ffmpeg_build/lib/' /etc/ld.so.conf
sudo ldconfig
# psdk
sudo apt -y install unzip
#sudo unzip Payload_SDK_V2.2.1-build.315.zip
#sudo mv Payload_SDK_V2.2.1-build.315 Payload_SDK_V2.2.1_300tc
sudo ln -sv /usr/lib/aarch64-linux-gnu/libopus.a /usr/local/lib/libopus.a
cd /home/300tc/projects_source/
sudo git clone http://172.16.0.230:3000/tangchao0503/Payload-SDK.git
sudo mkdir /home/300tc/projects_source/Payload-SDK/samples/sample_c/platform/linux/manifold2/build
cd /home/300tc/projects_source/Payload-SDK/samples/sample_c/platform/linux/manifold2/build
sudo cmake ..
sudo make
# crontab
# cd /etc/cron.d
# touch 300tc
# echo "*/1 * * * * root /home/pi/tc_ShellScripts/finger_daemon.sh" >> 300tc
# remove source code
cd /home/300tc/projects_source/
rm -r !(Payload_SDK_V2.2.1_300tc)

0
autoMount.sh Normal file
View File

134
finger_daemon.sh Normal file
View File

@ -0,0 +1,134 @@
#!/bin/bash
# Program:
# This script is a finger daemon of program ximeaImageRecorder and psdkProgram. It has three function:
# 1) ensure that the programs ximeaImagerRecorder and psdkProgram are runing; if not run the programs;
# 2) generate log file name based the local time and directory if not exist;
# 3) redirect the output of programs to file generated in (2);
# Usage:
# 1) crontab -e
# 2) */1 * * * * /home/pi/tc_ShellScripts/finger_daemon.sh
# History:
# 2021/07/13 Tangchao First release
# 2022/06/24 Tangchao Second release
#
#sleep 60s #rockpi need sleep 180s when start because if not wired lan which psdk's image transmission use don't work normal.
rowNumberDisconnect=0
while true
do
# echo "current time is " $(date)
# echo "the current directory is " $(pwd)
LogDirectory=/media/nvme/300TC/programRunLog
if [ ! -e $LogDirectory ]; then
sudo mkdir -p $LogDirectory
else
#echo directory $LogDirectory exist!
delete=2
fi
# run psdk program
cd $LogDirectory
if [ ! -e djiLog ]; then
sudo mkdir djiLog
else
# echo directory "djiLog" exist!
delete=2
fi
#python /home/pi/tc_ShellScripts/test.py
bool=`ps -ef | grep dji_300tc | grep -v grep | wc -l`
if [ $bool -eq 0 ] ; then
psdkLogFileName=$(date +%Y%m%d_%H%M_%S).dji_log
sudo /bin/echo $(/bin/date +%F_%T) >> $LogDirectory"/djiLog/runtime.log"
# sudo /home/300tc/projects/psdk/psdk_demo &> $LogDirectory"/djiLog/"$psdkLogFileName &
cd /home/300tc/projects_source/Payload-SDK/samples/sample_c/platform/linux/manifold2/build/bin
sudo /home/300tc/projects_source/Payload-SDK/samples/sample_c/platform/linux/manifold2/build/bin/dji_300tc &> $LogDirectory"/djiLog/"$psdkLogFileName &
runtimes=$(head -n +1 $LogDirectory"/djiLog/Number_of_runs.txt")
echo $runtimes
runtimes=$[runtimes+1]
echo $runtimes
sudo sed -i "1i $runtimes" $LogDirectory"/djiLog/Number_of_runs.txt"
echo "Now, start run dji program!"
else
# echo "Dji program already runing!"
tmp1=$(dmesg | grep -n disconnect | grep "usb 1-1.1" | awk '{match($0, /^[0-9]+/); print substr($0, RSTART, RLENGTH)}' | awk 'BEGIN {max = rowNumberDisconnect} {if ($1 > max) max = $1} END {print max}')
if [ $tmp1 -gt $rowNumberDisconnect ]; then
echo "new disconnect! "$rowNumberDisconnect"\t"$tmp1
dmesg -T &> $LogDirectory"/djiLog/"kernalLog_$(date +%Y%m%d-%H%M%S).txt
rowNumberDisconnect=$tmp1
kill -9 $(ps -ef | grep dji_300tc | grep -v grep | awk '{print $2}')
else
echo "no disconnect!"
fi
fi
# run ximea program
while [ ! -f "/media/nvme/300TC/config/timesyncfromdji" ]
do
sleep 1s
echo "timesyncfromdji don't exist"
done
while [ ! -s "/media/nvme/300TC/config/timesyncfromdji" ]
do
sleep 1s
echo "timesyncfromdji is empty"
done
number=$(cat /media/nvme/300TC/config/timesyncfromdji)
while [ "$number" -eq 0 ]
do
sleep 1s
echo "Time synchronization is not performed."
number=$(cat /media/nvme/300TC/config/timesyncfromdji)
done
cd $LogDirectory
if [ ! -e hyperspectralLog ]; then
sudo mkdir hyperspectralLog
else
# echo directory "hyperspectralLog" exist!
delete=2
fi
procnum=`ps -ef | grep ximeaAirborneSystem | grep -v grep | wc -l`
if [ $procnum -eq 0 ] ; then
fileName=$(date +%Y%m%d_%H%M_%S).hyperspectral_log
echo $fileName
sudo /home/300tc/projects/ximeaAirborneSystem/ximeaAirborneSystem &> $LogDirectory"/hyperspectralLog/"$fileName &
echo "Now, start run hyperspectral program!"
else
# echo "HyperspectralLog program already runing!"
delete=2
fi
sleep 1s
done

21
finger_daemon_while.sh Normal file
View File

@ -0,0 +1,21 @@
#! /bin/sh
PRO_NAME=psdk_demo
while true ; do
NUM=`ps -ef | grep ${PRO_NAME} | grep -v grep |wc -l`
# echo $NUM
if [ "${NUM}" -lt "1" ];then
echo "${PRO_NAME} was killed"
/bin/echo $(/bin/date +%F_%T) >> /home/rock/programRunLog/djiLog/runtime.log
psdkLogFileName=$(date +%Y%m%d_%H%M_%S).dji_log
sudo /home/rock/tc_projects/Payload_SDK_V2.2.1/sample/platform/linux/manifold2/project/build/psdk_demo &> /home/rock/programRunLog/djiLog/$psdkLogFileName
elif [ "${NUM}" -gt "1" ];then
echo "${PRO_NAME} is running"
fi
done
exit 0

33
kill_psdk.py Normal file
View File

@ -0,0 +1,33 @@
import os
import sys
import subprocess
def get_process_id(name):
child = subprocess.Popen(["pgrep","-f",name],stdout=subprocess.PIPE,shell=False)
response = child.communicate()[0]
return response
pids = get_process_id("psdk_demo")
pids = pids.splitlines()
print type(pids)
print pids
if not pids:
print "no target pid to kill,please check"
sys.exit(1)
f=open('/media/nvme/300TC/programRunLog/djiLog/Number_of_runs.txt')
signal=[]
for line in f:
signal.append(line.strip())
f.close()
signal_int=int(signal[0])
for pid in pids:
if (signal_int % 2) != 0:
result=os.system("kill -9 "+pid)
if result==0:
print "execute kill success"
else:
sys.exit(1)

2
kill_psdk.sh Normal file
View File

@ -0,0 +1,2 @@
sleep 300s
ps -ef | grep psdk | grep -v grep | awk '{print $2}' | sudo xargs kill -9

12
kill_psdk_v2.sh Normal file
View File

@ -0,0 +1,12 @@
#! /bin/bash
psdkpid=$(ps -ef | grep psdk_demo | grep -v grep | awk '{print $2}')
while true ; do
if [ $psdkpid -le 5000 ]; then
#sleep 100s
sudo kill $psdkpid
#echo $psdkpid 'xiaoyu 5000'
fi
done
exit 0

18
monitorMemory_while.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
while true
do
Mem=$(free -m | grep Mem | awk {'print $3'})
disk=$(iotop -o -b -k -d 1 -n 1 | grep Total | awk {'print $10'})
if [ $Mem -ge 3000 ]; then
/home/300tc/projects/udpClient/udpClient 127.0.0.1 9,0
fi
time=$(date +%Y%m%d_%H%M%S)
txt=$time"\t"$Mem"\t"$disk
echo -e $txt &>> /media/nvme/300TC/programRunLog/memoryUseage.txt
sleep 2
done

11
sources.list Normal file
View File

@ -0,0 +1,11 @@
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu-ports/ focal-proposed main restricted universe multiverse

37
update0.sh Normal file
View File

@ -0,0 +1,37 @@
#!/bin/bash
# tar -zcf - update1.sh Payload_SDK_V2.2.1_300tc ximeaControlDll ximeaAirborneSystem | openssl des3 -salt -k irishk******* | dd of=source.des3
makeEmptyDIR()
{
if [ ! -e $1 ]; then
# echo "$1 do not exist!"
mkdir -p $1
elif [ -e $1 ] && [ ! "$(ls -A $1)" ]; then
# echo "$1 exist and null!"
a=1
elif [ -e $1 ] && [ "$(ls -A $1)" ]; then
# echo "$1 exist but not null!"
cd $1
rm -r *
fi
}
uncompressDir=/home/300tc/source_update_tmp
makeEmptyDIR $uncompressDir
updateSource=/media/nvme/300TC/update/source*
boolSource=`ls -l $updateSource | wc -l`
if [ ! $boolSource -eq 0 ] ; then
temp=$(ls $updateSource)
dd if=$temp | openssl des3 -d -k irishk*******|tar zxf - -C $uncompressDir
rm $updateSource
cd $uncompressDir
chmod +x update1.sh
sh update1.sh
fi

85
update1.sh Normal file
View File

@ -0,0 +1,85 @@
#!/bin/bash
makeDIR()
{
if [ ! -e $1 ]; then
mkdir -p $1
fi
}
makeEmptyDIR()
{
if [ ! -e $1 ]; then
# echo "$1 do not exist!"
mkdir -p $1
elif [ -e $1 ] && [ ! "$(ls -A $1)" ]; then
# echo "$1 exist and null!"
a=1
elif [ -e $1 ] && [ "$(ls -A $1)" ]; then
# echo "$1 exist but not null!"
cd $1
rm -r *
fi
}
projectsSourceDir=/home/300tc/projects_source
binDir=/home/300tc/projects
libraryDir=/home/300tc/library
makeDIR $projectsSourceDir
makeDIR $binDir
makeDIR $libraryDir
uncompressDir=/home/300tc/source_update_tmp
psdk_Source=$uncompressDir"/Payload_SDK_V2.2.1_300tc"
if [ -e $psdk_Source ]; then
rm -r $projectsSourceDir"/Payload_SDK_V2.2.1_300tc"
cp -r $psdk_Source $projectsSourceDir
buildDir=$projectsSourceDir"/Payload_SDK_V2.2.1_300tc/sample/platform/linux/manifold2/project/build"
makeEmptyDIR $buildDir
cd $buildDir
sudo cmake ..
sudo make
rm -r $psdk_Source
fi
ximeaControlDll_Source=$uncompressDir"/ximeaControlDll"
if [ -e $ximeaControlDll_Source ]; then
soDir=$libraryDir"/ximeaControlDll"
makeEmptyDIR $soDir
cd $soDir
sudo cmake $ximeaControlDll_Source
sudo make
sudo cp -r $uncompressDir"/ximeaControlDll/Header_Files" $libraryDir"/ximeaControlDll/Header_Files"
#
path=$(pwd)
path=${path}"/libirisXimeaImager.so"
sudo ln -sv $path /usr/lib/libirisXimeaImager.so
rm -r $ximeaControlDll_Source
fi
ximeaAirborneSystem_Source=$uncompressDir"/ximeaAirborneSystem"
if [ -e $ximeaAirborneSystem_Source ]; then
exedir=$binDir"/ximeaAirborneSystem"
makeEmptyDIR $exedir
cd $exedir
sudo cmake $ximeaAirborneSystem_Source
sudo make -j3
rm -r $ximeaAirborneSystem_Source
fi
cd $uncompressDir
rm *
reboot now

4
usbadd.sh Normal file
View File

@ -0,0 +1,4 @@
touch ~/mount.log
# sudo mount /dev/sda1 /media/usb &> ~/mount.log

3
usbremove.sh Normal file
View File

@ -0,0 +1,3 @@
touch ~/remove.log
# sudo umount /media/usb