Instalimi i ROS në IMG-imazhin e Ubuntu për pllakën e vetme

Hyrje

Nja, duke punuar mbi diplomĂ«n, u pĂ«rballa me nevojĂ«n pĂ«r tĂ« krijuar njĂ« imazh tĂ« Ubuntu pĂ«r njĂ« kompjuter tĂ« vetĂ«m me ROS tĂ« instaluar tashmĂ« (Sistemi i Operacionit tĂ« RobotĂ«ve – sistemi operativ pĂ«r robotĂ«t). NĂ« pĂ«rmbledhje, diplomĂ« Ă«shtĂ« dedikuar menaxhimit tĂ« njĂ« grupi robotĂ«sh. RobotĂ«t janĂ« tĂ« pajisur me dy rrota dhe tre sensorĂ«. ËshtĂ« gjithçka e kontrolluar nga ROS, qĂ« funksionon nĂ« pllakĂ«n ODROID-C2.

Instalimi i ROS në IMG-imazhin e Ubuntu për pllakën e vetme
Roboti Ladybug. Më vjen keq për cilësinë e dobët të fotos

Nuk kishte kohë, as dëshirë për të instaluar ROS në secilin robot veçmas, prandaj lindi nevoja për një imazh sistemi me ROS të instaluar tashmë. Pas një shëtitjeje në hapësirat e internetit, gjeta disa qasje se si mund të bëhej kjo.
Në përgjithësi, të gjitha zgjidhjet e gjetura mund të ndahen në grupet e mëposhtme.

  1. Programet që krijojnë një imazh nga një sistem i gatshëm dhe i konfiguruar (Distroshare Ubuntu Imager, linux live kit, linux respin, systemback etj.)
  2. Projektet që lejojnë krijimin e imazhit tuaj (yocto, linux from scratch)
  3. Krijimi manual i imazhit (customizimi i liveCD dhe një analog rus, plus artikulli në Habrë)

Përdorimi i zgjidhjeve nga grupi i parë dukej si opsioni më i thjeshtë dhe i tërheqës, megjithatë nuk arrita ta krijoja një imazh të sistemas live për ODROID. Zgjidhjet e grupit të dytë gjithashtu nuk më përputheshin për shkak të një pragu të lartë të hyrjes. Krijimi manual sipas tutorialeve që kisha gjithashtu nuk funksionoi, sepse në imazhin tim nuk kishte një sistem të compressuar të skedarëve.
NĂ« fund, duke u ndeshur me njĂ« video mbi chroot (chroot – ndrysho rrĂ«njĂ«n, lidhja e videos nĂ« fund tĂ« postit) dhe mundĂ«sitĂ« e tij, vendosa ta pĂ«rdor atĂ«. MĂ« vonĂ« do tĂ« pĂ«rshkruaj rastin tim tĂ« personalizimit tĂ« Ubuntu pĂ«r zhvilluesit e robotikĂ«s.

Të dhënat fillestare:

  • Procedura e tĂ«rĂ« e modifikimit tĂ« imazhit (pĂ«rveç regjistrimit nĂ« kartĂ«n SD me pĂ«rdorimin e balenaEtcher) u realizua nĂ« sistemin operacional Ubuntu 18.04.
  • Sistemi operativ qĂ« modifikova – Ubuntu 18.04.3 versioni mate desktop.
  • Makina, ku duhet tĂ« funksionojĂ« sistemi i mbledhur – ODROID-C2.

