LoginSignup
0

More than 5 years have passed since last update.

Xillybus and ROS on Ubuntu14.04 on Zybo Part 4 : Zybo上における設定~ROSのインストール

Posted at

Contents

Zybo上における設定:Zybo

各種パーミッションを変更します。

# chmod 4755 /usr/bin/sudo
# chmod 777 /tmp
# chmod o+rwt /tmp

以下は基本的にrootモードで作業しています。

なお、導入したファイルシステムにはあらかじめ、ubuntuというユーザも用意されています(パスワードはubuntu)。

そのため、のちの作業の便宜上、ユーザubuntuをsudoのグループに追加します。

# gpasswd -a ubuntu sudo

また、/home/ubuntuの所有者とグループを変更します。

# cd /home
# chown ubuntu:ubuntu ubuntu/

xillybusのデバイスドライバのパーミッションの設定

xillybusのデバイスドライバのパーミッションを固定するために設定ファイルを作成します。

# cat <<EOT>> /etc/udev/rules.d/10-xillybus.rules
SUBSYSTEM=="xillybus", MODE="666", OPTIONS="last_rule"
EOT

Swap領域を作る

Zyboにおいて作業をする際にSwap領域を作成したほうが作業がスピーディーになる場合があります。

/var/cacheにSawp領域用のディレクトリを作ります。

# mkdir /var/cache/swap

以下のコマンドで512MBのswapfileを生成します。

# dd if=/dev/zero of=/var/cache/swap/swapfile bs=1M count=512
# mkswap /var/cache/swap/swapfile

内蔵エディタで/etc/fstabを編集します。

ファイル内に/var/cache/swap/swapfile none swap sw 0 0の行を追加してください。

# nano /etc/fstab

リブートしましょう。

# reboot

swaponで確認すると、先ほどの設定が確認できます。

# swapon -s
Filename                                Type            Size    Used    Priority
/var/cache/swap/swapfile                file            524284  0       -1

Proxyを設定する

Proxyの設定が必要な場合は以下の設定をしてください。

apt-get

# cat <<EOT>> /etc/apt/apt.conf
Acquire::ftp::proxy "ftp://proxy.servr.jp:port/";
Acquire::http::proxy "http://proxy.servr.jp:port/";
Acquire::https::proxy "https://proxy.servr.jp:port/";
Acquire::socks::proxy "socks://proxy.servr.jp:port/";
EOT

システムプロキシ

# nano ~/.bashrc
### 末尾に追加 ###
export HTTPS_PROXY=http://proxy.server.jp:port/
export HTTP_PROXY=http://proxy.server.jp:port/
export FTP_PROXY=http://proxy.server.jp:port/

export https_proxy=http://proxy.server.jp:port/
export http_proxy=http://proxy.server.jp:port/
export ftp_proxy=http://proxy.server.jp:port/

各種ツール導入

apt-get updateしましょう。

# apt-get update

ssh

# apt-get install ssh -y

ssh接続においてrootログインできるように設定します。

/etc/ssh/sshd_configに以下の設定をします。

- PermitRootLogin without-password
+ PermitRootLogin yes

また、rootパスワードを設定しておきましょう。

# passwd

その他

# apt-get install gcc make git -y

Contentsにもどる

デモappを動かす:Zybo

ubuntuユーザになります。

# su ubuntu
$ cd

デモアプリ用のディレクトリを作成します。

$ mkdir demoapps
$ cd demoapps

XillybusではプロセッシングシステムとFPGA間においてデータを送受信する際は、デバイスファルへread/writeすることでデータを送受信できます。

また、read用、write用のそれぞれのデバイスファイルがあり、データを読み書きするとFPGAの回路上のFIFOがデータをバッファしてくれます。
ここではPythonでread用とwrite用のそれぞれのプログラムを作成・実行します。

touchコマンドでread.py、write.pyを作成します。

touch read.py write.py

ソースコードは以下のものです。

read.py

# -*- coding: utf-8 -*-

import os
import sys

XILLYBUS_READ_32 = "/dev/xillybus_read_32"

def main():
    dev = os.open(XILLYBUS_READ_32, os.O_RDONLY)
    while True:
        string_data = os.read(dev, 1)
        sys.stdout.write(string_data)
        sys.stdout.flush()

if __name__ == '__main__':
    main()

write.py

# -*- coding: utf-8 -*-

import os
import sys
XILLYBUS_WRITE_32 = "/dev/xillybus_write_32"

def main():
    dev = os.open(XILLYBUS_WRITE_32, os.O_WRONLY)

    while True:
        string_data = sys.stdin.read(1)
        os.write(dev, string_data)

if __name__ == '__main__':
    main()

プログラムの実行には2つの端末を用いてください。(sshなどでリモートログイン)

write側で任意の文字列を入力し、Enterキーを押して、read側に出力されれば成功です。

端末1

$ python write.py
123456789

端末2

$ python read.py
123456789

Contentsにもどる

ROS indigoのインストール:Zybo

ROSの導入をします。

リポジトリの設定をします。

$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu trusty main" > /etc/apt/sources.list.d/ros-latest.list'

リポジトリの鍵を取得します。

$ sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net --recv-key 0xB01FA116

apt-get updateします。

$ sudo apt-get update

ROSのインストールを開始します。

$ sudo apt-get install ros-indigo-ros-base -y

インストールが終了したら動作確認をします。ROSのパスを設定します。

$ source /opt/ros/indigo/setup.bash

roscoreを起動します。以下のようなログが出ればインストール成功です。ctl+cで
停止です。

$ roscore
... logging to /home/ubuntu/.ros/log/f93a280a-ac28-11e6-95ce-46bea99c65de/roslaunch-ubuntu-armhf-6933.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://ubuntu-armhf:44472/
ros_comm version 1.11.20


<a name="summary"></a>
SUMMARY
========

PARAMETERS
 * /rosdistro: indigo
 * /rosversion: 1.11.20

NODES

auto-starting new master
process[master]: started with pid [6944]
ROS_MASTER_URI=http://ubuntu-armhf:11311/

setting /run_id to f93a280a-ac28-11e6-95ce-46bea99c65de
process[rosout-1]: started with pid [6957]
started core service [/rosout]

Contentsにもどる

Complete!

これでシステム構築は終了です。お疲れさまでした。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0