ubuntu下motion安装调试的补充

本文详细阐述了在邮件发送脚本中遇到的问题,即无法准确定位文件,通过使用Ubuntu下的find命令解决该问题的过程,并分享了最终实现成功发送移动监测视频到邮箱的完整脚本。

昨天测试的时候发现发送邮件的脚本还是有问题,发送邮件不成功。问题在于在成功获取了TIME之后,使用$DIRC*$TIME.avi没有办法准确定位到文件,我本来发现文件命是01-time.avi,于是把发送的文件名改成了$DIRC"01-"$TIME.avi,能够成功发送,但是运行时间长的时候你就会发现他的序号不是只有01的,于是就开始想办法获取他的完整文件名,这样发送就不会有问题了。想到ubuntu下查找文件的命令find,根据这个修改了脚本,最终成功发送,脚本如下:

on_motion_end:

#!/bin/bash


echo "111111111111111on_motion_end1111111111111111"


DIRC="/root/motion/snapshots/"


VIDEOTIME="/root/tmp/videotime"


TIME=$(cat $VIDEOTIME)
echo $TIME
ALARM_EMAIL="/root/tmp/myalarm.txt"


 


echo "Subject: Motion detected - $TIME - $DIRC" > $ALARM_EMAIL


echo "">> $ALARM_EMAIL


echo "Motion detected - check 01-$TIME.avi">>$ALARM_EMAIL


MAILBODY=$(cat $ALARM_EMAIL)
echo $MAILBODY




#first trying of sending the avi video
echo $MAILBODY
FILE=$(find $DIRC -name *$TIME.avi*)
echo $FILE 
echo $DIRC*$TIME.avi*
#echo $MAILBODY | mutt -s $TIME -a $DIRC"01-"$TIME.avi xxx@gmail.com
echo $MAILBODY | mutt -s $TIME -a "$FILE" -- xxx@gmail.com< "/root/aaa.txt"




#second trying of sending the avi video


TIME=$(expr $TIME - 1)
echo $TIME
FILE=$(find $DIRC -name *$TIME.avi*)
echo $FILE 
#echo $MAILBODY | mutt -s $TIME -a $DIRC*$TIME.avi* xxx@gmail.com
echo $MAILBODY | mutt -s $TIME -a "$FILE" -- xxx@gmail.com< "/root/aaa.txt"


注意shell下面单引号‘  ’里面的变量是不被替换的,所以FILE=$(find $DIRC -name *$TIME.avi*)这里不要写成FILE=$(find $DIRC -name ’*$TIME.avi*‘),使用双引号是可以的。关于/root/aaa.txt这个你建一个文件就可以了,实际上没什么内容,可以是任何文件名。现在你就可以成功发送移动监测视频到你的邮箱了。

转载于:https://www.cnblogs.com/shulianghe/archive/2012/11/28/3724144.html

Requirements The code is tested on clean Ubuntu 20.04 with ROS noetic installation. Install the required package toppra: sudo pip3 install toppra catkin_pkg PyYAML empy matplotlib pyrfc3339 Run the code 1. Download and compile the code git clone https://github.com/ZJU-FAST-Lab/Primitive-Planner.git cd Primitive-Planner catkin_make -DCMAKE_BUILD_TYPE=Release 2. Generate the motion primitive library cd src/scripts python3 swarm_path.py The generated motion primitive library is stored in "src/planner/plan_manage/primitive_library/". 3. Run the planner In the "Primitive-Planner/" directory: source devel/setup.bash # or setup.zsh cd src/scripts python3 gen_position_swap.py 20 # It will generate the swarm.launch with 20 drones roslaunch primitive_planner swarm.launch Wait until all the nodes have their launch process finished and keep printing "[FSM]: state: WAIT_TARGET. Waiting for trigger". Open another terminal, publish the trigger cd src/scripts bash pub_trigger.sh Then the drones (drone number is 40) will start to fly like this Change the drone number when executing "python3 gen_position_swap.py <drone_number>". Before starting the "roslaunch" command, please open another terminal and run "htop" to monitor the Memory usage and CPU usage. Each drone requires about 200 MB memory. Keep the htop opened for entire flight. The computation time is printed on the terminal in blue text, named as "plan_time". To get the accurate computation time, please fix the CPU frequency to its maximum by sudo apt install cpufrequtils sudo cpufreq-set -g performance Otherwise the CPU will run in powersave mode with low frequency. (根据上述代码帮我生成复现最适合在乌班图20.04复现的详细的实现过程和每一步的预期输出,需要安装的每个东西的乌班图20.04兼容版本,还有每一步是否需要创建虚拟环境,每一步是在创建的虚拟环境进行还是不进入虚拟环境的终端进行)
最新发布
07-09
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值