1、搭建NFS
1.1、server
安装必备包
sudo apt-get install nfs-kernel-server
创建要共享的目录文件夹
sudo mkdir -p mnt
编辑配置文件
①添加NFS共享目录
sudo nano /etc/exports
/home/jetson/catkin_ws *(rw,sync,no_root_squash)
②给挂载的目录设置权限以及修改文件用户
sudo chmod -R 777 /home/jetson/catkin_ws
sudo chown -R 777 /home/jetson/catkin_ws
启动服务
sudo /etc/init.d/nfs-kernel-server start
sudo /etc/init.d/nfs-kernel-server restart
1.2、client
安装nfs-utils和portma包
sudo apt-get install nfs-common portmap
创建一个提供挂载的目录
sudo mkdir /mnt/mount_nfs
挂载
sudo mount -t nfs 192.168.2.81:/home/jetson/catkin_ws /mnt
1.3、开机启动
制作脚本
cd /home/jetson
nano nfs.sh
在nfs.sh文件中输入以下内容:
#!/bin/sh
sudo mount -t nfs 192.168.2.81:/home/jetson/catkin_ws /mnt
给脚本添加执行权限
sudo chmod 777 nfs.sh
测试脚本功能
./nfs.sh
将脚本文件写入rc.local文件中
sudo nano /etc/rc.local
在末尾添加
#!/bin/bash
/home/jetson/software/nfs.sh
2、安装Anaconda
anaconda 官网
anaconda 清华大学开源软件镜像站
sudo touch .condarc
sudo chmod 777 .condarc
sudo vim .condarc
在C:\Users\asus目录下创建.condarc文件,文本文档打开添加
auto_activate_base: false
channels:
- defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
ssl_verify: true
- 解决与ros的python环境冲突,修改~/.condarc文件, 在文件中添加:
auto_activate_base: false
- 开启服务
python3 -m http.server 8080
- 浏览器
http://localhost:8080
3、Ubuntu下使用VMware
安装命令
sudo ./VMware-Workstation-Full-16.2.3-19376536.x86_64.bundle
卸载命令
sudo vmware-installer -u vmware-workstation
sudo vmware-installer -u vmware-player
4、Ubuntu下使用git
4.1、上传github仓库
# 安装Git,使用命令
sudo apt-get install git
# 初始化
git init
# 创建忽略文件
touch .gitignore
sudo gedit .gitignore
git status
git add .
git commit -m "第一次:初始化程序"
4.2、本地仓库的文件和远程仓库的文件同时删除
先删除本地仓库的文件,后执行命令
git add * //把本地仓库的文件上传到缓存
git commit -m "del" //把第一步上传到缓存的东西上传到本地仓库,其中'del'是操作标识,内容随便填,方便用户观看。
git push origin master //把本地仓库的文件上传到远程仓库。
4.3、只删除远程仓库,不删除本地仓库
git pull origin master //将远程仓库里面的项目拉下来。
dir //查看有哪些文件夹
git rm -r --cached target //删除你要删除的文件夹名称,这里是删除target文件夹(不会把本地的文件夹删除)
git commit -m "删除target" //提交,添加操作说明
git push -u origin master //重新提交
5、问题汇总
5.1、linux烧录工具stm32flash
sudo apt install stm32flash
sudo stm32flash -w AkermanRobot.hex -p /dev/ttyUSB0 -b 460800
sudo stm32flash -w AkermanRobot.hex -v -g 0 /dev/ttyUSB0 -b 460800
帮助查看
sudo stm32flash -h
5.2、NO_PUBKEY:F42ED6FBAB17C654
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
5.3、pip异常:'setuptools_scm"错误
下载补丁setuptools_scm-3.0.6-py2.py3-none-any.whl
pip install setuptools_scm-3.0.6-py2.py3-none-any.whl
5.4、grub启动菜单字体改大
sudo gedit /etc/default/grub
把
#GRUB_GFXMODE=640x480
改成
GRUB_GFXMODE=1920x1080
然后 sudo update-grub
5.5、CMake can’t find yaml-cpp on debian jessie
- package.xml
<depend>yaml-cpp</depend>
- CMakeLists.txt
find_package(PkgConfig REQUIRED)
pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)
include_directories(${YAML_CPP_INCLUDEDIR})
5.6、报错 module ‘skimage‘ has no attribute ‘io‘
使用pip或conda安装:
pip install scikit-image
或
conda install scikit-image
若已经正确安装,则原因应该是io是子模块,应该:
from skimage import io
5.7、ImportError: (PyInit__tf2)
sudo apt install python3-catkin-pkg-modules python3-rospkg-modules python3-empy ros-melodic-geometry2
6、常用命令
6.1、调试
- 键盘控制
rosrun teleop_twist_keyboard teleop_twist_keyboard.py
- dynamic reconfigure
rosrun rqt_reconfigure rqt_reconfigure
- rqt_plot
rqt_plot
- 查看图像
rqt_image_view
- 查看tf树
rosrun rqt_tf_tree rqt_tf_tree
- 查看节点图
rqt_graph
- 删除gazebo进程
killall gzclient gzserver
- 删除roscore进程
killall roscore rosmaster
- ros 杀掉所有节点
rosnode kill -a
rosnode kill --all
- 导航停止命令
rostopic pub /move_base/cancel actionlib_msgs/GoalID -- {}
- 单独编译某个功能包
catkin_make -j4 -l4
catkin_make -DCATKIN_WHITELIST_PACKAGES="world_canvas_msgs"
catkin_make -DCATKIN_WHITELIST_PACKAGES="" -j4 -l4
6.2、查看深度图topic编码
rostopic echo /camera/depth/image_raw/encoding
rostopic echo /camera/rgb/image_raw/encoding
6.3、获取当前路径
import sys,os
print sys.argv[0] #获取当前文件路径
print os.getcwd() #获取当前工作目录路径
print type(os.getcwd()) #获取当前工作目录路径
print os.path.abspath('.') #获取当前工作目录路径
print os.path.abspath('test.txt') #获取当前目录文件下的工作目录路径
print os.path.abspath('..') #获取当前工作的父目录 !注意是父目录路径
print os.path.abspath(os.curdir) #获取当前工作目录路径