从官网下载镜像,并烧录进sd卡。
https://ubuntu-mate.org/download/
换源:
sudo vi /etc/apt/sources.list
改为如下内容:
deb http://mirrors.ustc.edu.cn/ubuntu-ports/ focal main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu-ports/ focal-security main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu-ports/ focal-updates main restricted universe multiverse
更新源内容:
sudo apt update
下载软件:
sudo apt install net-tools
这条指令就可知道现在IP地址
ifconfig
下载openssh:
sudo apt install openssh-server
添加ROS源:
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
添加密钥:
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
更新:
sudo apt update
安装ROS:
sudo apt install ros-noetic-desktop-full
将环境写入bashrc文件:
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc source ~/.bashrc
小乌龟测试,开三个窗口:
roscore rosrun turtlesim turtlesim_node rosrun turtlesmi turtle_teleop_key
在linux系统下。每一个固定端口,都有固定的KERNELS、idProduct、idVendor,并且每个端口的KERNELS不同。
查询串口号:
ls /dev | grep ttyUSB
查询KERNELS、idProduct、idVendor:
udevadm info -a -p $(udevadm info -q path -n /dev/ttyUSB0)
在一以下目录中创建99-*.rules文件:
/etc/udev/rules.d/
内容为:
KERNELS=="1-1.4", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", SYMLINK+="robot",MODE:="0777"
重启并查看端口:
ll /dev | grep ttyUSB
显示如下信息:
lrwxrwxrwx 1 root root 7 Sep 20 22:30 robot -> ttyUSB0 crwxrwxrwx 1 root dialout 188, 0 Sep 20 22:30 ttyUSB0
sudo apt-get install ros-noetic-navigation sudo apt-get install ros-noetic-robot-pose-ekf sudo apt-get install ros-noetic-ecl-threads
串口通信noetic不支持serial包。改为使用boost::asio编写。
mkdir -p ~/newhpc_ws/src cd newhpc_ws/src/ catkin_init_workspace echo "source ~/newhpc_ws/devel/setup.bash">>~/.bashrc cd .. catkin_make
输入rosrun tf view_frames
查看TF树报错:
Listening to /tf for 5.0 seconds Done Listening b’dot - graphviz version 2.43.0 (0)\n’ Traceback (most recent call last): File “/opt/ros/noetic/lib/tf/view_frames”, line 119, in generate(dot_graph) File “/opt/ros/noetic/lib/tf/view_frames”, line 89, in generate m = r.search(vstr) TypeError: cannot use a string pattern on a bytes-like object
打开view_frame.py文件
sudo vi /opt/ros/noetic/lib/tf/view_frames
查看view_frame.py文件报错处的代码
m = r.search(vstr)
通过分析得知search函数需要输入str类型数据,而vstr不是str类型,所以我们可以强制转换其为str类型数据,如下所示:
vstr=str(vstr) m = r.search(vstr)
之后运行成功:
Listening to /tf for 5.0 seconds Done Listening b’dot - graphviz version 2.43.0 (0)\n’ Detected dot version 2.43 frames.pdf generated