Coder Social home page Coder Social logo

rpi_gp10's Introduction

rpi_gp10

RPi-GP10用ROSノード

このソフトウェアは、ラトックシステム株式会社製のI2C絶縁型デジタル入出力ボード「RPi-GP10」用のROSノードです。 Raspberry Pi 3B+, 4 上の ROS Melodic で動作を確認しています。

  1. インストール

msbusをインストールしてください。

~$ sudo apt-get install python-smbus

RPi.GPIOをインストールしてください。

~$ sudo apt-get install python-rpi.gpio

このリポジトリをForkして、~/catkin_ws/src/ の下にクローンしてください。

~$ cd ~/catkin_ws/src

~/catkin_ws/src$ git clone [email protected]:<ユーザー名>/rpi_gp10.git

ビルドしてください。

~/catkin_ws/src$ cd ~/catkin_ws

~/catkin_ws$ catkin_make

I2Cのデバイスファイルに書き込み権限がないとエラーになります。 私は、~/.bashrc ファイルの末尾に、

sudo chmod 666 /dev/i2c-1

を追記しました。

  1. 動作確認

次のコマンドでROSノードが起動します。

~$ roslaunch rpi-gp10 rpi-gp10.launch

別のターミナルを起動し、rostopic コマンドで動作を確認できます。 IN0-7の値の表示:

~$ rostopic echo /rpi_gp10/input

トリガ入力の表示:

~$ rostopic echo /rpi_gp10/trg

OUT0 = L, OUT1-7 = H の出力

~$ rostopic pub -1 /rpi_gp10/output std_msgs/UInt8 0x01

ストローブ出力を L にする。

~$ rostopic pub -1 /rpi_gp10/output std_msgs/UInt8 1

  1. トピックの説明

・パブリッシャ /rpi/input : IN 端子の入力データ。H = 0, L = 1 /rpi/trg : TRG 端子の入力データ。H = 1, L = 0

・サブスクライバ /rpi/output : OUT 端子に出力。H = 0, L = 1 /rpi/stb : STB 端子に出力。H = 0, L = 1 /rpi/polling : True でレートごとに入力データをパブリッシュ。False で、入力データが変化したときだけパブリッシュ。

  1. launch ファイルの param の説明

rate: 入力信号監視のレート。単位は Hz initOut: OUT 端子の初期値。0 で OUT 0-7 = H 出力 initStb: STB 端子の初期値。0 で STB = H 出力 polling: True でレートごとに /rpi_gp10/input と /rpi_gp10/trg をパブリッシュする。False でデータに変化があったときだけパブリッシュする。

以上です。

rpi_gp10's People

Contributors

lybfip avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.