Rapsberry Pi Install ROS

前端之家收集整理的这篇文章主要介绍了Rapsberry Pi Install ROS前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Rapsberry Pi Install ROS

环境

  • Raspberry Pi 2B
  • Ubuntu Snappy

Install ROS

  1. First we need to download Ubuntu ARM image from
    https://wiki.ubuntu.com/ARM/RaspberryPi

  2. Write image to SD card:
    find sd card device (mine is /dev/sdg):
    fdisk -l
    write image to SD card using dd.
    Dont forget that image is compressed:
    xzcat {image} | sudo dd bs=4M of=/dev/sdg
    ensure that image has been written:
    sudo fdisk -l /dev/{sdX}

  3. Connect RPi to yor PC using ethernet cable

  4. Wait for a minute or so until RPi finished loading…

  5. Let’s find IP address of connected RPi:
    arp -a

  6. Connect to RPi using ssh.
    Default user/pass is ubuntu/ubuntu:
    ssh ubuntu@{your.ip}

  7. After first login system will ask you to update password

  8. Let’s check if we have connection to Internet

  9. And update all packages:
    sudo apt update; sudo apt upgrade

  10. If you don’t use ubuntu cloud,you can remove cloud-init.
    This will speed up boot:
    sudo apt remove cloud-init

  11. Also remove cloud dirs from /etc and /var/lib dirs:
    sudo rm -rf /etc/cloud; sudo rm -fr /var/lib/cloud

  12. Add ROS repository:
    sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

  13. Setup keys:
    wget http://packages.ros.org/ros.key -O - | sudo apt-key add -

  14. Update package index:
    sudo apt update

  15. We will install ROS base. It is set of basic packages
    for ROS:
    sudo apt install ros-kinetic-ros-base

  16. Initialise rosdep:
    sudo rosdep init; rosdep update

  17. Set up the ROS environment variables:
    echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
    source ~/.bashrc

  18. Modify /etc/hosts

    ubuntu@ubuntu:~$ cat /etc/hosts
    127.0.0.1 localhost
    127.0.0.1 ubuntu
    
    
    # The following lines are desirable for IPv6 capable hosts
    
    ::1 ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    ff02::3 ip6-allhosts
  19. And check that ROS is correctly installed:
    roscore

配置WiFi

wifi_dhcp.sh

ubuntu@ubuntu:~$ cat wifi_dhcp.sh
#!/usr/bin/env bash 
sudo apt -y install wpasupplicant

echo "allow-hotplug wlan0" > wlan0.cfg.tmp
echo "iface wlan0 inet dhcp" >> wlan0.cfg.tmp
echo ' wpa_ssid "YOUR_WIFI_SSID"' >> wlan0.cfg.tmp
echo ' wpa_psk "YOUR_WIFI_PASSWORD"' >> wlan0.cfg.tmp
echo "" >> wlan0.cfg.tmp

sudo mv wlan0.cfg.tmp /etc/network/interfaces.d/wlan0.cfg

wifi_static.sh

ubuntu@ubuntu:~$ cat wifi_static.sh
#!/usr/bin/env bash 
sudo apt -y install wpasupplicant

echo "allow-hotplug wlan0" > wlan0.cfg.tmp
echo "iface wlan0 inet static" >> wlan0.cfg.tmp
echo ' address 192.168.1.151' >> wlan0.cfg.tmp
echo ' netmask 255.255.255.0' >> wlan0.cfg.tmp
echo ' gateway 192.168.1.100' >> wlan0.cfg.tmp

#because my router is rubbish and doesn't provide DNS service
echo ' dns-nameservers 8.8.8.8' >> wlan0.cfg.tmp

echo ' wpa_ssid "YOUR_WIFI_SSID"' >> wlan0.cfg.tmp
echo ' wpa_psk "YOUR_WIFI_PASSWORD"' >> wlan0.cfg.tmp
echo "" >> wlan0.cfg.tmp

sudo mv wlan0.cfg.tmp /etc/network/interfaces.d/wlan0.cfg
原文链接:https://www.f2er.com/ubuntu/351060.html

猜你在找的Ubuntu相关文章