Përgatitja e imazhit

  1. Shkarko imazhin e Ubuntu për ODROID nga faqja zyrtare

  2. Shkarkoni arkivën

    unxz –kv

  3. Krijoni një direktori ku do të montoni imazhin

    mkdir mnt

  4. Përcaktoni ndarjen ku ndodhet sistemi i skedarëve

    file

    Kërkoni ndarjen me sistem skedarësh në format ext2, ext3 ose ext4. Na nevojitet adresa e fillimit të ndarjes (e theksuar në të kuqe në ekran):

    Instalimi i ROS në IMG-imazhin e Ubuntu për pllakën e vetme

    Shënim. Pozita e sistemit të skedarëve mund të shihet gjithashtu me anë të utilitarit parted.

  5. Montojmë imazhin

    sudo mount -o loop,offset=$((264192*512))  mnt/

    The section we need starts from block 264192 (your numbers may vary), the size of one block is 512 bytes, we multiply them to get the offset in bytes.

  6. Let's go to the directory with the mounted system and access it.

    cd mnt/
    sudo chroot ~/livecd/mnt/ bin/sh

    ~/livecd/mnt — full path to the directory with the mounted system
    bin/sh — shell (can also replace with bin/bash)
    Now we can start installing the necessary packages and applications.

Installing ROS

I installed the latest version of ROS (ROS Melodic) according to the official tutorial.

  1. Update the package list

    sudo apt-get update

    Here I encountered an error:

    Err:6 http://deb.odroid.in/c2 bionic InRelease
    The following signatures were invalid: EXPKEYSIG 5360FB9DAB19BAC9 Mauro Ribeiro (mdrjr)

    This is due to the fact that the key for signing the packages has expired. To update the keys, type:

    sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys AB19BAC9

  2. Preparing the system for installing ROS

    sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) 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

  3. Installing ROS
    Unfortunately, I couldn't install the desktop version of ROS, so I only installed the basic packages:

    sudo apt install ros-melodic-ros-base
    apt search ros-melodic

    Shënim 1. During the installation, there were sometimes errors:

    dpkg: error: failed to write status database record about 'iputils-ping' to '/var/lib/dpkg/status': No space left on device

    This was fixed by cleaning the apt cache:

    sudo apt-get clean; sudo apt-get autoclean

    Shënim 2. After installation, source (source) with the command:

    source /opt/ros/melodic/setup.bash

    will not work, as we haven't started bash, so it should NOT be typed in the terminal.

  4. Installing necessary dependencies

    sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential

    sudo apt install python-rosdep

    sudo rosdep init
    rosdep update

  5. Setting up permissions
    Since we have chrooted and are effectively performing all actions as root within the system being assembled, ROS will also run only with superuser privileges.
    When attempting to run roscore without sudo, an error occurs:

    Traceback (most recent call last): File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/__init__.py", line 230, in main write_pid_file(options.pid_fn, options.core, options.port) File "/opt/ros/melodic/lib/python2.7/dist-packages/roslaunch/__init__.py", line 106, in write_pid_file with open(pid_fn, "w") as f: IOError: [Errno 13] Permission denied: '/home/user/.ros/roscore-11311.pid'

    To prevent the error from occurring, we will recursively change permissions for the home directory of the ROS user. To do this, type:

    sudo rosdep fix-permissions

  6. Instalim paketet rviz dhe rqt

    sudo apt-get install ros-melodic-rqt ros-melodic-rviz

Detajet përfundimtare

  1. Dalimë nga chroot:
    exit
  2. Shkëputim imazhin
    cd ..
    sudo umount mnt/
  3. Paketa imazhin e sistemit në një arkiv
    xz –ckv1

Të gjitha! Tani mund të balenaEtcher shkruani imazhin e sistemit në kartën SD, vendosni në ODROID-C2, dhe do të keni Ubuntu me ROS të instaluar!

Linket:

  • MĂ« ndihmoi shumĂ« ky video nĂ« lidhje me si tĂ« bĂ«jmĂ« chroot nĂ« linux dhe pĂ«r çfarĂ« Ă«shtĂ« e nevojshme:

Luaj videon


Burimi: habr.com
Bleni hostim tĂ« besueshĂ«m pĂ«r faqe me mbrojtje nga DDoS, serverĂ« VPS VDS đŸ”„ Bleni hostim tĂ« besueshĂ«m pĂ«r faqe me mbrojtje nga DDoS, serverĂ« VPS VDS | ProHoster