1. 开启Ubuntu meta 开机自启(已测试)
修改文件sudo nano /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf
:
[Seat:*]
greeter-session=lightdm-gtk-greeter
autologin-user=burger #Ubuntu 用户名
保存后 重启 sudo reboot now
2. 设置wifi AP 节点自动登录。
淘宝买一个 无线wifi,我测试用的是vodafone
下载驱动库:
git clone https://github.com/oblique/create_ap
cd create_ap
make install
# 安装相关的驱动
sudo apt-get install util-linux procps hostapd iproute2 iw haveged dnsmasq
编辑文件:/usr/lib/systemd/system/create_ap.service
ifconfig
试试wifi能不能用:
# 这个是创建一个无转发的wifi ap,也就是没有连上外网,wlan0是你的网卡名
create_ap -n wlan0 MyAccessPoint MyPassPhrase
# 如果树莓派已经连上了外网,比如是 wlan0,就可以吧wlan0的转发到当前的驱动上面,当前驱动是 wlx00026fbdf9af
sudo create_ap -n wlx00026fbdf9af MyAccessPoint 12345678
# args:-n 不分享网络 wlx:网卡(ifcongfig得到的)wifi 名字和密码
#把enp2s0的网络转给这个WiFi
sudo create_ap wlx00026fbdf9af enp2s0 sc_1 12345678
改成开机自动启动
修改行ExecStart
:
ExecStart=/usr/bin/create_ap -n wlan0 Name Password
改完了是这个样子:
[Unit]
Description=Create AP Service
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/create_ap -n wlx00026fbdf9af raspi 12345678
KillSignal=SIGINT
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
然后,这行这行命令把修改的服务添加上去
sudo systemctl daemon-reload
sudo systemctl enable create_ap.service
sudo systemctl start create_ap.service
3. 开机自动运行ROS节点.
据说有好多种方法,首推rc.local 和systemd
使用Upstart for ROS:http://docs.ros.org/jade/api/robot_upstart/html/
#安装
sudo apt-get install ros-kinetic-robot-upstart
#使用: 首先需要准备好 要运行的 launch文件 比如 turtlebot3.launch
#安装这个launch文件
rosrun robot_upstart install myrobot_bringup/launch/base.launch
sudo service turtlebot3 start
#如果需要停止这个服务.
sudo service myrobot stop
#查看这一过程的日志文件
sudo tail /var/log/upstart/myrobot.log -n 30
先手rc.local,运行的Python程序都可以,不知道为什么roscore不行.
# 打开 rc.local
sudo vim.tiny /etc/rc.loacl
#首先配置 ros环境变量
cd $home
source /opt/ros/kinetic/setup.bash&
roscore&
sudo python /home/burger/sample.py &
exit 0
失败了
4. 想要关掉roscore 又找不到是哪个终端.
当运行roscore & 时我们关闭了这个终端,roscore 还是会运行, 以至于没有办法关闭,
可以运行killall -9 rosmaster
ps aux|grep roscore #查看roscore 所在的线程.
kill 对应的线程数
也可以
重启, 完美收工