wifi连接成功,且自己电脑ssh ubuntu server 20.04成功后,便尝试电脑远程登陆ubuntu server
1.换源
2.安装桌面环境
sudo apt install ubuntu-desktop
sudo apt install xrdp
安装之后重启就会登陆桌面,如果你的树莓派有连电脑的话
我是把显示器拔掉,重启树莓派后使用windows的远程桌面连接ubuntu server
3.允许root登陆
sudo passwd root #执行后提示输入密码
sudo vim /usr/share/lightdm/lightdm.conf.d/50-ubuntu.conf
#进入vim编辑界面,添加后面两行到文件末尾
greeter-show-manual-login=true
allow-guest=false
sudo reboot
4.安装ros
点击左上角activities
我的里面没有软件和更新,直接搜updates 会搜到,打开之后,勾选以下选项。
设置安装源
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
设置key
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
更新apt
sudo apt update
安装ros(20.04对应ros 版本noetic)
sudo apt install ros-noetic-desktop-full
5.配置环境变量
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
6.构建依赖关系
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
sudo apt install python3-rosdep
接下来执行
sudo rosdep init
rosdep update
不出意外的话要出意外了
报错:
sudo rosdep init
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.
这里我选择直接一点的方法
/etc/目录下新建ros/rosdep/sources.list.d/文件夹,并在里面新建20-default.list文件
cd /etc/
sudo mkdir ros
cd ros
sudo mkdir rosdep
cd rosdep
sudo mkdir sources.list.d
cd sources.list.d
sudo touch 20-default.list
sudo vim 20-default.list
将以下文件粘贴到文件中
# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
相当于执行了sudo rosdep init
接下来执行rosdep update
没问题的话还是报错
这大概率是连接不上该网站
我们还是使用简单方法
在hosts文件中添加该网站
#打开hosts文件
sudo gedit /etc/hosts
#在文件末尾添加
151.101.84.133 raw.githubusercontent.com
#保存后退出再尝试
rosdep update
我试了这个ip还是不行,应该是网站ip换了
我们自己查最新ip
在windows命令行执行
nslookup raw.githubusercontent.com
出现以下内容:
后面四行ip就是新ip,可以依次ping一下,选一个延迟最小的,我试了都一样
把hosts文件中添加的ip换成新ip后再rosdep update成功
7.测试ros
新开三个终端
依次执行
roscore #启动ros核心
rosrun turtlesim turtlesim_node #打开小乌龟窗口
rosrun turtlesim turtle_teleop_key #启动按键控制
结果如下图所示: